Skip to content

Commit 87d68b3

Browse files
committed
Add expected_commit_id input to E2E test workflow for improved commit tracking
1 parent 611e304 commit 87d68b3

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

.github/workflows/pr-deploy-and-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ jobs:
3939
include:
4040
- apigee_environment_name: internal-dev
4141
required_test_suite: smoke
42+
require_matching_commit_id: true
4243
- apigee_environment_name: internal-dev-sandbox
4344
required_test_suite: sandbox
45+
require_matching_commit_id: false
4446
uses: ./.github/workflows/run-e2e-automation-tests.yml
4547
with:
4648
apigee_environment: ${{ matrix.apigee_environment_name }}
@@ -49,6 +51,7 @@ jobs:
4951
service_under_test: all
5052
suite_to_run: ${{ matrix.required_test_suite }}
5153
expected_commit_id: ${{ github.event.pull_request.head.sha }}
54+
require_matching_commit_id: ${{ matrix.require_matching_commit_id }}
5255
secrets:
5356
APIGEE_PASSWORD: ${{ secrets.APIGEE_PASSWORD }}
5457
APIGEE_BASIC_AUTH_TOKEN: ${{ secrets.APIGEE_BASIC_AUTH_TOKEN }}

.github/workflows/run-e2e-automation-tests.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ on:
2222
required: false
2323
type: string
2424
default: ""
25+
require_matching_commit_id:
26+
required: false
27+
type: boolean
28+
default: true
2529
secrets:
2630
APIGEE_PASSWORD:
2731
required: true
@@ -81,6 +85,11 @@ on:
8185
required: false
8286
type: string
8387
default: ""
88+
require_matching_commit_id:
89+
description: Whether the _status endpoint commitId must match the expected commit SHA.
90+
required: false
91+
type: boolean
92+
default: true
8493

8594
env:
8695
APIGEE_AUTH_ENV: ${{ inputs.apigee_environment == 'int' && inputs.apigee_environment || 'internal-dev' }}
@@ -91,6 +100,7 @@ env:
91100
PROXY_NAME: ${{ startsWith(inputs.sub_environment, 'pr-') && format('immunisation-fhir-api-{0}', inputs.sub_environment) || format('immunisation-fhir-api-{0}', inputs.apigee_environment) }}
92101
STATUS_API_KEY: ${{ secrets.STATUS_API_KEY }}
93102
SOURCE_COMMIT_ID: ${{ inputs.expected_commit_id || github.sha }}
103+
REQUIRE_MATCHING_COMMIT_ID: ${{ inputs.require_matching_commit_id }}
94104
MNS_VALIDATION_REQUIRED: ${{ inputs.mns_validation_required || startsWith(inputs.sub_environment, 'pr-') || inputs.apigee_environment == 'internal-dev' }}
95105

96106
jobs:
@@ -121,11 +131,15 @@ jobs:
121131
122132
if [[ "${response_code}" -eq 200 ]] && [[ "${response_body}" == "OK" ]] && [[ "${status}" == "pass" ]]; then
123133
echo "Status test successful"
134+
if [[ "${REQUIRE_MATCHING_COMMIT_ID}" != "true" ]]; then
135+
echo "Skipping commit hash validation for ${APIGEE_ENVIRONMENT}"
136+
break
137+
fi
124138
if [[ "${commitId}" == "${SOURCE_COMMIT_ID}" ]]; then
125139
echo "Commit hash test successful"
126140
break
127141
else
128-
echo "Waiting for ${endpoint} to return the correct commit hash..."
142+
echo "Waiting for ${endpoint} to return the correct commit hash... expected ${SOURCE_COMMIT_ID}, got ${commitId}"
129143
fi
130144
else
131145
echo "Waiting for ${endpoint} to return a 200 response with 'OK' body..."

0 commit comments

Comments
 (0)