From 1e789f64b203eaff7b439763ffc4fb9287f92c00 Mon Sep 17 00:00:00 2001 From: Pete Dunlap Date: Tue, 11 Feb 2025 09:28:02 -0500 Subject: [PATCH] CMDCT-4325 - STAGE_PREFIX is not real (#12041) --- .github/build-vars.sh | 1 - .github/workflows/deploy.yml | 10 ++++------ .github/workflows/destroy.yml | 15 +++++++-------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/build-vars.sh b/.github/build-vars.sh index 380179a9c..209d90923 100755 --- a/.github/build-vars.sh +++ b/.github/build-vars.sh @@ -3,7 +3,6 @@ var_list=( 'AWS_OIDC_ROLE_TO_ASSUME' 'AWS_DEFAULT_REGION' - 'STAGE_PREFIX' 'SLACK_WEBHOOK_URL' 'CODE_CLIMATE_ID' ) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c65452b3c..1d3816845 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -73,7 +73,7 @@ jobs: BRANCH_NAME=$(./.github/setBranchName.sh ${{ github.ref_name }}) echo "branch_name=${BRANCH_NAME}" >> $GITHUB_ENV - name: Validate branch name - run: ./.github/branch-name-validation.sh $STAGE_PREFIX$branch_name + run: ./.github/branch-name-validation.sh $branch_name - name: set branch specific variable names run: ./.github/build-vars.sh set_names - name: set variable values @@ -81,7 +81,6 @@ jobs: env: AWS_DEFAULT_REGION: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }} AWS_OIDC_ROLE_TO_ASSUME: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME] || secrets.AWS_OIDC_ROLE_TO_ASSUME }} - STAGE_PREFIX: ${{ secrets.STAGE_PREFIX }} CODE_CLIMATE_ID: ${{ secrets.CODE_CLIMATE_ID }} - name: Configure AWS credentials for GitHub Actions uses: aws-actions/configure-aws-credentials@v4 @@ -104,10 +103,10 @@ jobs: run: | # When deploying multiple copies of this quickstart to the same AWS Account (not ideal), a prefix helps prevent stepping on each other. # This can optionally be set as an GitHub Actions Secret - ./run deploy --stage $STAGE_PREFIX$branch_name + ./run deploy --stage $branch_name - id: endpoint run: | - APPLICATION_ENDPOINT=$(./output.sh ui ApplicationEndpointUrl $STAGE_PREFIX$branch_name) + APPLICATION_ENDPOINT=$(./output.sh ui ApplicationEndpointUrl $branch_name) echo "application_endpoint=$APPLICATION_ENDPOINT" >> $GITHUB_OUTPUT echo "## Application Endpoint" >> $GITHUB_STEP_SUMMARY echo "<$APPLICATION_ENDPOINT>" >> $GITHUB_STEP_SUMMARY @@ -143,7 +142,6 @@ jobs: env: AWS_DEFAULT_REGION: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }} AWS_OIDC_ROLE_TO_ASSUME: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME] || secrets.AWS_OIDC_ROLE_TO_ASSUME }} - STAGE_PREFIX: ${{ secrets.STAGE_PREFIX }} - name: Configure AWS credentials for GitHub Actions uses: aws-actions/configure-aws-credentials@v4 @@ -173,7 +171,7 @@ jobs: id: gen-ip-set-name run: | #!/bin/bash - STAGE_GH_IPSET_NAME=$STAGE_PREFIX$branch_name-gh-ipset + STAGE_GH_IPSET_NAME=$branch_name-gh-ipset echo "Github IP Set name: $STAGE_GH_IPSET_NAME" echo "STAGE_GH_IPSET_NAME=$STAGE_GH_IPSET_NAME" >> $GITHUB_OUTPUT diff --git a/.github/workflows/destroy.yml b/.github/workflows/destroy.yml index 4b132b286..b036a815d 100644 --- a/.github/workflows/destroy.yml +++ b/.github/workflows/destroy.yml @@ -1,6 +1,6 @@ name: Destroy -on: +on: delete: workflow_dispatch: inputs: @@ -10,7 +10,7 @@ on: concurrency: group: ${{ inputs.environment || github.event.ref }} - + permissions: id-token: write contents: read @@ -32,13 +32,13 @@ jobs: ( inputs.environment != '' && (!contains(fromJson('["main", "val", "production"]'), inputs.environment)) - ) + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version-file: ".nvmrc" + node-version-file: ".nvmrc" - name: set branch_name run: | BRANCH_NAME=$(./.github/setBranchName.sh ${{ inputs.environment || github.event.ref }}) @@ -50,7 +50,6 @@ jobs: env: AWS_DEFAULT_REGION: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }} AWS_OIDC_ROLE_TO_ASSUME: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME] || secrets.AWS_OIDC_ROLE_TO_ASSUME }} - STAGE_PREFIX: ${{ secrets.STAGE_PREFIX }} - name: Configure AWS credentials for GitHub Actions uses: aws-actions/configure-aws-credentials@v4 with: @@ -59,13 +58,13 @@ jobs: - name: Destroy # destroy app-api first due to a dependency between it and database run: | - ./run destroy --stage $STAGE_PREFIX$branch_name --verify false --service app-api - ./run destroy --stage $STAGE_PREFIX$branch_name --verify false + ./run destroy --stage $branch_name --verify false --service app-api + ./run destroy --stage $branch_name --verify false # Notify the integrations channel when a destroy action fails notify_on_destroy_failure: runs-on: ubuntu-latest - needs: + needs: - destroy if: ${{ failure() }} steps: