Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions images/tidb-backup-manager/e2e-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ cleanup() {

trap cleanup EXIT

export GOOGLE_APPLICATION_CREDENTIALS=/tmp/google-credentials.json
GCS_SERVICE_ACCOUNT_FILE_CONFIG=
if [ -n "${GCS_SERVICE_ACCOUNT_JSON_KEY:-}" ]; then
export GOOGLE_APPLICATION_CREDENTIALS=/tmp/google-credentials.json
GCS_SERVICE_ACCOUNT_FILE_CONFIG="service_account_file = ${GOOGLE_APPLICATION_CREDENTIALS}"
echo "Create google-credentials.json file."
cat <<EOF > "${GOOGLE_APPLICATION_CREDENTIALS}"
${GCS_SERVICE_ACCOUNT_JSON_KEY}
EOF
else
unset GOOGLE_APPLICATION_CREDENTIALS
fi

echo "Create rclone.conf file."
cat <<EOF > /tmp/rclone.conf
[s3]
Expand All @@ -41,7 +52,7 @@ storage_class = ${AWS_STORAGE_CLASS}
[gcs]
type = google cloud storage
project_number = ${GCS_PROJECT_ID}
service_account_file = ${GOOGLE_APPLICATION_CREDENTIALS}
${GCS_SERVICE_ACCOUNT_FILE_CONFIG}
object_acl = ${GCS_OBJECT_ACL}
bucket_acl = ${GCS_BUCKET_ACL}
location = ${GCS_LOCATION}
Expand All @@ -52,15 +63,6 @@ account = ${AZUREBLOB_ACCOUNT}
key = ${AZUREBLOB_KEY}
EOF

if [[ -n "${GCS_SERVICE_ACCOUNT_JSON_KEY:-}" ]]; then
echo "Create google-credentials.json file."
cat <<EOF > ${GOOGLE_APPLICATION_CREDENTIALS}
${GCS_SERVICE_ACCOUNT_JSON_KEY}
EOF
else
touch ${GOOGLE_APPLICATION_CREDENTIALS}
fi

BACKUP_BIN=/tidb-backup-manager

COV_NAME="backup-manager.$(( ( RANDOM % 100000 ) + 1 ))"
Expand Down
24 changes: 13 additions & 11 deletions images/tidb-backup-manager/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ cleanup() {

trap cleanup EXIT

export GOOGLE_APPLICATION_CREDENTIALS=/tmp/google-credentials.json
GCS_SERVICE_ACCOUNT_FILE_CONFIG=
if [ -n "${GCS_SERVICE_ACCOUNT_JSON_KEY:-}" ]; then
export GOOGLE_APPLICATION_CREDENTIALS=/tmp/google-credentials.json
GCS_SERVICE_ACCOUNT_FILE_CONFIG="service_account_file = ${GOOGLE_APPLICATION_CREDENTIALS}"
echo "Create google-credentials.json file."
cat <<EOF > "${GOOGLE_APPLICATION_CREDENTIALS}"
${GCS_SERVICE_ACCOUNT_JSON_KEY}
EOF
else
unset GOOGLE_APPLICATION_CREDENTIALS
fi

echo "Create rclone.conf file."
cat <<EOF > /tmp/rclone.conf
[s3]
Expand All @@ -43,7 +54,7 @@ storage_class = ${AWS_STORAGE_CLASS}
[gcs]
type = google cloud storage
project_number = ${GCS_PROJECT_ID}
service_account_file = ${GOOGLE_APPLICATION_CREDENTIALS}
${GCS_SERVICE_ACCOUNT_FILE_CONFIG}
object_acl = ${GCS_OBJECT_ACL}
bucket_acl = ${GCS_BUCKET_ACL}
location = ${GCS_LOCATION}
Expand All @@ -54,15 +65,6 @@ account = ${AZUREBLOB_ACCOUNT}
key = ${AZUREBLOB_KEY}
EOF

if [[ -n "${GCS_SERVICE_ACCOUNT_JSON_KEY:-}" ]]; then
echo "Create google-credentials.json file."
cat <<EOF > ${GOOGLE_APPLICATION_CREDENTIALS}
${GCS_SERVICE_ACCOUNT_JSON_KEY}
EOF
else
touch ${GOOGLE_APPLICATION_CREDENTIALS}
fi

BACKUP_BIN=/tidb-backup-manager
if [[ -n "${AWS_DEFAULT_REGION}" ]]; then
EXEC_COMMAND="exec"
Expand Down
Loading