Skip to content

Commit d158eb0

Browse files
committed
Have e2e-status job start right away then poll.
1 parent 7255a2b commit d158eb0

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

ci/input_files/build.yaml.tpl

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ e2e-status:
279279
image: registry.ddbuild.io/images/mirror/alpine:latest
280280
tags: ["arch:amd64"]
281281
needs:
282-
- e2e-test
283282
{{- range (ds "runtimes").runtimes }}
284283
{{- if eq .arch "amd64" }}
285284
- "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]"
286285
{{- end }}
287286
{{- end }}
288287
script:
288+
- apt-get install -y curl
289289
- echo "Python layer ARNs used in E2E tests:"
290290
{{- range (ds "runtimes").runtimes }}
291291
{{- if eq .arch "amd64" }}
@@ -295,11 +295,36 @@ e2e-status:
295295
{{- end }}
296296
- |
297297
# TODO: link to the test results
298-
# make this job start running at same time as e2e-test job
299298
# do not wait around for the scheduled job to complete
300-
if [ "${CI_JOB_STATUS}" = "failed" ]; then
301-
echo "❌ E2E tests failed"
302-
exit 1
303-
else
304-
echo "✅ E2E tests completed successfully"
305-
fi
299+
echo "🔄 Waiting for E2E tests to complete..."
300+
# Poll for e2e-test job completion
301+
while true; do
302+
# Get the e2e-test job status
303+
E2E_JOB_STATUS=$(curl -s --header "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" \
304+
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs" | \
305+
jq -r '.[] | select(.name=="e2e-test") | .status')
306+
echo "E2E job status: $E2E_JOB_STATUS"
307+
case "$E2E_JOB_STATUS" in
308+
"success")
309+
echo "✅ E2E tests completed successfully"
310+
exit 0
311+
;;
312+
"failed")
313+
echo "❌ E2E tests failed"
314+
echo "💡 Look for pipelines triggered around $(date -u +"%Y-%m-%d %H:%M:%S UTC")"
315+
exit 1
316+
;;
317+
"canceled")
318+
echo "⚠️ E2E tests were canceled"
319+
exit 1
320+
;;
321+
"running"|"pending"|"created")
322+
echo "⏳ E2E tests still running..."
323+
sleep 30
324+
;;
325+
*)
326+
echo "❓ Unknown E2E test status: $E2E_JOB_STATUS"
327+
sleep 30
328+
;;
329+
esac
330+
done

0 commit comments

Comments
 (0)