diff --git a/.github/workflows/helmfile_production_apply.yaml b/.github/workflows/helmfile_production_apply.yaml new file mode 100644 index 000000000..ac4cff8eb --- /dev/null +++ b/.github/workflows/helmfile_production_apply.yaml @@ -0,0 +1,46 @@ +name: Production - Helmfile Apply + +on: + push: + branches: + - main + paths: + - "VERSION" + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HELMFILE_FILE_PATH: ${{ github.workspace }}/helmfile + PRODUCTION_AWS_ACCOUNT: ${{ secrets.PRODUCTION_AWS_ACCOUNT }} + +jobs: + helmfile-apply: + runs-on: ubuntu-latest + steps: + + - name: Inject token authentication + run: | + git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0 + id: awsconfig + with: + aws-access-key-id: ${{ secrets.PRODUCTION_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.PRODUCTION_AWS_SECRET_ACCESS_KEY }} + aws-region: ca-central-1 + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + with: + # Fetches entire history, so we can analyze commits since last tag + fetch-depth: 0 + - name: Configure kubeconfig + run: | + aws eks update-kubeconfig --name notification-canada-ca-production-eks-cluster + kubectl config rename-context arn:aws:eks:ca-central-1:$PRODUCTION_AWS_ACCOUNT:cluster/notification-canada-ca-production-eks-cluster production + - name: Load EnvVars + run: | + ./helmfile/getContext.sh true + - name: Run helmfile + id: helmfile_apply + uses: helmfile/helmfile-action@v1.0.0 + with: + helmfile-args: apply --environment production \ No newline at end of file diff --git a/.github/workflows/helmfile_production_plan.yaml b/.github/workflows/helmfile_production_plan.yaml new file mode 100644 index 000000000..ad1afb23b --- /dev/null +++ b/.github/workflows/helmfile_production_plan.yaml @@ -0,0 +1,57 @@ +name: Production - Helmfile Diff + +on: + pull_request: + branches: + - main + paths: + - "VERSION" + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HELMFILE_FILE_PATH: ${{ github.workspace }}/helmfile + PRODUCTION_AWS_ACCOUNT: ${{ secrets.PRODUCTION_AWS_ACCOUNT }} + +jobs: + helmfile-diff: + runs-on: ubuntu-latest + steps: + + - name: Inject token authentication + run: | + git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0 + id: awsconfig + with: + aws-access-key-id: ${{ secrets.PRODUCTION_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.PRODUCTION_AWS_SECRET_ACCESS_KEY }} + aws-region: ca-central-1 + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + with: + # Fetches entire history, so we can analyze commits since last tag + fetch-depth: 0 + - name: Configure kubeconfig + run: | + aws eks update-kubeconfig --name notification-canada-ca-production-eks-cluster + kubectl config rename-context arn:aws:eks:ca-central-1:$PRODUCTION_AWS_ACCOUNT:cluster/notification-canada-ca-production-eks-cluster production + - name: Load EnvVars + run: | + ./helmfile/getContext.sh true + - name: Setup helmfile + uses: mamezou-tech/setup-helmfile@v2.0.0 + with: + install-kubectl: no + install-helm: yes + - name: Helmfile Diff + id: helmfile_diff + run: | + echo 'var<> $GITHUB_OUTPUT + helmfile --environment staging diff >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + - name: Helmfile Diff Comment + uses: mshick/add-pr-comment@v2 + with: + message: | + ${{join(steps.helmfile_diff.outputs.*, '\n')}} diff --git a/.github/workflows/helmfile_staging_apply.yaml b/.github/workflows/helmfile_staging_apply.yaml index c6d9eea5f..840c65feb 100644 --- a/.github/workflows/helmfile_staging_apply.yaml +++ b/.github/workflows/helmfile_staging_apply.yaml @@ -11,7 +11,7 @@ env: STAGING_AWS_ACCOUNT: ${{ secrets.STAGING_AWS_ACCOUNT }} jobs: - helmfile-diff: + helmfile-apply: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/helmfile_staging_plan.yaml b/.github/workflows/helmfile_staging_plan.yaml index d5169bf1c..67e875766 100644 --- a/.github/workflows/helmfile_staging_plan.yaml +++ b/.github/workflows/helmfile_staging_plan.yaml @@ -35,13 +35,19 @@ jobs: - name: Load EnvVars run: | ./helmfile/getContext.sh true - - name: Run helmfile - id: helmfile_diff - uses: helmfile/helmfile-action@v1.0.0 + - name: Setup helmfile + uses: mamezou-tech/setup-helmfile@v2.0.0 with: - helmfile-args: diff --environment staging + install-kubectl: no + install-helm: yes + - name: Helmfile Diff + id: helmfile_diff + run: | + echo 'var<> $GITHUB_OUTPUT + helmfile --environment staging diff >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT - name: Helmfile Diff Comment uses: mshick/add-pr-comment@v2 with: message: | - Placeholder for helm diff once the output from GA works. + ${{join(steps.helmfile_diff.outputs.*, '\n')}}