Skip to content

Commit 4880f3c

Browse files
authored
Merge pull request #440 from github/enterprise-3.7-backport-318-eptekov-pages-lazybuild
Backport 318 for 3.7: Adding new option to support Pages lazy-build strategy
2 parents 5542a5d + 095be1f commit 4880f3c

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

backup.config-example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,6 @@ GHE_NUM_SNAPSHOTS=10
9090
# When running an external mysql database, run this script to trigger a MySQL restore
9191
# rather than attempting to backup via backup-utils directly.
9292
#EXTERNAL_DATABASE_RESTORE_SCRIPT="/bin/false"
93+
94+
# If set to 'yes', Pages data will be included in backup and restore. Defaults to 'yes'
95+
#GHE_BACKUP_PAGES=no

bin/ghe-backup

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,14 @@ commands+=("
231231
echo \"Backing up Git repositories ...\"
232232
ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"")
233233

234-
commands+=("
235-
echo \"Backing up GitHub Pages artifacts ...\"
236-
ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"")
234+
# Pages backups are skipped only if GHE_BACKUP_PAGES is explicitly set to 'no' to guarantee backward compatibility.
235+
# If a customer upgrades backup-utils but keeps the config file from a previous version, Pages backups still work as expected.
236+
237+
if [ "$GHE_BACKUP_PAGES" != "no" ]; then
238+
commands+=("
239+
echo \"Backing up GitHub Pages artifacts ...\"
240+
ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"")
241+
fi
237242

238243
commands+=("
239244
echo \"Backing up storage data ...\"

bin/ghe-restore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,11 @@ commands+=("
447447
echo \"Restoring Gists ...\"
448448
ghe-restore-repositories-gist \"$GHE_HOSTNAME\"")
449449

450-
commands+=("
451-
echo \"Restoring GitHub Pages artifacts ...\"
452-
ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3")
450+
if [ "$GHE_BACKUP_PAGES" != "no" ]; then
451+
commands+=("
452+
echo \"Restoring GitHub Pages artifacts ...\"
453+
ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3")
454+
fi
453455

454456
commands+=("
455457
echo \"Restoring SSH authorized keys ...\"

0 commit comments

Comments
 (0)