Skip to content

Commit d13c033

Browse files
committed
VED-812: Wait for correct commit hash earlier in the pipeline.
1 parent 16162da commit d13c033

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ env:
4040
SERVICE_BASE_PATH: ${{ startsWith(inputs.sub_environment, 'pr-') && format('immunisation-fhir-api/FHIR/R4-{0}', inputs.sub_environment) || 'immunisation-fhir-api/FHIR/R4' }}
4141
PROXY_NAME: ${{ startsWith(inputs.sub_environment, 'pr-') && format('immunisation-fhir-api-{0}', inputs.sub_environment) || format('immunisation-fhir-api-{0}', inputs.apigee_environment) }}
4242
STATUS_API_KEY: ${{ secrets.STATUS_API_KEY }}
43+
SOURCE_COMMIT_ID: ${{ github.sha }}
4344

4445
permissions:
4546
id-token: write
@@ -65,18 +66,27 @@ jobs:
6566
counter=0
6667
while [[ ${counter} -lt 31 ]]; do
6768
response=$(curl -H "apikey: ${STATUS_API_KEY}" -s "${endpoint}")
69+
6870
response_code=$(jq -r '.checks.healthcheck.responseCode' <<< "${response}")
6971
response_body=$(jq -r '.checks.healthcheck.outcome' <<< "${response}")
7072
status=$(jq -r '.status' <<< "${response}")
73+
commitId=$(jq -r '.commitId' <<< "${response}")
74+
7175
if [[ "${response_code}" -eq 200 ]] && [[ "${response_body}" == "OK" ]] && [[ "${status}" == "pass" ]]; then
72-
echo "Status test successful"
76+
echo "Status test successful"
77+
if [[ "${commitId}" == "${SOURCE_COMMIT_ID}" ]]; then
78+
echo "Commit hash test successful"
7379
break
80+
else
81+
echo "Waiting for ${endpoint} to return the correct commit hash..."
82+
fi
7483
else
75-
echo "Waiting for ${endpoint} to return a 200 response with 'OK' body..."
76-
((counter=counter+1)) # Increment counter by 1
77-
echo "Attempt ${counter}"
78-
sleep 30
84+
echo "Waiting for ${endpoint} to return a 200 response with 'OK' body..."
7985
fi
86+
87+
((counter=counter+1)) # Increment counter by 1
88+
echo "Attempt ${counter}"
89+
sleep 30
8090
done
8191
8292
if [[ ${counter} -eq 31 ]]; then
@@ -92,7 +102,6 @@ jobs:
92102
environment: ${{ inputs.apigee_environment }}
93103
env:
94104
APIGEE_USERNAME: ${{ vars.APIGEE_USERNAME }}
95-
SOURCE_COMMIT_ID: ${{ github.sha }}
96105
steps:
97106
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
98107

0 commit comments

Comments
 (0)