From 59af9961ca6cc55dde96b83364d8388a0a8f68f4 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Mon, 12 Sep 2022 21:13:44 +0200 Subject: fix(download_artifacts): use latest URLs from list retrieved from gerrit Ref: HICN-781 Change-Id: Iaeaa57bb97599772611506444fcf806f17f7b9b0 Signed-off-by: Mauro Sardara --- scripts/functions.sh | 7 +++++-- 1 file 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}" -- cgit 1.2.3-korg