Skip to content

Commit 238af85

Browse files
VIA-598 Prevent E2E tests from being re-run if another version has been deployed in the meantime
Due to how concurrency rules work in Github it is entirely possible that the deploy and e2e steps from multiple workflows will run in a arbitrary order. Additionally, devs require the ability to re-run a failed E2E run but there is no guarantee that another workflow hasn't deployed a different version of the app since, resulting in the re-run being executed against the wrong build and an erroneous result. Start the E2E test job with a check that the build it expects to be deployed actually is, and fail the build if not.
1 parent ae6d206 commit 238af85

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@ jobs:
4646
with:
4747
ref: ${{ inputs.checkout_ref }}
4848

49+
- name: "Configure AWS credentials for env"
50+
uses: aws-actions/configure-aws-credentials@v5
51+
with:
52+
role-session-name: GitHubActionsSession
53+
role-to-assume: ${{ secrets.IAM_ROLE }}
54+
aws-region: ${{ env.AWS_REGION }}
55+
56+
- name: "Check expected version is running in ${{inputs.environment}}"
57+
timeout-minutes: 20
58+
shell: bash
59+
run: |
60+
APP_VERSION=$(aws lambda get-function-configuration --function-name gh-vita-${{ secrets.AWS_ACCOUNT_ID }}-server-function | jq -r '.Environment.Variables.APP_VERSION')
61+
echo "deployed_app_version=$APP_VERSION"
62+
if [ "$APP_VERSION" != "${{ inputs.checkout_ref }}" ]; then
63+
echo "Expected build ${{ inputs.checkout_ref }} is not currently deployed in ${{inputs.environment}} (current deployed version: $APP_VERSION)"
64+
exit 1
65+
fi
4966
5067
- name: "Run E2E tests on ${{ inputs.checkout_ref }} (${{ inputs.environment }})"
5168
timeout-minutes: 10

0 commit comments

Comments
 (0)