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