mirror of
https://github.com/owncloud/ocis.git
synced 2025-04-18 23:44:07 +03:00
Merge pull request #11225 from owncloud/use-minio-to-check-cache
[tests-only][full-ci]Use minio client to check if cache exists
This commit is contained in:
commit
5ed7a3ef8b
26
.drone.star
26
.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",
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user