Skip to content

Commit 944829c

Browse files
authored
Merge pull request #2 from AckeeDevOps/feat/40928-service-accounts
GOOGLE_APPLICATION_CREDENTIALS support
2 parents 8d6a8b2 + 4fdcb79 commit 944829c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

entrypoint.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ else
1717
set -eo pipefail # if we do not force, we want clean exit codes on mysqldump command
1818
fi
1919

20+
if [ ! -z "$GOOGLE_APPLICATION_CREDENTIALS" ]; then
21+
/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
22+
fi
23+
2024
# verify gs config - ls bucket
2125
$backup_tool ls "gs://${GS_URL%%/*}" > /dev/null
2226
echo "Google storage bucket access verified."
2327

2428
mkdir -p /tmp/backup/
25-
rm -rf -- /tmp/backup/*
29+
rm -rf -- /tmp/backup/*
2630

2731
candidates=$(echo "show databases" | mysql -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" -h "$MYSQL_HOST" -P "$MYSQL_PORT" | grep -Ev "^(Database|sys|performance_schema|information_schema)$")
2832

@@ -32,4 +36,4 @@ echo $?
3236
echo "export done, now gzip output and transfer it to GCS"
3337

3438
gzip -v /tmp/backup/dump.sql
35-
$backup_tool $backup_options /tmp/backup/ gs://$GS_URL/
39+
$backup_tool $backup_options /tmp/backup/ gs://$GS_URL/

0 commit comments

Comments
 (0)