-
Notifications
You must be signed in to change notification settings - Fork 630
Minimum version enforcement for cluster restores #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
37f816f
Minimum version enforcement for cluster restores
snh a2884e9
Fix wording in error
snh 3ac2327
Add clustering tests
gnawhleinad 634323d
Fix paths to ghe-backup-config and testlib.sh
gnawhleinad 7153f0d
Test on a 2.4.0 snapshot
gnawhleinad ea4b921
Add clustering tests
gnawhleinad 70537d4
Merge branch 'gnawhleinad/add-cluster-test'
gnawhleinad 403733b
rm test/cluster
gnawhleinad d78bff2
Test on a 2.5.0 snapshot
gnawhleinad 5e0c82e
Add ghe-cluster-config-apply stub
gnawhleinad 47be7e1
Update with @snh's feedback
gnawhleinad acf069f
Merge pull request #183 from github/gnawhleinad/add-cluster-test
gnawhleinad 676ecc3
Merge branch 'master' into snh/cluster-restore-version-check
snh 086ff39
Change to bash for new test
snh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| echo "Error: Snapshot must be from GitHub Enterprise v2.5.0 and above to be restored" | ||
|
||
| 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 | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
, but who wants to live forever.