aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Mantellini <angelo.mantellini@cisco.com>2022-09-13 09:03:12 +0000
committerGerrit Code Review <gerrit@fd.io>2022-09-13 09:03:12 +0000
commitb7f57d0f689d073340994cdade532462ca264d3b (patch)
tree7738af3385c1ec1cc6e4d18a183709a94d2f3a5d
parenta4c11477fee6f77440dc5353595f3c1390f765b5 (diff)
parent59af9961ca6cc55dde96b83364d8388a0a8f68f4 (diff)
Merge "fix(download_artifacts): use latest URLs from list retrieved from gerrit"
-rw-r--r--scripts/functions.sh7
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}"