Skip to content

Commit 4df4edf

Browse files
committed
update restore to check data exists vs check version
1 parent acca071 commit 4df4edf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

share/github-backup-utils/ghe-restore-actions

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ restore-secret "Actions Launch service private key" "actions-launch-app-app-priv
8585
restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" "secrets.launch.token-oauth-key"
8686
restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert"
8787

88-
# Restore storage container prefix, but only if the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings
89-
# This value will only be present in backups from versions >= 3.10 so needs to be wrapped in version checks.
90-
snapshot_version=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/version")
91-
# shellcheck disable=SC2046 # Word splitting is required to populate the variables
92-
read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version "$snapshot_version")
93-
if [[ $RESTORE_SETTINGS == "true" && "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10" ]]; then
94-
restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix"
88+
# Restore storage container prefix, but only if it exists, and the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings
89+
if [[ -e "$GHE_RESTORE_SNAPSHOT_PATH/actions-storage-container-prefix" ]]; then
90+
if [[ $RESTORE_SETTINGS == "true" ]]; then
91+
restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix"
92+
fi
93+
else
94+
log_warn "Actions storage container prefix not present in backup. Skipping ..."
9595
fi
9696

9797
# Setup the database logins.

0 commit comments

Comments
 (0)