mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-04 15:43:54 -04:00
archive go/bin content and push it as cache
fix cache source
This commit is contained in:
25
.drone.star
25
.drone.star
@@ -43,6 +43,8 @@ dirs = {
|
||||
"zip": "/drone/src/zip",
|
||||
"webZip": "/drone/src/zip/web.tar.gz",
|
||||
"webPnpmZip": "/drone/src/zip/pnpm-store.tar.gz",
|
||||
"gobinTar": "go-bin.tar.gz",
|
||||
"gobinTarPath": "/drone/src/go-bin.tar.gz",
|
||||
"ocisConfig": "tests/config/drone/ocis-config.json",
|
||||
"ocis": "/srv/app/tmp/ocis",
|
||||
"ocisRevaDataRoot": "/srv/app/tmp/ocis/owncloud/data",
|
||||
@@ -400,7 +402,7 @@ def checkGoBinCache():
|
||||
},
|
||||
},
|
||||
"commands": [
|
||||
"bash -x %s/tests/config/drone/check_go_bin_cache.sh %s" % (dirs["base"], dirs["base"]),
|
||||
"bash -x %s/tests/config/drone/check_go_bin_cache.sh %s %s" % (dirs["base"], dirs["base"], dirs["gobinTar"]),
|
||||
],
|
||||
}]
|
||||
|
||||
@@ -414,6 +416,14 @@ def cacheGoBin():
|
||||
],
|
||||
"volumes": [stepVolumeGo],
|
||||
},
|
||||
{
|
||||
"name": "archive-go-bin",
|
||||
"image": OC_UBUNTU,
|
||||
"commands": [
|
||||
"tar -czvf %s -C /go/bin ." % dirs["gobinTarPath"],
|
||||
],
|
||||
"volumes": [stepVolumeGo],
|
||||
},
|
||||
{
|
||||
"name": "cache-go-bin",
|
||||
"image": MINIO_MC,
|
||||
@@ -424,7 +434,7 @@ def cacheGoBin():
|
||||
"BINGO_HASH=$(cat %s/.bingo_hash)" % dirs["base"],
|
||||
# cache using the minio client to the public bucket (long term bucket)
|
||||
"mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
|
||||
"mc cp -r /go/bin s3/$CACHE_BUCKET/ocis/go-bin/$BINGO_HASH",
|
||||
"mc cp -r %s s3/$CACHE_BUCKET/ocis/go-bin/$BINGO_HASH" % (dirs["gobinTarPath"]),
|
||||
],
|
||||
"volumes": [stepVolumeGo],
|
||||
},
|
||||
@@ -439,7 +449,16 @@ def restoreGoBinCache():
|
||||
"commands": [
|
||||
"BINGO_HASH=$(cat %s/.bingo/* | sha256sum | cut -d ' ' -f 1)" % dirs["base"],
|
||||
"mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
|
||||
"mc cp -r -a s3/$CACHE_BUCKET/ocis/go-bin/$BINGO_HASH/bin /go",
|
||||
"mc cp -r -a s3/$CACHE_BUCKET/ocis/go-bin/$BINGO_HASH/%s %s" % (dirs["gobinTar"], dirs["base"]),
|
||||
],
|
||||
"volumes": [stepVolumeGo],
|
||||
},
|
||||
{
|
||||
"name": "extract-go-bin-cache",
|
||||
"image": OC_UBUNTU,
|
||||
"commands": [
|
||||
"mkdir -p /go/bin",
|
||||
"tar -xvf %s -C /go/bin" % dirs["gobinTarPath"],
|
||||
"chmod +x /go/bin/*",
|
||||
],
|
||||
"volumes": [stepVolumeGo],
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#
|
||||
# $1 - root path where .bingo resides
|
||||
# $2 - name of the cache item
|
||||
#
|
||||
|
||||
ROOT_PATH="$1"
|
||||
@@ -13,7 +14,7 @@ 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/bin/golangci-lint"
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user