diff --git a/.cirrus.yml b/.cirrus.yml index 9c720e5f1..6752de319 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -80,13 +80,14 @@ private_scan_task: - echo "docker.includes=${tag}" >> .cirrus/wss-unified-agent.config scan_script: - echo "Scan the ${STAGING_IMAGE_NAME}:${tag} image supporting linux/${platform}" - - docker pull --platform linux/${platform} "${STAGING_IMAGE_NAME}:${tag}" + - .cirrus/pull.sh ${STAGING_IMAGE_NAME} ${tag} ${platform} - java -jar wss-unified-agent.jar -c .cirrus/wss-unified-agent.config -apiKey $MEND_API_KEY -product ${WS_PRODUCTNAME} -project ${STAGING_IMAGE_NAME}:${tag} -wss.url ${WS_WSS_URL} -docker.scanImages true depends_on: multi_arch_build public_scan_task: only_if: $CIRRUS_CRON == 'nightly-mend-scan' env: + platform: amd64 MEND_API_KEY: VAULT[development/kv/data/mend data.apikey] WS_WSS_URL: https://saas-eu.whitesourcesoftware.com/agent matrix: @@ -106,6 +107,7 @@ public_scan_task: scan_script: - echo "Scan the ${PUBLIC_IMAGE_NAME}:${tag} image" - docker pull "${PUBLIC_IMAGE_NAME}:${tag}" + - .cirrus/pull.sh ${PUBLIC_IMAGE_NAME} ${tag} ${platform} - java -jar wss-unified-agent.jar -c .cirrus/wss-unified-agent.config -apiKey $MEND_API_KEY -product ${WS_PRODUCTNAME} -project ${PUBLIC_IMAGE_NAME}:${tag} -wss.url ${WS_WSS_URL} -docker.scanImages true multi_arch_test_task: diff --git a/.cirrus/pull.sh b/.cirrus/pull.sh new file mode 100755 index 000000000..b38bcbf6d --- /dev/null +++ b/.cirrus/pull.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +IMAGE_NAME=${1} +tag=${2} +platform=${3} + +for i in $(seq 1 3); do + if docker pull --platform linux/"${platform}" "${IMAGE_NAME}:${tag}"; then + exit 0 + fi + echo "[${i}/3] Retrying to pull image ${IMAGE_NAME}:${tag}..." + sleep 5 +done +echo "[Error]: Failed to pull image ${IMAGE_NAME}:${tag}" +exit 1