2121# * Python: Clone locally the github repo
2222# * Ruby: Direct from github source
2323# * WAF: Direct from github source, but not working, as this repo is now private
24- # * Python Lambda: Clone locally the github repo
24+ # * Python Lambda: Fetch from GitHub Actions artifact
2525# #########################################################################################
2626
2727set -eu
@@ -124,7 +124,8 @@ get_github_action_artifact() {
124124 SLUG=$1
125125 WORKFLOW=$2
126126 BRANCH=$3
127- PATTERN=$4
127+ ARTIFACT_NAME=$4
128+ PATTERN=$5
128129
129130 # query filter seems not to be working ??
130131 WORKFLOWS=$( curl --silent --fail --show-error -H " Authorization: token $GH_TOKEN " " https://api.github.com/repos/$SLUG /actions/workflows/$WORKFLOW /runs?per_page=100" )
@@ -134,8 +135,7 @@ get_github_action_artifact() {
134135 HTML_URL=$( echo $WORKFLOWS | jq -r " $QUERY | .html_url" )
135136 echo " Load artifact $HTML_URL "
136137 ARTIFACTS=$( curl --silent -H " Authorization: token $GH_TOKEN " $ARTIFACT_URL )
137-
138- ARCHIVE_URL=$( echo $ARTIFACTS | jq -r ' .artifacts[0].archive_download_url' )
138+ ARCHIVE_URL=$( echo $ARTIFACTS | jq -r --arg ARTIFACT_NAME " $ARTIFACT_NAME " ' .artifacts | map(select(.name | contains($ARTIFACT_NAME))).[0].archive_download_url' )
139139 echo " Load archive $ARCHIVE_URL "
140140
141141 curl -H " Authorization: token $GH_TOKEN " --output artifacts.zip -L $ARCHIVE_URL
@@ -256,7 +256,7 @@ elif [ "$TARGET" = "cpp" ]; then
256256
257257elif [ " $TARGET " = " cpp_httpd" ]; then
258258 assert_version_is_dev
259- get_github_action_artifact " DataDog/httpd-datadog" " dev.yml" " main" " mod_datadog.so"
259+ get_github_action_artifact " DataDog/httpd-datadog" " dev.yml" " main" " mod_datadog_artifact " " mod_datadog.so"
260260
261261elif [ " $TARGET " = " cpp_nginx" ]; then
262262 assert_version_is_dev
@@ -300,18 +300,7 @@ elif [ "$TARGET" = "python_lambda" ]; then
300300 assert_version_is_dev
301301 assert_target_branch_is_not_set
302302
303- rm -rf datadog-lambda-python/
304-
305- git clone https://github.com/DataDog/datadog-lambda-python.git
306- cd datadog-lambda-python
307- echo " Checking out the datadog_lambda ref"
308- git log -1 --format=%H
309-
310- # do not use `--depth 1`, setuptools_scm, does not like it
311- git clone https://github.com/DataDog/dd-trace-py.git
312- cd dd-trace-py
313- echo " Checking out the ddtrace ref"
314- git log -1 --format=%H
303+ get_github_action_artifact " DataDog/datadog-lambda-python" " build_layer.yml" " main" " datadog-lambda-python-3.13-amd64" " datadog_lambda_py-amd64-3.13.zip"
315304
316305else
317306 echo " Unknown target: $1 "
0 commit comments