diff options
-rw-r--r-- | scripts/functions.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/functions.sh b/scripts/functions.sh index e5484b02e..d6d8bf84e 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -81,13 +81,16 @@ function download_artifacts() { [[ -n ${GERRIT_PATCHSET_NUMBER:-} ]]; then # Retrieve the Jenkins URL of the build relative to this PATCHSET - JENKINS_URL=$( + JENKINS_URLS=$( curl -s "https://${GERRIT_HOST}/r/changes/${GERRIT_CHANGE_NUMBER}/detail" | tail -n +2 | jq '.messages[].message?' | grep -E "Patch Set ${GERRIT_PATCHSET_NUMBER}:.*hicn-verify-build.*build_success-hicn-ubuntu2004-$(uname -m)" | grep -Eo "https?://jenkins.fd.io/job/hicn-verify-build-hicn-ubuntu2004-$(uname -m)[^ ]+" ) - ARTIFACTS_URL="${JENKINS_URL}/artifact/packages/*zip*/packages.zip" + + # Transform string to array and get last + JENKINS_URLS_ARRAY=(${JENKINS_URLS}) + ARTIFACTS_URL="${JENKINS_URLS_ARRAY[-1]}/artifact/packages/*zip*/packages.zip" # Download artifacts curl -o "${SCRIPT_PATH}/../packages.zip" -L "${ARTIFACTS_URL}" |