Skip to content

Commit d50d94d

Browse files
committed
Merge branch 'master' into stable
2 parents 4a07a44 + 4ff376b commit d50d94d

File tree

10 files changed

+67
-23
lines changed

10 files changed

+67
-23
lines changed

RELEASING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Coming :soon:
2626

2727
1. Install the Debian `devscripts` package:
2828
`sudo apt-get install devscripts`
29-
2. Run...
29+
2. Generate a PAT through github.com with access to the `github/backup-utils` repository. This will be used for the `GH_RELEASE_TOKEN` environment variable in the next step.
30+
3. Run...
3031
- Feature release:
3132
`GH_AUTHOR="Bob Smith <[email protected]>" GH_RELEASE_TOKEN=your-amazing-secure-token script/release 2.13.0 2.11.0`
3233
- Patch release:

bin/ghe-host-check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fi
113113

114114
# backup-utils 2.13 onwards limits support to the current and previous two releases
115115
# of GitHub Enterprise Server.
116-
supported_minimum_version="2.17.0"
116+
supported_minimum_version="2.18.0"
117117

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

debian/changelog

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ github-backup-utils (2.19.4) UNRELEASED; urgency=medium
44

55
-- Hao Jiang <[email protected]> Tue, 18 Feb 2020 17:54:31 +0000
66

7+
github-backup-utils (2.20.0) UNRELEASED; urgency=medium
8+
9+
* Fix `ghe-backup-repositories` performance for large instances #541
10+
* Fix two issues with binary backup (slow gzip compression and support for restore from instances other than SQL master) #551
11+
12+
-- Alejandro Figueroa <[email protected]> Tue, 11 Feb 2020 20:47:17 +0000
13+
714
github-backup-utils (2.19.3) UNRELEASED; urgency=medium
815

916
* Fix two issues with binary backup (slow gzip compression and support for restore from instances other than SQL master) #551
@@ -241,7 +248,7 @@ github-backup-utils (2.7.1) UNRELEASED; urgency=medium
241248

242249
github-backup-utils (2.7.0) UNRELEASED; urgency=medium
243250

244-
* GitHub Enterprise 2.7.0 support
251+
* GitHub Enterprise 2.7.0 support
245252

246253
-- Sergio Rubio <[email protected]> Wed, 03 Aug 2016 20:25:31 +0200
247254

script/cibuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -e
66
# place with this version at the beginning of each test and many commands have
77
# conditional logic based on the remote version. Running the suite against
88
# different major versions ensures we're covering these conditional paths.
9-
REMOTE_VERSIONS="2.17.0 2.19.0"
9+
REMOTE_VERSIONS="2.18.0 2.20.0"
1010

1111
# Enable verbose logging of ssh commands
1212
export GHE_VERBOSE_SSH=true

script/release

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ GH_REPO = ENV['GH_REPO'] || 'backup-utils'
3131
GH_OWNER = ENV['GH_OWNER'] || 'github'
3232
GH_AUTHOR = ENV['GH_AUTHOR']
3333
DEB_PKG_NAME = 'github-backup-utils'
34+
GH_BASE_BRANCH = ENV['GH_BASE_BRANCH'] || 'master'
3435

3536
CHANGELOG_TMPL = '''<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium
3637
@@ -136,7 +137,7 @@ def beautify_changes(changes)
136137
end
137138

138139
def changelog
139-
changes = `git log --pretty=oneline origin/stable...origin/master --reverse --grep "Merge pull request" | sort -t\# -k2`.lines.map(&:strip)
140+
changes = `git log --pretty=oneline origin/stable...origin/#{GH_BASE_BRANCH} --reverse --grep "Merge pull request" | sort -t\# -k2`.lines.map(&:strip)
140141
raise 'Building the changelog failed' if $CHILD_STATUS != 0
141142

142143
changes
@@ -232,8 +233,8 @@ end
232233

233234
def update_stable_branch
234235
`git checkout --quiet stable`
235-
unless (out = `git merge --quiet --ff-only origin/master`)
236-
warn "Merging master into stable failed:\n\n#{out}"
236+
unless (out = `git merge --quiet --ff-only origin/#{GH_BASE_BRANCH}`)
237+
warn "Merging #{GH_BASE_BRANCH} into stable failed:\n\n#{out}"
237238
end
238239
unless (out = `git push --quiet origin stable`)
239240
warn "Failed pushing the stable branch:\n\n#{out}"
@@ -245,7 +246,7 @@ def create_release_pr(version, release_body)
245246
'title': "Bump version: #{version}",
246247
'body': release_body,
247248
'head': "release-#{version}",
248-
'base': 'master'
249+
'base': GH_BASE_BRANCH
249250
}.to_json
250251
res = post("/repos/#{GH_OWNER}/#{GH_REPO}/pulls", body)
251252
raise "Creating release PR failed (#{res.code})" unless res.is_a? Net::HTTPSuccess
@@ -328,9 +329,9 @@ def attach_assets_to_release(upload_url, release_id, files)
328329
end
329330

330331
def clean_up(version)
331-
`git checkout --quiet master`
332+
`git checkout --quiet #{GH_BASE_BRANCH}`
332333
`git fetch --quiet origin --prune`
333-
`git pull --quiet origin master --prune`
334+
`git pull --quiet origin #{GH_BASE_BRANCH} --prune`
334335
`git branch --quiet -D release-#{version} >/dev/null 2>&1`
335336
`git push --quiet origin :release-#{version} >/dev/null 2>&1`
336337
`git branch --quiet -D tmp-packging >/dev/null 2>&1`
@@ -382,6 +383,7 @@ if $PROGRAM_NAME == __FILE__
382383
puts "Repo: #{GH_REPO}"
383384
puts "Author: #{GH_AUTHOR}"
384385
puts "Token: #{ENV['GH_RELEASE_TOKEN'] && 'set' || 'unset'}"
386+
puts "Base branch: #{GH_BASE_BRANCH}"
385387
puts 'Changelog:'
386388
if release_changes.empty?
387389
puts ' => No new bug fixes, enhancements or features.'
@@ -429,7 +431,7 @@ if $PROGRAM_NAME == __FILE__
429431

430432
puts 'Creating release...'
431433
release_title = "GitHub Enterprise Server Backup Utilities v#{version}"
432-
res = create_release "v#{version}", 'master', release_title, release_body, true
434+
res = create_release "v#{version}", GH_BASE_BRANCH, release_title, release_body, true
433435

434436
# Tidy up before building tarball and deb pkg
435437
clean_up version

share/github-backup-utils/ghe-backup-audit-log

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ is_skip_truncate_enabled(){
2929
ghe-ssh "$host" test -e "$GHE_REMOTE_DATA_USER_DIR/common/audit-log-import/skip_truncate"
3030
}
3131

32+
# Check whether the audit_entries table is deleted
33+
audit_entries_deleted(){
34+
[ -z "$(ghe-ssh "$host" -- "/usr/local/share/enterprise/github-mysql 'SHOW TABLES LIKE \"audit_entries\"'")" ]
35+
}
36+
3237
is_binary_backup(){
3338
ghe-ssh "$host" ghe-config --true "mysql.backup.binary"
3439
}
@@ -38,7 +43,10 @@ backup_mysql(){
3843
ghe_verbose "Skip backup audit_entries for Mysql since it is using binary backup"
3944
return
4045
fi
41-
if is_skip_truncate_enabled; then
46+
47+
if audit_entries_deleted; then
48+
ghe_verbose "audit_entries table does not exist"
49+
elif is_skip_truncate_enabled; then
4250
# As skip_truncate exists, we need to also backup the audit entries
4351
# in MySQL because Elasticsearch may not be fully synced.
4452
"${base_path}/ghe-backup-mysql-audit-log"

share/github-backup-utils/ghe-restore-audit-log

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ is_mysql_supported(){
4646
'test \"\$ENTERPRISE_AUDIT_LOG_MYSQL_LOGGER_ENABLED\" = \"1\""' | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash
4747
}
4848

49+
# Check if the backup is binary by looking up the sentinel file
4950
is_binary_backup(){
50-
ghe-ssh "$GHE_HOSTNAME" ghe-config --true "mysql.backup.binary"
51+
test -f "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"/mysql-binary-backup-sentinel
5152
}
5253

5354
# Helper function to set remote flags in `/data/user/common/audit-log-import`
@@ -90,6 +91,11 @@ restore_mysql(){
9091

9192
ghe_verbose "Restoring MySQL audit logs ..."
9293

94+
if ! mysql_table_schema_available; then
95+
ghe_verbose "schema.gz does not exist"
96+
return
97+
fi
98+
9399
"${base_path}/ghe-restore-mysql-audit-log" "$GHE_HOSTNAME" "$only_schema"
94100
}
95101

share/github-backup-utils/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.19.4
1+
2.20.0

test/bin/dgit-cluster-backup-routes

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
#!/usr/bin/env bash
22
# Usage: dgit-cluster-backup-routes
3-
# Emulates the remote GitHub enterprise-configure command. Tests use this
4-
# to assert that the command was executed.
3+
# Emulates the remote GitHub dgit-cluster-backup-routes command. Tests use this
4+
# to assert that all repos and gists get backed up.
55
set -e
6-
cat <<EOF
7-
0/nw/01/aa/3f/1234 git-server-fake-uuid
8-
1/nw/23/bb/4c/2345 git-server-fake-uuid1
9-
0/01/aa/3f/gist git-server-fake-uuid2
10-
1/23/bb/4c/gist git-server-fake-uuid
11-
EOF
6+
7+
version() {
8+
echo "${@#v}" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }';
9+
}
10+
11+
if [ -z "$GHE_REMOTE_VERSION" ]; then
12+
echo GHE_REMOTE_VERSION must be set for this script to work.
13+
exit 1
14+
fi
15+
16+
# The list of gists returned by the source changed in 2.16.23, 2.17.14,
17+
# 2.18.8, and 2.19.3. We need to account for this difference here.
18+
if [[ "$GHE_REMOTE_VERSION" =~ 2.16. && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.16.23)" ]] || \
19+
[[ "$GHE_REMOTE_VERSION" =~ 2.17. && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.17.14)" ]] || \
20+
[[ "$GHE_REMOTE_VERSION" =~ 2.18. && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.18.8)" ]] || \
21+
[[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.19.3)" ]]; then
22+
echo 0/nw/01/aa/3f/1234 git-server-fake-uuid
23+
echo 1/nw/23/bb/4c/2345 git-server-fake-uuid1
24+
echo 0/01/aa/3f/gist/93069ad4c391b6203f183e147d52a97a.git git-server-fake-uuid2
25+
echo 1/23/bb/4c/gist/1234.git git-server-fake-uuid
26+
else
27+
echo 0/nw/01/aa/3f/1234 git-server-fake-uuid
28+
echo 1/nw/23/bb/4c/2345 git-server-fake-uuid1
29+
echo 0/01/aa/3f/gist git-server-fake-uuid2
30+
echo 1/23/bb/4c/gist git-server-fake-uuid
31+
fi

test/testlib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export GHE_BACKUP_CONFIG GHE_DATA_DIR GHE_REMOTE_DATA_DIR GHE_REMOTE_ROOT_DIR
4242

4343
# The default remote appliance version. This may be set in the environment prior
4444
# to invoking tests to emulate a different remote vm version.
45-
: ${GHE_TEST_REMOTE_VERSION:=2.19.0}
45+
: ${GHE_TEST_REMOTE_VERSION:=2.20.0}
4646
export GHE_TEST_REMOTE_VERSION
4747

4848
# Source in the backup config and set GHE_REMOTE_XXX variables based on the

0 commit comments

Comments
 (0)