Skip to content
Merged
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions bin/ghe-restore
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ if ghe-ssh "$GHE_HOSTNAME" -- \
restore_settings=false
fi

# Figure out if we're restoring into a cluster with an unsupported snapshot
if $cluster; then
snapshot_instance_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version)
if ! echo $snapshot_instance_version | \
grep -Eq "v2\.[5-9]|v2\.[1-9][0-9]|v[3-9]|v[1-9][0-9]"; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminded me that we need to add a semver comparison helper at some point, somewhere. The ^^^ regex may not be future proof :trollface:, but who wants to live forever.

echo "Error: Snapshot must be from GitHub Enterprise v2.5.0 and above to be restored"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2.5.0 or above

echo " into a cluster (detected $snapshot_instance_version). Aborting." >&2
exit 1
fi
fi

# Figure out if this instance is in a replication pair
if ghe-ssh "$GHE_HOSTNAME" -- "ghe-repl-status -r 2>/dev/null" \
| grep -Eq "replica|primary"; then
Expand Down