From 4bbc2bf703199f95757e112797c361e2af7e920d Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo <71768+gionn@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:35:48 +0200 Subject: [PATCH] Skip fetching existing artifacts (#24) --- scripts/fetch-artifact.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/fetch-artifact.sh b/scripts/fetch-artifact.sh index fa651327..a1017ca4 100755 --- a/scripts/fetch-artifact.sh +++ b/scripts/fetch-artifact.sh @@ -17,9 +17,14 @@ for i in $(find . -name artifacts.json -mindepth 2); do ARTIFACT_GROUP=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].group" $i) ARTIFACT_PATH=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].path" $i) ARTIFACT_BASEURL="https://nexus.alfresco.com/nexus/repository/${ARTIFACT_REPO}" + ARTIFACT_FINAL_PATH="${ARTIFACT_PATH}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}" + if [ -f "${ARTIFACT_FINAL_PATH}" ]; then + echo "Artifact $ARTIFACT_NAME-$ARTIFACT_VERSION already downloaded, skipping..." + continue + fi echo "Downloading $ARTIFACT_GROUP:$ARTIFACT_NAME $ARTIFACT_VERSION from $ARTIFACT_BASEURL" wget "${ARTIFACT_BASEURL}/${ARTIFACT_GROUP//\./\/}/${ARTIFACT_NAME}/${ARTIFACT_VERSION}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}" \ - -O ${ARTIFACT_PATH}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT} \ + -O "${ARTIFACT_FINAL_PATH}" \ --no-verbose done done