Skip to content

Commit 54e03a7

Browse files
committed
CCM-7409: use branch name for workflow sandboxes
1 parent 94ef454 commit 54e03a7

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: "Normalize branch name"
2+
description: "Normalize branch name"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: "Normalize branch name"
7+
shell: bash
8+
run: |
9+
echo "normalized_branch_name=$(sed -e 's/[^a-zA-Z0-9-]//g' <<< $(git rev-parse --abbrev-ref HEAD) | tr '[:upper:]' '[:lower:]' | head -c 25)" >> $GITHUB_OUTPUT

.github/workflows/stage-4-acceptance.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
with:
6868
name: amplify_outputs.json
6969
path: amplify_outputs.json
70+
7071
sandbox-set-up:
7172
name: "Sandbox set up"
7273
runs-on: ubuntu-latest
@@ -75,20 +76,23 @@ jobs:
7576
steps:
7677
- name: "Checkout code"
7778
uses: actions/checkout@v4
78-
7979
- name: Configure AWS credentials
8080
uses: aws-actions/configure-aws-credentials@v4
8181
with:
8282
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ASSUME_ROLE_NAME }}
8383
role-session-name: deployInfra
8484
aws-region: ${{ env.AWS_REGION }}
85+
- name: "Get normalized branch name"
86+
id: normalize_branch_name
87+
uses: ./github/actions/normalize-branch-name
8588
- name: "Create Backend sandbox"
8689
run: |
87-
npm run create-backend-sandbox wf-${GITHUB_RUN_ID}
90+
npm run create-backend-sandbox ${{ steps.normalize_branch_name.outputs.normalized_branch_name }}
8891
- uses: actions/upload-artifact@v4
8992
with:
9093
name: sandbox_tf_outputs.json
9194
path: sandbox_tf_outputs.json
95+
9296
test-security:
9397
name: "Security test"
9498
runs-on: ubuntu-latest
@@ -214,6 +218,9 @@ jobs:
214218
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ASSUME_ROLE_NAME }}
215219
role-session-name: deployInfra
216220
aws-region: eu-west-2
221+
- name: "Get normalized branch name"
222+
id: normalize_branch_name
223+
uses: ./github/actions/normalize-branch-name
217224
- name: "Destroy Backend sandbox"
218225
run: |
219-
npm run destroy-backend-sandbox wf-${GITHUB_RUN_ID}
226+
npm run destroy-backend-sandbox ${{ steps.normalize_branch_name.outputs.normalized_branch_name }}

0 commit comments

Comments
 (0)