Skip to content

Commit f17c40a

Browse files
committed
Use AWS credentials to deploy review apps
Rather than using a codebuild runner to deploy the review apps, instead authenticate to AWS with OIDC and deploy them directly.
1 parent 53ba2aa commit f17c40a

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

.github/workflows/review_apps_on_pr_change.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ on:
77
types: [opened, reopened, synchronize]
88
jobs:
99
update-review-app:
10-
# this references a codebuild project configured in forms-deploy
11-
# see: https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html
12-
runs-on: codebuild-review-forms-runner-gha-runner-${{github.run_id}}-${{github.run_attempt}}
10+
runs-on: ubuntu-24.04-arm
1311

1412
permissions:
13+
id-token: write
14+
contents: read
1515
pull-requests: write
1616

1717
steps:
18+
- name: Configure AWS credentials
19+
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1
20+
with:
21+
role-to-assume: arn:aws:iam::842676007477:role/review-github-actions-forms-runner
22+
aws-region: eu-west-2
1823
- name: Generate container image URI
1924
run: |
2025
echo "CONTAINER_IMAGE_URI=842676007477.dkr.ecr.eu-west-2.amazonaws.com/forms-runner:pr-${{github.event.pull_request.number}}-${{github.event.pull_request.head.sha}}-$(date +%s)" >> "$GITHUB_ENV"
@@ -24,9 +29,6 @@ jobs:
2429

2530
- name: Build container
2631
run: |
27-
# Docker credentials are configured in CodeBuild
28-
# CodeBuild retrieves the credentials from ParameterStore
29-
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
3032
docker build \
3133
--tag "${{env.CONTAINER_IMAGE_URI}}" \
3234
.

.github/workflows/review_apps_on_pr_close.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ env:
77
IMAGE_TAG: "842676007477.dkr.ecr.eu-west-2.amazonaws.com/forms-runner:pr-${{github.event.pull_request.number}}-${{github.event.pull_request.head.ref}}"
88
jobs:
99
delete-review-app:
10-
# this references a codebuild project configured in forms-deploy
11-
# see: https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html
12-
runs-on: codebuild-review-forms-runner-gha-runner-${{github.run_id}}-${{github.run_attempt}}
10+
runs-on: ubuntu-24.04-arm
11+
permissions:
12+
id-token: write
13+
contents: read
1314

1415
steps:
16+
- name: Configure AWS credentials
17+
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1
18+
with:
19+
role-to-assume: arn:aws:iam::842676007477:role/review-github-actions-forms-runner
20+
aws-region: eu-west-2
1521
- name: Checkout code
1622
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1723

0 commit comments

Comments
 (0)