Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
craigzour committed Apr 5, 2024
1 parent 889d551 commit 9c7d603
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 117 deletions.
25 changes: 8 additions & 17 deletions .github/workflows/terragrunt-apply-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ jobs:
working-directory: env/cloud/ecr
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Build Lambda images
uses: ./.github/workflows/build-lambda-images

- name: Tag and push Lambda images
uses: ./.github/workflows/tag-and-push-lambda-images

- name: Terragrunt apply hosted_zone
working-directory: env/cloud/hosted_zone
run: terragrunt apply --terragrunt-non-interactive -auto-approve
Expand Down Expand Up @@ -109,16 +115,10 @@ jobs:
working-directory: env/cloud/sns
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Install Cognito Lambda deps
run: ./aws/cognito/lambda/deps.sh install

- name: Terragrunt apply cognito
working-directory: env/cloud/cognito
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Remove Cognito Lambda deps
run: ./aws/cognito/lambda/deps.sh delete

- name: Terragrunt apply network
working-directory: env/cloud/network
run: terragrunt apply --terragrunt-non-interactive -auto-approve
Expand All @@ -145,25 +145,16 @@ jobs:
working-directory: env/cloud/app
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Install Lambda deps
run: ./aws/lambdas/code/deps.sh install

- name: Terragrunt apply lambdas
working-directory: env/cloud/lambdas
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Remove Lambda deps
run: ./aws/lambdas/code/deps.sh delete

- name: Install Lambda Alarm deps
run: ./aws/alarms/lambda/deps.sh install

- name: Terragrunt apply alarms
working-directory: env/cloud/alarms
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Remove Lambda deps
run: ./aws/alarms/lambda/deps.sh delete
- name: Request Lambda functions to use latest image
uses: ./.github/workflows/request-lambda-functions-to-use-latest-image

- name: Notify Slack on failure
if: failure()
Expand Down
73 changes: 14 additions & 59 deletions .github/workflows/terragrunt-apply-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,23 @@ jobs:
sqs:
- 'aws/sqs/**'
- 'env/cloud/sqs/**'
lambda_code:
- 'lambda-code/**'
# No dependencies
- name: Terragrunt apply ecr
if: ${{ steps.filter.outputs.ecr == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: env/cloud/ecr
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Build Lambda images
if: ${{ steps.filter.outputs.lambda_code == 'true' || steps.filter.outputs.common == 'true' }}
uses: ./.github/workflows/build-lambda-images

- name: Tag and push Lambda images
if: ${{ steps.filter.outputs.lambda_code == 'true' || steps.filter.outputs.common == 'true' }}
uses: ./.github/workflows/tag-and-push-lambda-images

- name: Terragrunt apply hosted_zone
if: ${{ steps.filter.outputs.hosted_zone == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: env/cloud/hosted_zone
Expand Down Expand Up @@ -187,19 +197,11 @@ jobs:
working-directory: env/cloud/sns
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Install Cognito Lambda deps
if: ${{ steps.filter.outputs.cognito == 'true' || steps.filter.outputs.common == 'true' }}
run: ./aws/cognito/lambda/deps.sh install

- name: Terragrunt apply cognito
if: ${{ steps.filter.outputs.cognito == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: env/cloud/cognito
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Remove Cognito Lambda deps
if: ${{ steps.filter.outputs.cognito == 'true' || steps.filter.outputs.common == 'true' }}
run: ./aws/cognito/lambda/deps.sh delete

- name: Terragrunt apply network
if: ${{ steps.filter.outputs.network == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: env/cloud/network
Expand Down Expand Up @@ -232,67 +234,16 @@ jobs:
working-directory: env/cloud/app
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Install Lambda deps
if: ${{ steps.filter.outputs.lambdas == 'true' || steps.filter.outputs.common == 'true' }}
run: ./aws/lambdas/code/deps.sh install

- name: Terragrunt apply lambdas
if: ${{ steps.filter.outputs.lambdas == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: env/cloud/lambdas
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Remove Lambda deps
if: ${{ steps.filter.outputs.lambdas == 'true' || steps.filter.outputs.common == 'true' }}
run: ./aws/lambdas/code/deps.sh delete

- name: Install Lambda Alarm deps
if: ${{ steps.filter.outputs.alarms == 'true' || steps.filter.outputs.common == 'true' }}
run: ./aws/alarms/lambda/deps.sh install

- name: Terragrunt apply alarms
if: ${{ steps.filter.outputs.alarms == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: env/cloud/alarms
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Remove Lambda Alarm deps
if: ${{ steps.filter.outputs.alarms == 'true' || steps.filter.outputs.common == 'true' }}
run: ./aws/alarms/lambda/deps.sh delete

# Load Testing - Depends on ECR
- name: Build Load Testing Lambda Container
if: ${{ steps.filter.outputs.load_testing == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: aws/load_testing/lambda
run: docker build -t load_testing_lambda:latest .

- name: Login to Staging Amazon ECR
if: ${{ steps.filter.outputs.load_testing == 'true' || steps.filter.outputs.common == 'true' }}
id: login-ecr-staging
uses: aws-actions/amazon-ecr-login@fe743e6bc3eb2ab5094262c5b9c6a168ceb05bec

- name: Tag Images for Staging
if: ${{ steps.filter.outputs.load_testing == 'true' || steps.filter.outputs.common == 'true' }}
env:
ECR_REGISTRY: ${{ steps.login-ecr-staging.outputs.registry }}
ECR_REPOSITORY: load_test
run: |
docker tag load_testing_lambda $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Push containers to Staging Amazon ECR
if: ${{ steps.filter.outputs.load_testing == 'true' || steps.filter.outputs.common == 'true' }}
env:
ECR_REGISTRY: ${{ steps.login-ecr-staging.outputs.registry }}
ECR_REPOSITORY: load_test
run: |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Logout of Staging Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr-staging.outputs.registry }}

- name: Remove local version of image
if: ${{ steps.filter.outputs.load_testing == 'true' || steps.filter.outputs.common == 'true' }}
run: docker image rm load_testing_lambda

- name: Terragrunt apply load_testing
if: ${{ steps.filter.outputs.load_testing == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: env/cloud/load_testing
Expand All @@ -302,6 +253,10 @@ jobs:
working-directory: env/cloud/pr_review
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Request Lambda functions to use latest image
if: ${{ steps.filter.outputs.lambda_code == 'true' || steps.filter.outputs.common == 'true' }}
uses: ./.github/workflows/request-lambda-functions-to-use-latest-image

- name: Notify Slack on failure
if: failure()
env:
Expand Down
25 changes: 3 additions & 22 deletions .github/workflows/terragrunt-plan-all-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ jobs:
comment: "false"
terragrunt: "true"

- name: Build Lambda images
uses: ./.github/workflows/build-lambda-images

- name: Terragrunt plan hosted_zone
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
Expand Down Expand Up @@ -132,19 +135,13 @@ jobs:
comment: "false"
terragrunt: "true"

- name: Install Cognito Lambda deps
run: ./aws/cognito/lambda/deps.sh install

- name: Terragrunt plan cognito
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
directory: "env/cloud/cognito"
comment: "false"
terragrunt: "true"

- name: Remove Cognito Lambda deps
run: ./aws/cognito/lambda/deps.sh delete

- name: Terragrunt plan network
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
Expand Down Expand Up @@ -189,36 +186,20 @@ jobs:
comment: "false"
terragrunt: "true"

- name: Install Lambda deps
run: ./aws/lambdas/code/deps.sh install

- name: Terragrunt plan lambdas
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
directory: "env/cloud/lambdas"
comment: "false"
terragrunt: "true"

- name: Remove Lambda deps
run: ./aws/lambdas/code/deps.sh delete

- name: Install Lambda Alarms deps
run: ./aws/alarms/lambda/deps.sh install

- name: Terragrunt plan alarms
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
directory: "env/cloud/alarms"
comment: "false"
terragrunt: "true"

- name: Remove Lambda Alarms deps
run: ./aws/alarms/lambda/deps.sh delete

- name: Build Load Testing Lambda Container
working-directory: aws/load_testing/lambda
run: docker build -t load_testing_lambda:latest .

- name: Terragrunt plan load_testing
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/terragrunt-plan-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
terragrunt: "true"

- name: Build Lambda images
uses: ./.github/workflows/build-lambda-images

- name: Terragrunt plan hosted_zone
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
Expand Down Expand Up @@ -154,9 +157,6 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
terragrunt: "true"

- name: Install Cognito Lambda deps
run: ./aws/cognito/lambda/deps.sh install

- name: Terragrunt plan cognito
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
Expand All @@ -166,9 +166,6 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
terragrunt: "true"

- name: Remove Cognito Lambda deps
run: ./aws/cognito/lambda/deps.sh delete

- name: Terragrunt plan network
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
Expand Down Expand Up @@ -226,9 +223,6 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
terragrunt: "true"

- name: Install Lambda deps
run: ./aws/lambdas/code/deps.sh install

- name: Terragrunt plan lambdas
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
Expand All @@ -238,20 +232,11 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
terragrunt: "true"

- name: Remove Lambda deps
run: ./aws/lambdas/code/deps.sh delete

- name: Install Lambda Alarms deps
run: ./aws/alarms/lambda/deps.sh install

- name: Terragrunt plan alarms
uses: cds-snc/terraform-plan@28d2efe5155573489fa5b5816fad20d44d1f274b # v3.0.7
with:
directory: "env/cloud/alarms"
comment-delete: "true"
comment-title: "Production: alarms"
github-token: "${{ secrets.GITHUB_TOKEN }}"
terragrunt: "true"

- name: Remove Lambda Alarms deps
run: ./aws/alarms/lambda/deps.sh delete
terragrunt: "true"

0 comments on commit 9c7d603

Please sign in to comment.