From 453d00a61db0926fa8ce5d0c253dd043200d34b7 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 6 Apr 2026 12:55:07 -0400 Subject: [PATCH 1/2] Migrate e2e status to short-lived token --- ci/input_files/build.yaml.tpl | 29 ++------------------------ ci/poll_e2e.sh | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 ci/poll_e2e.sh diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 67f13706..420eea64 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -285,30 +285,5 @@ e2e-test-status: - if: '$SKIP_E2E_TESTS == "true"' when: never - when: on_success - script: | - GITLAB_API_TOKEN=$(aws ssm get-parameter --region us-east-1 --name "ci.${CI_PROJECT_NAME}.serverless-e2e-gitlab-token" --with-decryption --query "Parameter.Value" --out text) - URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" - echo "Fetching E2E job status from: $URL" - while true; do - RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL") - E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .downstream_pipeline.status') - echo -n "E2E job status: $E2E_JOB_STATUS, " - if [ "$E2E_JOB_STATUS" == "success" ]; then - echo "✅ E2E tests completed successfully" - exit 0 - elif [ "$E2E_JOB_STATUS" == "failed" ]; then - echo "❌ E2E tests failed" - exit 1 - elif [ "$E2E_JOB_STATUS" == "running" ]; then - echo "⏳ E2E tests are still running, retrying in 1 minute..." - elif [ "$E2E_JOB_STATUS" == "canceled" ]; then - echo "🚫 E2E tests were canceled" - exit 1 - elif [ "$E2E_JOB_STATUS" == "skipped" ]; then - echo "⏭️ E2E tests were skipped" - exit 0 - else - echo "❓ Unknown E2E test status: $E2E_JOB_STATUS, retrying in 1 minute..." - fi - sleep 60 - done + script: + - ci/poll_e2e.sh diff --git a/ci/poll_e2e.sh b/ci/poll_e2e.sh new file mode 100644 index 00000000..3d56926a --- /dev/null +++ b/ci/poll_e2e.sh @@ -0,0 +1,38 @@ +curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere + +BTI_CI_API_TOKEN=$(authanywhere --audience rapid-devex-ci) + +BTI_RESPONSE=$(curl --silent --request GET \ + --header "$BTI_CI_API_TOKEN" \ + --header "Content-Type: application/vnd.api+json" \ + "https://bti-ci-api.us1.ddbuild.io/internal/ci/gitlab/token?owner=DataDog&repository=datadog-lambda-python") + +GITLAB_TOKEN=$(echo "$BTI_RESPONSE" | jq -r '.token // empty') + +URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" + +echo "Fetching E2E job status from: $URL" + +while true; do + RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "$URL") + E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .downstream_pipeline.status') + echo -n "E2E job status: $E2E_JOB_STATUS, " + if [ "$E2E_JOB_STATUS" == "success" ]; then + echo "✅ E2E tests completed successfully" + exit 0 + elif [ "$E2E_JOB_STATUS" == "failed" ]; then + echo "❌ E2E tests failed" + exit 1 + elif [ "$E2E_JOB_STATUS" == "running" ]; then + echo "⏳ E2E tests are still running, retrying in 2 minutes..." + elif [ "$E2E_JOB_STATUS" == "canceled" ]; then + echo "🚫 E2E tests were canceled" + exit 1 + elif [ "$E2E_JOB_STATUS" == "skipped" ]; then + echo "⏭️ E2E tests were skipped" + exit 0 + else + echo "❓ Unknown E2E test status: $E2E_JOB_STATUS, retrying in 2 minutes..." + fi + sleep 120 +done \ No newline at end of file From c071508892b60f86ebf6d9ee742e53be771c68fa Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 6 Apr 2026 13:16:43 -0400 Subject: [PATCH 2/2] Executable mode --- ci/poll_e2e.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ci/poll_e2e.sh diff --git a/ci/poll_e2e.sh b/ci/poll_e2e.sh old mode 100644 new mode 100755