Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production and testing diff output #2373

Merged
merged 16 commits into from
Feb 13, 2024
46 changes: 46 additions & 0 deletions .github/workflows/helmfile_production_apply.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
helmfile-args: apply --environment production
57 changes: 57 additions & 0 deletions .github/workflows/helmfile_production_plan.yaml
Original file line number Diff line number Diff line change
@@ -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/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting stuff going on here with the insteadOf instruction!

Copy link
Collaborator Author

@ben851 ben851 Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy paste from our other GA's!

- 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/[email protected]
with:
install-kubectl: no
install-helm: yes
- name: Helmfile Diff
id: helmfile_diff
run: |
echo 'var<<EOF' >> $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')}}
2 changes: 1 addition & 1 deletion .github/workflows/helmfile_staging_apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
STAGING_AWS_ACCOUNT: ${{ secrets.STAGING_AWS_ACCOUNT }}

jobs:
helmfile-diff:
helmfile-apply:
runs-on: ubuntu-latest
steps:

Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/helmfile_staging_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ jobs:
- name: Load EnvVars
run: |
./helmfile/getContext.sh true
- name: Run helmfile
id: helmfile_diff
uses: helmfile/[email protected]
- name: Setup helmfile
uses: mamezou-tech/[email protected]
with:
helmfile-args: diff --environment staging
install-kubectl: no
install-helm: yes
- name: Helmfile Diff
id: helmfile_diff
run: |
echo 'var<<EOF' >> $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')}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that is the working diff here I assume?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You got it!

Loading