Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rasheedamir committed Nov 17, 2023
1 parent bff2883 commit f5489c7
Show file tree
Hide file tree
Showing 11 changed files with 1,299 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .autoexec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
######################################################## SSH KEYS ######################################################
eval $(ssh-agent -s)

for key in $(ls -p /root/.ssh/ | grep -v -E ".pub|known_hosts|config|.iml|/" )
do
ssh-add "/root/.ssh/$key"
done

######################################################## ALIASES #######################################################

#GENERIC
alias getpubip='curl https://ipinfo.io/ip'
alias unproxy='unset HTTP_PROXY && unset HTTPS_PROXY && unset http_proxy && unset https_proxy'

#KUBECTL
alias k='kubectl'
alias ksn='kubectl config set-context $(kubectl config current-context) --namespace '
alias kgc='kubectl config get-contexts'
alias ksc='kubectl config use-context '

######################################################## MOUNTED CAs ###################################################
update-ca-certificates

######################################################## UNSET CONTAINER ENV ###########################################
unset TILLER_NAMESPACE

######################################################## SET USER-SPECIFIC ENV #########################################
export MAKEFILE_REPO=/root/project/dev/github/makefiles

######################################################## DONE ##########################################################
echo "$( cd "$(dirname "$0")" ; pwd -P )/.autoexec.sh loaded successfully!"
32 changes: 32 additions & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
######################################################## AUTOCOMPLETION ################################################

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
if [ -f /usr/local/bin/kubectl ] ; then
source <(kubectl completion bash)
echo "kubectl bash completion installed!"
fi
if [ -f /usr/local/bin/helm ] ; then
source <(helm completion bash)
echo "helm bash completion installed!"
fi
if [ -f /usr/local/bin/oc ] ; then
source <(oc completion bash)
echo "oc bash completion installed!"
fi
if [ -f /usr/local/bin/terraform ] ; then
terraform -install-autocomplete
echo "terraform bash completion installed!"
fi

######################################################## SOURCE ########################################################
sleep 1
if [ -f "/root/.autoexec.sh" ]; then
source /root/.autoexec.sh
fi

echo "/root/.bashrc loaded successfully!"
83 changes: 83 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Pull Request

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
name: Build
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate Tag
id: generate_tag
run: |
sha=${{ github.event.pull_request.head.sha }}
tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}"
echo "##[set-output name=GIT_TAG;]$(echo ${tag})"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}

- name: Generate image repository path
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | sed -e 's/stakater-docker/stakater/g' | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKER_FILE_PATH }}
pull: true
push: true
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
cache-to: type=inline
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Comment on PR
uses: mshick/add-pr-comment@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: '@${{ github.actor }} Image is available for testing. `docker pull ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
allow-repeats: false

- name: Notify Failure
if: failure()
uses: mshick/add-pr-comment@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
allow-repeats: false

- name: Notify Slack
uses: 8398a7/action-slack@v3
if: always() # Pick up events even if the job fails or is canceled.
with:
status: ${{ job.status }}
fields: repo,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
86 changes: 86 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Push

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
name: Build
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Generate Tag
id: generate_tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
RELEASE_BRANCHES: main
DEFAULT_BUMP: patch
DRY_RUN: true

- name: Login to Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}

- name: Generate image repository path
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | sed -e 's/stakater-docker/stakater/g' | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKER_FILE_PATH }}
pull: true
push: true
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
cache-to: type=inline
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Push Latest Tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
WITH_V: true
RELEASE_BRANCHES: main
DEFAULT_BUMP: patch

- name: Notify Failure
if: failure()
uses: mshick/add-pr-comment@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
allow-repeats: false

- name: Notify Slack
uses: 8398a7/action-slack@v3
if: always() # Pick up events even if the job fails or is canceled.
with:
status: ${{ job.status }}
fields: repo,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
38 changes: 38 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
build:
name: Release
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Notify Slack
uses: 8398a7/action-slack@v3
if: always()
with:
status: ${{ job.status }}
fields: repo,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.iml
*.DS_Store
14 changes: 14 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#@IgnoreInspection BashAddShebang
export ZSH=$HOME/.oh-my-zsh

ZSH_THEME="agnoster"

plugins=(ansible git helm kubectl oc terraform)

source $ZSH/oh-my-zsh.sh

######################################################## SOURCE ########################################################
sleep 1
if [ -f "/root/.autoexec.sh" ]; then
source /root/.autoexec.sh
fi
Loading

0 comments on commit f5489c7

Please sign in to comment.