Skip to content

Commit e6744e2

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

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

ci/input_files/build.yaml.tpl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,48 @@ 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+
GITLAB_API_TOKEN=$(aws ssm get-parameter \
280+
--region us-east-1 \
281+
--name "ci.${CI_PROJECT_NAME}.serverless-e2e-gitlab-token" \
282+
--with-decryption \
283+
--query "Parameter.Value" \
284+
--out text)
285+
URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges"
286+
echo "Fetching E2E job status from: $URL"
287+
RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL")
288+
E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status')
289+
echo "E2E job status: $E2E_JOB_STATUS"
290+
case "$E2E_JOB_STATUS" in
291+
"success")
292+
echo "✅ E2E tests completed successfully"
293+
exit 0
294+
;;
295+
"failed")
296+
echo "❌ E2E tests failed"
297+
echo "💡 Look for pipelines triggered around $(date -u +"%Y-%m-%d %H:%M:%S UTC")"
298+
exit 1
299+
;;
300+
"canceled")
301+
echo "⚠️ E2E tests were canceled"
302+
exit 1
303+
;;
304+
*)
305+
echo "❓ Unknown E2E test status: $E2E_JOB_STATUS"
306+
exit 1
307+
;;
308+
esac

0 commit comments

Comments
 (0)