Merge branch 'master' into master
This commit is contained in:
Коммит
5415ac133f
|
@ -131,7 +131,7 @@ fi
|
|||
|
||||
# backup-utils 2.13 onwards limits support to the current and previous two releases
|
||||
# of GitHub Enterprise Server.
|
||||
supported_minimum_version="3.1.0"
|
||||
supported_minimum_version="3.2.0"
|
||||
|
||||
if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then
|
||||
supported=1
|
||||
|
|
|
@ -261,12 +261,22 @@ if $instance_configured; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Make sure the GitHub appliance has Actions enabled if the snapshot contains Actions data.
|
||||
if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then
|
||||
if ! ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then
|
||||
# Get GHES release version in major.minor format
|
||||
RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-version' | cut -d '.' -f 1,2)
|
||||
# Get GHES release version in major.minor format
|
||||
RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-version' | cut -d '.' -f 1,2)
|
||||
|
||||
# Make sure the GitHub appliance has Actions enabled if the snapshot contains Actions data.
|
||||
# If above is true, also check if ac is present in appliance then snapshot should also contains ac databases
|
||||
if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then
|
||||
if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then
|
||||
ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash)
|
||||
ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ")
|
||||
if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then
|
||||
echo "Error: $GHE_HOSTNAME contains ArtifactCache databases but no ArtifactCache databases are present in snapshot. Aborting" 1>&2
|
||||
echo "Please delete ArtifactCache databases from $GHE_HOSTNAME and retry" 1>&2
|
||||
echo "Steps to delete ArtifactCache databases can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/deleting-artifact-cache-databases" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Error: $GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." 1>&2
|
||||
echo "Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2
|
||||
exit 1
|
||||
|
@ -446,6 +456,14 @@ echo "Restarting memcached ..." 1>&3
|
|||
echo "sudo restart -q memcached 2>/dev/null || true" |
|
||||
ghe-ssh "$GHE_HOSTNAME" -- /bin/sh
|
||||
|
||||
# Prevent GitHub Connect jobs running before we've had a chance to reset
|
||||
# the configuration by setting the last run date to now.
|
||||
if ! $RESTORE_SETTINGS; then
|
||||
echo "Setting last run date for GitHub Connect jobs ..." 1>&3
|
||||
echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" |
|
||||
ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3
|
||||
fi
|
||||
|
||||
# When restoring to a host that has already been configured, kick off a
|
||||
# config run to perform data migrations.
|
||||
if $CLUSTER; then
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
github-backup-utils (3.4.0) UNRELEASED; urgency=medium
|
||||
|
||||
* Add anchor to usage doc for settings restore #865
|
||||
|
||||
-- Steve Culver <steveculver@github.com> Tue, 15 Feb 2022 19:25:09 +0000
|
||||
|
||||
github-backup-utils (3.3.1) UNRELEASED; urgency=medium
|
||||
|
||||
* Fix compat issue with ghe-actions-start during maintenance mode #836
|
||||
|
|
|
@ -26,6 +26,6 @@ git checkout -q "$PKG_HEAD"
|
|||
|
||||
debuild -uc -us 1>&2
|
||||
cd ..
|
||||
files=$(ls -1 *.deb *.tar.gz *.dsc *.changes)
|
||||
files=$(ls -1 *.deb *.tar.xz *.dsc *.changes)
|
||||
mv $files ../
|
||||
for f in $files; do echo "dist/$f"; done
|
||||
|
|
|
@ -90,14 +90,15 @@ cleanup() {
|
|||
|
||||
# Enable remote GC operations
|
||||
for hostname in $hostnames; do
|
||||
ghe-gc-enable $ssh_config_file_opt $hostname:$port || true
|
||||
ghe-gc-enable $ssh_config_file_opt $hostname:$port || {
|
||||
echo "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2
|
||||
}
|
||||
done
|
||||
|
||||
ghe-ssh "$GHE_HOSTNAME" -- rm -rf $remote_tempdir
|
||||
rm -rf $tempdir
|
||||
}
|
||||
trap 'cleanup' EXIT
|
||||
trap 'exit $?' INT # ^C always terminate
|
||||
trap 'cleanup' EXIT INT
|
||||
|
||||
# Disable remote GC operations
|
||||
for hostname in $hostnames; do
|
||||
|
|
|
@ -59,7 +59,9 @@ mkdir -p "$backup_dir"
|
|||
cleanup() {
|
||||
# Enable remote maintenance operations
|
||||
for hostname in $hostnames; do
|
||||
ghe-gc-enable $ssh_config_file_opt $hostname:$port || true
|
||||
ghe-gc-enable $ssh_config_file_opt $hostname:$port || {
|
||||
echo "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2
|
||||
}
|
||||
done
|
||||
|
||||
ghe-ssh "$GHE_HOSTNAME" -- rm -rf $remote_tempdir
|
||||
|
|
|
@ -93,4 +93,10 @@ ghe-ssh -p "$port" "$host" -- ghe-actions-console -s mps -c "Repair-DatabaseLogi
|
|||
ghe-ssh -p "$port" "$host" -- ghe-actions-console -s token -c "Repair-DatabaseLogins"
|
||||
ghe-ssh -p "$port" "$host" -- ghe-actions-console -s actions -c "Repair-DatabaseLogins"
|
||||
|
||||
if [ ! -z "$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache_Configuration*.bak')" ]; then
|
||||
ghe-ssh -p "$port" "$host" -- ghe-actions-console -s artifactcache -c "Repair-DatabaseLogins"
|
||||
else
|
||||
echo "ArtifactCache is not present in mssql backup. Skipping Repair-DatabaseLogins for it."
|
||||
fi
|
||||
|
||||
bm_end "$(basename $0)"
|
||||
|
|
|
@ -1 +1 @@
|
|||
3.3.1
|
||||
3.4.0
|
||||
|
|
|
@ -18,6 +18,11 @@ while true; do
|
|||
echo "fake redis data" > "$GHE_REMOTE_DATA_USER_DIR/redis/dump.rdb"
|
||||
break
|
||||
;;
|
||||
mset)
|
||||
# Fake accepting of mset command
|
||||
shift 9
|
||||
break
|
||||
;;
|
||||
--remote)
|
||||
# Fake accepting hostname argument
|
||||
shift 3
|
||||
|
|
|
@ -61,7 +61,8 @@ begin_test "ghe-host-check detects unsupported GitHub Enterprise Server versions
|
|||
! GHE_TEST_REMOTE_VERSION=2.21.0 ghe-host-check
|
||||
! GHE_TEST_REMOTE_VERSION=2.22.0 ghe-host-check
|
||||
! GHE_TEST_REMOTE_VERSION=3.0.0 ghe-host-check
|
||||
GHE_TEST_REMOTE_VERSION=3.1.0 ghe-host-check
|
||||
! GHE_TEST_REMOTE_VERSION=3.1.0 ghe-host-check
|
||||
GHE_TEST_REMOTE_VERSION=3.2.0 ghe-host-check
|
||||
GHE_TEST_REMOTE_VERSION=$BACKUP_UTILS_VERSION ghe-host-check
|
||||
GHE_TEST_REMOTE_VERSION=$BACKUP_UTILS_VERSION ghe-host-check
|
||||
GHE_TEST_REMOTE_VERSION=$bu_version_major.$bu_version_minor.999 ghe-host-check
|
||||
|
|
|
@ -42,7 +42,7 @@ export GHE_BACKUP_CONFIG GHE_DATA_DIR GHE_REMOTE_DATA_DIR GHE_REMOTE_ROOT_DIR
|
|||
|
||||
# The default remote appliance version. This may be set in the environment prior
|
||||
# to invoking tests to emulate a different remote vm version.
|
||||
: ${GHE_TEST_REMOTE_VERSION:=3.3.0.rc1}
|
||||
: ${GHE_TEST_REMOTE_VERSION:=3.4.0.rc1}
|
||||
export GHE_TEST_REMOTE_VERSION
|
||||
|
||||
# Source in the backup config and set GHE_REMOTE_XXX variables based on the
|
||||
|
|
Загрузка…
Ссылка в новой задаче