Skip to content

Commit

Permalink
CMDCT-4325 - STAGE_PREFIX is not real (#12041)
Browse files Browse the repository at this point in the history
  • Loading branch information
peoplespete authored Feb 11, 2025
1 parent fbf3e9f commit 1e789f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
1 change: 0 additions & 1 deletion .github/build-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var_list=(
'AWS_OIDC_ROLE_TO_ASSUME'
'AWS_DEFAULT_REGION'
'STAGE_PREFIX'
'SLACK_WEBHOOK_URL'
'CODE_CLIMATE_ID'
)
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@ 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
run: ./.github/build-vars.sh set_values
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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/destroy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Destroy

on:
on:
delete:
workflow_dispatch:
inputs:
Expand All @@ -10,7 +10,7 @@ on:

concurrency:
group: ${{ inputs.environment || github.event.ref }}

permissions:
id-token: write
contents: read
Expand All @@ -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 }})
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 1e789f6

Please sign in to comment.