Skip to content

Commit d87b272

Browse files
committed
Merge pull request #39 from github/merge-public-master
Merge public master
2 parents 75c1178 + 5c51445 commit d87b272

File tree

6 files changed

+32
-2
lines changed

6 files changed

+32
-2
lines changed

bin/ghe-backup

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ if [ "$GHE_BACKUP_STRATEGY" = "tarball" ]; then
121121
GHE_MAINTENANCE_MODE_ENABLED=true
122122
fi
123123

124+
ghe-backup-store-version ||
125+
echo "Warning: storing backup-utils version remotely failed."
126+
124127
echo "Backing up GitHub settings ..."
125128
ghe-backup-settings ||
126129
failures="$failures settings"

bin/ghe-host-check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ set -e
3737
if [ $rc -ne 0 ]; then
3838
case $rc in
3939
255)
40-
if echo "$output" | grep -i "port 22: connection refused\|port 22: no route to host\|Connection timed out during banner exchange" >/dev/null; then
40+
if echo "$output" | grep -i "port 22: connection refused\|port 22: no route to host\|ssh_exchange_identification: Connection closed by remote host\|Connection timed out during banner exchange" >/dev/null; then
4141
exec "bin/$(basename $0)" "$hostname:122"
4242
fi
4343

bin/ghe-restore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ if $instance_configured; then
187187
fi
188188
fi
189189

190+
ghe-backup-store-version ||
191+
echo "Warning: storing backup-utils version remotely failed."
192+
190193
# Restore settings and license if restoring to an unconfigured appliance or when
191194
# specified manually.
192195
if $restore_settings; then
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#/ Usage: ghe-backup-store-version
3+
#/ Stores information about the used version of backup-utils on <host>
4+
set -e
5+
6+
# Bring in the backup configuration
7+
cd $(dirname "$0")/../..
8+
. share/github-backup-utils/ghe-backup-config
9+
10+
if [ -d .git ]; then
11+
version_info="$BACKUP_UTILS_VERSION"
12+
ref=$(git rev-parse HEAD || true)
13+
if [ -n "$ref" ]; then
14+
version_info="$version_info:$ref"
15+
fi
16+
echo "$version_info" |
17+
ghe-ssh "$GHE_HOSTNAME" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/common/backup-utils-version"
18+
fi

test/test-ghe-backup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ begin_test "ghe-backup first snapshot"
131131
# verify all alambic assets user data was transferred
132132
diff -ru "$GHE_REMOTE_DATA_USER_DIR/alambic_assets" "$GHE_DATA_DIR/current/alambic_assets"
133133
fi
134+
135+
# verify that ghe-backup wrote its version information to the host
136+
[ -f "$GHE_REMOTE_DATA_USER_DIR/common/backup-utils-version" ]
134137
)
135138
end_test
136139

test/test-ghe-restore.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ begin_test "cluster: ghe-restore from v2.5.0 snapshot"
497497
export GHE_RESTORE_HOST
498498

499499
# create file used to determine if instance is in maintenance mode.
500-
mkdir -p "$GHE_REMOTE_DATA_DIR/github/current/public/system"
500+
mkdir -p "$GHE_REMOTE_DATA_DIR/github/current/public/system" "$GHE_REMOTE_DATA_USER_DIR/common"
501501
touch "$GHE_REMOTE_DATA_DIR/github/current/public/system/maintenance.html"
502502

503503
echo "v2.5.0" > "$GHE_DATA_DIR/current/version"
@@ -508,5 +508,8 @@ begin_test "cluster: ghe-restore from v2.5.0 snapshot"
508508
: ghe-restore should have exited successfully
509509
false
510510
fi
511+
512+
# verify that ghe-backup wrote its version information to the host
513+
[ -f "$GHE_REMOTE_DATA_USER_DIR/common/backup-utils-version" ]
511514
)
512515
end_test

0 commit comments

Comments
 (0)