mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-04 18:14:53 -05:00
archive go/bin content and push it as cache
fix cache source
This commit is contained in:
+22
-3
@@ -43,6 +43,8 @@ dirs = {
|
|||||||
"zip": "/drone/src/zip",
|
"zip": "/drone/src/zip",
|
||||||
"webZip": "/drone/src/zip/web.tar.gz",
|
"webZip": "/drone/src/zip/web.tar.gz",
|
||||||
"webPnpmZip": "/drone/src/zip/pnpm-store.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",
|
"ocisConfig": "tests/config/drone/ocis-config.json",
|
||||||
"ocis": "/srv/app/tmp/ocis",
|
"ocis": "/srv/app/tmp/ocis",
|
||||||
"ocisRevaDataRoot": "/srv/app/tmp/ocis/owncloud/data",
|
"ocisRevaDataRoot": "/srv/app/tmp/ocis/owncloud/data",
|
||||||
@@ -400,7 +402,7 @@ def checkGoBinCache():
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"commands": [
|
"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],
|
"volumes": [stepVolumeGo],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "archive-go-bin",
|
||||||
|
"image": OC_UBUNTU,
|
||||||
|
"commands": [
|
||||||
|
"tar -czvf %s -C /go/bin ." % dirs["gobinTarPath"],
|
||||||
|
],
|
||||||
|
"volumes": [stepVolumeGo],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "cache-go-bin",
|
"name": "cache-go-bin",
|
||||||
"image": MINIO_MC,
|
"image": MINIO_MC,
|
||||||
@@ -424,7 +434,7 @@ def cacheGoBin():
|
|||||||
"BINGO_HASH=$(cat %s/.bingo_hash)" % dirs["base"],
|
"BINGO_HASH=$(cat %s/.bingo_hash)" % dirs["base"],
|
||||||
# cache using the minio client to the public bucket (long term bucket)
|
# 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 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],
|
"volumes": [stepVolumeGo],
|
||||||
},
|
},
|
||||||
@@ -439,7 +449,16 @@ def restoreGoBinCache():
|
|||||||
"commands": [
|
"commands": [
|
||||||
"BINGO_HASH=$(cat %s/.bingo/* | sha256sum | cut -d ' ' -f 1)" % dirs["base"],
|
"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 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/*",
|
"chmod +x /go/bin/*",
|
||||||
],
|
],
|
||||||
"volumes": [stepVolumeGo],
|
"volumes": [stepVolumeGo],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
# $1 - root path where .bingo resides
|
# $1 - root path where .bingo resides
|
||||||
|
# $2 - name of the cache item
|
||||||
#
|
#
|
||||||
|
|
||||||
ROOT_PATH="$1"
|
ROOT_PATH="$1"
|
||||||
@@ -13,7 +14,7 @@ BINGO_DIR="$ROOT_PATH/.bingo"
|
|||||||
# generate hash of a .bingo folder
|
# generate hash of a .bingo folder
|
||||||
BINGO_HASH=$(cat "$BINGO_DIR"/* | sha256sum | cut -d ' ' -f 1)
|
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
|
if curl --output /dev/null --silent --head --fail "$URL"; then
|
||||||
echo "[INFO] Go bin cache with has '$BINGO_HASH' exists."
|
echo "[INFO] Go bin cache with has '$BINGO_HASH' exists."
|
||||||
# https://discourse.drone.io/t/how-to-exit-a-pipeline-early-without-failing/3951
|
# https://discourse.drone.io/t/how-to-exit-a-pipeline-early-without-failing/3951
|
||||||
|
|||||||
Reference in New Issue
Block a user