Skip to content

Commit 54b7224

Browse files
committed
add check for greater than 3.9
1 parent 4210881 commit 54b7224

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

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

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,16 @@ 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
89-
# `-c` should be used if restoring to an unconfigured appliance or when sif restoring to an unconfigured appliance or when
90-
# specified manually.
91-
# This is to avoid a staging instance using the same bucket prefix settings as production in the case of a staging instance restored from production
92-
if $RESTORE_SETTINGS; then
93-
restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix"
94-
fi
9588
# Restore storage container prefix, but only if the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings
9689
# This value will only be present in backups from versions >= 3.10 so needs to be wrapped in version checks.
97-
# if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then
98-
# snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version)
99-
# # shellcheck disable=SC2046 # Word splitting is required to populate the variables
100-
# read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version $snapshot_version)
101-
# if [ "$(version $snapshot_version_major.$snapshot_version_minor.0)" -a $RESTORE_SETTINGS ]; then
102-
# restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix"
103-
# fi
104-
# fi
90+
if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then
91+
snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version)
92+
# shellcheck disable=SC2046 # Word splitting is required to populate the variables
93+
read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version $snapshot_version)
94+
if [ "$snapshot_version_major" -eq "3" -a "$snapshot_version_minor" -ge "9" -a $RESTORE_SETTINGS ]; then
95+
restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix"
96+
fi
97+
fi
10598

10699
# Setup the database logins.
107100
ghe_verbose "* Restoring database logins and users to $host ..."

0 commit comments

Comments
 (0)