diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 828c3082..1e96634a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,12 +38,26 @@ jobs: source venv/bin/activate flake8 datadog_lambda/ + python-versions: + runs-on: ubuntu-24.04 + outputs: + versions: ${{ steps.load.outputs.versions }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Load Python versions + id: load + run: | + echo "versions=$(yq -o=json -I=0 '[.versions[] | .version]' python_versions.yaml)" >> "$GITHUB_OUTPUT" + unit-test: + needs: python-versions runs-on: ubuntu-24.04 strategy: max-parallel: 4 matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] + python-version: ${{ fromJSON(needs.python-versions.outputs.versions) }} steps: - name: Checkout diff --git a/.github/workflows/build_layer.yml b/.github/workflows/build_layer.yml index 4bbe073e..fee2593b 100644 --- a/.github/workflows/build_layer.yml +++ b/.github/workflows/build_layer.yml @@ -8,14 +8,30 @@ on: - "main" jobs: + python-versions: + runs-on: ubuntu-latest + outputs: + versions: ${{ steps.load.outputs.versions }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Load Python versions + id: load + run: | + # system_tests: false versions are skipped. dd-trace-py main no longer + # publishes wheels for them (currently 3.8). + echo "versions=$(yq -o=json -I=0 '[.versions[] | select(.system_tests != false) | .version]' python_versions.yaml)" >> "$GITHUB_OUTPUT" + build: + needs: python-versions runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} strategy: fail-fast: false matrix: arch: [arm64, amd64] - python_version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] + python_version: ${{ fromJSON(needs.python-versions.outputs.versions) }} steps: - name: Checkout diff --git a/ci/config.yaml b/ci/config.yaml index d37a0f31..749a96c6 100644 --- a/ci/config.yaml +++ b/ci/config.yaml @@ -5,8 +5,8 @@ outputFiles: - ci/build-pipeline.yaml datasources: - runtimes: - url: ci/datasources/runtimes.yaml + python_versions: + url: python_versions.yaml regions: url: ci/datasources/regions.yaml environments: diff --git a/ci/datasources/runtimes.yaml b/ci/datasources/runtimes.yaml deleted file mode 100644 index b750be67..00000000 --- a/ci/datasources/runtimes.yaml +++ /dev/null @@ -1,65 +0,0 @@ -runtimes: - - name: "python38" - python_version: "3.8" - arch: "amd64" - image: "3.8" - - name: "python38" - python_version: "3.8" - arch: "arm64" - image: "3.8" - - name: "python39" - python_version: "3.9" - arch: "amd64" - image: "3.9" - - name: "python39" - python_version: "3.9" - arch: "arm64" - image: "3.9" - - name: "python310" - python_version: "3.10" - arch: "amd64" - image: "3.10" - - name: "python310" - python_version: "3.10" - arch: "arm64" - image: "3.10" - - name: "python311" - python_version: "3.11" - arch: "amd64" - image: "3.11.6" - - name: "python311" - python_version: "3.11" - arch: "arm64" - image: "3.11.6" - - name: "python312" - python_version: "3.12" - arch: "amd64" - image: "3.12.0" - - name: "python312" - python_version: "3.12" - arch: "arm64" - image: "3.12.0" - - name: "python313" - python_version: "3.13" - arch: "amd64" - image: "3.13.0" - - name: "python313" - python_version: "3.13" - arch: "arm64" - image: "3.13.0" - - name: "python314" - python_version: "3.14" - arch: "amd64" - image: "3.14.0" - - name: "python314" - python_version: "3.14" - arch: "arm64" - image: "3.14.0" - - name: "python315" - python_version: "3.15" - arch: "amd64" - image: "3.15.0" - - name: "python315" - python_version: "3.15" - arch: "arm64" - image: "3.15.0" diff --git a/ci/input_files/build.yaml.tpl b/ci/input_files/build.yaml.tpl index cf89c5ea..8e37420a 100644 --- a/ci/input_files/build.yaml.tpl +++ b/ci/input_files/build.yaml.tpl @@ -1,4 +1,8 @@ {{- $e2e_region := "us-west-2" -}} +{{- $runtimes := coll.Slice -}} +{{- range $py := (ds "python_versions").versions }}{{ range $arch := coll.Slice "amd64" "arm64" }} +{{- $runtimes = $runtimes | coll.Append (dict "name" (printf "python%s" ($py.version | strings.ReplaceAll "." "")) "python_version" $py.version "arch" $arch "image" $py.image) }} +{{- end }}{{ end -}} stages: - build @@ -26,7 +30,7 @@ default: - apt-get install nodejs -y - npm install --global yarn -{{ range $runtime := (ds "runtimes").runtimes }} +{{ range $runtime := $runtimes }} # TODO(astuyve) - figure out python build cache .{{ $runtime.name }}-{{ $runtime.arch }}-cache: &{{ $runtime.name }}-{{ $runtime.arch }}-cache @@ -208,7 +212,7 @@ publish-pypi-package: rules: - if: '$CI_COMMIT_TAG =~ /^v.*/' when: manual - needs: {{ range $runtime := (ds "runtimes").runtimes }} + needs: {{ range $runtime := $runtimes }} - sign-layer ({{ $runtime.name }}-{{ $runtime.arch}}) {{- end }} script: @@ -219,11 +223,11 @@ layer bundle: tags: ["arch:amd64"] image: registry.ddbuild.io/images/docker:20.10 needs: - {{ range (ds "runtimes").runtimes }} + {{ range $runtimes }} - build-layer ({{ .name }}-{{ .arch }}) {{ end }} dependencies: - {{ range (ds "runtimes").runtimes }} + {{ range $runtimes }} - build-layer ({{ .name }}-{{ .arch }}) {{ end }} artifacts: @@ -243,11 +247,11 @@ signed layer bundle: rules: - if: '$CI_COMMIT_TAG =~ /^v.*/' needs: - {{ range (ds "runtimes").runtimes }} + {{ range $runtimes }} - sign-layer ({{ .name }}-{{ .arch }}) {{ end }} dependencies: - {{ range (ds "runtimes").runtimes }} + {{ range $runtimes }} - sign-layer ({{ .name }}-{{ .arch }}) {{ end }} artifacts: @@ -272,13 +276,13 @@ e2e-test: variables: LANGUAGES_SUBSET: python # These env vars are inherited from the dotenv reports of the publish-layer jobs - {{- range (ds "runtimes").runtimes }} + {{- range $runtimes }} {{- if eq .arch "amd64" }} {{- $version := print (.name | strings.Trim "python") }} PYTHON_{{ $version }}_VERSION: $PYTHON_{{ $version }}_VERSION {{- end }} {{- end }} - needs: {{ range (ds "runtimes").runtimes }} + needs: {{ range $runtimes }} {{- if eq .arch "amd64" }} - "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" {{- end }} diff --git a/ci/publish_layers.sh b/ci/publish_layers.sh index 573b8028..06f289bc 100755 --- a/ci/publish_layers.sh +++ b/ci/publish_layers.sh @@ -10,78 +10,10 @@ set -e # Available runtimes: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html -AWS_CLI_PYTHON_VERSIONS=( - "python3.8" - "python3.8" - "python3.9" - "python3.9" - "python3.10" - "python3.10" - "python3.11" - "python3.11" - "python3.12" - "python3.12" - "python3.13" - "python3.13" - "python3.14" - "python3.14" - "python3.15" - "python3.15" -) -PYTHON_VERSIONS=( - "3.8-amd64" - "3.8-arm64" - "3.9-amd64" - "3.9-arm64" - "3.10-amd64" - "3.10-arm64" - "3.11-amd64" - "3.11-arm64" - "3.12-amd64" - "3.12-arm64" - "3.13-amd64" - "3.13-arm64" - "3.14-amd64" - "3.14-arm64" - "3.15-amd64" - "3.15-arm64" -) -LAYER_PATHS=( - ".layers/datadog_lambda_py-amd64-3.8.zip" - ".layers/datadog_lambda_py-arm64-3.8.zip" - ".layers/datadog_lambda_py-amd64-3.9.zip" - ".layers/datadog_lambda_py-arm64-3.9.zip" - ".layers/datadog_lambda_py-amd64-3.10.zip" - ".layers/datadog_lambda_py-arm64-3.10.zip" - ".layers/datadog_lambda_py-amd64-3.11.zip" - ".layers/datadog_lambda_py-arm64-3.11.zip" - ".layers/datadog_lambda_py-amd64-3.12.zip" - ".layers/datadog_lambda_py-arm64-3.12.zip" - ".layers/datadog_lambda_py-amd64-3.13.zip" - ".layers/datadog_lambda_py-arm64-3.13.zip" - ".layers/datadog_lambda_py-amd64-3.14.zip" - ".layers/datadog_lambda_py-arm64-3.14.zip" - ".layers/datadog_lambda_py-amd64-3.15.zip" - ".layers/datadog_lambda_py-arm64-3.15.zip" -) -LAYERS=( - "Datadog-Python38" - "Datadog-Python38-ARM" - "Datadog-Python39" - "Datadog-Python39-ARM" - "Datadog-Python310" - "Datadog-Python310-ARM" - "Datadog-Python311" - "Datadog-Python311-ARM" - "Datadog-Python312" - "Datadog-Python312-ARM" - "Datadog-Python313" - "Datadog-Python313-ARM" - "Datadog-Python314" - "Datadog-Python314-ARM" - "Datadog-Python315" - "Datadog-Python315-ARM" -) +source "$(dirname "${BASH_SOURCE[0]}")/../scripts/python_versions.sh" +AWS_CLI_PYTHON_VERSIONS=("${LAYER_RUNTIMES[@]}") +LAYERS=("${LAYER_NAMES[@]}") +PYTHON_VERSIONS=("${LAYER_KEYS[@]}") STAGES=('prod', 'sandbox', 'staging', 'gov-staging', 'gov-prod') printf "Starting script...\n\n" diff --git a/python_versions.yaml b/python_versions.yaml new file mode 100644 index 00000000..e29e2e70 --- /dev/null +++ b/python_versions.yaml @@ -0,0 +1,31 @@ +# Supported Python versions for the Lambda library. +# +# Layer builds, publish scripts, tests, and CI read this file. Add a version +# here and those pick it up. The README and the pyproject.toml classifiers are +# the lists still maintained by hand. +# +# version: CPython minor version. +# image: GitLab CI image tag (registry.ddbuild.io/images/mirror/python). +# preview: AWS has not published a SAM build image yet. Layer builds use +# public.ecr.aws/lambda/python:-preview. Default false. +# system_tests: Set false to skip the GitHub system-tests layer build. That +# job installs a dd-trace-py main-branch wheel, which no longer +# publishes 3.8 wheels. Default true. +versions: + - version: "3.8" + image: "3.8" + system_tests: false + - version: "3.9" + image: "3.9" + - version: "3.10" + image: "3.10" + - version: "3.11" + image: "3.11.6" + - version: "3.12" + image: "3.12.0" + - version: "3.13" + image: "3.13.0" + - version: "3.14" + image: "3.14.0" + - version: "3.15" + image: "3.15.0" diff --git a/scripts/add_new_region.sh b/scripts/add_new_region.sh index 62367e5f..411b3aba 100755 --- a/scripts/add_new_region.sh +++ b/scripts/add_new_region.sh @@ -12,42 +12,8 @@ set -e OLD_REGION='us-east-1' -LAYER_NAMES=( - "Datadog-Python38" - "Datadog-Python38-ARM" - "Datadog-Python39" - "Datadog-Python39-ARM" - "Datadog-Python310" - "Datadog-Python310-ARM" - "Datadog-Python311" - "Datadog-Python311-ARM" - "Datadog-Python312" - "Datadog-Python312-ARM" - "Datadog-Python313" - "Datadog-Python313-ARM" - "Datadog-Python314" - "Datadog-Python314-ARM" - "Datadog-Python315" - "Datadog-Python315-ARM" -) -PYTHON_VERSIONS_FOR_AWS_CLI=( - "python3.8" - "python3.8" - "python3.9" - "python3.9" - "python3.10" - "python3.10" - "python3.11" - "python3.11" - "python3.12" - "python3.12" - "python3.13" - "python3.13" - "python3.14" - "python3.14" - "python3.15" - "python3.15" -) +source "$(dirname "${BASH_SOURCE[0]}")/python_versions.sh" +PYTHON_VERSIONS_FOR_AWS_CLI=("${LAYER_RUNTIMES[@]}") NEW_REGION=$1 publish_layer() { diff --git a/scripts/build_layers.sh b/scripts/build_layers.sh index a4c7662e..6954184a 100755 --- a/scripts/build_layers.sh +++ b/scripts/build_layers.sh @@ -35,12 +35,8 @@ set -e LAYER_DIR=".layers" LAYER_FILES_PREFIX="datadog_lambda_py" -AVAILABLE_PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13" "3.14" "3.15") -# Preview runtimes. AWS has not published a SAM build image for these, so the -# Lambda preview base image is used instead. The Dockerfile installs the -# compiler toolchain that image is missing. -PREVIEW_PYTHON_VERSIONS=() -ALL_PYTHON_VERSIONS=("${AVAILABLE_PYTHON_VERSIONS[@]}" "${PREVIEW_PYTHON_VERSIONS[@]}") +# Versions and the preview flag live in python_versions.yaml. +source "$(dirname "${BASH_SOURCE[0]}")/python_versions.sh" AVAILABLE_ARCHS=("arm64" "amd64") if [ -n "$ARCH" ]; then @@ -74,11 +70,11 @@ fi # Determine which Python versions to build layers for if [ -z "$PYTHON_VERSION" ]; then echo "Python version not specified, building layers for all versions." - PYTHON_VERSIONS=("${ALL_PYTHON_VERSIONS[@]}") + PYTHON_VERSIONS=("${SUPPORTED_PYTHON_VERSIONS[@]}") else echo "Python version specified: $PYTHON_VERSION" - if [[ ! " ${ALL_PYTHON_VERSIONS[@]} " =~ " ${PYTHON_VERSION} " ]]; then - echo "Python version $PYTHON_VERSION is not a valid option. Choose from: ${ALL_PYTHON_VERSIONS[@]}" + if [[ ! " ${SUPPORTED_PYTHON_VERSIONS[@]} " =~ " ${PYTHON_VERSION} " ]]; then + echo "Python version $PYTHON_VERSION is not a valid option. Choose from: ${SUPPORTED_PYTHON_VERSIONS[*]}" echo "" echo "EXITING SCRIPT." exit 1 @@ -108,7 +104,8 @@ function docker_build_zip { destination=$(make_path_absolute $2) arch=$3 - # Preview runtimes have no SAM build image yet. See PREVIEW_PYTHON_VERSIONS. + # Preview runtimes have no SAM build image yet. The Dockerfile installs + # the compiler toolchain that the Lambda preview image is missing. if [[ " ${PREVIEW_PYTHON_VERSIONS[*]} " =~ " ${1} " ]]; then image="public.ecr.aws/lambda/python:${1}-preview" else diff --git a/scripts/list_layers.sh b/scripts/list_layers.sh index 352c5b7a..68617283 100755 --- a/scripts/list_layers.sh +++ b/scripts/list_layers.sh @@ -10,24 +10,7 @@ set -e -LAYER_NAMES=( - "Datadog-Python38" - "Datadog-Python38-ARM" - "Datadog-Python39" - "Datadog-Python39-ARM" - "Datadog-Python310" - "Datadog-Python310-ARM" - "Datadog-Python311" - "Datadog-Python311-ARM" - "Datadog-Python312" - "Datadog-Python312-ARM" - "Datadog-Python313" - "Datadog-Python313-ARM" - "Datadog-Python314" - "Datadog-Python314-ARM" - "Datadog-Python315" - "Datadog-Python315-ARM" -) +source "$(dirname "${BASH_SOURCE[0]}")/python_versions.sh" AVAILABLE_REGIONS=$(aws ec2 describe-regions | jq -r '.[] | .[] | .RegionName') LAYERS_MISSING_REGIONS=() diff --git a/scripts/publish_govcloud.sh b/scripts/publish_govcloud.sh index db79a200..1ac6d0eb 100755 --- a/scripts/publish_govcloud.sh +++ b/scripts/publish_govcloud.sh @@ -90,13 +90,15 @@ else fi fi +source "$(dirname "${BASH_SOURCE[0]}")/python_versions.sh" + for region in $REGIONS do echo "Starting publishing layers for region $region..." export REGION=$region - for python_version in "3.8" "3.9" "3.10" "3.11" "3.12" "3.13" "3.14" "3.15"; do + for python_version in "${SUPPORTED_PYTHON_VERSIONS[@]}"; do for arch in "amd64" "arm64"; do export PYTHON_VERSION=$python_version export ARCH=$arch diff --git a/scripts/publish_layers.sh b/scripts/publish_layers.sh index 12ba05a4..ac76fed2 100755 --- a/scripts/publish_layers.sh +++ b/scripts/publish_layers.sh @@ -13,60 +13,9 @@ set -e # Makes sure any subprocesses will be terminated with this process trap "pkill -P $$; exit 1;" INT -PYTHON_VERSIONS_FOR_AWS_CLI=( - "python3.8" - "python3.8" - "python3.9" - "python3.9" - "python3.10" - "python3.10" - "python3.11" - "python3.11" - "python3.12" - "python3.12" - "python3.13" - "python3.13" - "python3.14" - "python3.14" - "python3.15" - "python3.15" -) -LAYER_PATHS=( - ".layers/datadog_lambda_py-amd64-3.8.zip" - ".layers/datadog_lambda_py-arm64-3.8.zip" - ".layers/datadog_lambda_py-amd64-3.9.zip" - ".layers/datadog_lambda_py-arm64-3.9.zip" - ".layers/datadog_lambda_py-amd64-3.10.zip" - ".layers/datadog_lambda_py-arm64-3.10.zip" - ".layers/datadog_lambda_py-amd64-3.11.zip" - ".layers/datadog_lambda_py-arm64-3.11.zip" - ".layers/datadog_lambda_py-amd64-3.12.zip" - ".layers/datadog_lambda_py-arm64-3.12.zip" - ".layers/datadog_lambda_py-amd64-3.13.zip" - ".layers/datadog_lambda_py-arm64-3.13.zip" - ".layers/datadog_lambda_py-amd64-3.14.zip" - ".layers/datadog_lambda_py-arm64-3.14.zip" - ".layers/datadog_lambda_py-amd64-3.15.zip" - ".layers/datadog_lambda_py-arm64-3.15.zip" -) -AVAILABLE_LAYERS=( - "Datadog-Python38" - "Datadog-Python38-ARM" - "Datadog-Python39" - "Datadog-Python39-ARM" - "Datadog-Python310" - "Datadog-Python310-ARM" - "Datadog-Python311" - "Datadog-Python311-ARM" - "Datadog-Python312" - "Datadog-Python312-ARM" - "Datadog-Python313" - "Datadog-Python313-ARM" - "Datadog-Python314" - "Datadog-Python314-ARM" - "Datadog-Python315" - "Datadog-Python315-ARM" -) +source "$(dirname "${BASH_SOURCE[0]}")/python_versions.sh" +PYTHON_VERSIONS_FOR_AWS_CLI=("${LAYER_RUNTIMES[@]}") +AVAILABLE_LAYERS=("${LAYER_NAMES[@]}") AVAILABLE_REGIONS=$(aws ec2 describe-regions | jq -r '.[] | .[] | .RegionName') BATCH_SIZE=60 diff --git a/scripts/python_versions.sh b/scripts/python_versions.sh new file mode 100644 index 00000000..4a8e704a --- /dev/null +++ b/scripts/python_versions.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Unless explicitly stated otherwise all files in this repository are licensed +# under the Apache License Version 2.0. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2026 Datadog, Inc. + +# Reads python_versions.yaml. Source this file: +# +# source scripts/python_versions.sh +# +# Sets: +# SUPPORTED_PYTHON_VERSIONS 3.8 3.9 ... +# PREVIEW_PYTHON_VERSIONS versions with preview: true +# and, one entry per version for amd64 then arm64: +# LAYER_NAMES Datadog-Python38, Datadog-Python38-ARM, ... +# LAYER_RUNTIMES python3.8, python3.8, ... +# LAYER_KEYS 3.8-amd64, 3.8-arm64, ... +# LAYER_ZIPS datadog_lambda_py-amd64-3.8.zip, ... +# LAYER_PATHS .layers/datadog_lambda_py-amd64-3.8.zip, ... + +_pv_file="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/python_versions.yaml" + +SUPPORTED_PYTHON_VERSIONS=($(sed -nE 's/^[[:space:]]*- version:[[:space:]]*"?([0-9]+\.[0-9]+)"?.*/\1/p' "$_pv_file")) +PREVIEW_PYTHON_VERSIONS=($(awk -F'"' '/- version:/{v=$2} /^[[:space:]]*preview:[[:space:]]*true/{print v}' "$_pv_file")) +if [ ${#SUPPORTED_PYTHON_VERSIONS[@]} -eq 0 ]; then + echo "no python versions found in $_pv_file" >&2 + return 1 +fi + +LAYER_NAMES=() +LAYER_RUNTIMES=() +LAYER_KEYS=() +LAYER_ZIPS=() +for _pv_version in "${SUPPORTED_PYTHON_VERSIONS[@]}"; do + for _pv_arch in amd64 arm64; do + _pv_suffix="" + [ "$_pv_arch" = arm64 ] && _pv_suffix="-ARM" + LAYER_NAMES+=("Datadog-Python${_pv_version//./}${_pv_suffix}") + LAYER_RUNTIMES+=("python${_pv_version}") + LAYER_KEYS+=("${_pv_version}-${_pv_arch}") + LAYER_ZIPS+=("datadog_lambda_py-${_pv_arch}-${_pv_version}.zip") + done +done +LAYER_PATHS=("${LAYER_ZIPS[@]/#/.layers/}") +unset _pv_file _pv_version _pv_arch _pv_suffix diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index e2c2f736..dff7ac13 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -23,26 +23,28 @@ script_utc_start_time=$(date -u +"%Y%m%dT%H%M%S") mismatch_found=false -# Format : +# Format of each python array: # [0]: serverless runtime name # [1]: python version # [2]: random 8-character ID to avoid collisions with other runs -python38=("python3.8" "3.8" $(xxd -l 4 -c 4 -p < /dev/random)) -python39=("python3.9" "3.9" $(xxd -l 4 -c 4 -p < /dev/random)) -python310=("python3.10" "3.10" $(xxd -l 4 -c 4 -p < /dev/random)) -python311=("python3.11" "3.11" $(xxd -l 4 -c 4 -p < /dev/random)) -python312=("python3.12" "3.12" $(xxd -l 4 -c 4 -p < /dev/random)) -python313=("python3.13" "3.13" $(xxd -l 4 -c 4 -p < /dev/random)) -python314=("python3.14" "3.14" $(xxd -l 4 -c 4 -p < /dev/random)) -python315=("python3.15" "3.15" $(xxd -l 4 -c 4 -p < /dev/random)) +source "$scripts_dir/python_versions.sh" -PARAMETERS_SETS=("python38" "python39" "python310" "python311" "python312" "python313" "python314" "python315") +PARAMETERS_SETS=() +for version in "${SUPPORTED_PYTHON_VERSIONS[@]}"; do + key="python${version//./}" + declare -a "${key}=(python${version} ${version} $(xxd -l 4 -c 4 -p < /dev/random))" + PARAMETERS_SETS+=("$key") +done if [ -z "$RUNTIME_PARAM" ]; then echo "Python version not specified, running for all python versions." else - RUNTIME_PARAM_NO_DOT=$(echo $RUNTIME_PARAM | sed 's/\.//') + RUNTIME_PARAM_NO_DOT=${RUNTIME_PARAM//./} echo "Python version is specified: $RUNTIME_PARAM" + if [[ ! " ${SUPPORTED_PYTHON_VERSIONS[*]} " =~ " ${RUNTIME_PARAM} " ]]; then + echo "Python version $RUNTIME_PARAM is not a valid option. Choose from: ${SUPPORTED_PYTHON_VERSIONS[*]}" + exit 1 + fi PARAMETERS_SETS=(python${RUNTIME_PARAM_NO_DOT}) BUILD_LAYER_VERSION=python$RUNTIME_PARAM_NO_DOT[1] fi diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index d9a0b2ba..ee18fce2 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -8,9 +8,9 @@ # Run unit tests in Docker set -e -PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13" "3.14" "3.15") +source "$(dirname "${BASH_SOURCE[0]}")/python_versions.sh" -for python_version in "${PYTHON_VERSIONS[@]}" +for python_version in "${SUPPORTED_PYTHON_VERSIONS[@]}" do echo "Running tests against python${python_version}" docker build -t datadog-lambda-python-test:$python_version \ diff --git a/scripts/sign_layers.sh b/scripts/sign_layers.sh index c014e3a6..340e86a7 100755 --- a/scripts/sign_layers.sh +++ b/scripts/sign_layers.sh @@ -8,24 +8,8 @@ set -e LAYER_DIR=".layers" -LAYER_FILES=( - "datadog_lambda_py-amd64-3.8.zip" - "datadog_lambda_py-arm64-3.8.zip" - "datadog_lambda_py-amd64-3.9.zip" - "datadog_lambda_py-arm64-3.9.zip" - "datadog_lambda_py-amd64-3.10.zip" - "datadog_lambda_py-arm64-3.10.zip" - "datadog_lambda_py-amd64-3.11.zip" - "datadog_lambda_py-arm64-3.11.zip" - "datadog_lambda_py-amd64-3.12.zip" - "datadog_lambda_py-arm64-3.12.zip" - "datadog_lambda_py-amd64-3.13.zip" - "datadog_lambda_py-arm64-3.13.zip" - "datadog_lambda_py-amd64-3.14.zip" - "datadog_lambda_py-arm64-3.14.zip" - "datadog_lambda_py-amd64-3.15.zip" - "datadog_lambda_py-arm64-3.15.zip" -) +source "$(dirname "${BASH_SOURCE[0]}")/python_versions.sh" +LAYER_FILES=("${LAYER_ZIPS[@]}") SIGNING_PROFILE_NAME="DatadogLambdaSigningProfile" # Check account parameter