From f7bf07cad5328b93480aea992b801bc4a083d61c Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Thu, 10 Apr 2025 14:13:54 -0700 Subject: [PATCH 01/57] Always publish to us-east-1. --- ci/input_files/build.yaml.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 769f87f5c..a79de0c47 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -138,6 +138,8 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): tags: ["arch:amd64"] image: registry.ddbuild.io/images/docker:20.10-py3 rules: + - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "us-east-1" && "{{ $runtime.arch }}" == "amd64"' + when: always - if: '"{{ $environment_name }}" == "sandbox"' when: manual allow_failure: true From d8ccc3d9891250b8b61ed9adcbda7752a885b358 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Thu, 24 Apr 2025 08:52:58 -0700 Subject: [PATCH 02/57] WIP --- ci/input_files/build.yaml.tpl | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index a79de0c47..2a3a7f027 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -3,6 +3,7 @@ stages: - test - sign - publish + - e2e .python-before-script: &python-before-script - pip install virtualenv @@ -138,7 +139,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): tags: ["arch:amd64"] image: registry.ddbuild.io/images/docker:20.10-py3 rules: - - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "us-east-1" && "{{ $runtime.arch }}" == "amd64"' + - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "ap-east-1" && "{{ $runtime.arch }}" == "amd64"' when: always - if: '"{{ $environment_name }}" == "sandbox"' when: manual @@ -174,6 +175,26 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): {{- end }} +run-e2e: + stage: e2e + tags: ["arch:amd64"] + image: registry.ddbuild.io/images/docker:20.10-py3 + needs: {{ range $runtime := (ds "runtimes").runtimes }} + - publish-layer-sandbox ({{ $runtime.name }}-amd64): [ap-east-1] + {{- end }} + trigger: + project: "DataDog/serverless-e2e-tests" + strategy: depend + variables: + LANGUAGES_SUBSET: python + PYTHON_38_VERSION: latest + PYTHON_39_VERSION: latest + PYTHON_310_VERSION: latest + PYTHON_311_VERSION: latest + PYTHON_312_VERSION: latest + PYTHON_313_VERSION: latest + + publish-pypi-package: stage: publish tags: ["arch:amd64"] From b8a4c8c9dbeaf0c8afa3ea2daa73088908dfb041 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 13 Jun 2025 13:40:38 -0700 Subject: [PATCH 03/57] Publishes to us-west-2. --- ci/input_files/build.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 2a3a7f027..c7dafbc50 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -139,7 +139,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): tags: ["arch:amd64"] image: registry.ddbuild.io/images/docker:20.10-py3 rules: - - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "ap-east-1" && "{{ $runtime.arch }}" == "amd64"' + - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "us-west-2" && "{{ $runtime.arch }}" == "amd64"' when: always - if: '"{{ $environment_name }}" == "sandbox"' when: manual @@ -180,7 +180,7 @@ run-e2e: tags: ["arch:amd64"] image: registry.ddbuild.io/images/docker:20.10-py3 needs: {{ range $runtime := (ds "runtimes").runtimes }} - - publish-layer-sandbox ({{ $runtime.name }}-amd64): [ap-east-1] + - publish-layer-sandbox ({{ $runtime.name }}-amd64): [us-west-2] {{- end }} trigger: project: "DataDog/serverless-e2e-tests" From ff461f9ef3849d61b99514d58c4687a3402d1acc Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 16 Jun 2025 11:28:25 -0700 Subject: [PATCH 04/57] Fix needs and update things. --- ci/input_files/build.yaml.tpl | 136 +++++++++++++++++----------------- ci/publish_layers.sh | 2 + 2 files changed, 72 insertions(+), 66 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index c7dafbc50..587a1bb79 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -57,52 +57,52 @@ check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}): stage: test tags: ["arch:amd64"] image: registry.ddbuild.io/images/docker:20.10 - needs: + needs: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) dependencies: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - script: + script: - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/check_layer_size.sh -lint python: - stage: test - tags: ["arch:amd64"] - image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} - cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache - before_script: *python-before-script - script: - - source venv/bin/activate - - ./scripts/check_format.sh +#lint python: +# stage: test +# tags: ["arch:amd64"] +# image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} +# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache +# before_script: *python-before-script +# script: +# - source venv/bin/activate +# - ./scripts/check_format.sh -unit-test ({{ $runtime.name }}-{{ $runtime.arch }}): - stage: test - tags: ["arch:amd64"] - image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} - cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache - before_script: *python-before-script - script: - - source venv/bin/activate - - pytest -vv +#unit-test ({{ $runtime.name }}-{{ $runtime.arch }}): +# stage: test +# tags: ["arch:amd64"] +# image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} +# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache +# before_script: *python-before-script +# script: +# - source venv/bin/activate +# - pytest -vv -integration-test ({{ $runtime.name }}-{{ $runtime.arch }}): - stage: test - tags: ["arch:amd64"] - image: registry.ddbuild.io/images/docker:20.10-py3 - needs: - - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - dependencies: - - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache - variables: - CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" - before_script: - - *install-node - - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh - - yarn global add serverless@^3.38.0 --prefix /usr/local - - yarn global add serverless-python-requirements@^6.1.1 --prefix /usr/local - - cd integration_tests && yarn install && cd .. - script: - - RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh +#integration-test ({{ $runtime.name }}-{{ $runtime.arch }}): +# stage: test +# tags: ["arch:amd64"] +# image: registry.ddbuild.io/images/docker:20.10-py3 +# needs: +# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) +# dependencies: +# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) +# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache +# variables: +# CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" +# before_script: +# - *install-node +# - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh +# - yarn global add serverless@^3.38.0 --prefix /usr/local +# - yarn global add serverless-python-requirements@^6.1.1 --prefix /usr/local +# - cd integration_tests && yarn install && cd .. +# script: +# - RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): stage: sign @@ -114,9 +114,9 @@ sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): needs: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) - - lint python - - unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) - - integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) + #- lint python + #- unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) + #- integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) dependencies: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) artifacts: # Re specify artifacts so the modified signed file is passed @@ -145,15 +145,18 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): when: manual allow_failure: true - if: '$CI_COMMIT_TAG =~ /^v.*/' + artifacts: + reports: + dotenv: layer-version needs: {{ if or (eq $environment_name "prod") }} - sign-layer ({{ $runtime.name }}-{{ $runtime.arch}}) {{ else }} - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) - - lint python - - unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) - - integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) + #- lint python + #- unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) + #- integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) {{ end }} dependencies: {{ if or (eq $environment_name "prod") }} @@ -169,32 +172,14 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh + - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log + # Extract the arn from the publish log to be used as envvar in e2e tests + - echo "PYTHON_{{ $runtime.python_version }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer-version {{- end }} {{- end }} -run-e2e: - stage: e2e - tags: ["arch:amd64"] - image: registry.ddbuild.io/images/docker:20.10-py3 - needs: {{ range $runtime := (ds "runtimes").runtimes }} - - publish-layer-sandbox ({{ $runtime.name }}-amd64): [us-west-2] - {{- end }} - trigger: - project: "DataDog/serverless-e2e-tests" - strategy: depend - variables: - LANGUAGES_SUBSET: python - PYTHON_38_VERSION: latest - PYTHON_39_VERSION: latest - PYTHON_310_VERSION: latest - PYTHON_311_VERSION: latest - PYTHON_312_VERSION: latest - PYTHON_313_VERSION: latest - - publish-pypi-package: stage: publish tags: ["arch:amd64"] @@ -255,3 +240,22 @@ signed layer bundle: - rm -rf datadog_lambda_py-signed-bundle-${CI_JOB_ID} - mkdir -p datadog_lambda_py-signed-bundle-${CI_JOB_ID} - cp .layers/datadog_lambda_py-*.zip datadog_lambda_py-signed-bundle-${CI_JOB_ID} + +e2e-test: + stage: e2e + trigger: + project: DataDog/serverless-e2e-tests + strategy: depend + variables: + LANGUAGES_SUBSET: python + PYTHON_38_VERSION: latest + PYTHON_39_VERSION: latest + PYTHON_310_VERSION: latest + PYTHON_311_VERSION: latest + PYTHON_312_VERSION: latest + PYTHON_313_VERSION: latest + needs: {{ range (ds "runtimes").runtimes }} + {{- if eq .arch "amd64" }} + - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [us-west-2]" + {{- end }} + {{- end }} diff --git a/ci/publish_layers.sh b/ci/publish_layers.sh index 58257bf11..9bac31140 100755 --- a/ci/publish_layers.sh +++ b/ci/publish_layers.sh @@ -199,6 +199,8 @@ fi while [ $latest_version -lt $VERSION ]; do latest_version=$(publish_layer $REGION $layer $aws_cli_python_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 38cefad20ca3ca5ef478d5b2143fb76ab6a8f52a Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 08:49:32 -0700 Subject: [PATCH 05/57] Use underscore. --- ci/input_files/build.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 587a1bb79..358c06025 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -147,7 +147,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - if: '$CI_COMMIT_TAG =~ /^v.*/' artifacts: reports: - dotenv: layer-version + dotenv: layer_version needs: {{ if or (eq $environment_name "prod") }} - sign-layer ({{ $runtime.name }}-{{ $runtime.arch}}) @@ -174,7 +174,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): script: - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests - - echo "PYTHON_{{ $runtime.python_version }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer-version + - echo "PYTHON_{{ $runtime.python_version }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer_version {{- end }} From d9c36010ea1ea78aea4b048aca9c4247981fda83 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 08:57:50 -0700 Subject: [PATCH 06/57] No dot. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 358c06025..ff299b69d 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -174,7 +174,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): script: - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests - - echo "PYTHON_{{ $runtime.python_version }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer_version + - echo "PYTHON_{{ $runtime.python_version | replace "." "" }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer_version {{- end }} From 9782ab0d61e9212bc2714bccf5fe0450dd5d4eb9 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 09:03:38 -0700 Subject: [PATCH 07/57] Correct replace. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index ff299b69d..bc8f6ff4d 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -174,7 +174,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): script: - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests - - echo "PYTHON_{{ $runtime.python_version | replace "." "" }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer_version + - echo "PYTHON_{{ $runtime.python_version | strings.ReplaceAll "." "" }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer_version {{- end }} From ff9372d9fa476051a642b2edcfb8fa4df353f06f Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 09:33:39 -0700 Subject: [PATCH 08/57] Use variables. --- ci/input_files/build.yaml.tpl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index bc8f6ff4d..381a4c372 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -1,3 +1,5 @@ +{{- $e2e_region := "us-west-2" -}} + stages: - build - test @@ -133,21 +135,24 @@ sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): - LAYER_FILE=datadog_lambda_py-{{ $runtime.arch}}-{{ $runtime.python_version }}.zip ./scripts/sign_layers.sh prod {{ range $environment_name, $environment := (ds "environments").environments }} +{{ $dotenv := print $runtime.name "_" $runtime.arch "_" $environment_name ".env" }} publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): stage: publish tags: ["arch:amd64"] image: registry.ddbuild.io/images/docker:20.10-py3 rules: - - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "us-west-2" && "{{ $runtime.arch }}" == "amd64"' + - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "{{ $e2e_region }}" && "{{ $runtime.arch }}" == "amd64"' when: always - if: '"{{ $environment_name }}" == "sandbox"' when: manual allow_failure: true - if: '$CI_COMMIT_TAG =~ /^v.*/' artifacts: + paths: + - {{ $dotenv }} reports: - dotenv: layer_version + dotenv: {{ $dotenv }} needs: {{ if or (eq $environment_name "prod") }} - sign-layer ({{ $runtime.name }}-{{ $runtime.arch}}) @@ -174,7 +179,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): script: - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests - - echo "PYTHON_{{ $runtime.python_version | strings.ReplaceAll "." "" }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer_version + - echo "PYTHON_{{ $runtime.python_version | strings.ReplaceAll "." "" }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > {{ $dotenv }} {{- end }} @@ -256,6 +261,6 @@ e2e-test: PYTHON_313_VERSION: latest needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [us-west-2]" + - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} {{- end }} From 7896e486bb161d09f302dbe179b5afb4be416505 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 09:42:47 -0700 Subject: [PATCH 09/57] Properly get arn. --- ci/input_files/build.yaml.tpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 381a4c372..e2a6067c8 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -179,7 +179,9 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): script: - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests - - echo "PYTHON_{{ $runtime.python_version | strings.ReplaceAll "." "" }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > {{ $dotenv }} + - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" + - echo "Found published arn: $layer_arn" + - echo "PYTHON_{{ $runtime.name | strings.TrimLeft "python" }}_VERSION=$layer_arn" > {{ $dotenv }} {{- end }} From 7c9476dff7894d6c4feec67d7520c63b7f055987 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 09:57:21 -0700 Subject: [PATCH 10/57] Just Trim. --- ci/input_files/build.yaml.tpl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index e2a6067c8..abc241b2f 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -181,7 +181,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): # Extract the arn from the publish log to be used as envvar in e2e tests - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" - echo "Found published arn: $layer_arn" - - echo "PYTHON_{{ $runtime.name | strings.TrimLeft "python" }}_VERSION=$layer_arn" > {{ $dotenv }} + - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} {{- end }} @@ -255,12 +255,6 @@ e2e-test: strategy: depend variables: LANGUAGES_SUBSET: python - PYTHON_38_VERSION: latest - PYTHON_39_VERSION: latest - PYTHON_310_VERSION: latest - PYTHON_311_VERSION: latest - PYTHON_312_VERSION: latest - PYTHON_313_VERSION: latest needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" From 9daf17bf54a8de037862f625edf210c3643d90a2 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:06:13 -0700 Subject: [PATCH 11/57] Multiline string. --- ci/input_files/build.yaml.tpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index abc241b2f..0be7ab9e0 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -176,12 +176,12 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): {{- end}} before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh - script: - - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log + script: | + STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests - - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" - - echo "Found published arn: $layer_arn" - - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} + layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" + echo "Found published arn: $layer_arn" + echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} {{- end }} From 85d6083bd6f42dea8c7b9890c370ba8109527f84 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:22:11 -0700 Subject: [PATCH 12/57] Change to template comment. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 0be7ab9e0..73c9317e1 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -178,7 +178,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: | STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log - # Extract the arn from the publish log to be used as envvar in e2e tests + {{/* Extract the arn from the publish log to be used as envvar in e2e tests */ -}} layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" echo "Found published arn: $layer_arn" echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} From 1d35ac3a7c4cdf3c4f12d8920162cf3cb0aae8a6 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:30:59 -0700 Subject: [PATCH 13/57] No more multiline. --- ci/input_files/build.yaml.tpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 73c9317e1..c020aa54b 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -176,12 +176,12 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): {{- end}} before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh - script: | - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log + script: + - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log {{/* Extract the arn from the publish log to be used as envvar in e2e tests */ -}} - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" - echo "Found published arn: $layer_arn" - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} + - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" + - echo "Found published arn: $layer_arn" + - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} {{- end }} From 61fb775212435aded2fe8de97e2d04a834d0b9e2 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:32:59 -0700 Subject: [PATCH 14/57] Remove comment? --- ci/input_files/build.yaml.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index c020aa54b..575134b81 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -178,7 +178,6 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log - {{/* Extract the arn from the publish log to be used as envvar in e2e tests */ -}} - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" - echo "Found published arn: $layer_arn" - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} From ab9e2df37ba7c1ee5d83a3e5b1afd66df67dedfe Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:51:06 -0700 Subject: [PATCH 15/57] Combine lines again. --- ci/input_files/build.yaml.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 575134b81..551144f5f 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -178,9 +178,9 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log - - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" - - echo "Found published arn: $layer_arn" - - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} + - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" > {{ $dotenv }} + +{{/* Extract the arn from the publish log to be used as envvar in e2e tests */}} {{- end }} From a3819c039fc37f9490332a4d5318533587af9944 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:52:22 -0700 Subject: [PATCH 16/57] Move comment. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 551144f5f..ddcf8cd02 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -178,9 +178,9 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log + # Extract the arn from the publish log to be used as envvar in e2e tests - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" > {{ $dotenv }} -{{/* Extract the arn from the publish log to be used as envvar in e2e tests */}} {{- end }} From f4a0311ee2418111ab6d49c6fb67f80833faeb9c Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:14:16 -0700 Subject: [PATCH 17/57] Another multiline. --- ci/input_files/build.yaml.tpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index ddcf8cd02..890423707 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -177,9 +177,11 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log - # Extract the arn from the publish log to be used as envvar in e2e tests - - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" > {{ $dotenv }} + - | + STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log + # Extract the arn from the publish log to be used as envvar in e2e tests + echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" > {{ $dotenv }} + cat {{ $dotenv }} {{- end }} From bbb551278cae0237860428ee5c73d8ce7ed3ba1b Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:19:04 -0700 Subject: [PATCH 18/57] Exit if not found. --- ci/input_files/build.yaml.tpl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 890423707..d8195ef9e 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -180,7 +180,14 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - | STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" > {{ $dotenv }} + layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" + if [ -z "$layer_arn" ]; then + echo "Error: Layer ARN not found in publish log" + exit 1 + else + echo "Found layer arn: $layer_arn" + fi + echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} cat {{ $dotenv }} From 7813992f6c6effdb321492f5c4a9fe4a89a91a93 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:24:29 -0700 Subject: [PATCH 19/57] Set -x. --- ci/input_files/build.yaml.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index d8195ef9e..a9016f034 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -178,6 +178,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - | + set -x STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" From f5acbac7e73a30362463e94881d035445e0a1a5e Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:32:18 -0700 Subject: [PATCH 20/57] More debugging. --- ci/input_files/build.yaml.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index a9016f034..caa3353f1 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -181,6 +181,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): set -x STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests + cat publish.log layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" if [ -z "$layer_arn" ]; then echo "Error: Layer ARN not found in publish log" From fba2869dbfa9bc7cbd0cc69792ecba421ddf2e2b Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:41:08 -0700 Subject: [PATCH 21/57] Even more debugging. --- ci/input_files/build.yaml.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index caa3353f1..7ed20c877 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -182,6 +182,8 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests cat publish.log + grep 'Published arn' publish.log + grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+' layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" if [ -z "$layer_arn" ]; then echo "Error: Layer ARN not found in publish log" From 82b3ee1039586919092ea74fa4e8ec540461a7e7 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:45:01 -0700 Subject: [PATCH 22/57] Broaden regex. --- ci/input_files/build.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 7ed20c877..bb7057ffb 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -183,8 +183,8 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): # Extract the arn from the publish log to be used as envvar in e2e tests cat publish.log grep 'Published arn' publish.log - grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+' - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*:\d+')" + grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*' + layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')" if [ -z "$layer_arn" ]; then echo "Error: Layer ARN not found in publish log" exit 1 From e7781e9704086a2e8946cb887fbad311869ac62c Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:58:06 -0700 Subject: [PATCH 23/57] Subscript. --- ci/input_files/build.yaml.tpl | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index bb7057ffb..8138d37ed 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -33,6 +33,18 @@ default: - apt-get install nodejs -y - npm install --global yarn +# Extract the arn from the publish log to be used as envvar in e2e tests +.extract-arn: &extract-arn + - | + layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')" + if [ -z "$layer_arn" ]; then + echo "Error: Layer ARN not found in publish log" + exit 1 + else + echo "Found layer arn, $layer_arn" + fi + echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} + {{ range $runtime := (ds "runtimes").runtimes }} # TODO(astuyve) - figure out python build cache @@ -149,8 +161,6 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): allow_failure: true - if: '$CI_COMMIT_TAG =~ /^v.*/' artifacts: - paths: - - {{ $dotenv }} reports: dotenv: {{ $dotenv }} needs: @@ -177,22 +187,8 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - - | - set -x - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log - # Extract the arn from the publish log to be used as envvar in e2e tests - cat publish.log - grep 'Published arn' publish.log - grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*' - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')" - if [ -z "$layer_arn" ]; then - echo "Error: Layer ARN not found in publish log" - exit 1 - else - echo "Found layer arn: $layer_arn" - fi - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} - cat {{ $dotenv }} + - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log + - *extract-arn {{- end }} @@ -267,6 +263,8 @@ e2e-test: strategy: depend variables: LANGUAGES_SUBSET: python + before_script: + - env needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" From 5505b6cb0da5e6987969a359513e9d0d649cef96 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 12:07:05 -0700 Subject: [PATCH 24/57] No more subscript. --- ci/input_files/build.yaml.tpl | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 8138d37ed..8a48809d4 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -33,18 +33,6 @@ default: - apt-get install nodejs -y - npm install --global yarn -# Extract the arn from the publish log to be used as envvar in e2e tests -.extract-arn: &extract-arn - - | - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')" - if [ -z "$layer_arn" ]; then - echo "Error: Layer ARN not found in publish log" - exit 1 - else - echo "Found layer arn, $layer_arn" - fi - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} - {{ range $runtime := (ds "runtimes").runtimes }} # TODO(astuyve) - figure out python build cache @@ -187,8 +175,18 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log - - *extract-arn + - | + STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log + # Extract the arn from the publish log to be used as envvar in e2e tests + layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')" + if [ -z "$layer_arn" ]; then + echo "Error: Layer ARN not found in publish log" + exit 1 + else + echo "Found layer arn, $layer_arn" + fi + echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} + cat {{ $dotenv }} {{- end }} From b536706d5fc51706c9415a22c260ca83b5c6e4e9 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 12:12:37 -0700 Subject: [PATCH 25/57] Artifacts true. --- ci/input_files/build.yaml.tpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 8a48809d4..e01934960 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -259,10 +259,9 @@ e2e-test: trigger: project: DataDog/serverless-e2e-tests strategy: depend + artifacts: true variables: LANGUAGES_SUBSET: python - before_script: - - env needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" From 91a8afa9797fdd081f152bedfe1cadbe72e73913 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 13:40:28 -0700 Subject: [PATCH 26/57] Inherit dependencies and variables. --- ci/input_files/build.yaml.tpl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index e01934960..d60961b79 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -259,7 +259,6 @@ e2e-test: trigger: project: DataDog/serverless-e2e-tests strategy: depend - artifacts: true variables: LANGUAGES_SUBSET: python needs: {{ range (ds "runtimes").runtimes }} @@ -267,3 +266,10 @@ e2e-test: - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} {{- end }} + dependencies: {{ range (ds "runtimes").runtimes }} + {{- if eq .arch "amd64" }} + - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" + {{- end }} + {{- end }} + inherit: + variables: true From f60afb2d190a9c59ac7bebf755ce5d1c95833102 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 13:40:54 -0700 Subject: [PATCH 27/57] Add testing downstream branch. --- ci/input_files/build.yaml.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index d60961b79..e54dcc7e9 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -259,6 +259,7 @@ e2e-test: trigger: project: DataDog/serverless-e2e-tests strategy: depend + branch: rey.abolofia/variable-passing variables: LANGUAGES_SUBSET: python needs: {{ range (ds "runtimes").runtimes }} From 612e63b15d91b21e564e0f22dbfc4a05317ac3a0 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 13:45:28 -0700 Subject: [PATCH 28/57] Remove dependencies use variables. --- ci/input_files/build.yaml.tpl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index e54dcc7e9..508a7b2be 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -262,15 +262,14 @@ e2e-test: branch: rey.abolofia/variable-passing variables: LANGUAGES_SUBSET: python + PYTHON_38_VERSION: $PYTHON_38_VERSION + PYTHON_39_VERSION: $PYTHON_39_VERSION + PYTHON_310_VERSION: $PYTHON_310_VERSION + PYTHON_311_VERSION: $PYTHON_311_VERSION + PYTHON_312_VERSION: $PYTHON_312_VERSION + PYTHON_313_VERSION: $PYTHON_313_VERSION needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} {{- end }} - dependencies: {{ range (ds "runtimes").runtimes }} - {{- if eq .arch "amd64" }} - - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" - {{- end }} - {{- end }} - inherit: - variables: true From 02c4578285d28f66885547af37384fb5977a5558 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 13:55:54 -0700 Subject: [PATCH 29/57] Use loop and main. --- ci/input_files/build.yaml.tpl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 508a7b2be..9976e8aab 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -259,15 +259,13 @@ e2e-test: trigger: project: DataDog/serverless-e2e-tests strategy: depend - branch: rey.abolofia/variable-passing variables: LANGUAGES_SUBSET: python - PYTHON_38_VERSION: $PYTHON_38_VERSION - PYTHON_39_VERSION: $PYTHON_39_VERSION - PYTHON_310_VERSION: $PYTHON_310_VERSION - PYTHON_311_VERSION: $PYTHON_311_VERSION - PYTHON_312_VERSION: $PYTHON_312_VERSION - PYTHON_313_VERSION: $PYTHON_313_VERSION + {{- range $runtime := (ds "runtimes").runtimes }} + {{- if eq $runtime.arch "amd64" }} + PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION: $PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION + {{- end }} + {{- end }} needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" From 3f5bc43a2392743e823fe73ddbe731e70ab39d8a Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 14:09:13 -0700 Subject: [PATCH 30/57] Uncomment other tests. --- ci/input_files/build.yaml.tpl | 86 +++++++++++++++++------------------ 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 9976e8aab..74555b329 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -66,45 +66,45 @@ check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}): script: - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/check_layer_size.sh -#lint python: -# stage: test -# tags: ["arch:amd64"] -# image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} -# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache -# before_script: *python-before-script -# script: -# - source venv/bin/activate -# - ./scripts/check_format.sh +lint python: + stage: test + tags: ["arch:amd64"] + image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} + cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache + before_script: *python-before-script + script: + - source venv/bin/activate + - ./scripts/check_format.sh -#unit-test ({{ $runtime.name }}-{{ $runtime.arch }}): -# stage: test -# tags: ["arch:amd64"] -# image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} -# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache -# before_script: *python-before-script -# script: -# - source venv/bin/activate -# - pytest -vv +unit-test ({{ $runtime.name }}-{{ $runtime.arch }}): + stage: test + tags: ["arch:amd64"] + image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} + cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache + before_script: *python-before-script + script: + - source venv/bin/activate + - pytest -vv -#integration-test ({{ $runtime.name }}-{{ $runtime.arch }}): -# stage: test -# tags: ["arch:amd64"] -# image: registry.ddbuild.io/images/docker:20.10-py3 -# needs: -# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) -# dependencies: -# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) -# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache -# variables: -# CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" -# before_script: -# - *install-node -# - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh -# - yarn global add serverless@^3.38.0 --prefix /usr/local -# - yarn global add serverless-python-requirements@^6.1.1 --prefix /usr/local -# - cd integration_tests && yarn install && cd .. -# script: -# - RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh +integration-test ({{ $runtime.name }}-{{ $runtime.arch }}): + stage: test + tags: ["arch:amd64"] + image: registry.ddbuild.io/images/docker:20.10-py3 + needs: + - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) + dependencies: + - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) + cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache + variables: + CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" + before_script: + - *install-node + - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh + - yarn global add serverless@^3.38.0 --prefix /usr/local + - yarn global add serverless-python-requirements@^6.1.1 --prefix /usr/local + - cd integration_tests && yarn install && cd .. + script: + - RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): stage: sign @@ -116,9 +116,9 @@ sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): needs: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) - #- lint python - #- unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) - #- integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) + - lint python + - unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) + - integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) dependencies: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) artifacts: # Re specify artifacts so the modified signed file is passed @@ -157,9 +157,9 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): {{ else }} - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) - #- lint python - #- unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) - #- integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) + - lint python + - unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) + - integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) {{ end }} dependencies: {{ if or (eq $environment_name "prod") }} From fe77f3179c349454ae80ded65b24962dc508e8f7 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 14:21:45 -0700 Subject: [PATCH 31/57] Cleanup version env vars. --- ci/input_files/build.yaml.tpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 74555b329..1eb51ae36 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -261,9 +261,11 @@ e2e-test: strategy: depend variables: LANGUAGES_SUBSET: python - {{- range $runtime := (ds "runtimes").runtimes }} - {{- if eq $runtime.arch "amd64" }} - PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION: $PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION + # These env vars are inherited from the dotenv reports of the publish-layer jobs + {{- range (ds "runtimes").runtimes }} + {{- if eq .arch "amd64" }} + {{- $version := print (.name | strings.Trim "python") }} + PYTHON_{{ $version }}_VERSION: $PYTHON_{{ $version }}_VERSION {{- end }} {{- end }} needs: {{ range (ds "runtimes").runtimes }} From ba03172d43296753a4e8272de50b57a128e7cd72 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Wed, 18 Jun 2025 11:28:45 -0700 Subject: [PATCH 32/57] Whitespace cleanups. --- ci/input_files/build.yaml.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 1eb51ae36..96bfc95bf 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -260,16 +260,16 @@ e2e-test: project: DataDog/serverless-e2e-tests strategy: depend variables: - LANGUAGES_SUBSET: python - # These env vars are inherited from the dotenv reports of the publish-layer jobs + LANGUAGES_SUBSET: python + # These env vars are inherited from the dotenv reports of the publish-layer jobs {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} {{- $version := print (.name | strings.Trim "python") }} - PYTHON_{{ $version }}_VERSION: $PYTHON_{{ $version }}_VERSION + PYTHON_{{ $version }}_VERSION: $PYTHON_{{ $version }}_VERSION {{- end }} {{- end }} needs: {{ range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} - {{- end }} + {{- end }} From 0fb0007f4d6214f6df8201fa5a77887c39804ed2 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Wed, 18 Jun 2025 13:11:21 -0700 Subject: [PATCH 33/57] Only deploy layers on success. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 96bfc95bf..97caf9b25 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -143,7 +143,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): image: registry.ddbuild.io/images/docker:20.10-py3 rules: - if: '"{{ $environment_name }}" == "sandbox" && $REGION == "{{ $e2e_region }}" && "{{ $runtime.arch }}" == "amd64"' - when: always + when: on_success - if: '"{{ $environment_name }}" == "sandbox"' when: manual allow_failure: true From 1256e10d55da364f5c8bff076eebd7b7650dbf2d Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Wed, 18 Jun 2025 13:40:12 -0700 Subject: [PATCH 34/57] Add e2e-status check. --- ci/input_files/build.yaml.tpl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 97caf9b25..4ae60b6b0 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -273,3 +273,14 @@ e2e-test: - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} {{- end }} + +e2e-status: + stage: e2e + image: registry.ddbuild.io/images/mirror/alpine:latest + tags: ["arch:amd64"] + needs: + - e2e-test + script: + - echo "✅ e2e tests completed successfully" + rules: + - when: on_success From 27430d26d40cf5ba972349671521e894977aee62 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 09:27:38 -0700 Subject: [PATCH 35/57] Improve output of job. --- ci/input_files/build.yaml.tpl | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 4ae60b6b0..fa4457637 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -281,6 +281,20 @@ e2e-status: needs: - e2e-test script: - - echo "✅ e2e tests completed successfully" - rules: - - when: on_success + - echo "Python layer ARNs used in E2E tests:" + {{- range (ds "runtimes").runtimes }} + {{- if eq .arch "amd64" }} + {{- $version := print (.name | strings.Trim "python") }} + - echo " PYTHON_{{ $version }}_VERSION=$PYTHON_{{ $version }}_VERSION" + {{- end }} + {{- end }} + - | + # TODO: link to the test results + # make this job start running at same time as e2e-test job + # do not wait around for the scheduled job to complete + if [ "${CI_JOB_STATUS}" = "failed" ]; then + echo "❌ E2E tests failed" + exit 1 + else + echo "✅ E2E tests completed successfully" + fi From b164380c7394de6e7eaae7b6e43dc6ca5e71afb8 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 09:31:55 -0700 Subject: [PATCH 36/57] Needing publish loads dotenv artifact. --- ci/input_files/build.yaml.tpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index fa4457637..4393985a2 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -280,6 +280,11 @@ e2e-status: tags: ["arch:amd64"] needs: - e2e-test + {{- range (ds "runtimes").runtimes }} + {{- if eq .arch "amd64" }} + - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" + {{- end }} + {{- end }} script: - echo "Python layer ARNs used in E2E tests:" {{- range (ds "runtimes").runtimes }} From 0497bf0c2a5c9fb53f5240432b61e7f1ceb6b005 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 14:18:49 -0700 Subject: [PATCH 37/57] Have e2e-status job start right away then poll. --- ci/input_files/build.yaml.tpl | 41 ++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 4393985a2..68243e19c 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -279,13 +279,13 @@ e2e-status: image: registry.ddbuild.io/images/mirror/alpine:latest tags: ["arch:amd64"] needs: - - e2e-test {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} {{- end }} script: + - apt-get install -y curl - echo "Python layer ARNs used in E2E tests:" {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} @@ -295,11 +295,36 @@ e2e-status: {{- end }} - | # TODO: link to the test results - # make this job start running at same time as e2e-test job # do not wait around for the scheduled job to complete - if [ "${CI_JOB_STATUS}" = "failed" ]; then - echo "❌ E2E tests failed" - exit 1 - else - echo "✅ E2E tests completed successfully" - fi + echo "🔄 Waiting for E2E tests to complete..." + # Poll for e2e-test job completion + while true; do + # Get the e2e-test job status + E2E_JOB_STATUS=$(curl -s --header "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs" | \ + jq -r '.[] | select(.name=="e2e-test") | .status') + echo "E2E job status: $E2E_JOB_STATUS" + case "$E2E_JOB_STATUS" in + "success") + echo "✅ E2E tests completed successfully" + exit 0 + ;; + "failed") + echo "❌ E2E tests failed" + echo "💡 Look for pipelines triggered around $(date -u +"%Y-%m-%d %H:%M:%S UTC")" + exit 1 + ;; + "canceled") + echo "⚠️ E2E tests were canceled" + exit 1 + ;; + "running"|"pending"|"created") + echo "⏳ E2E tests still running..." + sleep 30 + ;; + *) + echo "❓ Unknown E2E test status: $E2E_JOB_STATUS" + sleep 30 + ;; + esac + done From 5a879f739fea30d1c681a00798ee41332e718b1c Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 14:29:34 -0700 Subject: [PATCH 38/57] Comment out tests for now. --- ci/input_files/build.yaml.tpl | 88 +++++++++++++++++------------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 68243e19c..cfaaf00d0 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -55,16 +55,16 @@ build-layer ({{ $runtime.name }}-{{ $runtime.arch }}): script: - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/build_layers.sh -check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}): - stage: test - tags: ["arch:amd64"] - image: registry.ddbuild.io/images/docker:20.10 - needs: - - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - dependencies: - - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - script: - - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/check_layer_size.sh +#check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}): +# stage: test +# tags: ["arch:amd64"] +# image: registry.ddbuild.io/images/docker:20.10 +# needs: +# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) +# dependencies: +# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) +# script: +# - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/check_layer_size.sh lint python: stage: test @@ -76,35 +76,35 @@ lint python: - source venv/bin/activate - ./scripts/check_format.sh -unit-test ({{ $runtime.name }}-{{ $runtime.arch }}): - stage: test - tags: ["arch:amd64"] - image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} - cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache - before_script: *python-before-script - script: - - source venv/bin/activate - - pytest -vv +#unit-test ({{ $runtime.name }}-{{ $runtime.arch }}): +# stage: test +# tags: ["arch:amd64"] +# image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} +# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache +# before_script: *python-before-script +# script: +# - source venv/bin/activate +# - pytest -vv -integration-test ({{ $runtime.name }}-{{ $runtime.arch }}): - stage: test - tags: ["arch:amd64"] - image: registry.ddbuild.io/images/docker:20.10-py3 - needs: - - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - dependencies: - - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache - variables: - CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" - before_script: - - *install-node - - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh - - yarn global add serverless@^3.38.0 --prefix /usr/local - - yarn global add serverless-python-requirements@^6.1.1 --prefix /usr/local - - cd integration_tests && yarn install && cd .. - script: - - RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh +#integration-test ({{ $runtime.name }}-{{ $runtime.arch }}): +# stage: test +# tags: ["arch:amd64"] +# image: registry.ddbuild.io/images/docker:20.10-py3 +# needs: +# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) +# dependencies: +# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) +# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache +# variables: +# CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" +# before_script: +# - *install-node +# - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh +# - yarn global add serverless@^3.38.0 --prefix /usr/local +# - yarn global add serverless-python-requirements@^6.1.1 --prefix /usr/local +# - cd integration_tests && yarn install && cd .. +# script: +# - RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): stage: sign @@ -115,10 +115,10 @@ sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): when: manual needs: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - - check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) + #- check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) - lint python - - unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) - - integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) + #- unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) + #- integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) dependencies: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) artifacts: # Re specify artifacts so the modified signed file is passed @@ -156,10 +156,10 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - sign-layer ({{ $runtime.name }}-{{ $runtime.arch}}) {{ else }} - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - - check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) + #- check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) - lint python - - unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) - - integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) + #- unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) + #- integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) {{ end }} dependencies: {{ if or (eq $environment_name "prod") }} From 879eb7574b80c2cba9ea1ea5d69d86e8799b688e Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 14:29:42 -0700 Subject: [PATCH 39/57] Use apk. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index cfaaf00d0..a87d73a0c 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -285,7 +285,7 @@ e2e-status: {{- end }} {{- end }} script: - - apt-get install -y curl + - apk add --no-cache curl jq - echo "Python layer ARNs used in E2E tests:" {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} From ab18312ebd730f6cce3fb8b05bec026519557b54 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 14:44:16 -0700 Subject: [PATCH 40/57] Debugging. --- ci/input_files/build.yaml.tpl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index a87d73a0c..effa187f9 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -300,9 +300,10 @@ e2e-status: # Poll for e2e-test job completion while true; do # Get the e2e-test job status - E2E_JOB_STATUS=$(curl -s --header "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" \ - "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs" | \ - jq -r '.[] | select(.name=="e2e-test") | .status') + RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs") + echo "Response: $RESPONSE" + E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .status') echo "E2E job status: $E2E_JOB_STATUS" case "$E2E_JOB_STATUS" in "success") From 757a13b98e38915073644be10431185b1605c620 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 15:01:00 -0700 Subject: [PATCH 41/57] Try JOB-TOKEN. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index effa187f9..d3b36a6a1 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -300,7 +300,7 @@ e2e-status: # Poll for e2e-test job completion while true; do # Get the e2e-test job status - RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" \ + RESPONSE=$(curl -s --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \ "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs") echo "Response: $RESPONSE" E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .status') From bdce9425edf846ee8f7742ab38b91ff4e772d056 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 15:33:53 -0700 Subject: [PATCH 42/57] Print out URL. --- ci/input_files/build.yaml.tpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index d3b36a6a1..afff10fb6 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -300,8 +300,9 @@ e2e-status: # Poll for e2e-test job completion while true; do # Get the e2e-test job status - RESPONSE=$(curl -s --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \ - "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs") + URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs" + echo "Fetching E2E job status from: $URL" + RESPONSE=$(curl -s --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "$URL") echo "Response: $RESPONSE" E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .status') echo "E2E job status: $E2E_JOB_STATUS" From c1cfa8fd4cda85451241dfb89e36d1d298800562 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 15:50:41 -0700 Subject: [PATCH 43/57] Try bridges api. --- ci/input_files/build.yaml.tpl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index afff10fb6..aca09e67e 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -53,6 +53,7 @@ build-layer ({{ $runtime.name }}-{{ $runtime.arch }}): variables: CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" script: + - exit 0 - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/build_layers.sh #check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}): @@ -73,6 +74,7 @@ lint python: cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache before_script: *python-before-script script: + - exit 0 - source venv/bin/activate - ./scripts/check_format.sh @@ -176,6 +178,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - | + exit 0 STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')" @@ -226,6 +229,7 @@ layer bundle: - datadog_lambda_py-bundle-${CI_JOB_ID}/ name: datadog_lambda_py-bundle-${CI_JOB_ID} script: + - exit 0 - rm -rf datadog_lambda_py-bundle-${CI_JOB_ID} - mkdir -p datadog_lambda_py-bundle-${CI_JOB_ID} - cp .layers/datadog_lambda_py-*.zip datadog_lambda_py-bundle-${CI_JOB_ID} @@ -300,11 +304,11 @@ e2e-status: # Poll for e2e-test job completion while true; do # Get the e2e-test job status - URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs" + URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" echo "Fetching E2E job status from: $URL" RESPONSE=$(curl -s --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "$URL") echo "Response: $RESPONSE" - E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .status') + E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status') echo "E2E job status: $E2E_JOB_STATUS" case "$E2E_JOB_STATUS" in "success") From efa4ff5cf3fe1a835599eee81d299263a901e201 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 16:02:19 -0700 Subject: [PATCH 44/57] Try GITLAB_API_TOKEN. --- ci/input_files/build.yaml.tpl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index aca09e67e..d1b2c3b1d 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -301,12 +301,13 @@ e2e-status: # TODO: link to the test results # do not wait around for the scheduled job to complete echo "🔄 Waiting for E2E tests to complete..." - # Poll for e2e-test job completion + URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" + echo "Fetching E2E job status from: $URL" + env while true; do # Get the e2e-test job status - URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" - echo "Fetching E2E job status from: $URL" - RESPONSE=$(curl -s --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "$URL") + #RESPONSE=$(curl -s --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "$URL") + RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL") echo "Response: $RESPONSE" E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status') echo "E2E job status: $E2E_JOB_STATUS" From d1e8c55bdda1e5dda2cdbfa4c1150c19637a3fad Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 16:30:27 -0700 Subject: [PATCH 45/57] Use CI_JOB_STATUS to determine pass/fail. --- ci/input_files/build.yaml.tpl | 146 +++++++++++++++------------------- 1 file changed, 62 insertions(+), 84 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index d1b2c3b1d..f11bc268b 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -53,19 +53,18 @@ build-layer ({{ $runtime.name }}-{{ $runtime.arch }}): variables: CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" script: - - exit 0 - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/build_layers.sh -#check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}): -# stage: test -# tags: ["arch:amd64"] -# image: registry.ddbuild.io/images/docker:20.10 -# needs: -# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) -# dependencies: -# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) -# script: -# - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/check_layer_size.sh +check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}): + stage: test + tags: ["arch:amd64"] + image: registry.ddbuild.io/images/docker:20.10 + needs: + - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) + dependencies: + - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) + script: + - PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/check_layer_size.sh lint python: stage: test @@ -74,39 +73,38 @@ lint python: cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache before_script: *python-before-script script: - - exit 0 - source venv/bin/activate - ./scripts/check_format.sh -#unit-test ({{ $runtime.name }}-{{ $runtime.arch }}): -# stage: test -# tags: ["arch:amd64"] -# image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} -# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache -# before_script: *python-before-script -# script: -# - source venv/bin/activate -# - pytest -vv +unit-test ({{ $runtime.name }}-{{ $runtime.arch }}): + stage: test + tags: ["arch:amd64"] + image: registry.ddbuild.io/images/mirror/python:{{ $runtime.image }} + cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache + before_script: *python-before-script + script: + - source venv/bin/activate + - pytest -vv -#integration-test ({{ $runtime.name }}-{{ $runtime.arch }}): -# stage: test -# tags: ["arch:amd64"] -# image: registry.ddbuild.io/images/docker:20.10-py3 -# needs: -# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) -# dependencies: -# - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) -# cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache -# variables: -# CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" -# before_script: -# - *install-node -# - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh -# - yarn global add serverless@^3.38.0 --prefix /usr/local -# - yarn global add serverless-python-requirements@^6.1.1 --prefix /usr/local -# - cd integration_tests && yarn install && cd .. -# script: -# - RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh +integration-test ({{ $runtime.name }}-{{ $runtime.arch }}): + stage: test + tags: ["arch:amd64"] + image: registry.ddbuild.io/images/docker:20.10-py3 + needs: + - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) + dependencies: + - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) + cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache + variables: + CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" + before_script: + - *install-node + - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh + - yarn global add serverless@^3.38.0 --prefix /usr/local + - yarn global add serverless-python-requirements@^6.1.1 --prefix /usr/local + - cd integration_tests && yarn install && cd .. + script: + - RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): stage: sign @@ -117,10 +115,10 @@ sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}): when: manual needs: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - #- check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) + - check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) - lint python - #- unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) - #- integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) + - unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) + - integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) dependencies: - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) artifacts: # Re specify artifacts so the modified signed file is passed @@ -158,10 +156,10 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - sign-layer ({{ $runtime.name }}-{{ $runtime.arch}}) {{ else }} - build-layer ({{ $runtime.name }}-{{ $runtime.arch }}) - #- check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) + - check-layer-size ({{ $runtime.name }}-{{ $runtime.arch }}) - lint python - #- unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) - #- integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) + - unit-test ({{ $runtime.name }}-{{ $runtime.arch }}) + - integration-test ({{ $runtime.name }}-{{ $runtime.arch }}) {{ end }} dependencies: {{ if or (eq $environment_name "prod") }} @@ -178,7 +176,6 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - | - exit 0 STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log # Extract the arn from the publish log to be used as envvar in e2e tests layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')" @@ -229,7 +226,6 @@ layer bundle: - datadog_lambda_py-bundle-${CI_JOB_ID}/ name: datadog_lambda_py-bundle-${CI_JOB_ID} script: - - exit 0 - rm -rf datadog_lambda_py-bundle-${CI_JOB_ID} - mkdir -p datadog_lambda_py-bundle-${CI_JOB_ID} - cp .layers/datadog_lambda_py-*.zip datadog_lambda_py-bundle-${CI_JOB_ID} @@ -283,13 +279,13 @@ e2e-status: image: registry.ddbuild.io/images/mirror/alpine:latest tags: ["arch:amd64"] needs: + - e2e-test {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} {{- end }} script: - - apk add --no-cache curl jq - echo "Python layer ARNs used in E2E tests:" {{- range (ds "runtimes").runtimes }} {{- if eq .arch "amd64" }} @@ -299,39 +295,21 @@ e2e-status: {{- end }} - | # TODO: link to the test results + # make this job start running at same time as e2e-test job # do not wait around for the scheduled job to complete - echo "🔄 Waiting for E2E tests to complete..." - URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" - echo "Fetching E2E job status from: $URL" - env - while true; do - # Get the e2e-test job status - #RESPONSE=$(curl -s --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "$URL") - RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL") - echo "Response: $RESPONSE" - E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status') - echo "E2E job status: $E2E_JOB_STATUS" - case "$E2E_JOB_STATUS" in - "success") - echo "✅ E2E tests completed successfully" - exit 0 - ;; - "failed") - echo "❌ E2E tests failed" - echo "💡 Look for pipelines triggered around $(date -u +"%Y-%m-%d %H:%M:%S UTC")" - exit 1 - ;; - "canceled") - echo "⚠️ E2E tests were canceled" - exit 1 - ;; - "running"|"pending"|"created") - echo "⏳ E2E tests still running..." - sleep 30 - ;; - *) - echo "❓ Unknown E2E test status: $E2E_JOB_STATUS" - sleep 30 - ;; - esac - done + switch "${CI_JOB_STATUS}" in + "success") + echo "✅ E2E tests completed successfully" + ;; + "failed") + echo "❌ E2E tests failed" + exit 1 + ;; + "canceled") + echo "❌ E2E tests were canceled" + exit 1 + ;; + *) + echo "❌ E2E tests unknown status: ${CI_JOB_STATUS}" + exit 1 + esac From a5571f165c9481835106d75de10a07165d6ab90c Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 17:37:20 -0700 Subject: [PATCH 46/57] Remove switch. --- ci/input_files/build.yaml.tpl | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index f11bc268b..595459cd2 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -294,22 +294,15 @@ e2e-status: {{- end }} {{- end }} - | - # TODO: link to the test results - # make this job start running at same time as e2e-test job - # do not wait around for the scheduled job to complete - switch "${CI_JOB_STATUS}" in - "success") - echo "✅ E2E tests completed successfully" - ;; - "failed") - echo "❌ E2E tests failed" - exit 1 - ;; - "canceled") - echo "❌ E2E tests were canceled" - exit 1 - ;; - *) - echo "❌ E2E tests unknown status: ${CI_JOB_STATUS}" - exit 1 - esac + if [ "$CI_JOB_STATUS" = "success" ]; then + echo "✅ E2E tests completed successfully" + elif [ "$CI_JOB_STATUS" = "failed" ]; then + echo "❌ E2E tests failed" + exit 1 + elif [ "$CI_JOB_STATUS" = "canceled" ]; then + echo "❌ E2E tests were canceled" + exit 1 + else + echo "❌ E2E tests unknown status: ${CI_JOB_STATUS}" + exit 1 + fi From e261dcdae373d5d71f18eac07b9d8b1ca0cab0ed Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 11:24:29 -0700 Subject: [PATCH 47/57] Create dotenv file from publish script. --- ci/input_files/build.yaml.tpl | 14 +------------- ci/publish_layers.sh | 6 ++++++ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 595459cd2..7b652c553 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -175,19 +175,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): before_script: - EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh script: - - | - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log - # Extract the arn from the publish log to be used as envvar in e2e tests - layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')" - if [ -z "$layer_arn" ]; then - echo "Error: Layer ARN not found in publish log" - exit 1 - else - echo "Found layer arn, $layer_arn" - fi - echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }} - cat {{ $dotenv }} - + - STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} DOTENV={{ $dotenv }} ./ci/publish_layers.sh {{- end }} diff --git a/ci/publish_layers.sh b/ci/publish_layers.sh index 9bac31140..9654582a2 100755 --- a/ci/publish_layers.sh +++ b/ci/publish_layers.sh @@ -211,4 +211,10 @@ while [ $latest_version -lt $VERSION ]; do fi done +if [ -n "$DOTENV" ]; then + printf "[$REGION] Exporting layer version to $DOTENV file...\n" + echo "PYTHON_${PYTHON_VERSION/./}_VERSION=$latest_arn" >> "$DOTENV" + cat "$DOTENV" +fi + printf "[$REGION] Finished publishing layers...\n\n" From 19d2fc32e83a032096b95b5045a29c62b13ed22e Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 11:27:34 -0700 Subject: [PATCH 48/57] Use docker docker image. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 7b652c553..e118572c2 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -264,7 +264,7 @@ e2e-test: e2e-status: stage: e2e - image: registry.ddbuild.io/images/mirror/alpine:latest + image: registry.ddbuild.io/images/docker:20.10-py3 tags: ["arch:amd64"] needs: - e2e-test From b34d4b289aabf964012ad410462ce22b6dbf21ce Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 11:28:31 -0700 Subject: [PATCH 49/57] This needs not needed. --- ci/input_files/build.yaml.tpl | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index e118572c2..e8a445f39 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -268,11 +268,6 @@ e2e-status: tags: ["arch:amd64"] needs: - e2e-test - {{- range (ds "runtimes").runtimes }} - {{- if eq .arch "amd64" }} - - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" - {{- end }} - {{- end }} script: - echo "Python layer ARNs used in E2E tests:" {{- range (ds "runtimes").runtimes }} From 13748283da1a4d6cb519fc7c574e577714289495 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 11:44:02 -0700 Subject: [PATCH 50/57] Push check status to file in e2e repo. --- ci/input_files/build.yaml.tpl | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index e8a445f39..82142b5ca 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -269,23 +269,6 @@ e2e-status: needs: - e2e-test script: - - echo "Python layer ARNs used in E2E tests:" - {{- range (ds "runtimes").runtimes }} - {{- if eq .arch "amd64" }} - {{- $version := print (.name | strings.Trim "python") }} - - echo " PYTHON_{{ $version }}_VERSION=$PYTHON_{{ $version }}_VERSION" - {{- end }} - {{- end }} - - | - if [ "$CI_JOB_STATUS" = "success" ]; then - echo "✅ E2E tests completed successfully" - elif [ "$CI_JOB_STATUS" = "failed" ]; then - echo "❌ E2E tests failed" - exit 1 - elif [ "$CI_JOB_STATUS" = "canceled" ]; then - echo "❌ E2E tests were canceled" - exit 1 - else - echo "❌ E2E tests unknown status: ${CI_JOB_STATUS}" - exit 1 - fi + - git clone -b rey.abolofia/status-check --single-branch https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/serverless-e2e-tests.git + - cd ./serverless-e2e-tests + - ./scripts/check_e2e_status.sh From c38abb17b8f8444c87ad852b90a87f2d5f1ea603 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 13:29:11 -0700 Subject: [PATCH 51/57] Start status checking in test stage. --- ci/input_files/build.yaml.tpl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 82142b5ca..73b1c2a9e 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -262,13 +262,11 @@ e2e-test: {{- end }} {{- end }} -e2e-status: - stage: e2e +e2e-test-status: + stage: test image: registry.ddbuild.io/images/docker:20.10-py3 tags: ["arch:amd64"] - needs: - - e2e-test script: - - git clone -b rey.abolofia/status-check --single-branch https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/serverless-e2e-tests.git + - git clone -b rey.abolofia/status-check --single-branch https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/serverless-e2e-tests - cd ./serverless-e2e-tests - ./scripts/check_e2e_status.sh From 7f29f718b2b70adaac1a916bc0a02a757084f514 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 12 Aug 2025 15:29:02 -0700 Subject: [PATCH 52/57] Remove e2e-test-status job for now. --- ci/input_files/build.yaml.tpl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 73b1c2a9e..c5a6105f5 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -261,12 +261,3 @@ e2e-test: - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} {{- end }} - -e2e-test-status: - stage: test - image: registry.ddbuild.io/images/docker:20.10-py3 - tags: ["arch:amd64"] - script: - - git clone -b rey.abolofia/status-check --single-branch https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/serverless-e2e-tests - - cd ./serverless-e2e-tests - - ./scripts/check_e2e_status.sh From eb787a14a1dfdd8a161e2286456ae47ddf937ad0 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 12 Aug 2025 15:54:34 -0700 Subject: [PATCH 53/57] Improve test status reporting. --- ci/input_files/build.yaml.tpl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index c5a6105f5..c91bff41c 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -261,3 +261,29 @@ e2e-test: - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} {{- end }} + +e2e-test-status: + stage: e2e + image: registry.ddbuild.io/images/docker:20.10-py3 + tags: ["arch:amd64"] + needs: + - e2e-test + script: + - apk add --no-cache curl jq + - | + 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" + RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL") + E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status') + echo "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 + else + echo "❓ Unknown E2E test status: $E2E_JOB_STATUS" + exit 1 + fi From 5cd891f7e3a9b8c807f96dbfc38553abc99d8836 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Thu, 14 Aug 2025 10:00:15 -0700 Subject: [PATCH 54/57] Use dependencies and remove apk. --- ci/input_files/build.yaml.tpl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index c91bff41c..7fa0016d6 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -266,15 +266,14 @@ e2e-test-status: stage: e2e image: registry.ddbuild.io/images/docker:20.10-py3 tags: ["arch:amd64"] - needs: + dependencies: - e2e-test - script: - - apk add --no-cache curl jq - - | + 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" RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL") + echo "Response from GitLab API: $RESPONSE" E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status') echo "E2E job status: $E2E_JOB_STATUS" if [ "$E2E_JOB_STATUS" == "success" ]; then From 658ad5e3bd26ffd9e071dc5017c81a9624834c93 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Thu, 14 Aug 2025 10:45:37 -0700 Subject: [PATCH 55/57] Handle all of the statuses. --- ci/input_files/build.yaml.tpl | 46 ++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 7fa0016d6..521510d65 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -263,26 +263,38 @@ e2e-test: {{- end }} e2e-test-status: - stage: e2e + stage: test image: registry.ddbuild.io/images/docker:20.10-py3 tags: ["arch:amd64"] - dependencies: - - e2e-test + 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" - RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL") - echo "Response from GitLab API: $RESPONSE" - E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status') - echo "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 - else - echo "❓ Unknown E2E test status: $E2E_JOB_STATUS" - exit 1 - fi + while true; do + RESPONSE=$(curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "$URL") + echo "Response from GitLab API: $RESPONSE" + E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status') + echo "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 -n "⏳ E2E tests are still running" + echo "Retrying in 1 minute..." + sleep 60 + 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 -n "❓ Unknown E2E test status: $E2E_JOB_STATUS" + echo "Retrying in 1 minute..." + sleep 60 + fi + done From 392c594b7480cbd02e75e51e7b8901a11cd79cff Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Thu, 14 Aug 2025 11:02:36 -0700 Subject: [PATCH 56/57] More modifications. --- ci/input_files/build.yaml.tpl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 521510d65..49904cba7 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -263,7 +263,7 @@ e2e-test: {{- end }} e2e-test-status: - stage: test + stage: e2e image: registry.ddbuild.io/images/docker:20.10-py3 tags: ["arch:amd64"] timeout: 3h @@ -273,9 +273,8 @@ 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 from GitLab API: $RESPONSE" E2E_JOB_STATUS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="e2e-test") | .pipeline.status') - echo "E2E job status: $E2E_JOB_STATUS" + echo -n "E2E job status: $E2E_JOB_STATUS, " if [ "$E2E_JOB_STATUS" == "success" ]; then echo "✅ E2E tests completed successfully" exit 0 @@ -283,9 +282,7 @@ e2e-test-status: echo "❌ E2E tests failed" exit 1 elif [ "$E2E_JOB_STATUS" == "running" ]; then - echo -n "⏳ E2E tests are still running" - echo "Retrying in 1 minute..." - sleep 60 + echo "⏳ E2E tests are still running, retrying in 1 minute..." elif [ "$E2E_JOB_STATUS" == "canceled" ]; then echo "🚫 E2E tests were canceled" exit 1 @@ -293,8 +290,7 @@ e2e-test-status: echo "⏭️ E2E tests were skipped" exit 0 else - echo -n "❓ Unknown E2E test status: $E2E_JOB_STATUS" - echo "Retrying in 1 minute..." - sleep 60 + echo "❓ Unknown E2E test status: $E2E_JOB_STATUS, retrying in 1 minute..." fi + sleep 60 done From 4776625cb4b88234fe1826aa535d007affc72381 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 15 Aug 2025 09:29:28 -0700 Subject: [PATCH 57/57] Look at downstream not this pipeline status. --- ci/input_files/build.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index 49904cba7..8624a8060 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -273,7 +273,7 @@ e2e-test-status: 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") | .pipeline.status') + 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"