Skip to content

Commit 948504a

Browse files
committed
Improve test status reporting.
1 parent ca4dd9f commit 948504a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

ci/input_files/build.yaml.tpl

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,57 @@ e2e-test:
261261
- "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]"
262262
{{- end }}
263263
{{- end }}
264+
265+
e2e-test-status:
266+
stage: e2e
267+
image: registry.ddbuild.io/images/docker:20.10-py3
268+
tags: ["arch:amd64"]
269+
script:
270+
- apk add --no-cache curl jq
271+
- echo "Python layer ARNs used in E2E tests:"
272+
{{- range (ds "runtimes").runtimes }}
273+
{{- if eq .arch "amd64" }}
274+
{{- $version := print (.name | strings.Trim "python") }}
275+
- echo " PYTHON_{{ $version }}_VERSION=$PYTHON_{{ $version }}_VERSION"
276+
{{- end }}
277+
{{- end }}
278+
- |
279+
# TODO: link to the test results
280+
# do not wait around for the scheduled job to complete
281+
echo "🔄 Waiting for E2E tests to complete..."
282+
URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges"
283+
echo "Fetching E2E job status from: $URL"
284+
while true; do
285+
GITLAB_API_TOKEN=$(aws ssm get-parameter \
286+
--region us-east-1 \
287+
--name "ci.${CI_PROJECT_NAME}.serverless-e2e-gitlab-token" \
288+
--with-decryption \
289+
--query "Parameter.Value" \
290+
--out text)
291+
RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL")
292+
E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status')
293+
echo "E2E job status: $E2E_JOB_STATUS"
294+
case "$E2E_JOB_STATUS" in
295+
"success")
296+
echo "✅ E2E tests completed successfully"
297+
exit 0
298+
;;
299+
"failed")
300+
echo "❌ E2E tests failed"
301+
echo "💡 Look for pipelines triggered around $(date -u +"%Y-%m-%d %H:%M:%S UTC")"
302+
exit 1
303+
;;
304+
"canceled")
305+
echo "⚠️ E2E tests were canceled"
306+
exit 1
307+
;;
308+
"running"|"pending"|"created")
309+
echo "⏳ E2E tests still running..."
310+
sleep 30
311+
;;
312+
*)
313+
echo "❓ Unknown E2E test status: $E2E_JOB_STATUS"
314+
sleep 30
315+
;;
316+
esac
317+
done

0 commit comments

Comments
 (0)