aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2022-09-12 21:13:44 +0200
committerMauro Sardara <msardara@cisco.com>2022-09-12 21:13:50 +0200
commit59af9961ca6cc55dde96b83364d8388a0a8f68f4 (patch)
tree82395a139ffa497fa94dcff0a7e88c02de7a3d9f
parent6ee6b65ef03f8a479cccb2ae04e6b156f309f045 (diff)
fix(download_artifacts): use latest URLs from list retrieved from gerrit
Ref: HICN-781 Change-Id: Iaeaa57bb97599772611506444fcf806f17f7b9b0 Signed-off-by: Mauro Sardara <msardara@cisco.com>
-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}"