|
| 1 | +on: |
| 2 | + workflow_call: |
| 3 | + inputs: |
| 4 | + cluster: |
| 5 | + required: true |
| 6 | + type: string |
| 7 | + arguments: |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +jobs: |
| 15 | + run-helmfile: |
| 16 | + name: run-helmfile |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout repo |
| 20 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 https://github.com/actions/checkout/releases/tag/v4.2.2 |
| 21 | + |
| 22 | + - name: Install kubectl |
| 23 | + uses: azure/setup-kubectl@0c5e050edfed71b2b50731ab044d42489d51c129 # vv4.0.0 https://github.com/Azure/setup-kubectl/releases/tag/vv4.0.0 |
| 24 | + with: |
| 25 | + version: "v1.32.3" |
| 26 | + |
| 27 | + - name: Sops Binary Installer |
| 28 | + uses: mdgreenwald/[email protected] |
| 29 | + |
| 30 | + - name: Configure AWS Credentials |
| 31 | + if: inputs.cluster == 'aws-vpn' |
| 32 | + uses: aws-actions/configure-aws-credentials@f24d7193d98baebaeacc7e2227925dd47cc267f5 # v4.2.0 https://github.com/aws-actions/configure-aws-credentials/releases/tag/v4.2.0 |
| 33 | + with: |
| 34 | + aws-region: us-east-1 |
| 35 | + aws-access-key-id: ${{ secrets.VPN_OPS_AWS_ACCESS_KEY_ID }} |
| 36 | + aws-secret-access-key: ${{ secrets.VPN_OPS_AWS_SECRET_ACCESS_KEY }} |
| 37 | + |
| 38 | + - name: Install AWS CLI |
| 39 | + if: inputs.cluster == 'aws-vpn' |
| 40 | + run: | |
| 41 | + set -e |
| 42 | + # Bail if AWS CLI is already in PATH |
| 43 | + export PATH=$HOME/bin:$PATH |
| 44 | + if which aws >/dev/null; then |
| 45 | + if test -f $HOME/bin/aws; then |
| 46 | + echo $HOME/bin >> $GITHUB_PATH |
| 47 | + fi |
| 48 | + exit 0 |
| 49 | + fi |
| 50 | + curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" |
| 51 | + unzip awscliv2.zip |
| 52 | + cd aws && ./install -i $HOME/aws-cli -b $HOME/bin --update |
| 53 | + rm -rf aws awscliv2.zip |
| 54 | + echo $HOME/bin >> $GITHUB_PATH |
| 55 | +
|
| 56 | + - name: Configure EKS access |
| 57 | + if: inputs.cluster == 'aws-vpn' |
| 58 | + run: aws --region us-east-1 eks update-kubeconfig --name vpn-us-east-1 |
| 59 | + |
| 60 | + - name: Run Helmfile |
| 61 | + uses: helmfile/helmfile-action@712000e3d4e28c72778ecc53857746082f555ef3 # v2.0.4 https://github.com/helmfile/helmfile-action/releases/tag/v2.0.4 |
| 62 | + with: |
| 63 | + helmfile-version: "v1.1.5" |
| 64 | + helm-version: "v3.19.0" |
| 65 | + helm-plugins: > |
| 66 | + https://github.com/databus23/helm-diff, |
| 67 | + https://github.com/jkroepke/helm-secrets |
| 68 | + helmfile-workdirectory: helmfile-app |
| 69 | + helmfile-args: "-e ${{ inputs.cluster }} ${{ inputs.arguments }}" |
| 70 | + helmfile-auto-init: "false" |
0 commit comments