Skip to content

Commit

Permalink
revert workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtzData committed Mar 25, 2024
1 parent a53d400 commit 01496d9
Show file tree
Hide file tree
Showing 14 changed files with 989 additions and 131 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/charts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Lint and publish charts

on:
pull_request:
paths:
- charts/**/*
push:
paths:
- .github/workflows/charts.yaml
- charts/**/*
- scripts/build-repo.sh
jobs:
helm-publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [helm-lint]
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: '0'
- name: Download Helm
run: |
curl -L https://get.helm.sh/helm-v3.4.1-linux-amd64.tar.gz | tar -xzf - --strip-component=1 linux-amd64/helm
chmod +x helm
- name: Package charts
run: |
sh ./scripts/build-repo.sh
- name: GitHub Pages action
uses: peaceiris/[email protected]
with:
publish_branch: gh-pages
force_orphan: true
publish_dir: ./repo
personal_token: ${{ secrets.GITHUB_TOKEN }}

helm-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Download Helm
run: |
curl -L https://get.helm.sh/helm-v3.4.1-linux-amd64.tar.gz | tar -xzf - --strip-component=1 linux-amd64/helm
chmod +x helm
- name: Lint using helm
run: |
./helm lint charts/*
53 changes: 53 additions & 0 deletions .github/workflows/cleanup_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Cleanup docker

# Triggered when a pull request is merged
on:
workflow_dispatch:
inputs:
dockerImage:
description: 'Docker image to delete'
required: false
type: string
workflow_call:
inputs:
dockerImage:
description: 'Docker image to delete'
required: false
type: string

jobs:
cleanup:
name: Cleanup
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 1
matrix:
environment: [Dev]
region: [us-east-1]
# environment:
# name: ${{ matrix.environment }}
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- name: Add inputs to GITHUB_ENV
run: |
echo "DOCKER_IMAGE=${{ inputs.dockerImage }}" >> $GITHUB_ENV
- name: Delete image
if: "${{ always() && env.DOCKER_IMAGE != ''}}"
uses: bots-house/[email protected]
with:
# NOTE: at now only orgs is supported
owner: ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}
name: ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}
# NOTE: using Personal Access Token
token: ${{ secrets.PAT }}
tag: ${{ env.DOCKER_IMAGE }}
139 changes: 139 additions & 0 deletions .github/workflows/cleanup_helmfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Cleanup release

# Triggered when a pull request is merged
on:
workflow_dispatch:
inputs:
dockerImage:
description: 'Docker image to delete'
required: false
type: string
appName:
description: 'Name of application to deploy'
required: true
default: ''
type: string
globalEnv:
description: 'Environment Name'
required: true
default: 'testing'
type: string
helmfileDir:
description: 'Directory to run helmfile'
required: false
default: '.'
type: string
kubeConfigSecret:
description: 'Path to kubeconfig in vault'
required: true
default: ''
type: string
vaultRole:
description: 'Role to authenticate in vault'
required: true
default: ''
type: string
workflow_call:
inputs:
appName:
description: 'Name of application to deploy'
required: true
default: ''
type: string
globalEnv:
description: 'Environment Name'
required: true
default: 'testing'
type: string
helmfileDir:
description: 'Directory to run helmfile'
required: false
default: '.'
type: string
kubeConfigSecret:
description: 'Path to kubeconfig in vault'
required: true
default: ''
type: string
vaultRole:
description: 'Role to authenticate in vault'
required: true
default: ''
type: string
dockerImage:
description: 'Docker image to delete'
required: false
type: string

jobs:
cleanup:
name: Cleanup
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 1
matrix:
environment: [Dev]
region: [us-east-1]
# environment:
# name: ${{ matrix.environment }}
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- name: Add inputs to GITHUB_ENV
run: |
echo "APP_NAMESPACE=${{ inputs.appNamespace }}" >> $GITHUB_ENV
echo "DOCKER_IMAGE=${{ inputs.dockerImage }}" >> $GITHUB_ENV
- name: Configure Kubectl
uses: azure/[email protected]
with:
version: 'v1.23.6'
id: install

# Install helm, helm-secrets, sops
- name: Install tools
shell: bash
run: |
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update -y
sudo apt-get install helm gnupg -y
helm plugin install https://github.com/jkroepke/helm-secrets
helm plugin install https://github.com/databus23/helm-diff
cd /tmp
curl -O -L -C - https://github.com/helmfile/helmfile/releases/download/v0.153.1/helmfile_0.153.1_linux_amd64.tar.gz
tar -xzvf helmfile_0.153.1_linux_amd64.tar.gz
sudo mv helmfile /usr/bin/helmfile
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
- name: Get Vault credentials
id: retrieve-vault-secrets
uses: hashicorp/[email protected]
with:
url: https://vault.k8s.blockscout.com
role: ${{ inputs.vaultRole }}
path: github-jwt
method: jwt
tlsSkipVerify: false
exportToken: true
secrets: |
${{ inputs.kubeConfigSecret }} kubeconfig | KUBECONFIG_BASE64 ;
# Delete release
- name: Delete
shell: bash
run: |
mkdir -p ~/.kube
echo $KUBECONFIG_BASE64 | base64 --decode > ~/.kube/config
chmod 600 ~/.kube/config
cd ${{ inputs.helmfileDir }}
helmfile -e ${{ inputs.globalEnv }} -l app=${{ inputs.appName }} destroy
Loading

0 comments on commit 01496d9

Please sign in to comment.