Exit early if the appliance is set to use gitbackups for repositories but is missing required script to do so
This commit is contained in:
Родитель
5bed84c7d0
Коммит
566902ecf2
|
@ -81,6 +81,25 @@ if [ "$(ls -il dest1/testfile | awk '{ print $1 }')" != "$(ls -il dest2/testfile
|
|||
fi
|
||||
rm -rf src dest1 dest2
|
||||
|
||||
# if we should use gitbackups to backup repositories
|
||||
should_use_gitbackups_for_repositories(){
|
||||
ghe-ssh "$GHE_HOSTNAME" ghe-config --true "app.github.gitbackups"
|
||||
}
|
||||
|
||||
# check that the appliance supports using gitbackups for repositories
|
||||
can_use_gitbackups_for_repositories(){
|
||||
ghe-ssh "$GHE_HOSTNAME" test -e /data/github/current/bin/backup-repositories
|
||||
}
|
||||
|
||||
# Exit early if the appliance is missing script to backup repositories using gitbackups
|
||||
if should_use_gitbackups_for_repositories; then
|
||||
if ! can_use_gitbackups_for_repositories; then
|
||||
echo "Error: Configuration setting 'app.github.gitbackups' is enabled but gitbackups cannot be used to back up repositories via 'ghe-backup'."
|
||||
echo "Disable configuration setting 'app.github.gitbackups' and re-run 'ghe-backup' to use rsync."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# To prevent multiple backup runs happening at the same time, we create a
|
||||
# in-progress file with the timestamp and pid of the backup process,
|
||||
# giving us a form of locking.
|
||||
|
@ -197,25 +216,9 @@ ghe-backup-audit-log || failures="$failures audit-log"
|
|||
echo "Backing up hookshot logs ..."
|
||||
ghe-backup-es-hookshot || failures="$failures hookshot"
|
||||
|
||||
# if we should use gitbackups to backup repositories
|
||||
should_use_gitbackups_for_repositories(){
|
||||
ghe-ssh "$GHE_HOSTNAME" ghe-config --true "app.github.gitbackups"
|
||||
}
|
||||
|
||||
# check that the appliance supports using gitbackups for repositories
|
||||
can_use_gitbackups_for_repositories(){
|
||||
ghe-ssh "$GHE_HOSTNAME" test -e /data/github/current/bin/backup-repositories
|
||||
}
|
||||
|
||||
if should_use_gitbackups_for_repositories; then
|
||||
if can_use_gitbackups_for_repositories; then
|
||||
echo "Backing up Git repositories using gitbackups ..."
|
||||
ghe-backup-repositories-gitbackups || failures="$failures repositories"
|
||||
else
|
||||
# we should probably just default to rsync version in this case?
|
||||
echo "Warning: This version of GHES does not support gitbackups for backing up repositories."
|
||||
echo "Disable app.github.gitbackups config setting and rerun to use rsync."
|
||||
fi
|
||||
if should_use_gitbackups_for_repositories && can_use_gitbackups_for_repositories; then
|
||||
echo "Backing up Git repositories using gitbackups ..."
|
||||
ghe-backup-repositories-gitbackups || failures="$failures repositories"
|
||||
else
|
||||
echo "Backing up Git repositories using rsync ..."
|
||||
ghe-backup-repositories-rsync || failures="$failures repositories"
|
||||
|
|
Загрузка…
Ссылка в новой задаче