From e3bd1c0ec826928188b3d8de1216a26b7387ea8c Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Thu, 10 Apr 2025 14:13:54 -0700 Subject: [PATCH 01/54] 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 769f87f5..a79de0c4 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 bcd969448c6f3c95fc0d155cb4608eb0bbe386af Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Thu, 24 Apr 2025 08:52:58 -0700 Subject: [PATCH 02/54] 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 a79de0c4..2a3a7f02 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 35ab3f5be3cafbec7f192c520fb9ed6c1bf30ac8 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 13 Jun 2025 13:40:38 -0700 Subject: [PATCH 03/54] 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 2a3a7f02..c7dafbc5 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 a2589352743694ca00a45b78cc0854148031aeda Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 16 Jun 2025 11:28:25 -0700 Subject: [PATCH 04/54] 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 c7dafbc5..587a1bb7 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 58257bf1..9bac3114 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 a6fcea91c9b7fd06bd268837dfac308f71d9a470 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 08:49:32 -0700 Subject: [PATCH 05/54] 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 587a1bb7..358c0602 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 bb556d19a9bf750af94b435d83d48db0b102feda Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 08:57:50 -0700 Subject: [PATCH 06/54] 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 358c0602..ff299b69 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 b4e3b4a8f923109248d3b6da4d766ac3cf00446e Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 09:03:38 -0700 Subject: [PATCH 07/54] 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 ff299b69..bc8f6ff4 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 0953779326c49f7547ecef93b31d9c086b754cb9 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 09:33:39 -0700 Subject: [PATCH 08/54] 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 bc8f6ff4..381a4c37 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 cf0ac9e3f030a9b6d17938a9fdefd7a330bf41cb Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 09:42:47 -0700 Subject: [PATCH 09/54] 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 381a4c37..e2a6067c 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 4340b67a6f421c18dea6a739cf5d402674f53226 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 09:57:21 -0700 Subject: [PATCH 10/54] 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 e2a6067c..abc241b2 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 64164952de29d5941ec1f460ca39d7dee1dc7840 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:06:13 -0700 Subject: [PATCH 11/54] 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 abc241b2..0be7ab9e 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 f21499342b7b94f741d36283ecf22378383f2988 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:22:11 -0700 Subject: [PATCH 12/54] 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 0be7ab9e..73c9317e 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 041bb9a0e3401a90146a3e7fd174c83188f0fd70 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:30:59 -0700 Subject: [PATCH 13/54] 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 73c9317e..c020aa54 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 6cd4b91fb5e529cb473d402ad615ba9f9a0b1025 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:32:59 -0700 Subject: [PATCH 14/54] 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 c020aa54..575134b8 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 1dd8e36f0aa5312e82d959acc42a21d2b934d047 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:51:06 -0700 Subject: [PATCH 15/54] 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 575134b8..551144f5 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 fac1c32236a1038c2f0d7b94abbe663ccd6a6f4e Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 10:52:22 -0700 Subject: [PATCH 16/54] 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 551144f5..ddcf8cd0 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 b7ffa1817533b136a7bf9e7714e7d54b0ad9efbd Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:14:16 -0700 Subject: [PATCH 17/54] 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 ddcf8cd0..89042370 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 aaef32445d47193021f1bd0877334f9338029b20 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:19:04 -0700 Subject: [PATCH 18/54] 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 89042370..d8195ef9 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 9816e4de89302279d801d25387eabe9ead47b86a Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:24:29 -0700 Subject: [PATCH 19/54] 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 d8195ef9..a9016f03 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 0a3ff1968bf9f079aeb0297a0583dc41bb79f379 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:32:18 -0700 Subject: [PATCH 20/54] 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 a9016f03..caa3353f 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 5c6b64cd2fab21cb3625b6f54c2716790ffb1a40 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:41:08 -0700 Subject: [PATCH 21/54] 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 caa3353f..7ed20c87 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 88987734eafdca2223605d738ddc5f6f33106949 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:45:01 -0700 Subject: [PATCH 22/54] 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 7ed20c87..bb7057ff 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 c6b953b2fee94094581091f5a7391fa968e07c7b Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 11:58:06 -0700 Subject: [PATCH 23/54] 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 bb7057ff..8138d37e 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 5bda987b2072d6098ad338f765b8d4815f971987 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 12:07:05 -0700 Subject: [PATCH 24/54] 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 8138d37e..8a48809d 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 f6844fb5ef66eef6079771d6dcf200d90d530945 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 12:12:37 -0700 Subject: [PATCH 25/54] 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 8a48809d..e0193496 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 49de9fdb0333608b673cebb65a56a5eda216b7f4 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 13:40:28 -0700 Subject: [PATCH 26/54] 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 e0193496..d60961b7 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 5b29953efb18f91becc5e2b152e0852942762c02 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 13:40:54 -0700 Subject: [PATCH 27/54] 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 d60961b7..e54dcc7e 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 ae1fa3453331bfa3cc8f9fe0185542918b56860f Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 13:45:28 -0700 Subject: [PATCH 28/54] 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 e54dcc7e..508a7b2b 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 47fd32ea676de7306637e4f35568ef906a1c8229 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 13:55:54 -0700 Subject: [PATCH 29/54] 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 508a7b2b..9976e8aa 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 58b9189e5cdc07cfdf3c7443cb4b3d61d5936994 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 14:09:13 -0700 Subject: [PATCH 30/54] 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 9976e8aa..74555b32 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 5c05fc512a86a2a17c6e88ee7e3cef4d10f7a852 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 17 Jun 2025 14:21:45 -0700 Subject: [PATCH 31/54] 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 74555b32..1eb51ae3 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 f92b03e0099843c0c9c74a815905d9668966f221 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Wed, 18 Jun 2025 11:28:45 -0700 Subject: [PATCH 32/54] 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 1eb51ae3..96bfc95b 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 793e31c4a2ad0388086a2e0eacc587a20d95decf Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Wed, 18 Jun 2025 13:11:21 -0700 Subject: [PATCH 33/54] 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 96bfc95b..97caf9b2 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 0d81a40480bded7dc5a733039cfa2abc46f99140 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Wed, 18 Jun 2025 13:40:12 -0700 Subject: [PATCH 34/54] 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 97caf9b2..4ae60b6b 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 3afb2531fb1eb66052bfc80dc7e1c7432390f06f Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 09:27:38 -0700 Subject: [PATCH 35/54] 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 4ae60b6b..fa445763 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 5b9c00233ea9300a5fd3a6f4648e3b69a1d246d4 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 09:31:55 -0700 Subject: [PATCH 36/54] 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 fa445763..4393985a 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 14c8d5b42cb53f03a69052f2a92b1f8ff43d247c Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 14:18:49 -0700 Subject: [PATCH 37/54] 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 4393985a..68243e19 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 692fcc9e5a928cff30ec5abbe464142f9ec9b4c3 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 14:29:34 -0700 Subject: [PATCH 38/54] 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 68243e19..cfaaf00d 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 312b150fc161b419683ca6aafd26a9e692315d97 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 14:29:42 -0700 Subject: [PATCH 39/54] 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 cfaaf00d..a87d73a0 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 1b03542f956bc67f71e9eede54f6718d5904b63a Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 14:44:16 -0700 Subject: [PATCH 40/54] 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 a87d73a0..effa187f 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 4832760613ccaf8efd79e9701f1d21470c5b9f20 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 15:01:00 -0700 Subject: [PATCH 41/54] 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 effa187f..d3b36a6a 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 16cb46f7bc8fa67ecc089b94d08be8b89e4d28fc Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 15:33:53 -0700 Subject: [PATCH 42/54] 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 d3b36a6a..afff10fb 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 66693aff7ca934f05870001864c58c02147fc814 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 15:50:41 -0700 Subject: [PATCH 43/54] 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 afff10fb..aca09e67 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 28bdf4b09e180ab71691deedd233e72e79d8f7c1 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 16:02:19 -0700 Subject: [PATCH 44/54] 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 aca09e67..d1b2c3b1 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 5b76dccf2bafd6686a75ba96cebf32cb746c8100 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 16:30:27 -0700 Subject: [PATCH 45/54] 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 d1b2c3b1..f11bc268 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 c7042e924d9bd5836a5ea013f7ec1174c079be4c Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 20 Jun 2025 17:37:20 -0700 Subject: [PATCH 46/54] 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 f11bc268..595459cd 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 694e14fb1d29dc3a15eb486a3882059f18dda1df Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 11:24:29 -0700 Subject: [PATCH 47/54] 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 595459cd..7b652c55 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 9bac3114..9654582a 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 90397071d748a76ff9dff3a7900c684343a70a49 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 11:27:34 -0700 Subject: [PATCH 48/54] 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 7b652c55..e118572c 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 0a4e02a077842e98e587010ec2c5c5d347b25bf5 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 11:28:31 -0700 Subject: [PATCH 49/54] 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 e118572c..e8a445f3 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 61c6ebf215e7a6d6fb5562744f4cfe17c2283760 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 11:44:02 -0700 Subject: [PATCH 50/54] 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 e8a445f3..82142b5c 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 2510813bf4392dd20375a2ac0cea4c5c7dcc4082 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 30 Jun 2025 13:29:11 -0700 Subject: [PATCH 51/54] 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 82142b5c..73b1c2a9 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 ca4dd9f4679f7053ce66ceca3125b4430981eacf Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 12 Aug 2025 15:29:02 -0700 Subject: [PATCH 52/54] 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 73b1c2a9..c5a6105f 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 bb19158e509fe61289a6600837a1876cf825d11e Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 12 Aug 2025 15:54:34 -0700 Subject: [PATCH 53/54] 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 c5a6105f..c91bff41 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 b634b4962624ced8fc0ce75ee7866f6d571e49c0 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Tue, 12 Aug 2025 15:33:32 -0700 Subject: [PATCH 54/54] Improve status reporting of e2e-test ci job. --- ci/input_files/build.yaml.tpl | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index c91bff41..73b1c2a9 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -263,27 +263,10 @@ e2e-test: {{- end }} e2e-test-status: - stage: e2e + stage: test 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 + - 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