Skip to content

Commit ead147a

Browse files
authored
Merge branch 'master' into master
2 parents 8112fa8 + 9f83a84 commit ead147a

12 files changed

+32
-51
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ to your specific GitHub Enterprise Server setup or would like assistance with
5050
backup site setup or recovery, please contact our [Enterprise support team][3]
5151
instead.
5252

53-
[1]: https://enterprise.github.com
53+
[1]: https://github.com/enterprise
5454
[2]: docs/requirements.md#github-enterprise-version-requirements
55-
[3]: https://enterprise.github.com/support/
55+
[3]: https://support.github.com/

bin/ghe-host-check

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -52,37 +52,8 @@ options="
5252
port=$(ssh_port_part "$host")
5353
hostname=$(ssh_host_part "$host")
5454

55-
set +e
55+
# ghe-negotiate-version verifies if the target is a Github Enterprise Server instance
5656
output=$(echo "ghe-negotiate-version backup-utils $BACKUP_UTILS_VERSION" | ghe-ssh -o BatchMode=no $options $host -- /bin/sh 2>&1)
57-
rc=$?
58-
set -e
59-
60-
if [ $rc -ne 0 ]; then
61-
case $rc in
62-
255)
63-
if echo "$output" | grep -i "port 22: Network is unreachable\|port 22: connection refused\|port 22: no route to host\|ssh_exchange_identification: Connection closed by remote host\|Connection timed out during banner exchange\|port 22: Connection timed out" >/dev/null; then
64-
exec "$(basename $0)" "$hostname:122"
65-
fi
66-
67-
echo "$output" 1>&2
68-
echo "Error: ssh connection with '$host' failed" 1>&2
69-
echo "Note that your SSH key needs to be setup on $host as described in:" 1>&2
70-
echo "* https://enterprise.github.com/help/articles/adding-an-ssh-key-for-shell-access" 1>&2
71-
;;
72-
101)
73-
echo "Error: couldn't read GitHub Enterprise Server fingerprint on '$host' or this isn't a GitHub appliance." 1>&2
74-
;;
75-
1)
76-
if [ "${port:-22}" -eq 22 ] && echo "$output" | grep "use port 122" >/dev/null; then
77-
exec "$(basename $0)" "$hostname:122"
78-
else
79-
echo "$output" 1>&2
80-
fi
81-
;;
82-
83-
esac
84-
exit $rc
85-
fi
8657

8758
CLUSTER=false
8859
if ghe-ssh "$host" -- \
@@ -130,7 +101,7 @@ fi
130101

131102
# backup-utils 2.13 onwards limits support to the current and previous two releases
132103
# of GitHub Enterprise Server.
133-
supported_minimum_version="3.0.0"
104+
supported_minimum_version="3.1.0"
134105

135106
if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then
136107
supported=1

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
github-backup-utils (3.3.0.rc1) UNRELEASED; urgency=medium
2+
3+
4+
-- Nick Iodice <[email protected]> Tue, 09 Nov 2021 19:56:08 +0000
5+
16
github-backup-utils (3.2.0) UNRELEASED; urgency=medium
27

38

share/github-backup-utils/ghe-backup-config

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,12 @@ ssh_host_part() {
334334
# This is used primarily to break hostspecs with non-standard ports down for
335335
# rsync commands.
336336
ssh_port_part() {
337-
[ "${1##*:}" = "$1" ] && echo 22 || echo "${1##*:}"
337+
if [ "${1##*:}" != "$1" ] && [ "${1##*:}" -ne "122" ]; then
338+
echo "Error: SSH port has to be 122 connecting to Github Enterprise Server, current value is ${1##*:} for $1." 1>&2
339+
exit 1
340+
fi
341+
342+
echo 122
338343
}
339344

340345
# Usage: ghe_remote_logger <message>...

share/github-backup-utils/ghe-backup-mssql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ add_minute() {
4242
echo "$(date -v +$2M -ujf'%Y%m%dT%H%M%S' $1 +%Y%m%dT%H%M%S)"
4343
else
4444
dt=$1
45-
echo "$(date '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes")"
45+
echo "$(date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes")"
4646
fi
4747
}
4848

share/github-backup-utils/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.0
1+
3.3.0.rc1

test/test-ghe-backup-config.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ end_test
8989
begin_test "ghe-backup-config ssh_port_part"
9090
(
9191
set -e
92-
[ "$(ssh_port_part 'github.example.com')" = "22" ]
93-
[ "$(ssh_port_part 'github.example.com:22')" = "22" ]
94-
[ "$(ssh_port_part 'github.example.com:5000')" = "5000" ]
95-
[ "$(ssh_port_part '[email protected]:5000')" = "5000" ]
92+
[ "$(ssh_port_part 'github.example.com')" = "122" ]
93+
[ ! "$(ssh_port_part 'github.example.com:22' 2>/dev/null)" ]
94+
[ ! "$(ssh_port_part 'github.example.com:5000' 2>/dev/null)" ]
95+
[ "$(ssh_port_part '[email protected]:122')" = "122" ]
9696
)
9797
end_test
9898

test/test-ghe-host-check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ begin_test "ghe-host-check detects unsupported GitHub Enterprise Server versions
6060
! GHE_TEST_REMOTE_VERSION=2.20.0 ghe-host-check
6161
! GHE_TEST_REMOTE_VERSION=2.21.0 ghe-host-check
6262
! GHE_TEST_REMOTE_VERSION=2.22.0 ghe-host-check
63-
GHE_TEST_REMOTE_VERSION=3.0.0 ghe-host-check
63+
! GHE_TEST_REMOTE_VERSION=3.0.0 ghe-host-check
6464
GHE_TEST_REMOTE_VERSION=3.1.0 ghe-host-check
6565
GHE_TEST_REMOTE_VERSION=$BACKUP_UTILS_VERSION ghe-host-check
6666
GHE_TEST_REMOTE_VERSION=$BACKUP_UTILS_VERSION ghe-host-check

test/test-ghe-restore-external-database.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ begin_test "ghe-restore allows restore of external DB snapshot to external DB in
6060
fi
6161

6262
# verify connect to right host
63-
check_restore_output_for "Connect 127.0.0.1:22 OK"
63+
check_restore_output_for "Connect 127.0.0.1:122 OK"
6464

6565
# verify stale servers were cleared
6666
check_restore_output_for "Cleaning up stale nodes ..."
@@ -156,7 +156,7 @@ begin_test "ghe-restore allows restore of external DB snapshot to non-external D
156156
check_restore_output_for "Skipping MySQL restore."
157157

158158
# verify connect to right host
159-
check_restore_output_for "Connect 127.0.0.1:22 OK"
159+
check_restore_output_for "Connect 127.0.0.1:122 OK"
160160

161161
# verify stale servers were cleared
162162
check_restore_output_for "Cleaning up stale nodes ..."
@@ -182,7 +182,7 @@ begin_test "ghe-restore allows restore of non external DB snapshot to external D
182182
check_restore_output_for "Skipping MySQL restore."
183183

184184
# verify connect to right host
185-
check_restore_output_for "Connect 127.0.0.1:22 OK"
185+
check_restore_output_for "Connect 127.0.0.1:122 OK"
186186

187187
# verify stale servers were cleared
188188
check_restore_output_for "Cleaning up stale nodes ..."

test/test-ghe-restore.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ begin_test "ghe-restore into configured vm"
5656
cat "$TRASHDIR/restore-out"
5757

5858
# verify connect to right host
59-
grep -q "Connect 127.0.0.1:22 OK" "$TRASHDIR/restore-out"
59+
grep -q "Connect 127.0.0.1:122 OK" "$TRASHDIR/restore-out"
6060

6161
# verify stale servers were cleared
6262
grep -q "Cleaning up stale nodes ..." "$TRASHDIR/restore-out"
@@ -141,7 +141,7 @@ begin_test "ghe-restore -c into unconfigured vm"
141141
fi
142142

143143
# verify connect to right host
144-
grep -q "Connect 127.0.0.1:22 OK" "$TRASHDIR/restore-out"
144+
grep -q "Connect 127.0.0.1:122 OK" "$TRASHDIR/restore-out"
145145

146146
# verify attempt to clear stale servers was not made
147147
grep -q "Cleaning up stale nodes ..." "$TRASHDIR/restore-out" && {
@@ -175,7 +175,7 @@ begin_test "ghe-restore into unconfigured vm"
175175
! grep -q "ghe-config-apply OK" "$TRASHDIR/restore-out"
176176

177177
# verify connect to right host
178-
grep -q "Connect 127.0.0.1:22 OK" "$TRASHDIR/restore-out"
178+
grep -q "Connect 127.0.0.1:122 OK" "$TRASHDIR/restore-out"
179179

180180
# verify attempt to clear stale servers was not made
181181
grep -q "Cleaning up stale nodes ..." "$TRASHDIR/restore-out" && {
@@ -215,7 +215,7 @@ begin_test "ghe-restore with host arg and config value"
215215
rm "$GHE_BACKUP_CONFIG_TEMP"
216216

217217
# verify host arg overrides configured restore host
218-
echo "$output" | grep -q 'Connect localhost:22 OK'
218+
echo "$output" | grep -q 'Connect localhost:122 OK'
219219

220220
# Verify all the data we've restored is as expected
221221
verify_all_restored_data
@@ -239,7 +239,7 @@ begin_test "ghe-restore with host arg"
239239
output="$(ghe-restore -f localhost)" || false
240240

241241
# verify host arg overrides configured restore host
242-
echo "$output" | grep -q 'Connect localhost:22 OK'
242+
echo "$output" | grep -q 'Connect localhost:122 OK'
243243

244244
# Verify all the data we've restored is as expected
245245
verify_all_restored_data

0 commit comments

Comments
 (0)