Teardown QA instance #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Teardown QA instance | |
on: | |
schedule: | |
- cron: "30 17 * * 5" # At 17.30 every Friday | |
workflow_dispatch: | |
concurrency: terraform_qa | |
defaults: | |
run: | |
shell: bash | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_BLUEPRINTS_QA_DEPLOY_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_BLUEPRINTS_QA_DEPLOY_AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: eu-central-1 | |
jobs: | |
qa-env: | |
runs-on: ubuntu-latest | |
container: | |
image: dfdsdk/python-pipeline:0.0.4 | |
steps: | |
- name: Check environment variables | |
run: bash -c '[[ -z $AWS_ACCESS_KEY_ID || -z $AWS_SECRET_ACCESS_KEY ]] && exit 1 || true' | |
- name: Send alert if job fails | |
if: failure() | |
uses: dfds/shared-workflows/.github/actions/automation-slack-notifier@master | |
with: | |
slack_webhook: ${{ secrets.SLACK_WEBHOOK }} | |
slack_message: Test environment variables failed. | |
qa-down: | |
runs-on: ubuntu-latest | |
needs: qa-env | |
container: | |
image: dfdsdk/python-pipeline:0.0.4 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
working-directory: tests/qa | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
working-directory: tests/qa | |
- name: Terraform Destroy | |
id: destroy | |
run: terraform destroy -input=false -auto-approve | |
working-directory: tests/qa | |
- name: Cleanup CloudWatch Log Groups | |
id: cloudwatch_log_groups | |
run: ./cloudwatch_log_groups.sh | |
working-directory: tests/qa | |
- name: Send alert if job fails | |
if: failure() | |
uses: dfds/shared-workflows/.github/actions/automation-slack-notifier@master | |
with: | |
slack_webhook: ${{ secrets.SLACK_WEBHOOK }} | |
slack_message: Teardown QA environment failed. |