From 9e7870a325d885a53df64635d5528eeb26a9b004 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Fri, 21 Jul 2023 13:37:17 +1000 Subject: [PATCH] feat: support a shared bucket for backups (#219) --- legacy/scripts/exec-backup-generation.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/legacy/scripts/exec-backup-generation.sh b/legacy/scripts/exec-backup-generation.sh index a5726738..df4dc63c 100755 --- a/legacy/scripts/exec-backup-generation.sh +++ b/legacy/scripts/exec-backup-generation.sh @@ -103,7 +103,16 @@ if [[ "${CAPABILITIES[@]}" =~ "backup.appuio.ch/v1alpha1/Schedule" ]]; then BAAS_BUCKET_NAME=$(echo $LAGOON_PROJECT_VARIABLES | jq -r '.[] | select(.name == "LAGOON_BAAS_BUCKET_NAME") | "\(.value)"') fi if [ -z $BAAS_BUCKET_NAME ]; then - BAAS_BUCKET_NAME=baas-${PROJECT} + # check for shared/cluster scoped bucket + # use build scope for now for testing + SHARED_BUCKET_NAME=$(echo $LAGOON_PROJECT_VARIABLES | jq -r '.[] | select(.scope == "internal_system" and .name == "LAGOON_SYSTEM_PROJECT_SHARED_BUCKET") | "\(.value)"') + if [ -z $SHARED_BUCKET_NAME ]; then + # if no shared bucketname, create as normal + BAAS_BUCKET_NAME=baas-${PROJECT} + else + # if shared, create using shared bucketname + BAAS_BUCKET_NAME=${SHARED_BUCKET_NAME}/baas-${PROJECT} + fi fi # Pull in .lagoon.yml variables