Skip to content

Commit 658ad5e

Browse files
committed
Handle all of the statuses.
1 parent 5cd891f commit 658ad5e

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

ci/input_files/build.yaml.tpl

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -263,26 +263,38 @@ e2e-test:
263263
{{- end }}
264264

265265
e2e-test-status:
266-
stage: e2e
266+
stage: test
267267
image: registry.ddbuild.io/images/docker:20.10-py3
268268
tags: ["arch:amd64"]
269-
dependencies:
270-
- e2e-test
269+
timeout: 3h
271270
script: |
272271
GITLAB_API_TOKEN=$(aws ssm get-parameter --region us-east-1 --name "ci.${CI_PROJECT_NAME}.serverless-e2e-gitlab-token" --with-decryption --query "Parameter.Value" --out text)
273272
URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges"
274273
echo "Fetching E2E job status from: $URL"
275-
RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL")
276-
echo "Response from GitLab API: $RESPONSE"
277-
E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status')
278-
echo "E2E job status: $E2E_JOB_STATUS"
279-
if [ "$E2E_JOB_STATUS" == "success" ]; then
280-
echo "✅ E2E tests completed successfully"
281-
exit 0
282-
elif [ "$E2E_JOB_STATUS" == "failed" ]; then
283-
echo "❌ E2E tests failed"
284-
exit 1
285-
else
286-
echo "❓ Unknown E2E test status: $E2E_JOB_STATUS"
287-
exit 1
288-
fi
274+
while true; do
275+
RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL")
276+
echo "Response from GitLab API: $RESPONSE"
277+
E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status')
278+
echo "E2E job status: $E2E_JOB_STATUS"
279+
if [ "$E2E_JOB_STATUS" == "success" ]; then
280+
echo "✅ E2E tests completed successfully"
281+
exit 0
282+
elif [ "$E2E_JOB_STATUS" == "failed" ]; then
283+
echo "❌ E2E tests failed"
284+
exit 1
285+
elif [ "$E2E_JOB_STATUS" == "running" ]; then
286+
echo -n "⏳ E2E tests are still running"
287+
echo "Retrying in 1 minute..."
288+
sleep 60
289+
elif [ "$E2E_JOB_STATUS" == "canceled" ]; then
290+
echo "🚫 E2E tests were canceled"
291+
exit 1
292+
elif [ "$E2E_JOB_STATUS" == "skipped" ]; then
293+
echo "⏭️ E2E tests were skipped"
294+
exit 0
295+
else
296+
echo -n "❓ Unknown E2E test status: $E2E_JOB_STATUS"
297+
echo "Retrying in 1 minute..."
298+
sleep 60
299+
fi
300+
done

0 commit comments

Comments
 (0)