@@ -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+ GITLAB_API_TOKEN= $ (aws ssm get-parameter \
283+ --region us-east-1 \
284+ --name " ci.${CI_PROJECT_NAME}.serverless-e2e-gitlab-token" \
285+ --with -decryption \
286+ --query " Parameter.Value" \
287+ --out text)
288+ URL= " ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges"
289+ echo " Fetching E2E job status from: $URL"
290+ while true; do
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