diff --git a/.drone.star b/.drone.star index 505160b8559..ceb202a5511 100644 --- a/.drone.star +++ b/.drone.star @@ -567,16 +567,10 @@ def getGoBinForTesting(ctx): def checkGoBinCache(): return [{ "name": "check-go-bin-cache", - "image": OC_UBUNTU, - "environment": { - "CACHE_ENDPOINT": { - "from_secret": "cache_s3_server", - }, - "CACHE_BUCKET": { - "from_secret": "cache_s3_bucket", - }, - }, + "image": MINIO_MC, + "environment": MINIO_MC_ENV, "commands": [ + "mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY", "bash -x %s/tests/config/drone/check_go_bin_cache.sh %s %s" % (dirs["base"], dirs["base"], dirs["gobinTar"]), ], }] @@ -3004,17 +2998,11 @@ def getDroneEnvAndCheckScript(ctx): def checkForWebCache(name): return { "name": "check-for-%s-cache" % name, - "image": OC_UBUNTU, - "environment": { - "CACHE_ENDPOINT": { - "from_secret": "cache_s3_server", - }, - "CACHE_BUCKET": { - "from_secret": "cache_s3_bucket", - }, - }, + "image": MINIO_MC, + "environment": MINIO_MC_ENV, "commands": [ - "bash -x check_web_cache.sh %s" % name, + "mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY", + "bash -x check_web_cache.sh web.tar.gz", ], } diff --git a/tests/config/drone/check_go_bin_cache.sh b/tests/config/drone/check_go_bin_cache.sh index 099a7794292..dac1e142984 100644 --- a/tests/config/drone/check_go_bin_cache.sh +++ b/tests/config/drone/check_go_bin_cache.sh @@ -7,21 +7,23 @@ ROOT_PATH="$1" if [ -z "$1" ]; then - ROOT_PATH="/drone/src" + ROOT_PATH="/drone/src" fi BINGO_DIR="$ROOT_PATH/.bingo" # generate hash of a .bingo folder BINGO_HASH=$(cat "$BINGO_DIR"/* | sha256sum | cut -d ' ' -f 1) -URL="$CACHE_ENDPOINT/$CACHE_BUCKET/ocis/go-bin/$BINGO_HASH/$2" -if curl --output /dev/null --silent --head --fail "$URL"; then - echo "[INFO] Go bin cache with has '$BINGO_HASH' exists." - # https://discourse.drone.io/t/how-to-exit-a-pipeline-early-without-failing/3951 - # exit a Pipeline early without failing - exit 78 +go_cache=$(mc find s3/$CACHE_BUCKET/ocis/go-bin/$BINGO_HASH/$2 2>&1 | grep 'Object does not exist') + +if [[ -z "$go_cache" ]] +then + echo "[INFO] Go bin cache with has '$BINGO_HASH' exists." + # https://discourse.drone.io/t/how-to-exit-a-pipeline-early-without-failing/3951 + # exit a Pipeline early without failing + exit 78 else - # stored hash of a .bingo folder to '.bingo_hash' file - echo "$BINGO_HASH" >"$ROOT_PATH/.bingo_hash" - echo "[INFO] Go bin cache with has '$BINGO_HASH' does not exist." + # stored hash of a .bingo folder to '.bingo_hash' file + echo "$BINGO_HASH" >"$ROOT_PATH/.bingo_hash" + echo "[INFO] Go bin cache with has '$BINGO_HASH' does not exist." fi diff --git a/tests/config/drone/check_web_cache.sh b/tests/config/drone/check_web_cache.sh index 875be723d23..752dac0470b 100644 --- a/tests/config/drone/check_web_cache.sh +++ b/tests/config/drone/check_web_cache.sh @@ -9,17 +9,13 @@ if [ -z "$1" ]; then fi echo "Checking web version - $WEB_COMMITID in cache" +web_cache=$(mc find s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/$1 2>&1 | grep 'Object does not exist') -URL="$CACHE_ENDPOINT/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/$1.tar.gz" - -echo "Checking for the web cache at '$URL'." - -if curl --output /dev/null --silent --head --fail "$URL" -then - echo "$1 cache with commit id $WEB_COMMITID already available." - # https://discourse.drone.io/t/how-to-exit-a-pipeline-early-without-failing/3951 - # exit a Pipeline early without failing - exit 78 +if [[ -z "$web_cache" ]]; then + echo "$1 cache with commit id $WEB_COMMITID already available." + # https://discourse.drone.io/t/how-to-exit-a-pipeline-early-without-failing/3951 + # exit a Pipeline early without failing + exit 78 else - echo "$1 cache with commit id $WEB_COMMITID was not available." + echo "$1 cache with commit id $WEB_COMMITID was not available." fi