Skip to content

Commit a301141

Browse files
authored
Merge branch 'main' into feature/ELI-731-add-regression-role-to-tf
2 parents 96f16c8 + 924b7af commit a301141

5 files changed

Lines changed: 68 additions & 58 deletions

File tree

.github/workflows/base-deploy.yml

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/checkout@v6
4040
with:
4141
ref: ${{ inputs.ref }}
42-
fetch-depth: 0 # get full history + tags
42+
fetch-depth: 0 # get full history + tags
4343

4444
- name: "Set CI/CD variables"
4545
id: variables
@@ -104,61 +104,60 @@ jobs:
104104
fi
105105
106106
download-lambda-artifact:
107-
name: "Fetch the lambda artifact from previous stage"
108-
runs-on: ubuntu-latest
109-
needs: [metadata]
110-
timeout-minutes: 45
111-
permissions:
112-
id-token: write
113-
contents: write
114-
environment: ${{ needs.metadata.outputs.promoted_environment }}
115-
steps:
116-
- name: "Checkout repository at ref"
117-
uses: actions/checkout@v6
118-
with:
119-
ref: ${{ needs.metadata.outputs.ref }}
120-
fetch-depth: 0
121-
122-
- name: "Setup Terraform"
123-
uses: hashicorp/setup-terraform@v3
124-
with:
125-
terraform_version: ${{ needs.metadata.outputs.terraform_version }}
107+
name: "Fetch the lambda artifact from previous stage"
108+
runs-on: ubuntu-latest
109+
needs: [metadata]
110+
timeout-minutes: 45
111+
permissions:
112+
id-token: write
113+
contents: write
114+
environment: ${{ needs.metadata.outputs.promoted_environment }}
115+
steps:
116+
- name: "Checkout repository at ref"
117+
uses: actions/checkout@v6
118+
with:
119+
ref: ${{ needs.metadata.outputs.ref }}
120+
fetch-depth: 0
126121

127-
- name: "Configure AWS Credentials"
128-
uses: aws-actions/configure-aws-credentials@v6
129-
with:
130-
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
131-
aws-region: eu-west-2
122+
- name: "Setup Terraform"
123+
uses: hashicorp/setup-terraform@v3
124+
with:
125+
terraform_version: ${{ needs.metadata.outputs.terraform_version }}
132126

133-
- name: "Terraform Init"
134-
env:
135-
ENVIRONMENT: ${{ needs.metadata.outputs.promoted_environment }}
136-
WORKSPACE: "default"
137-
run: |
138-
echo "Running: make terraform env=$ENVIRONMENT workspace=$WORKSPACE stack=api-layer tf-command=init"
139-
make terraform env=$ENVIRONMENT stack=api-layer tf-command=init workspace=$WORKSPACE
140-
working-directory: ./infrastructure
127+
- name: "Configure AWS Credentials"
128+
uses: aws-actions/configure-aws-credentials@v6
129+
with:
130+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
131+
aws-region: eu-west-2
141132

142-
- name: "Extract S3 bucket name from Terraform output"
143-
id: tf_output
144-
run: |
145-
BUCKET=$(terraform output -raw lambda_artifact_bucket)
146-
echo "bucket_name=$BUCKET" >> $GITHUB_OUTPUT
147-
working-directory: ./infrastructure/stacks/api-layer
133+
- name: "Terraform Init"
134+
env:
135+
ENVIRONMENT: ${{ needs.metadata.outputs.promoted_environment }}
136+
WORKSPACE: "default"
137+
run: |
138+
echo "Running: make terraform env=$ENVIRONMENT workspace=$WORKSPACE stack=api-layer tf-command=init"
139+
make terraform env=$ENVIRONMENT stack=api-layer tf-command=init workspace=$WORKSPACE
140+
working-directory: ./infrastructure
148141

149-
- name: "Download lambda artifact from S3"
150-
run: |
151-
aws s3 cp \
152-
s3://${{ steps.tf_output.outputs.bucket_name }}/artifacts/${{ needs.metadata.outputs.tag }}/lambda.zip \
153-
./dist/lambda.zip \
154-
--region eu-west-2
142+
- name: "Extract S3 bucket name from Terraform output"
143+
id: tf_output
144+
run: |
145+
BUCKET=$(terraform output -raw lambda_artifact_bucket)
146+
echo "bucket_name=$BUCKET" >> $GITHUB_OUTPUT
147+
working-directory: ./infrastructure/stacks/api-layer
155148

156-
- name: "Upload lambda artifact for the current workflow"
157-
uses: actions/upload-artifact@v6
158-
with:
159-
name: lambda-${{ needs.metadata.outputs.tag }}
160-
path: ./dist/lambda.zip
149+
- name: "Download lambda artifact from S3"
150+
run: |
151+
aws s3 cp \
152+
s3://${{ steps.tf_output.outputs.bucket_name }}/artifacts/${{ needs.metadata.outputs.tag }}/lambda.zip \
153+
./dist/lambda.zip \
154+
--region eu-west-2
161155
156+
- name: "Upload lambda artifact for the current workflow"
157+
uses: actions/upload-artifact@v6
158+
with:
159+
name: lambda-${{ needs.metadata.outputs.tag }}
160+
path: ./dist/lambda.zip
162161

163162
deploy:
164163
name: "Deploy to ${{ needs.metadata.outputs.environment }}"
@@ -264,7 +263,6 @@ jobs:
264263
s3://${{ steps.tf_output.outputs.bucket_name }}/artifacts/${{ steps.release_tag.outputs.release_tag }}/lambda.zip \
265264
--region eu-west-2
266265
267-
268266
regression-tests:
269267
name: "Regression Tests"
270268
if: ${{ needs.metadata.outputs.environment == 'preprod' }}
@@ -273,4 +271,5 @@ jobs:
273271
with:
274272
ENVIRONMENT: "preprod"
275273
VERSION_NUMBER: "main"
276-
secrets: inherit
274+
secrets:
275+
AWS_ACCOUNT_ID: ${{ secrets.PREPROD_AWS_ACCOUNT_ID }}

.github/workflows/cicd-2-publish.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- name: "Set up Python"
7070
uses: actions/setup-python@v6
7171
with:
72-
python-version: '3.13'
72+
python-version: "3.13"
7373

7474
- name: "Checkout Repository"
7575
uses: actions/checkout@v6
@@ -158,4 +158,5 @@ jobs:
158158
with:
159159
ENVIRONMENT: "dev"
160160
VERSION_NUMBER: "main"
161-
secrets: inherit
161+
secrets:
162+
AWS_ACCOUNT_ID: ${{ secrets.DEV_AWS_ACCOUNT_ID }}

.github/workflows/cicd-3-test-deploy.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ permissions:
1313
contents: read
1414
id-token: write
1515
actions: read
16+
issues: write
17+
pull-requests: write
1618

1719
jobs:
1820
metadata:
@@ -254,5 +256,5 @@ jobs:
254256
with:
255257
ENVIRONMENT: "test"
256258
VERSION_NUMBER: "main"
257-
secrets: inherit
258-
259+
secrets:
260+
AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }}

.github/workflows/regression-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
VERSION_NUMBER:
1010
required: true
1111
type: string
12+
secrets:
13+
AWS_ACCOUNT_ID:
14+
required: true
1215

1316
jobs:
1417
regression-tests:
@@ -19,6 +22,7 @@ jobs:
1922
issues: write
2023
pull-requests: write
2124
uses: NHSDigital/eligibility-signposting-api-regression-tests/.github/workflows/regression_tests.yml@main
25+
secrets: inherit
2226
with:
2327
environment: ${{ inputs.ENVIRONMENT }}
2428
tags: "@regression"

.github/workflows/release-candidate.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ permissions:
3131
contents: write
3232
id-token: write
3333
actions: read
34+
issues: write
35+
pull-requests: write
3436

3537
jobs:
3638
validate:
@@ -278,7 +280,8 @@ jobs:
278280
with:
279281
ENVIRONMENT: "test"
280282
VERSION_NUMBER: "main"
281-
secrets: inherit
283+
secrets:
284+
AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }}
282285

283286
deploy-to-preprod:
284287
name: "Deploy to PreProd and create RC"
@@ -394,7 +397,8 @@ jobs:
394397
with:
395398
ENVIRONMENT: "preprod"
396399
VERSION_NUMBER: "main"
397-
secrets: inherit
400+
secrets:
401+
AWS_ACCOUNT_ID: ${{ secrets.PREPROD_AWS_ACCOUNT_ID }}
398402

399403
summary:
400404
name: "Deployment Summary"

0 commit comments

Comments
 (0)