From d5d68358a976e428fe36451a1b24cd2c73bd7ae5 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 2 Feb 2026 13:43:26 -0500 Subject: [PATCH 01/42] Adding e2e test trigger --- .gitlab/input_files/build.yaml.tpl | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 737d746e..7c1f9c06 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -1,3 +1,5 @@ +{{- $e2e_region := "us-west-2" -}} + variables: CI_DOCKER_TARGET_IMAGE: registry.ddbuild.io/ci/datadog-lambda-js CI_DOCKER_TARGET_VERSION: latest @@ -7,6 +9,7 @@ stages: - test - sign - publish + - e2e default: retry: @@ -126,6 +129,8 @@ publish layer {{ $environment.name }} ({{ $runtime.name }}): tags: ["arch:amd64"] image: ${CI_DOCKER_TARGET_IMAGE}:${CI_DOCKER_TARGET_VERSION} rules: + - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "{{ $e2e_region }}"' + when: on_success - if: '"{{ $environment.name }}" =~ /^(sandbox|staging)/' when: manual allow_failure: true @@ -203,3 +208,56 @@ publish npm package: - mkdir -p datadog_lambda_js-{{ if eq $environment.name "prod"}}signed-{{ end }}bundle-${CI_JOB_ID} - cp .layers/datadog_lambda_node*.zip datadog_lambda_js-{{ if eq $environment.name "prod"}}signed-{{ end }}bundle-${CI_JOB_ID} {{ end }} + +e2e-test: + stage: e2e + trigger: + project: DataDog/serverless-e2e-tests + strategy: depend + variables: + LANGUAGES_SUBSET: node + # These env vars are inherited from the dotenv reports of the publish-layer jobs + {{- range (ds "runtimes").runtimes }} + {{- if eq .arch "amd64" }} + {{- $runtime.node_version := print (.name | strings.Trim "node") }} + NODEJS_{{ $runtime.node_version }}_VERSION: $NODEJS_{{ $runtime.node_version }}_VERSION + {{- end }} + {{- end }} + needs: {{ range (ds "runtimes").runtimes }} + {{- if eq .arch "amd64" }} + - "publish-layer-sandbox ({{ .name }}): [{{ $e2e_region }}]" + {{- end }} + {{- end }} + +e2e-test-status: + stage: e2e + image: registry.ddbuild.io/images/docker:20.10-py3 + tags: ["arch:amd64"] + timeout: 3h + 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 From ac3dec3d7328a30d3505072cc72390c00c703706 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 2 Feb 2026 13:47:17 -0500 Subject: [PATCH 02/42] typo --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 7c1f9c06..af32a614 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -129,7 +129,7 @@ publish layer {{ $environment.name }} ({{ $runtime.name }}): tags: ["arch:amd64"] image: ${CI_DOCKER_TARGET_IMAGE}:${CI_DOCKER_TARGET_VERSION} rules: - - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "{{ $e2e_region }}"' + - if: '"{{ $environment.name }}" == "sandbox" && $REGION == "{{ $e2e_region }}"' when: on_success - if: '"{{ $environment.name }}" =~ /^(sandbox|staging)/' when: manual From 9ce643176749f909b762fba9af73b276f2884a5d Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 2 Feb 2026 13:56:11 -0500 Subject: [PATCH 03/42] more typos --- .gitlab/input_files/build.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index af32a614..0d62466c 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -217,7 +217,7 @@ e2e-test: variables: LANGUAGES_SUBSET: node # These env vars are inherited from the dotenv reports of the publish-layer jobs - {{- range (ds "runtimes").runtimes }} + {{- range $runtime := (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} {{- $runtime.node_version := print (.name | strings.Trim "node") }} NODEJS_{{ $runtime.node_version }}_VERSION: $NODEJS_{{ $runtime.node_version }}_VERSION @@ -225,7 +225,7 @@ e2e-test: {{- end }} needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - - "publish-layer-sandbox ({{ .name }}): [{{ $e2e_region }}]" + - "publish-layer-sandbox ({{ $environment.name }}): [{{ $e2e_region }}]" {{- end }} {{- end }} From fe832d617f1b3f0add2202e4b26b6f0a985e6340 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 3 Feb 2026 15:10:24 -0500 Subject: [PATCH 04/42] another typo --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 0d62466c..c4975480 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -217,7 +217,7 @@ e2e-test: variables: LANGUAGES_SUBSET: node # These env vars are inherited from the dotenv reports of the publish-layer jobs - {{- range $runtime := (ds "runtimes").runtimes }} + {{ range $runtime := (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} {{- $runtime.node_version := print (.name | strings.Trim "node") }} NODEJS_{{ $runtime.node_version }}_VERSION: $NODEJS_{{ $runtime.node_version }}_VERSION From afe6cc77f013c74b397832220a96e6769c3db6b4 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 3 Feb 2026 15:52:03 -0500 Subject: [PATCH 05/42] reformat --- .gitlab/input_files/build.yaml.tpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index c4975480..12016828 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -215,17 +215,17 @@ e2e-test: project: DataDog/serverless-e2e-tests strategy: depend variables: - LANGUAGES_SUBSET: node - # These env vars are inherited from the dotenv reports of the publish-layer jobs - {{ range $runtime := (ds "runtimes").runtimes }} + LANGUAGES_SUBSET: node + # These env vars are inherited from the dotenv reports of the publish-layer jobs + {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} {{- $runtime.node_version := print (.name | strings.Trim "node") }} - NODEJS_{{ $runtime.node_version }}_VERSION: $NODEJS_{{ $runtime.node_version }}_VERSION + NODEJS_{{ .node_version }}_VERSION: $NODEJS_{{ .node_version }}_VERSION {{- end }} {{- end }} needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - - "publish-layer-sandbox ({{ $environment.name }}): [{{ $e2e_region }}]" + - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" {{- end }} {{- end }} From 2f28943a005b7f68dc151384b6891b5f0fe6f854 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 3 Feb 2026 15:53:32 -0500 Subject: [PATCH 06/42] typo --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 12016828..2d478b9d 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -219,7 +219,7 @@ e2e-test: # These env vars are inherited from the dotenv reports of the publish-layer jobs {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - {{- $runtime.node_version := print (.name | strings.Trim "node") }} + {{- .node_version := print (.name | strings.Trim "node") }} NODEJS_{{ .node_version }}_VERSION: $NODEJS_{{ .node_version }}_VERSION {{- end }} {{- end }} From eff51df6ed783ca44b39ed267050b3d88556ec80 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 3 Feb 2026 15:56:23 -0500 Subject: [PATCH 07/42] remove var --- .gitlab/input_files/build.yaml.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 2d478b9d..35649393 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -219,7 +219,6 @@ e2e-test: # These env vars are inherited from the dotenv reports of the publish-layer jobs {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - {{- .node_version := print (.name | strings.Trim "node") }} NODEJS_{{ .node_version }}_VERSION: $NODEJS_{{ .node_version }}_VERSION {{- end }} {{- end }} From 3493c7c93d2dc31c406efd2521105b299aa80ac5 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 3 Feb 2026 16:38:12 -0500 Subject: [PATCH 08/42] remove arch --- .gitlab/input_files/build.yaml.tpl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 35649393..f47a7776 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -218,15 +218,11 @@ e2e-test: LANGUAGES_SUBSET: node # These env vars are inherited from the dotenv reports of the publish-layer jobs {{- range (ds "runtimes").runtimes }} - {{- if eq .arch "amd64" }} NODEJS_{{ .node_version }}_VERSION: $NODEJS_{{ .node_version }}_VERSION {{- end }} - {{- end }} needs: {{ range (ds "runtimes").runtimes }} - {{- if eq .arch "amd64" }} - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" {{- end }} - {{- end }} e2e-test-status: stage: e2e From 00590559535fd5135e6313b2c994621e04056824 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 3 Feb 2026 17:09:16 -0500 Subject: [PATCH 09/42] remove status check --- .gitlab/input_files/build.yaml.tpl | 33 ------------------------------ 1 file changed, 33 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index f47a7776..972da4e8 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -223,36 +223,3 @@ e2e-test: needs: {{ range (ds "runtimes").runtimes }} - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" {{- end }} - -e2e-test-status: - stage: e2e - image: registry.ddbuild.io/images/docker:20.10-py3 - tags: ["arch:amd64"] - timeout: 3h - 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 From 25d52582992d0fc99c2f31b1c54a26cc4967193a Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Thu, 5 Feb 2026 15:48:34 -0500 Subject: [PATCH 10/42] python test --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 972da4e8..883d3a8d 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -215,7 +215,7 @@ e2e-test: project: DataDog/serverless-e2e-tests strategy: depend variables: - LANGUAGES_SUBSET: node + LANGUAGES_SUBSET: python # These env vars are inherited from the dotenv reports of the publish-layer jobs {{- range (ds "runtimes").runtimes }} NODEJS_{{ .node_version }}_VERSION: $NODEJS_{{ .node_version }}_VERSION From d79eea220c736aceafb9b45dc4a98d65bed094ed Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Thu, 5 Feb 2026 16:46:25 -0500 Subject: [PATCH 11/42] indent --- .gitlab/input_files/build.yaml.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 883d3a8d..7bc275c8 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -215,11 +215,11 @@ e2e-test: project: DataDog/serverless-e2e-tests strategy: depend variables: - LANGUAGES_SUBSET: python + LANGUAGES_SUBSET: node # These env vars are inherited from the dotenv reports of the publish-layer jobs {{- range (ds "runtimes").runtimes }} - NODEJS_{{ .node_version }}_VERSION: $NODEJS_{{ .node_version }}_VERSION + NODEJS_{{ .node_version }}_VERSION: $NODEJS_{{ .node_version }}_VERSION {{- end }} needs: {{ range (ds "runtimes").runtimes }} - - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" + - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" {{- end }} From cff40c115ba13288040b8b837a1ef18839cb532d Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Thu, 5 Feb 2026 17:11:36 -0500 Subject: [PATCH 12/42] fix version --- .gitlab/input_files/build.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 7bc275c8..40dc56d7 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -216,9 +216,9 @@ e2e-test: strategy: depend variables: LANGUAGES_SUBSET: node - # These env vars are inherited from the dotenv reports of the publish-layer jobs {{- range (ds "runtimes").runtimes }} - NODEJS_{{ .node_version }}_VERSION: $NODEJS_{{ .node_version }}_VERSION + {{- $version := print (.name | strings.Trim "node") }} + NODEJS_{{ $version }}_VERSION: $NODEJS_{{ $version }}_VERSION {{- end }} needs: {{ range (ds "runtimes").runtimes }} - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" From 6e5bb84b552f22988cc538735b2db3077d18e9d3 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Thu, 5 Feb 2026 17:25:26 -0500 Subject: [PATCH 13/42] status --- .gitlab/input_files/build.yaml.tpl | 36 +++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 40dc56d7..ac589f09 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -218,8 +218,42 @@ e2e-test: LANGUAGES_SUBSET: node {{- range (ds "runtimes").runtimes }} {{- $version := print (.name | strings.Trim "node") }} - NODEJS_{{ $version }}_VERSION: $NODEJS_{{ $version }}_VERSION + NODEJS_{{ $version }}_VERSION: "NODEJS_{{ $version }}_VERSION" {{- end }} needs: {{ range (ds "runtimes").runtimes }} - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" {{- end }} + + +e2e-test-status: + stage: e2e + image: registry.ddbuild.io/images/docker:20.10-py3 + tags: ["arch:amd64"] + timeout: 3h + 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 From 2f2018c5a00e56eac067b9b8f501dfca0560bbe0 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 9 Feb 2026 15:29:46 -0500 Subject: [PATCH 14/42] fix gitlab api token --- .gitlab/input_files/build.yaml.tpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index ac589f09..12b5b668 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -231,7 +231,8 @@ e2e-test-status: tags: ["arch:amd64"] timeout: 3h 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) + GITLAB_API_TOKEN=$(curl -H "$(ddtool auth token sdm-staging --datacenter us1.ddbuild.staging.dog --http-header)" \ + "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" echo "Fetching E2E job status from: $URL" while true; do From 2d01ec6b1f0171e5f4f33d21d36fda5d2b6b849e Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 9 Feb 2026 15:53:37 -0500 Subject: [PATCH 15/42] trying new image for polling job --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 12b5b668..e5e64ea1 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -227,7 +227,7 @@ e2e-test: e2e-test-status: stage: e2e - image: registry.ddbuild.io/images/docker:20.10-py3 + image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX tags: ["arch:amd64"] timeout: 3h script: | From 5884352dcee722254d1691b6355cc38a7f6a3ad4 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 9 Feb 2026 16:22:05 -0500 Subject: [PATCH 16/42] trying to add auth anywhere --- .gitlab/input_files/build.yaml.tpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index e5e64ea1..b39bd40b 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -227,11 +227,12 @@ e2e-test: e2e-test-status: stage: e2e - image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX + image: registry.ddbuild.io/images/docker:20.10-py3 tags: ["arch:amd64"] timeout: 3h script: | - GITLAB_API_TOKEN=$(curl -H "$(ddtool auth token sdm-staging --datacenter us1.ddbuild.staging.dog --http-header)" \ + auth_header=$(authanywhere --audience rapid-foo-bar) + GITLAB_API_TOKEN=$(curl -H "${auth_header}" "$(ddtool auth token sdm-staging --datacenter us1.ddbuild.staging.dog --http-header)" \ "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" echo "Fetching E2E job status from: $URL" From 12da3477775bef93de9fea2dd836eb877a09f18d Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Mon, 9 Feb 2026 16:52:43 -0500 Subject: [PATCH 17/42] auth anywhere install? --- .gitlab/input_files/build.yaml.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index b39bd40b..40e362c1 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -231,6 +231,7 @@ e2e-test-status: tags: ["arch:amd64"] timeout: 3h script: | + curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere auth_header=$(authanywhere --audience rapid-foo-bar) GITLAB_API_TOKEN=$(curl -H "${auth_header}" "$(ddtool auth token sdm-staging --datacenter us1.ddbuild.staging.dog --http-header)" \ "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") From dbfd2b0fc7a462517828da63aa359222432ddc67 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 10 Feb 2026 14:40:27 -0500 Subject: [PATCH 18/42] more auth --- .gitlab/input_files/build.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 40e362c1..8b6a4e30 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -231,8 +231,8 @@ e2e-test-status: tags: ["arch:amd64"] timeout: 3h script: | - curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere - auth_header=$(authanywhere --audience rapid-foo-bar) + brew update && brew upgrade datadog/tap/ddr && brew install authanywhere + auth_header=$(authanywhere --serverless-e2e-tests) GITLAB_API_TOKEN=$(curl -H "${auth_header}" "$(ddtool auth token sdm-staging --datacenter us1.ddbuild.staging.dog --http-header)" \ "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" From c752b8aa8e4bf6e1ddc2b14f2e696b71aaf1d2c9 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 10 Feb 2026 14:57:33 -0500 Subject: [PATCH 19/42] no ddtool? --- .gitlab/input_files/build.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 8b6a4e30..12765a54 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -232,8 +232,8 @@ e2e-test-status: timeout: 3h script: | brew update && brew upgrade datadog/tap/ddr && brew install authanywhere - auth_header=$(authanywhere --serverless-e2e-tests) - GITLAB_API_TOKEN=$(curl -H "${auth_header}" "$(ddtool auth token sdm-staging --datacenter us1.ddbuild.staging.dog --http-header)" \ + auth_header=$(authanywhere) + GITLAB_API_TOKEN=$(curl -H "${auth_header}" \ "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" echo "Fetching E2E job status from: $URL" From a949af700c49649714fbd16c5465f327971d6e74 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 10 Feb 2026 15:16:18 -0500 Subject: [PATCH 20/42] no brew --- .gitlab/input_files/build.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 12765a54..897fbaa3 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -231,8 +231,8 @@ e2e-test-status: tags: ["arch:amd64"] timeout: 3h script: | - brew update && brew upgrade datadog/tap/ddr && brew install authanywhere - auth_header=$(authanywhere) + curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere + auth_header=$(authanywhere --serverless-e2e-tests) GITLAB_API_TOKEN=$(curl -H "${auth_header}" \ "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" From 0f5cbb1a20a4165897a012e7013456c19defb286 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 10 Feb 2026 15:40:41 -0500 Subject: [PATCH 21/42] remove authanywhere flag --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 897fbaa3..59f2a48d 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -232,7 +232,7 @@ e2e-test-status: timeout: 3h script: | curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere - auth_header=$(authanywhere --serverless-e2e-tests) + auth_header=$(authanywhere) GITLAB_API_TOKEN=$(curl -H "${auth_header}" \ "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" From 90bed39ce771ecfbabf259598d4ba5980286d2e0 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Tue, 10 Feb 2026 16:04:08 -0500 Subject: [PATCH 22/42] debugging string indexing --- .gitlab/input_files/build.yaml.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 59f2a48d..73fe7027 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -239,6 +239,7 @@ e2e-test-status: echo "Fetching E2E job status from: $URL" while true; do RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL") + echo $RESPONSE 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 From 830ffcf4998409f386f549b236fe434314447151 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Thu, 12 Feb 2026 17:16:48 -0500 Subject: [PATCH 23/42] No auth? --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 73fe7027..f9a42495 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -238,7 +238,7 @@ e2e-test-status: 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") + RESPONSE=$(curl -s "$URL") echo $RESPONSE E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .downstream_pipeline.status') echo -n "E2E job status: $E2E_JOB_STATUS, " From 596f799a95c5dddedee6c66b83ed6b98a5a5312a Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 10:02:02 -0500 Subject: [PATCH 24/42] new audience --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index f9a42495..20a826d3 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -232,7 +232,7 @@ e2e-test-status: timeout: 3h script: | curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere - auth_header=$(authanywhere) + auth_header=$(authanywhere --audience rapid-devex-ci) GITLAB_API_TOKEN=$(curl -H "${auth_header}" \ "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" From 004646c7ede641ba037dafb8576919354e576846 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 10:31:19 -0500 Subject: [PATCH 25/42] mimic code-gen --- .gitlab/input_files/build.yaml.tpl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 20a826d3..63226864 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -232,13 +232,20 @@ e2e-test-status: timeout: 3h script: | curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere - auth_header=$(authanywhere --audience rapid-devex-ci) - GITLAB_API_TOKEN=$(curl -H "${auth_header}" \ - "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") + 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=serverless-e2e-tests") + GITLAB_TOKEN=$(echo "$BTI_RESPONSE" | jq -r '.token // empty') + if [ -z "$GITLAB_TOKEN" ]; then + echo "Error: Failed to get GitLab token from BTI CI API. Response: $BTI_RESPONSE" + exit 1 + fi 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 "$URL") + RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "$URL") echo $RESPONSE E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .downstream_pipeline.status') echo -n "E2E job status: $E2E_JOB_STATUS, " From bdf978e304dc2a36c8439d7d757cf33a0f1f3855 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 11:28:55 -0500 Subject: [PATCH 26/42] try using staging --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 63226864..5a7f5607 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -236,7 +236,7 @@ e2e-test-status: 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=serverless-e2e-tests") + "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") GITLAB_TOKEN=$(echo "$BTI_RESPONSE" | jq -r '.token // empty') if [ -z "$GITLAB_TOKEN" ]; then echo "Error: Failed to get GitLab token from BTI CI API. Response: $BTI_RESPONSE" From 47c72db3069542b92c578a7d61648de8e35a1655 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 13:43:27 -0500 Subject: [PATCH 27/42] try getting datadog-lambda-js token --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 5a7f5607..ce46dc67 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -236,7 +236,7 @@ e2e-test-status: BTI_RESPONSE= $(curl --silent --request GET \ --header "$BTI_CI_API_TOKEN" \ --header "Content-Type: application/vnd.api+json" \ - "https://bti-ci-api.us1.ddbuild.staging.dog/internal/ci/gitlab/token?owner=DataDog&repository=serverless-e2e-tests") + "https://bti-ci-api.us1.ddbuild.io/internal/ci/gitlab/token?owner=DataDog&repository=datadog-lambda-js") GITLAB_TOKEN=$(echo "$BTI_RESPONSE" | jq -r '.token // empty') if [ -z "$GITLAB_TOKEN" ]; then echo "Error: Failed to get GitLab token from BTI CI API. Response: $BTI_RESPONSE" From 9a1d010ecbd0e694df8246aee590adc4259b3230 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 14:51:20 -0500 Subject: [PATCH 28/42] move script into separate file --- .gitlab/input_files/build.yaml.tpl | 40 ++------------------------- .gitlab/scripts/poll_e2e.sh | 44 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 38 deletions(-) create mode 100644 .gitlab/scripts/poll_e2e.sh diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index ce46dc67..ff2c2861 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -230,41 +230,5 @@ e2e-test-status: image: registry.ddbuild.io/images/docker:20.10-py3 tags: ["arch:amd64"] timeout: 3h - script: | - 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-js") - GITLAB_TOKEN=$(echo "$BTI_RESPONSE" | jq -r '.token // empty') - if [ -z "$GITLAB_TOKEN" ]; then - echo "Error: Failed to get GitLab token from BTI CI API. Response: $BTI_RESPONSE" - exit 1 - fi - 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") - echo $RESPONSE - 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: + - .gitlab/scripts/poll_e2e.sh diff --git a/.gitlab/scripts/poll_e2e.sh b/.gitlab/scripts/poll_e2e.sh new file mode 100644 index 00000000..a3eac228 --- /dev/null +++ b/.gitlab/scripts/poll_e2e.sh @@ -0,0 +1,44 @@ +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-js") + +GITLAB_TOKEN=$(echo "$BTI_RESPONSE" | jq -r '.token // empty') + +if [ -z "$GITLAB_TOKEN" ]; then +echo "Error: Failed to get GitLab token from BTI CI API. Response: $BTI_RESPONSE" +exit 1 +fi + +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") + echo $RESPONSE + 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 \ No newline at end of file From 4f621f881968e46bb181b33e5b3effe60c336c17 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 15:06:22 -0500 Subject: [PATCH 29/42] chmod --- .gitlab/scripts/poll_e2e.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .gitlab/scripts/poll_e2e.sh diff --git a/.gitlab/scripts/poll_e2e.sh b/.gitlab/scripts/poll_e2e.sh old mode 100644 new mode 100755 From 746a9c33d2cc368121a4ac46c941c55cca3ccc0a Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 15:40:22 -0500 Subject: [PATCH 30/42] /bin/authanywhere --- .gitlab/scripts/poll_e2e.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab/scripts/poll_e2e.sh b/.gitlab/scripts/poll_e2e.sh index a3eac228..7d610da8 100755 --- a/.gitlab/scripts/poll_e2e.sh +++ b/.gitlab/scripts/poll_e2e.sh @@ -1,5 +1,7 @@ curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere +/bin/authanywhere + BTI_CI_API_TOKEN=$(authanywhere --audience rapid-devex-ci) BTI_RESPONSE= $(curl --silent --request GET \ From 09c7a16a2fced33f12834ef7ef99f983e5aab33d Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 16:07:00 -0500 Subject: [PATCH 31/42] space --- .gitlab/scripts/poll_e2e.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/scripts/poll_e2e.sh b/.gitlab/scripts/poll_e2e.sh index 7d610da8..8b1a96b5 100755 --- a/.gitlab/scripts/poll_e2e.sh +++ b/.gitlab/scripts/poll_e2e.sh @@ -4,7 +4,7 @@ curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-a BTI_CI_API_TOKEN=$(authanywhere --audience rapid-devex-ci) -BTI_RESPONSE= $(curl --silent --request GET \ +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-js") From 62826d173be1fd961a979dad3f71e4f45c879612 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Fri, 13 Feb 2026 16:47:50 -0500 Subject: [PATCH 32/42] Removing debug prints --- .gitlab/scripts/poll_e2e.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab/scripts/poll_e2e.sh b/.gitlab/scripts/poll_e2e.sh index 8b1a96b5..fe54c874 100755 --- a/.gitlab/scripts/poll_e2e.sh +++ b/.gitlab/scripts/poll_e2e.sh @@ -22,7 +22,6 @@ echo "Fetching E2E job status from: $URL" while true; do RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "$URL") - echo $RESPONSE 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 From 22ebd416f5eb05f168f0c659342ba7a2ce698361 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 09:13:10 -0500 Subject: [PATCH 33/42] find printed token --- .gitlab/scripts/poll_e2e.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitlab/scripts/poll_e2e.sh b/.gitlab/scripts/poll_e2e.sh index fe54c874..6ff3c5ba 100755 --- a/.gitlab/scripts/poll_e2e.sh +++ b/.gitlab/scripts/poll_e2e.sh @@ -2,19 +2,22 @@ curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-a /bin/authanywhere +echo "here" + BTI_CI_API_TOKEN=$(authanywhere --audience rapid-devex-ci) +echo "there" + 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-js") +echo "where" + GITLAB_TOKEN=$(echo "$BTI_RESPONSE" | jq -r '.token // empty') -if [ -z "$GITLAB_TOKEN" ]; then -echo "Error: Failed to get GitLab token from BTI CI API. Response: $BTI_RESPONSE" -exit 1 -fi +echo "bear" URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" @@ -39,7 +42,7 @@ while true; do echo "⏭️ E2E tests were skipped" exit 0 else - echo "❓ Unknown E2E test status: $E2E_JOB_STATUS, retrying in 1 minute..." + echo "❓ Unknown E2E test status: $E2E_JOB_STATUS, retrying in 2 minutes..." fi - sleep 60 + sleep 120 done \ No newline at end of file From 654fdc1149a44cdf4223dbac5cb65b184851c4d2 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 13:17:42 -0500 Subject: [PATCH 34/42] layer version --- .gitlab/input_files/build.yaml.tpl | 2 +- .gitlab/scripts/poll_e2e.sh | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index ff2c2861..9f1f2d5c 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -218,7 +218,7 @@ e2e-test: LANGUAGES_SUBSET: node {{- range (ds "runtimes").runtimes }} {{- $version := print (.name | strings.Trim "node") }} - NODEJS_{{ $version }}_VERSION: "NODEJS_{{ $version }}_VERSION" + NODEJS_{{ $version }}_VERSION: $NODEJS_{{ $version }}_VERSION {{- end }} needs: {{ range (ds "runtimes").runtimes }} - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" diff --git a/.gitlab/scripts/poll_e2e.sh b/.gitlab/scripts/poll_e2e.sh index 6ff3c5ba..fff293b1 100755 --- a/.gitlab/scripts/poll_e2e.sh +++ b/.gitlab/scripts/poll_e2e.sh @@ -1,24 +1,14 @@ curl -OL "binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-amd64" && mv "authanywhere-linux-amd64" /bin/authanywhere && chmod +x /bin/authanywhere -/bin/authanywhere - -echo "here" - BTI_CI_API_TOKEN=$(authanywhere --audience rapid-devex-ci) -echo "there" - 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-js") -echo "where" - GITLAB_TOKEN=$(echo "$BTI_RESPONSE" | jq -r '.token // empty') -echo "bear" - URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" echo "Fetching E2E job status from: $URL" From 8f4a023d4510154d1cb421eddcdaacbed6450649 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 14:52:06 -0500 Subject: [PATCH 35/42] dotenv --- .gitlab/input_files/build.yaml.tpl | 7 ++++++- .gitlab/scripts/publish_layers.sh | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 9f1f2d5c..9b9bb11d 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -97,6 +97,7 @@ integration test ({{ $runtime.name }}): - RUNTIME_PARAM={{ $runtime.node_major_version }} ./scripts/run_integration_tests.sh {{ range $environment := (ds "environments").environments }} +{{ $dotenv := print $runtime.name "_" $environment_name ".env" }} {{ if or (eq $environment.name "prod") }} sign layer ({{ $runtime.name }}): @@ -135,6 +136,9 @@ publish layer {{ $environment.name }} ({{ $runtime.name }}): when: manual allow_failure: true - if: '$CI_COMMIT_TAG =~ /^v.*/' + artifacts: + reports: + dotenv: {{ $dotenv }} needs: {{ if or (eq $environment.name "prod") }} - sign layer ({{ $runtime.name }}) @@ -159,7 +163,8 @@ publish layer {{ $environment.name }} ({{ $runtime.name }}): before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source .gitlab/scripts/get_secrets.sh script: - - STAGE={{ $environment.name }} NODE_VERSION={{ $runtime.node_version }} .gitlab/scripts/publish_layers.sh + - version := print (.name | strings.Trim "node") + - STAGE={{ $environment.name }} NODE_VERSION={{ $runtime.node_version }} DOTENV={{ $dotenv }} MAJOR_VERSION=version .gitlab/scripts/publish_layers.sh {{- end }} diff --git a/.gitlab/scripts/publish_layers.sh b/.gitlab/scripts/publish_layers.sh index efca7f11..8d143bfd 100755 --- a/.gitlab/scripts/publish_layers.sh +++ b/.gitlab/scripts/publish_layers.sh @@ -156,4 +156,11 @@ while [ $latest_version -lt $VERSION ]; do fi done +echo $MAJOR_VERSION +if [ -n "$DOTENV" ]; then + printf "[$REGION] Exporting layer version to $DOTENV file...\n" + echo "NODE_${MAJOR_VERSION}_VERSION=$latest_arn" >> "$DOTENV" + cat "$DOTENV" +fi + printf "[$REGION] Finished publishing layers...\n\n" From 5aa8542e2e344d492de8d9f6efbbe9390fbe258c Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 14:53:43 -0500 Subject: [PATCH 36/42] typo --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 9b9bb11d..37ae3586 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -97,7 +97,7 @@ integration test ({{ $runtime.name }}): - RUNTIME_PARAM={{ $runtime.node_major_version }} ./scripts/run_integration_tests.sh {{ range $environment := (ds "environments").environments }} -{{ $dotenv := print $runtime.name "_" $environment_name ".env" }} +{{ $dotenv := print $runtime.name "_" $environment.name ".env" }} {{ if or (eq $environment.name "prod") }} sign layer ({{ $runtime.name }}): From 856571f68ba97ffa0987bd805d14a51db7bffb0a Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 15:09:58 -0500 Subject: [PATCH 37/42] fixing version --- .gitlab/input_files/build.yaml.tpl | 3 +-- .gitlab/scripts/publish_layers.sh | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index 37ae3586..e68d5d66 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -163,8 +163,7 @@ publish layer {{ $environment.name }} ({{ $runtime.name }}): before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source .gitlab/scripts/get_secrets.sh script: - - version := print (.name | strings.Trim "node") - - STAGE={{ $environment.name }} NODE_VERSION={{ $runtime.node_version }} DOTENV={{ $dotenv }} MAJOR_VERSION=version .gitlab/scripts/publish_layers.sh + - STAGE={{ $environment.name }} NODE_VERSION={{ $runtime.node_version }} DOTENV={{ $dotenv }} .gitlab/scripts/publish_layers.sh {{- end }} diff --git a/.gitlab/scripts/publish_layers.sh b/.gitlab/scripts/publish_layers.sh index 8d143bfd..d92959f4 100755 --- a/.gitlab/scripts/publish_layers.sh +++ b/.gitlab/scripts/publish_layers.sh @@ -156,10 +156,10 @@ while [ $latest_version -lt $VERSION ]; do fi done -echo $MAJOR_VERSION if [ -n "$DOTENV" ]; then printf "[$REGION] Exporting layer version to $DOTENV file...\n" - echo "NODE_${MAJOR_VERSION}_VERSION=$latest_arn" >> "$DOTENV" + major_version="${$NODE_VERSION:0:2}" + echo "NODE_${major_version}_VERSION=$latest_arn" >> "$DOTENV" cat "$DOTENV" fi From 00a6aa8859512504f595da893a2d7be76c5c966a Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 15:24:11 -0500 Subject: [PATCH 38/42] substitution --- .gitlab/scripts/publish_layers.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab/scripts/publish_layers.sh b/.gitlab/scripts/publish_layers.sh index d92959f4..c6fc4d0b 100755 --- a/.gitlab/scripts/publish_layers.sh +++ b/.gitlab/scripts/publish_layers.sh @@ -158,7 +158,8 @@ done if [ -n "$DOTENV" ]; then printf "[$REGION] Exporting layer version to $DOTENV file...\n" - major_version="${$NODE_VERSION:0:2}" + node_version=$NODE_VERSION + major_version="${node_version:0:2}" echo "NODE_${major_version}_VERSION=$latest_arn" >> "$DOTENV" cat "$DOTENV" fi From 1987cee29e2b8cf79b008efe04492cd1b0ceb179 Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 15:41:22 -0500 Subject: [PATCH 39/42] getting layer arn --- .gitlab/scripts/publish_layers.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab/scripts/publish_layers.sh b/.gitlab/scripts/publish_layers.sh index c6fc4d0b..3bd888a4 100755 --- a/.gitlab/scripts/publish_layers.sh +++ b/.gitlab/scripts/publish_layers.sh @@ -146,6 +146,8 @@ fi while [ $latest_version -lt $VERSION ]; do latest_version=$(publish_layer $REGION $layer $aws_cli_node_version_key $layer_path) printf "[$REGION] Published version $latest_version for layer $layer in region $REGION\n" + latest_arn=$(aws lambda get-layer-version --layer-name $layer --version-number $latest_version --region $REGION --query 'LayerVersionArn' --output text) + printf "[$REGION] Published arn $latest_arn\n" # This shouldn't happen unless someone manually deleted the latest version, say 28, and # then tries to republish 28 again. The published version would actually be 29, because From 3fa70ebbccf42b5598c8e712328c4a9dbffad87c Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 15:52:37 -0500 Subject: [PATCH 40/42] more typo --- .gitlab/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/input_files/build.yaml.tpl b/.gitlab/input_files/build.yaml.tpl index e68d5d66..527308bb 100644 --- a/.gitlab/input_files/build.yaml.tpl +++ b/.gitlab/input_files/build.yaml.tpl @@ -222,7 +222,7 @@ e2e-test: LANGUAGES_SUBSET: node {{- range (ds "runtimes").runtimes }} {{- $version := print (.name | strings.Trim "node") }} - NODEJS_{{ $version }}_VERSION: $NODEJS_{{ $version }}_VERSION + NODEJS_{{ $version }}_VERSION: $NODE_{{ $version }}_VERSION {{- end }} needs: {{ range (ds "runtimes").runtimes }} - "publish layer sandbox ({{ .name }}): [{{ $e2e_region }}]" From 4409741aeb94d63c7b3a94a938baf822aaba4b2c Mon Sep 17 00:00:00 2001 From: Rithika Narayan Date: Wed, 18 Feb 2026 16:43:58 -0500 Subject: [PATCH 41/42] update polling time --- .gitlab/scripts/poll_e2e.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/scripts/poll_e2e.sh b/.gitlab/scripts/poll_e2e.sh index fff293b1..4d7652e6 100755 --- a/.gitlab/scripts/poll_e2e.sh +++ b/.gitlab/scripts/poll_e2e.sh @@ -24,7 +24,7 @@ while true; do echo "❌ E2E tests failed" exit 1 elif [ "$E2E_JOB_STATUS" == "running" ]; then - echo "⏳ E2E tests are still running, retrying in 1 minute..." + echo "⏳ E2E tests are still running, retrying in 2 minutes..." elif [ "$E2E_JOB_STATUS" == "canceled" ]; then echo "🚫 E2E tests were canceled" exit 1 From 831327334f20e670186f4d8a750f02f63786952c Mon Sep 17 00:00:00 2001 From: jchrostek-dd Date: Thu, 19 Feb 2026 17:55:37 +0100 Subject: [PATCH 42/42] [SVLS-8538] add durable function tags (#730) * [SVLS-8538] add durable function tags * format * add a tiny comment to re-trigger the pipeline --------- Co-authored-by: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> --- src/trace/durable-function-context.spec.ts | 97 ++++++++++++++++++++++ src/trace/durable-function-context.ts | 37 +++++++++ src/trace/listener.ts | 11 +++ 3 files changed, 145 insertions(+) create mode 100644 src/trace/durable-function-context.spec.ts create mode 100644 src/trace/durable-function-context.ts diff --git a/src/trace/durable-function-context.spec.ts b/src/trace/durable-function-context.spec.ts new file mode 100644 index 00000000..76d35676 --- /dev/null +++ b/src/trace/durable-function-context.spec.ts @@ -0,0 +1,97 @@ +import { parseDurableExecutionArn, extractDurableFunctionContext } from "./durable-function-context"; + +describe("durable-function-context", () => { + describe("parseDurableExecutionArn", () => { + it("returns execution name and ID for a valid ARN", () => { + const arn = + "arn:aws:lambda:us-east-1:123456789012:function:my-func:$LATEST/durable-execution/order-123/550e8400-e29b-41d4-a716-446655440001"; + const result = parseDurableExecutionArn(arn); + + expect(result).toEqual({ + executionName: "order-123", + executionId: "550e8400-e29b-41d4-a716-446655440001", + }); + }); + + it("returns undefined for ARN without durable-execution marker", () => { + const arn = "arn:aws:lambda:us-east-1:123456789012:function:my-func:$LATEST"; + const result = parseDurableExecutionArn(arn); + + expect(result).toBeUndefined(); + }); + + it("returns undefined for malformed ARN with only execution name", () => { + const arn = "arn:aws:lambda:us-east-1:123456789012:function:my-func:$LATEST/durable-execution/order-123"; + const result = parseDurableExecutionArn(arn); + + expect(result).toBeUndefined(); + }); + + it("returns undefined for malformed ARN with empty execution name", () => { + const arn = + "arn:aws:lambda:us-east-1:123456789012:function:my-func:$LATEST/durable-execution//550e8400-e29b-41d4-a716-446655440002"; + const result = parseDurableExecutionArn(arn); + + expect(result).toBeUndefined(); + }); + + it("returns undefined for malformed ARN with empty execution ID", () => { + const arn = "arn:aws:lambda:us-east-1:123456789012:function:my-func:$LATEST/durable-execution/order-123/"; + const result = parseDurableExecutionArn(arn); + + expect(result).toBeUndefined(); + }); + }); + + describe("extractDurableFunctionContext", () => { + it("extracts context from event.DurableExecutionArn", () => { + const event = { + DurableExecutionArn: + "arn:aws:lambda:us-east-1:123456789012:function:my-func:1/durable-execution/my-execution/550e8400-e29b-41d4-a716-446655440004", + CheckpointToken: "some-token", + InitialExecutionState: { + Operations: [], + }, + }; + const result = extractDurableFunctionContext(event); + + expect(result).toEqual({ + durable_function_execution_name: "my-execution", + durable_function_execution_id: "550e8400-e29b-41d4-a716-446655440004", + }); + }); + + it("returns undefined for regular Lambda event without DurableExecutionArn", () => { + const event = { + body: '{"key": "value"}', + headers: { + "Content-Type": "application/json", + }, + }; + const result = extractDurableFunctionContext(event); + + expect(result).toBeUndefined(); + }); + + it("returns undefined when event is null", () => { + const result = extractDurableFunctionContext(null); + + expect(result).toBeUndefined(); + }); + + it("returns undefined when event is undefined", () => { + const result = extractDurableFunctionContext(undefined); + + expect(result).toBeUndefined(); + }); + + it("returns undefined when DurableExecutionArn cannot be parsed", () => { + const event = { + DurableExecutionArn: "invalid-arn-without-durable-execution-marker", + }; + const result = extractDurableFunctionContext(event); + + expect(result).toBeUndefined(); + }); + }); +}); diff --git a/src/trace/durable-function-context.ts b/src/trace/durable-function-context.ts new file mode 100644 index 00000000..f6308a7a --- /dev/null +++ b/src/trace/durable-function-context.ts @@ -0,0 +1,37 @@ +import { logDebug } from "../utils"; + +export interface DurableFunctionContext { + durable_function_execution_name: string; + durable_function_execution_id: string; +} + +export function extractDurableFunctionContext(event: any): DurableFunctionContext | undefined { + const durableExecutionArn = event?.DurableExecutionArn; + + if (typeof durableExecutionArn !== "string") { + return undefined; + } + + const parsed = parseDurableExecutionArn(durableExecutionArn); + if (!parsed) { + logDebug("Failed to parse DurableExecutionArn", { arn: durableExecutionArn }); + return undefined; + } + + return { + durable_function_execution_name: parsed.executionName, + durable_function_execution_id: parsed.executionId, + }; +} + +/** + * Parses a DurableExecutionArn to extract execution name and ID. + * ARN format: arn:aws:lambda:{region}:{account}:function:{func}:{version}/durable-execution/{name}/{id} + */ +export function parseDurableExecutionArn(arn: string): { executionName: string; executionId: string } | undefined { + // Match only the trailing durable execution segment. + const match = arn.match(/\/durable-execution\/([^/]+)\/([^/]+)$/); + if (!match) return undefined; + const [, executionName, executionId] = match; + return { executionName, executionId }; +} diff --git a/src/trace/listener.ts b/src/trace/listener.ts index 49c46af7..fdaa0d92 100644 --- a/src/trace/listener.ts +++ b/src/trace/listener.ts @@ -15,6 +15,7 @@ import { SpanWrapper } from "./span-wrapper"; import { getTraceTree, clearTraceTree } from "../runtime/index"; import { TraceContext, TraceContextService, TraceSource } from "./trace-context-service"; import { StepFunctionContext, StepFunctionContextService } from "./step-function-service"; +import { DurableFunctionContext, extractDurableFunctionContext } from "./durable-function-context"; import { XrayService } from "./xray-service"; import { AUTHORIZING_REQUEST_ID_HEADER } from "./context/extractors/http"; import { getSpanPointerAttributes, SpanPointerAttributes } from "../utils/span-pointers"; @@ -85,6 +86,7 @@ export class TraceListener { private contextService: TraceContextService; private context?: Context; private stepFunctionContext?: StepFunctionContext; + private durableFunctionContext?: DurableFunctionContext; private tracerWrapper: TracerWrapper; private inferrer: SpanInferrer; private inferredSpan?: SpanWrapper; @@ -146,6 +148,7 @@ export class TraceListener { const eventSource = parseEventSource(event); this.triggerTags = extractTriggerTags(event, context, eventSource); this.stepFunctionContext = StepFunctionContextService.instance().context; + this.durableFunctionContext = extractDurableFunctionContext(event); if (this.config.addSpanPointers) { this.spanPointerAttributesList = getSpanPointerAttributes(eventSource, event); @@ -288,6 +291,7 @@ export class TraceListener { // Reset singletons and trace context this.stepFunctionContext = undefined; + this.durableFunctionContext = undefined; StepFunctionContextService.reset(); this.contextService.reset(); } @@ -328,6 +332,13 @@ export class TraceListener { ...this.stepFunctionContext, }; } + if (this.durableFunctionContext) { + logDebug("Applying durable function context to the aws.lambda span"); + options.tags = { + ...options.tags, + ...this.durableFunctionContext, + }; + } if (this.lambdaSpanParentContext) { options.childOf = this.lambdaSpanParentContext; }