From ea49354ad6c580228ee185951b730e2ce53f5dec Mon Sep 17 00:00:00 2001 From: "github-service-catalog[bot]" <66641770+github-service-catalog[bot]@users.noreply.github.com> Date: Wed, 14 Jul 2021 19:18:19 +0000 Subject: [PATCH 001/946] Update service ownership data Co-authored-by: jianghao0718 <45571951+jianghao0718@users.noreply.github.com> --- ownership.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 ownership.yaml diff --git a/ownership.yaml b/ownership.yaml new file mode 100644 index 000000000..3d5fa96cf --- /dev/null +++ b/ownership.yaml @@ -0,0 +1,11 @@ +--- +version: 1 +ownership: +- name: backup-utils + long_name: backup-utils + description: backup-utils is backup and restore tooling for Github enterprise server + (GHES) + kind: logical + repo: https://github.com/github/backup-utils + qos: critical + component_of: ghes-infra From 781ad21d6481e6b01b2ef1a3b6173cb404ef5968 Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Wed, 14 Jul 2021 15:20:35 -0400 Subject: [PATCH 002/946] Update ownership.yaml --- ownership.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ownership.yaml b/ownership.yaml index 3d5fa96cf..6970dbedb 100644 --- a/ownership.yaml +++ b/ownership.yaml @@ -5,7 +5,7 @@ ownership: long_name: backup-utils description: backup-utils is backup and restore tooling for Github enterprise server (GHES) - kind: logical + kind: code repo: https://github.com/github/backup-utils qos: critical component_of: ghes-infra From 0da5e3fb272cd2c84146a0fc7332e844dc81633d Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Wed, 14 Jul 2021 15:22:23 -0400 Subject: [PATCH 003/946] Update ownership.yaml --- ownership.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ownership.yaml b/ownership.yaml index 6970dbedb..3d7ca2039 100644 --- a/ownership.yaml +++ b/ownership.yaml @@ -1,6 +1,13 @@ --- version: 1 ownership: +- name: backup-utils-private + long_name: backup-utils-private + description: backup-utils-private is the private fork of backup-utils + kind: code + repo: https://github.com/github/backup-utils-private + qos: critical + component_of: ghes-infra - name: backup-utils long_name: backup-utils description: backup-utils is backup and restore tooling for Github enterprise server From c0663150c2644b78594c143696345e2b71912045 Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Wed, 4 Aug 2021 15:52:08 -0400 Subject: [PATCH 004/946] Create stale-support-escalation.yml --- .../workflows/stale-support-escalation.yml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/stale-support-escalation.yml diff --git a/.github/workflows/stale-support-escalation.yml b/.github/workflows/stale-support-escalation.yml new file mode 100644 index 000000000..63df54628 --- /dev/null +++ b/.github/workflows/stale-support-escalation.yml @@ -0,0 +1,24 @@ + +name: 'Close stale support escalation issues' +on: + push: + branches: + - master + schedule: + - cron: '30 1 * * *' # Run each day at 1:30 UTC + +jobs: + stale: + if: github.repository == 'github/ghes' || github.repository == 'github/enterprise2' || github.repository == 'github/backup-utils-private' + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This support escalation issue is stale because it has been open 30 days with no activity. To make it never stale, add a label never-stale.' + close-issue-message: 'This support escalation issue is closed because it has been open 60 days with no activity. To make it never stale, add a label never-stale.' + days-before-stale: 30 + days-before-close: 60 + only-labels: 'support-escalation' + stale-issue-label: 'stale' + exempt-issue-labels: 'never-stale,P1,P2,P3' From 8fb420449e8f23256cd94391329b80b12a944930 Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Wed, 4 Aug 2021 15:55:55 -0400 Subject: [PATCH 005/946] Add permissions for write issues --- .github/workflows/stale-support-escalation.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/stale-support-escalation.yml b/.github/workflows/stale-support-escalation.yml index 63df54628..d83dc56b8 100644 --- a/.github/workflows/stale-support-escalation.yml +++ b/.github/workflows/stale-support-escalation.yml @@ -7,6 +7,9 @@ on: schedule: - cron: '30 1 * * *' # Run each day at 1:30 UTC +permissions: + issues: write + jobs: stale: if: github.repository == 'github/ghes' || github.repository == 'github/enterprise2' || github.repository == 'github/backup-utils-private' From a789466d55c1ca44bf6e4853f7fd408f5c9903dc Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:50:56 -0400 Subject: [PATCH 006/946] Update stale-support-escalation.yml --- .github/workflows/stale-support-escalation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale-support-escalation.yml b/.github/workflows/stale-support-escalation.yml index d83dc56b8..2bb01ab53 100644 --- a/.github/workflows/stale-support-escalation.yml +++ b/.github/workflows/stale-support-escalation.yml @@ -19,9 +19,9 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This support escalation issue is stale because it has been open 30 days with no activity. To make it never stale, add a label never-stale.' - close-issue-message: 'This support escalation issue is closed because it has been open 60 days with no activity. To make it never stale, add a label never-stale.' + close-issue-message: 'This support escalation issue is closed because it has been open 45 days with no activity. To make it never stale, add a label never-stale.' days-before-stale: 30 - days-before-close: 60 + days-before-close: 45 only-labels: 'support-escalation' stale-issue-label: 'stale' exempt-issue-labels: 'never-stale,P1,P2,P3' From d6d8fd1239d7c6ea843487b7147b39958b558c4f Mon Sep 17 00:00:00 2001 From: Zachary Mark Date: Tue, 17 Aug 2021 09:56:56 -0500 Subject: [PATCH 007/946] Add example of how to sync two git repositories --- RELEASING.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 0bcb66557..345a6311e 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -15,11 +15,24 @@ Only repo administrator is allowed to run the release script, otherwise it will Prior to making a release, 1. Sync any changes that have been merged to backup-utils-private into this repository. -1. Go through the list of open pull requests and merge any that are ready for merging. -1. Go through the list of closed pull requests since the last release and ensure those that should be included in the release notes: - - have a "bug", "enhancement" or "feature" label, - - have a title that clearly describes the changes in that pull request. Reword if necessary. -1. Perform a dry run (add `--dry-run` to one of the commands below) and verify the version strings are going to be changed and verify the release notes. + + One possible way to accomplish this is to add the other repository as a remote and merge the changes from the default branch of that remote. + ``` + git clone git@github.com:github/backup-utils + cd backup-utils + git checkout master + git checkout -b sync-private-to-public + git remote add private + git fetch private + git merge private/master + git push origin HEAD + ``` + Then open a pull request on this repository with the changes. +2. Go through the list of open pull requests and merge any that are ready for merging. +3. Go through the list of closed pull requests since the last release and ensure those that should be included in the release notes: + - have a "bug", "enhancement" or "feature" label, + - have a title that clearly describes the changes in that pull request. Reword if necessary. +4. Perform a dry run (add `--dry-run` to one of the commands below) and verify the version strings are going to be changed and verify the release notes. ## Automatic Process from chatops (internal to GitHub only) From 0bab95bce63137141d1d6b21987fc244ace842d3 Mon Sep 17 00:00:00 2001 From: Shruti Corbett <90784253+shcorbett@users.noreply.github.com> Date: Mon, 6 Dec 2021 18:57:19 -0500 Subject: [PATCH 008/946] Create stale.yml Adding this check for this repo to clean up old issues if they are no longer relevant by adding 'stale' label. Copied this from another repo that uses this same process. --- .github/workflows/stale.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..828182457 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,25 @@ + +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: "👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot." + stale-issue-label: "Stale" + exempt-issue-labels: "Keep" + stale-pr-message: "👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot." + stale-pr-label: "Stale" + exempt-pr-labels: "Keep, epic, initiative, GHAE" + days-before-stale: 30 # 1 month, which accounts for "now" and "next", but anything beyond is "never" + days-before-close: 5 + ascending: true From b146df54512d3e62172ca10aafad658a658f29d9 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 13 Jan 2022 12:02:34 -0800 Subject: [PATCH 009/946] Bump super linter Resolves #232 --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4a38ba869..6ac0adc8d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,6 +13,6 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - name: Lint Code Base - uses: docker://github/super-linter:v2.1.1 + uses: github/super-linter@b8641364ca9a79b3cf07f3c4c59a82709cd39094 env: VALIDATE_ALL_CODEBASE: false From 1859fdb0af94f36e60270a048b7c087f145ddbaa Mon Sep 17 00:00:00 2001 From: bonsohi <31749534+bonsohi@users.noreply.github.com> Date: Thu, 13 Jan 2022 18:08:40 -0800 Subject: [PATCH 010/946] Update lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6ac0adc8d..46017ce29 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,6 +13,6 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - name: Lint Code Base - uses: github/super-linter@b8641364ca9a79b3cf07f3c4c59a82709cd39094 + uses: docker://github/super-linter:latest env: VALIDATE_ALL_CODEBASE: false From efc116fd4df49dcf7e268397566d4a14fc793eee Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 21 Apr 2022 15:39:46 -0400 Subject: [PATCH 011/946] Updated instances of 'cat' to redirections to prevent broken pipe failures --- share/github-backup-utils/ghe-backup-repositories | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index a66934d0d..7eb17e366 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -129,14 +129,14 @@ bm_end "$(basename $0) - Generating routes" bm_start "$(basename $0) - Fetching routes" ghe-ssh "$GHE_HOSTNAME" -- gzip -c $remote_routes_list | gzip -d > $routes_list -cat $routes_list | ghe_debug +< $routes_list ghe_debug bm_end "$(basename $0) - Fetching routes" bm_start "$(basename $0) - Processing routes" if [ "$GHE_BACKUP_STRATEGY" != "cluster" ]; then server=$host fi -cat $routes_list | awk -v tempdir="$tempdir" -v server="$server" '{ for(i=2;i<=NF;i++){ server != "" ? host=server : host=$i; print $1 > (tempdir"/"host".rsync") }}' +< $routes_list awk -v tempdir="$tempdir" -v server="$server" '{ for(i=2;i<=NF;i++){ server != "" ? host=server : host=$i; print $1 > (tempdir"/"host".rsync") }}' ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" @@ -324,7 +324,7 @@ bm_start "$(basename $0) - Repo sync" for file_list in $tempdir/*.rsync; do hostname=$(basename $file_list .rsync) - repo_num=$(cat $file_list | wc -l) + repo_num=$(< $file_list wc -l) ghe_verbose "* Transferring $repo_num repositories from $hostname" sync_data $hostname $file_list & @@ -366,7 +366,7 @@ bm_end "$(basename $0) - Special Data Directories Sync" if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then bm_start "$(basename $0) - Verifying Routes" - cat $tempdir/*.rsync | uniq | sort | uniq > $tempdir/source_routes + < $tempdir/*.rsync uniq | sort | uniq > $tempdir/source_routes (cd $backup_dir/ && find * -mindepth 5 -maxdepth 6 -type d -name \*.git | fix_paths_for_ghe_version | uniq | sort | uniq) > $tempdir/destination_routes git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more repository networks and/or gists were not found on the source appliance. Please contact GitHub Enterprise Support for assistance." From 1d3688fdf12a9f9a5cea28dc431cf97872f4274c Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Tue, 10 May 2022 13:47:18 -0400 Subject: [PATCH 012/946] Update ghe-backup-repositories Updated rsync file sorting to loop through, to overcome `ambiguous redirect` error in Debian. --- share/github-backup-utils/ghe-backup-repositories | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index 7eb17e366..10e1e9239 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -366,7 +366,9 @@ bm_end "$(basename $0) - Special Data Directories Sync" if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then bm_start "$(basename $0) - Verifying Routes" - < $tempdir/*.rsync uniq | sort | uniq > $tempdir/source_routes + for file_lst in $tempdir/*.rsync; do + < $file_lst sort | uniq + done |sort|uniq > $tempdir/source_routes (cd $backup_dir/ && find * -mindepth 5 -maxdepth 6 -type d -name \*.git | fix_paths_for_ghe_version | uniq | sort | uniq) > $tempdir/destination_routes git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more repository networks and/or gists were not found on the source appliance. Please contact GitHub Enterprise Support for assistance." From 206c5d88f2485fe449d4982d5d511bb78cfba31a Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 25 May 2022 14:37:09 -0400 Subject: [PATCH 013/946] Updated mkdir to use -p to be consistent with GHE*DIR and handle create dir failures --- bin/ghe-backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 8d9be333c..783ea9980 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -63,7 +63,7 @@ touch "incomplete" # Exit early if the snapshot filesystem doesn't support hard links, symlinks and # if rsync doesn't support hardlinking of dangling symlinks trap 'rm -rf src dest1 dest2' EXIT -mkdir src +mkdir -p src touch src/testfile if ! ln -s /data/does/not/exist/hooks/ src/ >/dev/null 2>&1; then echo "Error: the filesystem containing $GHE_DATA_DIR does not support symbolic links." 1>&2 From f2e8ca9d50aa5dadad10ee58de4638212aee65fb Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Wed, 25 May 2022 20:53:46 -0400 Subject: [PATCH 014/946] spelling: file Signed-off-by: Josh Soref --- share/github-backup-utils/ghe-backup-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index e180f8013..309644326 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -232,7 +232,7 @@ export GHE_SNAPSHOT_DIR # Set "true" to get verbose logging of all ssh commands on stderr : ${GHE_VERBOSE_SSH:=false} -# The location of the cluster configuration file file on the remote side. +# The location of the cluster configuration file on the remote side. # This is always "/data/user/common/cluster.conf" for GitHub Cluster instances. # Use of this variable allows the location to be overridden in tests. : ${GHE_REMOTE_CLUSTER_CONF_FILE:="$GHE_REMOTE_DATA_DIR/user/common/cluster.conf"} From 4109b5fd5afb37c0f0f84a1757f4794e23c9741d Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Wed, 25 May 2022 20:54:02 -0400 Subject: [PATCH 015/946] spelling: github Signed-off-by: Josh Soref --- bin/ghe-host-check | 2 +- share/github-backup-utils/ghe-backup-config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 4d934386c..fc418920e 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -53,7 +53,7 @@ port=$(ssh_port_part "$host") hostname=$(ssh_host_part "$host") set +e -# ghe-negotiate-version verifies if the target is a Github Enterprise Server instance +# ghe-negotiate-version verifies if the target is a GitHub Enterprise Server instance output=$(echo "ghe-negotiate-version backup-utils $BACKUP_UTILS_VERSION" | ghe-ssh -o BatchMode=no $options $host -- /bin/sh 2>&1) rc=$? set -e diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 309644326..b9271cf6b 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -335,7 +335,7 @@ ssh_host_part() { # rsync commands. ssh_port_part() { if [ "${1##*:}" != "$1" ] && [ "${1##*:}" -ne "122" ]; then - echo "Error: SSH port has to be 122 connecting to Github Enterprise Server, current value is ${1##*:} for $1." 1>&2 + echo "Error: SSH port has to be 122 connecting to GitHub Enterprise Server, current value is ${1##*:} for $1." 1>&2 exit 1 fi From 5e3193e34d88303b5dad98285ac9c1d27a4e9b66 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Wed, 25 May 2022 20:50:26 -0400 Subject: [PATCH 016/946] spelling: maintenance Signed-off-by: Josh Soref --- docs/usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage.md b/docs/usage.md index 30954c01a..b4db45e73 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -100,7 +100,7 @@ GitHub Actions enabled, the following steps are required: 1. Enable GitHub Actions on the replacement appliance and configure it to use the same GitHub Actions external storage configuration as the original appliance. -2. Put replacement appliance into maintaince mode. +2. Put replacement appliance into maintenance mode. 3. Use `ghe-restore` to restore the backup. 4. Re-register your self-hosted runners on the replacement appliance. From 65e3404ea0ed48b4c77398ec835bce67af63fd00 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Wed, 25 May 2022 20:50:27 -0400 Subject: [PATCH 017/946] spelling: packaging Signed-off-by: Josh Soref --- script/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/release b/script/release index 71dc31e39..a27194d4b 100755 --- a/script/release +++ b/script/release @@ -330,7 +330,7 @@ def clean_up(version) `git pull --quiet origin #{GH_BASE_BRANCH} --prune` `git branch --quiet -D release-#{version} >/dev/null 2>&1` `git push --quiet origin :release-#{version} >/dev/null 2>&1` - `git branch --quiet -D tmp-packging >/dev/null 2>&1` + `git branch --quiet -D tmp-packaging >/dev/null 2>&1` end #### All the action starts #### From 559716fae7556d5990c71e5f85c0b8af3c113a18 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Wed, 25 May 2022 20:53:30 -0400 Subject: [PATCH 018/946] spelling: that Signed-off-by: Josh Soref --- RELEASING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASING.md b/RELEASING.md index 0bcb66557..b54df7845 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -6,7 +6,7 @@ For example, Backup Utilities 2.13.0 can be used to backup and restore all patch There is no need to align Backup Utilities patch releases with GitHub Enterprise Server patch releases. -When making a `.0` release, you will need to specify the minimum supported version of GitHub Enterprise Server that that release supports. +When making a `.0` release, you will need to specify the minimum supported version of GitHub Enterprise Server that release supports. Only repo administrator is allowed to run the release script, otherwise it will fail. From a81400b8461c06271d5a3a474f2a76f51655dbc7 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Wed, 25 May 2022 20:50:27 -0400 Subject: [PATCH 019/946] spelling: utilities Signed-off-by: Josh Soref --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 94e5c5701..4f5427bda 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -67,7 +67,7 @@ be running GitHub Enterprise Server 2.12.x or 2.13.x. You can't restore a snapsh Using multiple backup hosts or backup configurations is not currently recommended. -Due to how some components of Backup Utiltiies (e.g. MSSQL) take incremental backups, running another instance of Backup Utilities may result in unrestorable snapshots as data may be split across backup hosts. If you still wish to have multiple instances of Backup Utilties for redundancy purposes or to run at different frequencies, ensure that they share the same `GHE_DATA_DIR` backup directory. +Due to how some components of Backup Utilities (e.g. MSSQL) take incremental backups, running another instance of Backup Utilities may result in unrestorable snapshots as data may be split across backup hosts. If you still wish to have multiple instances of Backup Utilities for redundancy purposes or to run at different frequencies, ensure that they share the same `GHE_DATA_DIR` backup directory. [1]: https://www.gnu.org/software/bash/ [2]: https://git-scm.com/ From e40faede00a831eaa9c5e490838eef076bcbf1dc Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Wed, 25 May 2022 20:50:28 -0400 Subject: [PATCH 020/946] spelling: variables Signed-off-by: Josh Soref --- STYLEGUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md index f2f6c8782..9c1fc1e86 100644 --- a/STYLEGUIDE.md +++ b/STYLEGUIDE.md @@ -165,7 +165,7 @@ rsync /data/user/db remote:/data/user/db --- ##### Use lowercase and uppercase variable names -Use lowercase variables for locals and internal veriables, and uppercase for variables inherited or exported via the environment +Use lowercase variables for locals and internal variables, and uppercase for variables inherited or exported via the environment ```bash #!/usr/bin/env bash From cc0fe1f85a486cca947c347870b6e3c357e1bd18 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Fri, 17 Jun 2022 09:38:14 +0000 Subject: [PATCH 021/946] GHE Kredz related --- share/github-backup-utils/ghe-backup-settings | 3 ++- share/github-backup-utils/ghe-restore-actions | 3 ++- test/test-ghe-backup.sh | 6 ++++-- test/test-ghe-restore.sh | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index d4ef7d019..49570ff0c 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -102,7 +102,6 @@ if ghe-ssh "$host" -- ghe-config --true app.actions.enabled; then backup-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" backup-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" - backup-secret "Actions Launch credz HMAC key" "actions-launch-credz-hmac" "secrets.launch.credz-hmac-secret" backup-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" backup-secret "Actions Launch Client id" "actions-launch-client-id" "secrets.launch.client-id" backup-secret "Actions Launch Client secret" "actions-launch-client-secret" "secrets.launch.client-secret" @@ -114,6 +113,8 @@ if ghe-ssh "$host" -- ghe-config --true app.actions.enabled; then backup-secret "Actions Launch action runner secret" "actions-launch-action-runner-secret" "secrets.launch.action-runner-secret" backup-secret "Actions Launch service cert" "actions-launch-azp-app-cert" "secrets.launch.azp-app-cert" backup-secret "Actions Launch service private key" "actions-launch-app-app-private-key" "secrets.launch.azp-app-private-key" + + backup-secret "Kredz credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" fi if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/idp.crt"; then diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 62832b24f..dbab46738 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -70,7 +70,6 @@ restore-secret "Actions service principal cert" "actions-service-principal-cert" restore-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" restore-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" -restore-secret "Actions Launch credz HMAC key" "actions-launch-credz-hmac" "secrets.launch.credz-hmac-secret" restore-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" restore-secret "Actions Launch Client id" "actions-launch-client-id" "secrets.launch.client-id" restore-secret "Actions Launch Client secret" "actions-launch-client-secret" "secrets.launch.client-secret" @@ -86,6 +85,8 @@ restore-secret "Actions Launch service private key" "actions-launch-app-app-priv restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" "secrets.launch.token-oauth-key" restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert" +restore-secret "Kredz credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" + # Setup the database logins. ghe_verbose "* Restoring database logins and users to $host ..." diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index bd0e63a3f..6ae1a3533 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -493,7 +493,6 @@ begin_test "ghe-backup takes backup of Actions settings" "secrets.actions.SpsValidationCertThumbprint" "secrets.launch.actions-secrets-private-key" - "secrets.launch.credz-hmac-secret" "secrets.launch.deployer-hmac-secret" "secrets.launch.client-id" "secrets.launch.client-secret" @@ -507,6 +506,8 @@ begin_test "ghe-backup takes backup of Actions settings" "secrets.launch.token-oauth-cert" "secrets.launch.azp-app-cert" "secrets.launch.azp-app-private-key" + + "secrets.kredz.credz-hmac-secret" ) # these 5 were removed in later versions, so we extract them as best effort @@ -538,7 +539,6 @@ begin_test "ghe-backup takes backup of Actions settings" "actions-sps-validation-cert-thumbprint" "actions-launch-secrets-private-key" - "actions-launch-credz-hmac" "actions-launch-deployer-hmac" "actions-launch-client-id" "actions-launch-client-secret" @@ -550,6 +550,8 @@ begin_test "ghe-backup takes backup of Actions settings" "actions-launch-action-runner-secret" "actions-launch-azp-app-cert" "actions-launch-app-app-private-key" + + "kredz-credz-hmac" ) # Add the one optional file we included tests for diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 6a202f1d3..3152f9de6 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -335,7 +335,6 @@ begin_test "ghe-restore with Actions settings" "actions-sps-validation-cert-thumbprint" "actions-launch-secrets-private-key" - "actions-launch-credz-hmac" "actions-launch-deployer-hmac" "actions-launch-client-id" "actions-launch-client-secret" @@ -347,6 +346,8 @@ begin_test "ghe-restore with Actions settings" "actions-launch-action-runner-secret" "actions-launch-azp-app-cert" "actions-launch-app-app-private-key" + + "kredz-credz-hmac" ) for file in "${required_files[@]}"; do @@ -374,7 +375,6 @@ begin_test "ghe-restore with Actions settings" "secrets.actions.SpsValidationCertThumbprint" "secrets.launch.actions-secrets-private-key" - "secrets.launch.credz-hmac-secret" "secrets.launch.deployer-hmac-secret" "secrets.launch.client-id" "secrets.launch.client-secret" @@ -388,6 +388,8 @@ begin_test "ghe-restore with Actions settings" "secrets.launch.token-oauth-cert" "secrets.launch.azp-app-cert" "secrets.launch.azp-app-private-key" + + "secrets.kredz.credz-hmac-secret" ) for secret in "${required_secrets[@]}"; do From 7e2f77d115fc8885cb12d7258cee2c807677e73e Mon Sep 17 00:00:00 2001 From: Matt Burke Date: Fri, 17 Jun 2022 08:20:02 -0400 Subject: [PATCH 022/946] Use spokesctl instead of dgit-cluster-restore-routes --- share/github-backup-utils/ghe-restore-repositories | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index 5938a55eb..ce9a26030 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -120,7 +120,7 @@ cat $tmp_list | ghe_debug bm_end "$(basename $0) - Transferring network list" bm_start "$(basename $0) - Generating routes" -echo "cat $remote_tmp_list | github-env ./bin/dgit-cluster-restore-routes | grep 'git-server-' > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash +echo "cat $remote_tmp_list | ghe-spokesctl backup-utils restore-routes | grep 'git-server-' > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash ghe-ssh "$GHE_HOSTNAME" -- cat $remote_routes_list | ghe_debug bm_end "$(basename $0) - Generating routes" From 79e18f75add2f53e2b6b21ebe7f89eab080b10a5 Mon Sep 17 00:00:00 2001 From: Matt Burke Date: Tue, 21 Jun 2022 09:36:17 -0400 Subject: [PATCH 023/946] Let the GHES instance decide how to restore routes --- share/github-backup-utils/ghe-restore-repositories | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index ce9a26030..b1fcf5386 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -120,7 +120,7 @@ cat $tmp_list | ghe_debug bm_end "$(basename $0) - Transferring network list" bm_start "$(basename $0) - Generating routes" -echo "cat $remote_tmp_list | ghe-spokesctl backup-utils restore-routes | grep 'git-server-' > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash +echo "cat $remote_tmp_list | /usr/local/share/enterprise/ghe-restore-network-routes | grep 'git-server-' > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash ghe-ssh "$GHE_HOSTNAME" -- cat $remote_routes_list | ghe_debug bm_end "$(basename $0) - Generating routes" From cb62ad128417d78a7360cee5304e102c4db61ab1 Mon Sep 17 00:00:00 2001 From: Matt Burke Date: Wed, 22 Jun 2022 15:03:29 -0400 Subject: [PATCH 024/946] Use ghe-restore-network-routes, if it's available Otherwise, dgit-cluster-restore-routes the old way. --- share/github-backup-utils/ghe-restore-repositories | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index b1fcf5386..f56454ce9 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -120,7 +120,11 @@ cat $tmp_list | ghe_debug bm_end "$(basename $0) - Transferring network list" bm_start "$(basename $0) - Generating routes" -echo "cat $remote_tmp_list | /usr/local/share/enterprise/ghe-restore-network-routes | grep 'git-server-' > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash +restore_routes_script="github-env ./bin/dgit-cluster-restore-routes" +if ghe-ssh "$GHE_HOSTNAME" test -e /usr/local/share/enterprise/ghe-restore-network-routes; then + restore_routes_script="/usr/local/share/enterprise/ghe-restore-network-routes" +fi +echo "cat $remote_tmp_list | $restore_routes_script | grep 'git-server-' > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash ghe-ssh "$GHE_HOSTNAME" -- cat $remote_routes_list | ghe_debug bm_end "$(basename $0) - Generating routes" From b408e20e2ce4aeea6742d1652c2748417ca7f73a Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Thu, 28 Jul 2022 15:27:33 +0000 Subject: [PATCH 025/946] backup --- share/github-backup-utils/ghe-backup-settings | 3 +-- share/github-backup-utils/ghe-restore-actions | 1 - .../github-backup-utils/ghe-restore-settings | 1 + test/test-ghe-backup.sh | 27 +++++++++++++++++-- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 49570ff0c..162409b17 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -76,6 +76,7 @@ backup-secret() { backup-secret "management console password" "manage-password" "secrets.manage" backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" +backup-secret "Kredz credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" # Backup external MySQL password if running external MySQL DB. if is_service_external 'mysql'; then @@ -113,8 +114,6 @@ if ghe-ssh "$host" -- ghe-config --true app.actions.enabled; then backup-secret "Actions Launch action runner secret" "actions-launch-action-runner-secret" "secrets.launch.action-runner-secret" backup-secret "Actions Launch service cert" "actions-launch-azp-app-cert" "secrets.launch.azp-app-cert" backup-secret "Actions Launch service private key" "actions-launch-app-app-private-key" "secrets.launch.azp-app-private-key" - - backup-secret "Kredz credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" fi if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/idp.crt"; then diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index dbab46738..fa9541137 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -85,7 +85,6 @@ restore-secret "Actions Launch service private key" "actions-launch-app-app-priv restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" "secrets.launch.token-oauth-key" restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert" -restore-secret "Kredz credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" # Setup the database logins. ghe_verbose "* Restoring database logins and users to $host ..." diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index 63dc7aa45..ccd36689a 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -40,6 +40,7 @@ restore-secret "external MySQL password" "external-mysql-password" "secrets.exte # Restore management console password hash if present. restore-secret "management console password" "manage-password" "secrets.manage" +restore-secret "Kredz credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 6ae1a3533..0ece437b8 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -470,6 +470,31 @@ begin_test "ghe-backup upgrades transaction backup to full if LSN chain break" ) end_test +begin_test "ghe-backup takes backup of Kredz settings" +( + set -e + + required_secrets=( + "secrets.kredz.credz-hmac-secret" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + ghe-backup + + required_files=( + "kredz-credz-hmac" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done + +) +end_test + begin_test "ghe-backup takes backup of Actions settings" ( set -e @@ -507,7 +532,6 @@ begin_test "ghe-backup takes backup of Actions settings" "secrets.launch.azp-app-cert" "secrets.launch.azp-app-private-key" - "secrets.kredz.credz-hmac-secret" ) # these 5 were removed in later versions, so we extract them as best effort @@ -551,7 +575,6 @@ begin_test "ghe-backup takes backup of Actions settings" "actions-launch-azp-app-cert" "actions-launch-app-app-private-key" - "kredz-credz-hmac" ) # Add the one optional file we included tests for From aadb8b955d3e9636bebb41397a716435f1be1668 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Thu, 28 Jul 2022 17:39:56 +0000 Subject: [PATCH 026/946] restore 1 --- .../github-backup-utils/ghe-restore-settings | 4 ++- test/test-ghe-restore.sh | 28 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index ccd36689a..f3bf7cb9b 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -40,7 +40,9 @@ restore-secret "external MySQL password" "external-mysql-password" "secrets.exte # Restore management console password hash if present. restore-secret "management console password" "manage-password" "secrets.manage" -restore-secret "Kredz credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" + +# Restore kredz.credz HMAC key if present. +restore-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 3152f9de6..6b6da2548 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -309,6 +309,32 @@ begin_test "ghe-restore invokes ghe-import-mssql" ) end_test +begin_test "ghe-restore with Kredz settings" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + enable_actions + + required_files=( + "kredz-credz-hmac" + ) + + for file in "${required_files[@]}"; do + echo "foo" > "$GHE_DATA_DIR/current/$file" + done + + ghe-restore -v -f localhost + required_secrets=( + "secrets.kredz.credz-hmac-secret" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + done +) +end_test + begin_test "ghe-restore with Actions settings" ( set -e @@ -347,7 +373,6 @@ begin_test "ghe-restore with Actions settings" "actions-launch-azp-app-cert" "actions-launch-app-app-private-key" - "kredz-credz-hmac" ) for file in "${required_files[@]}"; do @@ -389,7 +414,6 @@ begin_test "ghe-restore with Actions settings" "secrets.launch.azp-app-cert" "secrets.launch.azp-app-private-key" - "secrets.kredz.credz-hmac-secret" ) for secret in "${required_secrets[@]}"; do From 634d313c8c64bbf1b0612734eadc25980ce43ea0 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 28 Jul 2022 21:01:39 -0700 Subject: [PATCH 027/946] Update Dockerfile to bullseye --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 00067263c..94d461c46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stretch-slim +FROM debian:bullseye-slim RUN apt-get -q -y update && \ apt-get install -y --no-install-recommends \ From 3b081203481042bd7b07be0d7cd9a477259ca854 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Fri, 29 Jul 2022 09:39:44 +0530 Subject: [PATCH 028/946] Update ghe-backup-settings --- share/github-backup-utils/ghe-backup-settings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 162409b17..1fbbb55f6 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -76,7 +76,7 @@ backup-secret() { backup-secret "management console password" "manage-password" "secrets.manage" backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" -backup-secret "Kredz credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" +backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" # Backup external MySQL password if running external MySQL DB. if is_service_external 'mysql'; then From 69242c087c6825a15c94a750870beb9d9744b84f Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 28 Jul 2022 21:11:43 -0700 Subject: [PATCH 029/946] Use preferred v3 checkout Action --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f10f64e5e..df25ff87e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: brew install moreutils gawk if: matrix.os == 'macos-latest' - name: Get Sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Test run: | export PATH="$PATH:/snap/bin" From e0e257e96fe35d824452a88c395e94ce62539fa6 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 28 Jul 2022 21:13:49 -0700 Subject: [PATCH 030/946] Bump actions versions --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4a38ba869..5629c6abd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,8 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Lint Code Base - uses: docker://github/super-linter:v2.1.1 + uses: github/super-linter@v4 env: VALIDATE_ALL_CODEBASE: false From 0db5bc546987ea90f6058d1a64a3a707fab76254 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 28 Jul 2022 21:16:54 -0700 Subject: [PATCH 031/946] Enable Dependabot for Actions and Docker ecosystems --- .github/dependabot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..fab2f101d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "docker" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" From f17c9c7a078c49cdef2bc1d2e325bf8e3b6e378e Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 2 Aug 2022 16:30:51 -0700 Subject: [PATCH 032/946] Add a Docker build and test Action --- .github/workflows/docker-image.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 000000000..71396f736 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,24 @@ +name: Docker Image CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build-docker: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Debian Docker image + run: docker build . --file Dockerfile --tag backup-utils-debian:$(date +%s) + - name: Build the Alpine Docker image + run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:$(date +%s) + - name: Run tests in Debian Docker image + run: docker run -it backup-utils-debian:$(date +%s) make test + - name: Run tests in Alpine Docker image + run: docker run -it backup-utils-alpine:$(date +%s) make test From 5aa5ab972608aaaeeea9bd90f0d2a0ff82ecf2e1 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 2 Aug 2022 16:35:03 -0700 Subject: [PATCH 033/946] Add ubuntu-22.04 runner to Actions Matrix The new runner version is going GA https://github.com/actions/virtual-environments/issues/5998 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f10f64e5e..db7b90db6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ jobs: build: strategy: matrix: - os: ['ubuntu-20.04', 'ubuntu-18.04', 'macos-latest'] + os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04', 'macos-latest'] fail-fast: false runs-on: ${{ matrix.os }} steps: From 7c01a409c1a03f198ac0af7d243e8312bd0652c0 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 2 Aug 2022 20:44:17 -0700 Subject: [PATCH 034/946] non-interactive --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 71396f736..a176df872 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,6 +19,6 @@ jobs: - name: Build the Alpine Docker image run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:$(date +%s) - name: Run tests in Debian Docker image - run: docker run -it backup-utils-debian:$(date +%s) make test + run: docker run backup-utils-debian:$(date +%s) script/cibuild --no-package - name: Run tests in Alpine Docker image - run: docker run -it backup-utils-alpine:$(date +%s) make test + run: docker run backup-utils-alpine:$(date +%s) script/cibuild --no-package From 0e15f56dcdb927372a9710c9653ba23e809cd4a3 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 2 Aug 2022 20:54:29 -0700 Subject: [PATCH 035/946] tag with run id instead of date --- .github/workflows/docker-image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index a176df872..45878c64c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Debian Docker image - run: docker build . --file Dockerfile --tag backup-utils-debian:$(date +%s) + run: docker build . --file Dockerfile --tag backup-utils-debian:${{ env. GITHUB_RUN_ID }} - name: Build the Alpine Docker image - run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:$(date +%s) + run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${{ env. GITHUB_RUN_ID }} - name: Run tests in Debian Docker image - run: docker run backup-utils-debian:$(date +%s) script/cibuild --no-package + run: docker run backup-utils-debian:${{ env. GITHUB_RUN_ID }} script/cibuild --no-package - name: Run tests in Alpine Docker image - run: docker run backup-utils-alpine:$(date +%s) script/cibuild --no-package + run: docker run backup-utils-alpine:${{ env. GITHUB_RUN_ID }} script/cibuild --no-package From 58698235166cee33a2d33bb135b1bc8f73e1ea74 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 2 Aug 2022 20:56:19 -0700 Subject: [PATCH 036/946] fix syntax issue --- .github/workflows/docker-image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 45878c64c..0acc6471c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Debian Docker image - run: docker build . --file Dockerfile --tag backup-utils-debian:${{ env. GITHUB_RUN_ID }} + run: docker build . --file Dockerfile --tag backup-utils-debian:${GITHUB_RUN_ID} - name: Build the Alpine Docker image - run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${{ env. GITHUB_RUN_ID }} + run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID} - name: Run tests in Debian Docker image - run: docker run backup-utils-debian:${{ env. GITHUB_RUN_ID }} script/cibuild --no-package + run: docker run backup-utils-debian:${GITHUB_RUN_ID} script/cibuild --no-package - name: Run tests in Alpine Docker image - run: docker run backup-utils-alpine:${{ env. GITHUB_RUN_ID }} script/cibuild --no-package + run: docker run backup-utils-alpine:${GITHUB_RUN_ID} script/cibuild --no-package From 86037e4c46090366d8e95906795ca5df10d5fa14 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 2 Aug 2022 21:16:12 -0700 Subject: [PATCH 037/946] simple version check --- .github/workflows/docker-image.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0acc6471c..3904b1e6c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,6 +19,7 @@ jobs: - name: Build the Alpine Docker image run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID} - name: Run tests in Debian Docker image - run: docker run backup-utils-debian:${GITHUB_RUN_ID} script/cibuild --no-package + run: docker run backup-utils-debian:${GITHUB_RUN_ID} ghe-backup --version - name: Run tests in Alpine Docker image - run: docker run backup-utils-alpine:${GITHUB_RUN_ID} script/cibuild --no-package + run: docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version + From 059eb5948be86e42f4a7c57cb7bf87ffc214b709 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 4 Aug 2022 09:41:27 -0700 Subject: [PATCH 038/946] Buster to align with GHES --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 94d461c46..3b66b5020 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye-slim +FROM debian:buster-slim RUN apt-get -q -y update && \ apt-get install -y --no-install-recommends \ From d3125df10d827bd167f3ef14b78aa02dbe794a4e Mon Sep 17 00:00:00 2001 From: djdefi Date: Fri, 5 Aug 2022 09:57:42 -0700 Subject: [PATCH 039/946] Lint PRs --- .github/workflows/lint.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5629c6abd..3cc52f4a1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,9 +1,10 @@ name: Lint Code Base on: + push: + branches-ignore: [master] pull_request: - branches-ignore: - - 'master' + branches: [master] jobs: build: From 72857dcfcc7a24ed45651f14cad12f4aee4bba2f Mon Sep 17 00:00:00 2001 From: djdefi Date: Fri, 5 Aug 2022 10:13:16 -0700 Subject: [PATCH 040/946] Full history for linter --- .github/workflows/lint.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3cc52f4a1..d2599fbd1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,12 +7,15 @@ on: branches: [master] jobs: - build: + lint: name: Lint Code Base runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v3 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 - name: Lint Code Base uses: github/super-linter@v4 env: From 3e4b93aebb607e20aaab49189b2b5949dffc3eba Mon Sep 17 00:00:00 2001 From: djdefi Date: Fri, 5 Aug 2022 10:22:40 -0700 Subject: [PATCH 041/946] Add token per linter docs --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d2599fbd1..9d97805de 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,3 +20,4 @@ jobs: uses: github/super-linter@v4 env: VALIDATE_ALL_CODEBASE: false + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 079e1cceecb8453f35360717bb9edcc6eb57bf16 Mon Sep 17 00:00:00 2001 From: Luca Cavallin <14332663+lucavallin@users.noreply.github.com> Date: Mon, 8 Aug 2022 09:16:01 +0200 Subject: [PATCH 042/946] Stop restore when a backup without Actions is being restored onto an appliance with Actions enabled (#946) * throw error and abort when restoring a backup with Actions disabled onto an appliance with Actions enabled * set ACTIONS_ENABLED_IN_BACKUP to false if the value is not found in settings.json * use git config to grab app.actions.enabled directly * add bash function to enable and disable actions in settings.json * enable actions in settings for part of other tests that require it * use git config to set initial value for actions in settings.json * empty settings.json before using git config --- bin/ghe-restore | 8 ++++++++ test/test-ghe-restore.sh | 15 +++++++++++++++ test/testlib.sh | 8 ++++++++ 3 files changed, 31 insertions(+) diff --git a/bin/ghe-restore b/bin/ghe-restore index c06f85071..42fe6cd57 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -285,6 +285,14 @@ fi # Get GHES release version in major.minor format RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-version' | cut -d '.' -f 1,2) +# If the backup being restored is from an appliance with Actions disabled, restoring it onto an appliance with Actions enabled will cause +# mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace +ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) +if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then + echo "Error: Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + exit 1 +fi + # Make sure the GitHub appliance has Actions enabled if the snapshot contains Actions data. # If above is true, also check if ac is present in appliance then snapshot should also contains ac databases if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 2e9ee3b12..6bef6bdc7 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -6,6 +6,7 @@ . "$(dirname "$0")/testlib.sh" setup_test_data "$GHE_DATA_DIR/1" +setup_actions_enabled_settings_for_restore true # Make the current symlink ln -s 1 "$GHE_DATA_DIR/current" @@ -700,3 +701,17 @@ end_test # verify_all_restored_data # ) # end_test + +begin_test "ghe-restore fails if Actions is disabled in the backup but enabled on the appliance" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + setup_actions_enabled_settings_for_restore false + enable_actions + + setup_maintenance_mode "configured" + + ! ghe-restore -v -f localhost +) +end_test diff --git a/test/testlib.sh b/test/testlib.sh index 74fe6faec..32b57579e 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -594,3 +594,11 @@ cleanup_moreutils_parallel() { unlink "$ROOTDIR/test/bin/parallel" fi } + +# setup_actions_enabled_in_settings_json writes settings for the Actions app to settings.json +# it accepts true or false as first argument to enable or disable actions in settings.json +setup_actions_enabled_settings_for_restore() { + # Empty the file, it now contains "fake ghe-export-settings data" + echo > "$GHE_DATA_DIR/1/settings.json" + git config -f "$GHE_DATA_DIR/1/settings.json" --bool app.actions.enabled $1 +} From f83c3eaa129a3eb1c217232d700e1606ccb84452 Mon Sep 17 00:00:00 2001 From: Joseph Franks Date: Wed, 17 Aug 2022 19:20:54 +0000 Subject: [PATCH 043/946] Bump version: 3.6.0 [ci skip] --- bin/ghe-host-check | 2 +- debian/changelog | 5 +++++ share/github-backup-utils/version | 2 +- test/testlib.sh | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 4d934386c..1f8a51847 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -131,7 +131,7 @@ fi # backup-utils 2.13 onwards limits support to the current and previous two releases # of GitHub Enterprise Server. -supported_minimum_version="3.3.0" +supported_minimum_version="3.4.0" if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then supported=1 diff --git a/debian/changelog b/debian/changelog index 3cf6c0d25..bf6ca9e03 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,8 @@ +github-backup-utils (3.6.0) UNRELEASED; urgency=medium + + + -- Joe Franks Wed, 17 Aug 2022 19:20:54 +0000 + github-backup-utils (3.5.0) UNRELEASED; urgency=medium * Simplify complex redirects for ghe-rsync #881 diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 1545d9665..40c341bdc 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.5.0 +3.6.0 diff --git a/test/testlib.sh b/test/testlib.sh index 32b57579e..64f00e0f6 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -42,7 +42,7 @@ export GHE_BACKUP_CONFIG GHE_DATA_DIR GHE_REMOTE_DATA_DIR GHE_REMOTE_ROOT_DIR # The default remote appliance version. This may be set in the environment prior # to invoking tests to emulate a different remote vm version. -: ${GHE_TEST_REMOTE_VERSION:=3.5.0.rc1} +: ${GHE_TEST_REMOTE_VERSION:=3.6.0.rc1} export GHE_TEST_REMOTE_VERSION # Source in the backup config and set GHE_REMOTE_XXX variables based on the From 96f735f161aedb969fd8b739453e74327477c15d Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Fri, 19 Aug 2022 12:45:55 -1000 Subject: [PATCH 044/946] refactor: ghe-cluster-each --print, --ip, --uuid flags --- share/github-backup-utils/ghe-cluster-nodes | 2 +- test/bin/ghe-cluster-each | 33 ++----------------- test/bin/ghe-cluster-nodes | 35 +++++++++++++++++++++ 3 files changed, 38 insertions(+), 32 deletions(-) create mode 100755 test/bin/ghe-cluster-nodes diff --git a/share/github-backup-utils/ghe-cluster-nodes b/share/github-backup-utils/ghe-cluster-nodes index a4d29247b..43e7416ee 100755 --- a/share/github-backup-utils/ghe-cluster-nodes +++ b/share/github-backup-utils/ghe-cluster-nodes @@ -28,7 +28,7 @@ prefix="$2" role=$(echo "$prefix" | cut -d '-' -f1) if ghe-ssh "$GHE_HOSTNAME" test -f $GHE_REMOTE_ROOT_DIR/etc/github/cluster; then - node_uuids=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-each -r "$role" -u) + node_uuids=$(ghe-ssh "$GHE_HOSTNAME" /usr/local/bin/ghe-cluster-nodes -r "$role" -u | cut -f 2) hostnames='' for uuid in $node_uuids; do hostnames+="$prefix-$uuid " diff --git a/test/bin/ghe-cluster-each b/test/bin/ghe-cluster-each index a7673f632..e503f2806 100755 --- a/test/bin/ghe-cluster-each +++ b/test/bin/ghe-cluster-each @@ -1,21 +1,11 @@ #!/usr/bin/env bash -# Usage: ghe-config -# Emulates the remote GitHub ghe-config command. Tests use this +# Usage: ghe-cluster-each +# Emulates the remote GitHub ghe-cluster-each command. Tests use this # to assert that the command was executed. set -e for _ in "$@"; do case "$1" in - -u) - SHOW_UUID=true - shift - ;; - -r|--role) - # fake change last save timestamp every 1s - ROLE=$2 - shift - shift - ;; --) if [ "$1" = "--" ]; then shift @@ -43,22 +33,3 @@ if [ "$COMMAND" == "/usr/local/share/enterprise/ghe-nomad-cleanup" ]; then echo "nomad cleanup" exit 0 fi - -if $SHOW_UUID; then - CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" - - hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) - - if [ -z "$hosts" ]; then - # Mimic `ghe-cluster-each $role -u` - echo "fake-uuid - fake-uuid1 - fake-uuid2 - " - else - for hostname in $hosts; do - [ -n "$ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$ROLE-server)" != "true" ] && continue - echo $hostname - done - fi -fi \ No newline at end of file diff --git a/test/bin/ghe-cluster-nodes b/test/bin/ghe-cluster-nodes new file mode 100755 index 000000000..b43604145 --- /dev/null +++ b/test/bin/ghe-cluster-nodes @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Usage: ghe-cluster-nodes +# Emulates the remote GitHub ghe-cluster-nodes command. Tests use this +# to assert that the command was executed. +set -e + +for _ in "$@"; do + case "$1" in + -r|--role) + MATCH_ROLE=$2 + shift + ;; + -u|--uuid) + PRINT_UUIDS=true + shift + ;; + esac +done + +CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" + +hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) + +for hostname in $hosts; do + [ -n "$MATCH_ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$MATCH_ROLE-server)" != "true" ] && continue + + print_line="$hostname" + + if [ -n "$PRINT_UUIDS" ]; then + uuid="$(ghe-config cluster.$hostname.uuid || true)" + print_line="$print_line\t$uuid" + fi + + echo -e "${print_line#\\t}" +done From 56192d3037cfdf87bfa07839093e0cace3aa847f Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Tue, 23 Aug 2022 12:38:57 -1000 Subject: [PATCH 045/946] t --- share/github-backup-utils/ghe-cluster-nodes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/share/github-backup-utils/ghe-cluster-nodes b/share/github-backup-utils/ghe-cluster-nodes index 43e7416ee..d103d963d 100755 --- a/share/github-backup-utils/ghe-cluster-nodes +++ b/share/github-backup-utils/ghe-cluster-nodes @@ -28,6 +28,12 @@ prefix="$2" role=$(echo "$prefix" | cut -d '-' -f1) if ghe-ssh "$GHE_HOSTNAME" test -f $GHE_REMOTE_ROOT_DIR/etc/github/cluster; then + test_output=$(ghe-ssh "GHE_HOSTNAME" ls -lah /) + echo $test_output + + test_output=$(ghe-ssh "GHE_HOSTNAME" ls -lah /usr/local/bin) + echo $test_output + node_uuids=$(ghe-ssh "$GHE_HOSTNAME" /usr/local/bin/ghe-cluster-nodes -r "$role" -u | cut -f 2) hostnames='' for uuid in $node_uuids; do From 7fee9a21beb172914661bab1b3148a4cc6544d41 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Tue, 23 Aug 2022 12:40:54 -1000 Subject: [PATCH 046/946] t --- share/github-backup-utils/ghe-cluster-nodes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/share/github-backup-utils/ghe-cluster-nodes b/share/github-backup-utils/ghe-cluster-nodes index d103d963d..6dc596666 100755 --- a/share/github-backup-utils/ghe-cluster-nodes +++ b/share/github-backup-utils/ghe-cluster-nodes @@ -34,6 +34,12 @@ if ghe-ssh "$GHE_HOSTNAME" test -f $GHE_REMOTE_ROOT_DIR/etc/github/cluster; then test_output=$(ghe-ssh "GHE_HOSTNAME" ls -lah /usr/local/bin) echo $test_output + test_output=$(ghe-ssh "GHE_HOSTNAME" whereis ghe-cluster-each) + echo $test_output + + test_output=$(ghe-ssh "GHE_HOSTNAME" whereis ghe-cluster-nodes) + echo $test_output + node_uuids=$(ghe-ssh "$GHE_HOSTNAME" /usr/local/bin/ghe-cluster-nodes -r "$role" -u | cut -f 2) hostnames='' for uuid in $node_uuids; do From 58568a496ce5d2be0722d9ee6c924c4e93c10671 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Tue, 23 Aug 2022 13:00:06 -1000 Subject: [PATCH 047/946] t --- share/github-backup-utils/ghe-backup-git-hooks | 2 +- share/github-backup-utils/ghe-backup-pages | 2 +- .../github-backup-utils/ghe-backup-repositories | 2 +- share/github-backup-utils/ghe-backup-storage | 2 +- ...{ghe-cluster-nodes => ghe-cluster-find-nodes} | 16 ++-------------- share/github-backup-utils/ghe-restore-git-hooks | 2 +- share/github-backup-utils/ghe-restore-pages | 2 +- .../github-backup-utils/ghe-restore-repositories | 2 +- .../ghe-restore-repositories-gist | 2 +- share/github-backup-utils/ghe-restore-storage | 2 +- ...r-nodes.sh => test-ghe-cluster-find-nodes.sh} | 10 +++++----- 11 files changed, 16 insertions(+), 28 deletions(-) rename share/github-backup-utils/{ghe-cluster-nodes => ghe-cluster-find-nodes} (71%) rename test/{test-ghe-cluster-nodes.sh => test-ghe-cluster-find-nodes.sh} (69%) diff --git a/share/github-backup-utils/ghe-backup-git-hooks b/share/github-backup-utils/ghe-backup-git-hooks index c7bd5429e..3229ee009 100755 --- a/share/github-backup-utils/ghe-backup-git-hooks +++ b/share/github-backup-utils/ghe-backup-git-hooks @@ -43,7 +43,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-backup-pages b/share/github-backup-utils/ghe-backup-pages index e6445c812..634e7a417 100755 --- a/share/github-backup-utils/ghe-backup-pages +++ b/share/github-backup-utils/ghe-backup-pages @@ -43,7 +43,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "pages-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "pages-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index 10e1e9239..1b711df37 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -74,7 +74,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index db49bc8e7..cbc05428c 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -47,7 +47,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "storage-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "storage-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-cluster-nodes b/share/github-backup-utils/ghe-cluster-find-nodes similarity index 71% rename from share/github-backup-utils/ghe-cluster-nodes rename to share/github-backup-utils/ghe-cluster-find-nodes index 6dc596666..c2a3cf0e1 100755 --- a/share/github-backup-utils/ghe-cluster-nodes +++ b/share/github-backup-utils/ghe-cluster-find-nodes @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#/ Usage: ghe-cluster-nodes +#/ Usage: ghe-cluster-find-nodes #/ #/ Finds all nodes of the cluster using the config on . #/ If it is a 2.8 and later cluster version the results are returned as @@ -28,19 +28,7 @@ prefix="$2" role=$(echo "$prefix" | cut -d '-' -f1) if ghe-ssh "$GHE_HOSTNAME" test -f $GHE_REMOTE_ROOT_DIR/etc/github/cluster; then - test_output=$(ghe-ssh "GHE_HOSTNAME" ls -lah /) - echo $test_output - - test_output=$(ghe-ssh "GHE_HOSTNAME" ls -lah /usr/local/bin) - echo $test_output - - test_output=$(ghe-ssh "GHE_HOSTNAME" whereis ghe-cluster-each) - echo $test_output - - test_output=$(ghe-ssh "GHE_HOSTNAME" whereis ghe-cluster-nodes) - echo $test_output - - node_uuids=$(ghe-ssh "$GHE_HOSTNAME" /usr/local/bin/ghe-cluster-nodes -r "$role" -u | cut -f 2) + node_uuids=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -r "$role" -u | cut -f 2) hostnames='' for uuid in $node_uuids; do hostnames+="$prefix-$uuid " diff --git a/share/github-backup-utils/ghe-restore-git-hooks b/share/github-backup-utils/ghe-restore-git-hooks index b9c9555f0..67081a921 100755 --- a/share/github-backup-utils/ghe-restore-git-hooks +++ b/share/github-backup-utils/ghe-restore-git-hooks @@ -42,7 +42,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-pages b/share/github-backup-utils/ghe-restore-pages index 17f80ae79..800eb14d3 100755 --- a/share/github-backup-utils/ghe-restore-pages +++ b/share/github-backup-utils/ghe-restore-pages @@ -56,7 +56,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "pages-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "pages-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index f56454ce9..3d522be0b 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -61,7 +61,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-repositories-gist b/share/github-backup-utils/ghe-restore-repositories-gist index 946dbc50d..5080b964f 100755 --- a/share/github-backup-utils/ghe-restore-repositories-gist +++ b/share/github-backup-utils/ghe-restore-repositories-gist @@ -60,7 +60,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index a890ca741..408d0e237 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -60,7 +60,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $tempdir/ssh_config" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "storage-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "storage-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/test/test-ghe-cluster-nodes.sh b/test/test-ghe-cluster-find-nodes.sh similarity index 69% rename from test/test-ghe-cluster-nodes.sh rename to test/test-ghe-cluster-find-nodes.sh index cdff8ad1e..20ce7fdbb 100755 --- a/test/test-ghe-cluster-nodes.sh +++ b/test/test-ghe-cluster-find-nodes.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# ghe-cluster-nodes command tests +# ghe-cluster-find-nodes command tests # Bring in testlib # shellcheck source=test/testlib.sh @@ -14,25 +14,25 @@ export GHE_DATA_DIR GHE_REMOTE_DATA_DIR mkdir -p "$GHE_REMOTE_DATA_USER_DIR/common" echo "fake-uuid" > "$GHE_REMOTE_DATA_USER_DIR/common/uuid" -begin_test "ghe-cluster-nodes should return both uuids for git-server" +begin_test "ghe-cluster-find-nodes should return both uuids for git-server" ( set -e setup_remote_cluster - output="$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server")" + output="$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server")" echo "$output" [ "git-server-fake-uuid git-server-fake-uuid1 git-server-fake-uuid2 " = "$output" ] ) end_test -begin_test "ghe-cluster-nodes should return one uuid for a single node" +begin_test "ghe-cluster-find-nodes should return one uuid for a single node" ( set -e # Ensure not a cluster rm -rf "$GHE_REMOTE_ROOT_DIR/etc/github/cluster" - output="$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server")" + output="$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server")" echo "$output" [ "git-server-fake-uuid" = "$output" ] ) From 5e2068e4bf4f73d002a01e63434af3e3b85d8874 Mon Sep 17 00:00:00 2001 From: donal Date: Thu, 8 Sep 2022 09:52:49 +1000 Subject: [PATCH 048/946] minor fixes --- test/bin/ghe-cluster-nodes | 2 +- test/test-ghe-backup.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/bin/ghe-cluster-nodes b/test/bin/ghe-cluster-nodes index b43604145..3dde1a884 100755 --- a/test/bin/ghe-cluster-nodes +++ b/test/bin/ghe-cluster-nodes @@ -7,7 +7,7 @@ set -e for _ in "$@"; do case "$1" in -r|--role) - MATCH_ROLE=$2 + ROLE=$2 shift ;; -u|--uuid) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 0ece437b8..f50963fd9 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -265,7 +265,7 @@ begin_test "ghe-backup cluster" if ! ghe-backup -v > "$TRASHDIR/backup-out" 2>&1; then cat "$TRASHDIR/backup-out" - : ghe-restore should have exited successfully + : ghe-backup should have exited successfully false fi From 7307f1f46cea64c0b1175d047ea14c5930fb6ffd Mon Sep 17 00:00:00 2001 From: donal Date: Thu, 8 Sep 2022 10:02:43 +1000 Subject: [PATCH 049/946] return fake uuids when cluster.conf doesn't exist Or it's invalid, which it is for most of these tests. --- test/bin/ghe-cluster-nodes | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/test/bin/ghe-cluster-nodes b/test/bin/ghe-cluster-nodes index 3dde1a884..29e4beb3e 100755 --- a/test/bin/ghe-cluster-nodes +++ b/test/bin/ghe-cluster-nodes @@ -21,15 +21,21 @@ CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) -for hostname in $hosts; do - [ -n "$MATCH_ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$MATCH_ROLE-server)" != "true" ] && continue +if $PRINT_UUIDS; then + CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" - print_line="$hostname" + hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) - if [ -n "$PRINT_UUIDS" ]; then - uuid="$(ghe-config cluster.$hostname.uuid || true)" - print_line="$print_line\t$uuid" - fi - - echo -e "${print_line#\\t}" -done + if [ -z "$hosts" ]; then + # Mimic `ghe-cluster-each $role -u` + echo "fake-uuid + fake-uuid1 + fake-uuid2 + " + else + for hostname in $hosts; do + [ -n "$ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$ROLE-server)" != "true" ] && continue + echo $hostname + done + fi +fi From 36003ea776cb45a853164c167260fc8abc7e5a6f Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Thu, 8 Sep 2022 12:41:33 -1000 Subject: [PATCH 050/946] refactor: ghe-cluster-each --print, --ip, --uuid flags --- .../github-backup-utils/ghe-backup-git-hooks | 2 +- share/github-backup-utils/ghe-backup-pages | 2 +- .../ghe-backup-repositories | 2 +- share/github-backup-utils/ghe-backup-storage | 2 +- ...e-cluster-nodes => ghe-cluster-find-nodes} | 4 +- .../github-backup-utils/ghe-restore-git-hooks | 2 +- share/github-backup-utils/ghe-restore-pages | 2 +- .../ghe-restore-repositories | 2 +- .../ghe-restore-repositories-gist | 2 +- share/github-backup-utils/ghe-restore-storage | 2 +- test/bin/ghe-cluster-each | 33 +-------------- test/bin/ghe-cluster-nodes | 41 +++++++++++++++++++ test/test-ghe-backup.sh | 2 +- ...odes.sh => test-ghe-cluster-find-nodes.sh} | 10 ++--- 14 files changed, 60 insertions(+), 48 deletions(-) rename share/github-backup-utils/{ghe-cluster-nodes => ghe-cluster-find-nodes} (89%) create mode 100644 test/bin/ghe-cluster-nodes rename test/{test-ghe-cluster-nodes.sh => test-ghe-cluster-find-nodes.sh} (69%) diff --git a/share/github-backup-utils/ghe-backup-git-hooks b/share/github-backup-utils/ghe-backup-git-hooks index c7bd5429e..3229ee009 100755 --- a/share/github-backup-utils/ghe-backup-git-hooks +++ b/share/github-backup-utils/ghe-backup-git-hooks @@ -43,7 +43,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-backup-pages b/share/github-backup-utils/ghe-backup-pages index e6445c812..634e7a417 100755 --- a/share/github-backup-utils/ghe-backup-pages +++ b/share/github-backup-utils/ghe-backup-pages @@ -43,7 +43,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "pages-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "pages-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index 5185f63d9..35b751b12 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -74,7 +74,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index 67517512b..bb8117021 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -47,7 +47,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "storage-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "storage-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-cluster-nodes b/share/github-backup-utils/ghe-cluster-find-nodes similarity index 89% rename from share/github-backup-utils/ghe-cluster-nodes rename to share/github-backup-utils/ghe-cluster-find-nodes index a4d29247b..c2a3cf0e1 100755 --- a/share/github-backup-utils/ghe-cluster-nodes +++ b/share/github-backup-utils/ghe-cluster-find-nodes @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#/ Usage: ghe-cluster-nodes +#/ Usage: ghe-cluster-find-nodes #/ #/ Finds all nodes of the cluster using the config on . #/ If it is a 2.8 and later cluster version the results are returned as @@ -28,7 +28,7 @@ prefix="$2" role=$(echo "$prefix" | cut -d '-' -f1) if ghe-ssh "$GHE_HOSTNAME" test -f $GHE_REMOTE_ROOT_DIR/etc/github/cluster; then - node_uuids=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-each -r "$role" -u) + node_uuids=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -r "$role" -u | cut -f 2) hostnames='' for uuid in $node_uuids; do hostnames+="$prefix-$uuid " diff --git a/share/github-backup-utils/ghe-restore-git-hooks b/share/github-backup-utils/ghe-restore-git-hooks index b9c9555f0..67081a921 100755 --- a/share/github-backup-utils/ghe-restore-git-hooks +++ b/share/github-backup-utils/ghe-restore-git-hooks @@ -42,7 +42,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-pages b/share/github-backup-utils/ghe-restore-pages index 17f80ae79..800eb14d3 100755 --- a/share/github-backup-utils/ghe-restore-pages +++ b/share/github-backup-utils/ghe-restore-pages @@ -56,7 +56,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "pages-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "pages-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index 5938a55eb..b42193cf7 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -61,7 +61,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-repositories-gist b/share/github-backup-utils/ghe-restore-repositories-gist index 946dbc50d..5080b964f 100755 --- a/share/github-backup-utils/ghe-restore-repositories-gist +++ b/share/github-backup-utils/ghe-restore-repositories-gist @@ -60,7 +60,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index a890ca741..408d0e237 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -60,7 +60,7 @@ if $CLUSTER; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $tempdir/ssh_config" opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-nodes "$GHE_HOSTNAME" "storage-server") + hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "storage-server") ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi diff --git a/test/bin/ghe-cluster-each b/test/bin/ghe-cluster-each index a7673f632..e503f2806 100755 --- a/test/bin/ghe-cluster-each +++ b/test/bin/ghe-cluster-each @@ -1,21 +1,11 @@ #!/usr/bin/env bash -# Usage: ghe-config -# Emulates the remote GitHub ghe-config command. Tests use this +# Usage: ghe-cluster-each +# Emulates the remote GitHub ghe-cluster-each command. Tests use this # to assert that the command was executed. set -e for _ in "$@"; do case "$1" in - -u) - SHOW_UUID=true - shift - ;; - -r|--role) - # fake change last save timestamp every 1s - ROLE=$2 - shift - shift - ;; --) if [ "$1" = "--" ]; then shift @@ -43,22 +33,3 @@ if [ "$COMMAND" == "/usr/local/share/enterprise/ghe-nomad-cleanup" ]; then echo "nomad cleanup" exit 0 fi - -if $SHOW_UUID; then - CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" - - hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) - - if [ -z "$hosts" ]; then - # Mimic `ghe-cluster-each $role -u` - echo "fake-uuid - fake-uuid1 - fake-uuid2 - " - else - for hostname in $hosts; do - [ -n "$ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$ROLE-server)" != "true" ] && continue - echo $hostname - done - fi -fi \ No newline at end of file diff --git a/test/bin/ghe-cluster-nodes b/test/bin/ghe-cluster-nodes new file mode 100644 index 000000000..5cc98341f --- /dev/null +++ b/test/bin/ghe-cluster-nodes @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Usage: ghe-cluster-nodes +# Emulates the remote GitHub ghe-cluster-nodes command. Tests use this +# to assert that the command was executed. +set -e + +for _ in "$@"; do + case "$1" in + -r|--role) + ROLE=$2 + shift + ;; + -u|--uuid) + PRINT_UUIDS=true + shift + ;; + esac +done + +CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" + +hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) + +if $PRINT_UUIDS; then + CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" + + hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) + + if [ -z "$hosts" ]; then + # Mimic `ghe-cluster-each $role -u` + echo "fake-uuid + fake-uuid1 + fake-uuid2 + " + else + for hostname in $hosts; do + [ -n "$ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$ROLE-server)" != "true" ] && continue + echo $hostname + done + fi +fi \ No newline at end of file diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index bd0e63a3f..da9a8d686 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -265,7 +265,7 @@ begin_test "ghe-backup cluster" if ! ghe-backup -v > "$TRASHDIR/backup-out" 2>&1; then cat "$TRASHDIR/backup-out" - : ghe-restore should have exited successfully + : ghe-backup should have exited successfully false fi diff --git a/test/test-ghe-cluster-nodes.sh b/test/test-ghe-cluster-find-nodes.sh similarity index 69% rename from test/test-ghe-cluster-nodes.sh rename to test/test-ghe-cluster-find-nodes.sh index cdff8ad1e..20ce7fdbb 100755 --- a/test/test-ghe-cluster-nodes.sh +++ b/test/test-ghe-cluster-find-nodes.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# ghe-cluster-nodes command tests +# ghe-cluster-find-nodes command tests # Bring in testlib # shellcheck source=test/testlib.sh @@ -14,25 +14,25 @@ export GHE_DATA_DIR GHE_REMOTE_DATA_DIR mkdir -p "$GHE_REMOTE_DATA_USER_DIR/common" echo "fake-uuid" > "$GHE_REMOTE_DATA_USER_DIR/common/uuid" -begin_test "ghe-cluster-nodes should return both uuids for git-server" +begin_test "ghe-cluster-find-nodes should return both uuids for git-server" ( set -e setup_remote_cluster - output="$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server")" + output="$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server")" echo "$output" [ "git-server-fake-uuid git-server-fake-uuid1 git-server-fake-uuid2 " = "$output" ] ) end_test -begin_test "ghe-cluster-nodes should return one uuid for a single node" +begin_test "ghe-cluster-find-nodes should return one uuid for a single node" ( set -e # Ensure not a cluster rm -rf "$GHE_REMOTE_ROOT_DIR/etc/github/cluster" - output="$(ghe-cluster-nodes "$GHE_HOSTNAME" "git-server")" + output="$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server")" echo "$output" [ "git-server-fake-uuid" = "$output" ] ) From 7e8c207275b1f7be38c1ad7aa407b9c9a268e616 Mon Sep 17 00:00:00 2001 From: donal Date: Fri, 9 Sep 2022 09:49:54 +1000 Subject: [PATCH 051/946] make stub script executable and quiet linter --- test/bin/ghe-cluster-nodes | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 test/bin/ghe-cluster-nodes diff --git a/test/bin/ghe-cluster-nodes b/test/bin/ghe-cluster-nodes old mode 100644 new mode 100755 index 5cc98341f..cbdefdb69 --- a/test/bin/ghe-cluster-nodes +++ b/test/bin/ghe-cluster-nodes @@ -19,12 +19,12 @@ done CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" -hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) +hosts=$(git config -f "$CONFIG" --get-regexp cluster.*.hostname | cut -d ' ' -f2) if $PRINT_UUIDS; then CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf" - hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2) + hosts=$(git config -f "$CONFIG" --get-regexp cluster.*.hostname | cut -d ' ' -f2) if [ -z "$hosts" ]; then # Mimic `ghe-cluster-each $role -u` @@ -34,8 +34,8 @@ if $PRINT_UUIDS; then " else for hostname in $hosts; do - [ -n "$ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$ROLE-server)" != "true" ] && continue - echo $hostname + [ -n "$ROLE" ] && [ "$(git config -f "$CONFIG" cluster."$hostname"."$ROLE"-server)" != "true" ] && continue + echo "$hostname" done fi -fi \ No newline at end of file +fi From 46329455297ecf68cf66c2f59f07e75293bc7241 Mon Sep 17 00:00:00 2001 From: Stoney <19228888+ThatStoney@users.noreply.github.com> Date: Thu, 15 Sep 2022 14:17:08 -0400 Subject: [PATCH 052/946] Update broken link --- docs/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 80e141218..64a1b14ed 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -32,7 +32,7 @@ with the `-i ` SSH option. 3. Add the backup host's SSH key to the GitHub appliance as an *Authorized SSH - key*. See [Adding an SSH key for shell access][4] for instructions. + key*. See [Adding your SSH key to the ssh-agent][4] for instructions. 4. Run `bin/ghe-host-check` to verify SSH connectivity with the GitHub appliance. @@ -42,4 +42,4 @@ [1]: https://github.com/github/backup-utils/releases [2]: https://github.com/github/backup-utils/releases/tag/v2.11.4 [3]: https://github.com/github/enterprise-backup-site/blob/master/backup.config-example -[4]: https://enterprise.github.com/help/articles/adding-an-ssh-key-for-shell-access +[4]: https://docs.github.com/en/enterprise-server@3.6/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent From 060d001eca7614b738ca03ac4716349440a00f56 Mon Sep 17 00:00:00 2001 From: Stoney <19228888+ThatStoney@users.noreply.github.com> Date: Thu, 15 Sep 2022 14:29:39 -0400 Subject: [PATCH 053/946] Fix link Co-authored-by: djdefi --- docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 64a1b14ed..baf949ad0 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -42,4 +42,4 @@ [1]: https://github.com/github/backup-utils/releases [2]: https://github.com/github/backup-utils/releases/tag/v2.11.4 [3]: https://github.com/github/enterprise-backup-site/blob/master/backup.config-example -[4]: https://docs.github.com/en/enterprise-server@3.6/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent +[4]: https://docs.github.com/enterprise-server/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent From 907b70bd120949a590bd3cebbd6a4a16ca7cf646 Mon Sep 17 00:00:00 2001 From: Stoney <19228888+ThatStoney@users.noreply.github.com> Date: Thu, 15 Sep 2022 14:38:36 -0400 Subject: [PATCH 054/946] Linter dragon --- docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index baf949ad0..58420639b 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -22,7 +22,7 @@ * Backup Utilities will attempt to load the backup configuration from the following locations, in this order: - ``` + ```bash $GHE_BACKUP_CONFIG (User configurable environment variable) $GHE_BACKUP_ROOT/backup.config (Root directory of backup-utils install) $HOME/.github-backup-utils/backup.config From 54396f98128a90a7470eae75b062e251b422c24d Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 15 Sep 2022 13:13:45 -0700 Subject: [PATCH 055/946] Update getting-started.md --- docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 58420639b..c80873d0e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -13,7 +13,7 @@ 2. Copy the [`backup.config-example`][3] file to `backup.config` and modify as necessary. The `GHE_HOSTNAME` value must be set to the primary GitHub Enterprise Server - host name. Additional options are available and documented in the + hostname. Additional options are available and documented in the configuration file but none are required for basic backup functionality. As the data on a High Availability replica may be in a transient state at the time of backup, From 592d8a1970f4f2a2973df3d32f51863decbf4a94 Mon Sep 17 00:00:00 2001 From: Vipin Deshmukh <39809415+vn0bbin@users.noreply.github.com> Date: Fri, 16 Sep 2022 13:42:15 -0500 Subject: [PATCH 056/946] Adding start, end and run time for backup --- bin/ghe-backup | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/ghe-backup b/bin/ghe-backup index 8d9be333c..9d44ddb5d 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -139,6 +139,8 @@ fi echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress +START_TIME=$(date +%s) +echo 'Start time:' $START_TIME echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" # Perform a host connection check and establish the remote appliance version. @@ -270,5 +272,9 @@ fi echo "Checking for leaked ssh keys ..." ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true +END_TIME=$(date +%s) +echo 'End time:' $END_TIME +echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' + # Make sure we exit zero after the conditional true From 9e2b52e3ac6abf818851c5c7bb9c39e1fc07c90c Mon Sep 17 00:00:00 2001 From: Vipin Deshmukh <39809415+vn0bbin@users.noreply.github.com> Date: Fri, 16 Sep 2022 13:44:08 -0500 Subject: [PATCH 057/946] Update ghe-backup --- bin/ghe-backup | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/ghe-backup b/bin/ghe-backup index 9d44ddb5d..8e235d4b1 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -141,6 +141,7 @@ echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress START_TIME=$(date +%s) echo 'Start time:' $START_TIME + echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" # Perform a host connection check and establish the remote appliance version. From 1a5a1073d937cd27744a14eb6d43a43712ca0b25 Mon Sep 17 00:00:00 2001 From: Vipin Deshmukh <39809415+vn0bbin@users.noreply.github.com> Date: Tue, 20 Sep 2022 10:29:33 -0500 Subject: [PATCH 058/946] Update ghe-backup Making suggested changes [here](https://github.com/github/backup-utils/pull/956#pullrequestreview-1113113580) --- bin/ghe-backup | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 8e235d4b1..65e0c53b8 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -141,7 +141,6 @@ echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress START_TIME=$(date +%s) echo 'Start time:' $START_TIME - echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" # Perform a host connection check and establish the remote appliance version. @@ -257,6 +256,10 @@ if [ -z "$failures" ]; then ghe-prune-snapshots fi +END_TIME=$(date +%s) +echo 'End time:' $END_TIME +echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' + echo "Completed backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP at $(date +"%H:%M:%S")" # Exit non-zero and list the steps that failed. @@ -273,9 +276,5 @@ fi echo "Checking for leaked ssh keys ..." ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true -END_TIME=$(date +%s) -echo 'End time:' $END_TIME -echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' - # Make sure we exit zero after the conditional true From 0a39e169f5c7087b9a86428fed4f3cc52d06e24d Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 21 Sep 2022 11:02:18 -0700 Subject: [PATCH 059/946] Add verbose output for audit log output Assist with determining if incremental hard linking occurred for an index, or if a full dump was required. --- share/github-backup-utils/ghe-backup-es-audit-log | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/github-backup-utils/ghe-backup-es-audit-log b/share/github-backup-utils/ghe-backup-es-audit-log index e28525e5d..42ef9314a 100755 --- a/share/github-backup-utils/ghe-backup-es-audit-log +++ b/share/github-backup-utils/ghe-backup-es-audit-log @@ -44,10 +44,12 @@ for index in $indices; do index_size=$2 if [[ -f $GHE_DATA_DIR/current/audit-log/$index_name.gz && $(cat $GHE_DATA_DIR/current/audit-log/$index_name.gz.size 2>/dev/null || true) -eq $index_size ]]; then + ghe_verbose "* Linking unchanged audit log index: $index_name" # Hard link any indices that have not changed since the last backup ln $GHE_DATA_DIR/current/audit-log/$index_name.gz $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz ln $GHE_DATA_DIR/current/audit-log/$index_name.gz.size $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz.size else + ghe_verbose "* Performing audit log export for index: $index_name" echo "/usr/local/share/enterprise/ghe-es-dump-json \"http://localhost:9201/$index_name\" | gzip" | ghe-ssh "$host" -- /bin/bash > $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz echo $index_size > $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz.size fi From c828d1f27a88947b573bdc56bc1b443e95814ae4 Mon Sep 17 00:00:00 2001 From: gitulisca <107976350+gitulisca@users.noreply.github.com> Date: Wed, 28 Sep 2022 10:48:16 +1000 Subject: [PATCH 060/946] Update instructions on granting backup host access to GHES (#959) --- docs/getting-started.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index c80873d0e..58054f3bf 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -31,8 +31,8 @@ * In a clustering environment, the `GHE_EXTRA_SSH_OPTS` key must be configured with the `-i ` SSH option. - 3. Add the backup host's SSH key to the GitHub appliance as an *Authorized SSH - key*. See [Adding your SSH key to the ssh-agent][4] for instructions. + 3. Add the backup host's SSH public key to the GitHub Enterprise Server appliance, in order to grant it administrative shell access. + See [Accessing the GitHub Enterprise Server administrative shell (SSH)][4] for instructions. 4. Run `bin/ghe-host-check` to verify SSH connectivity with the GitHub appliance. @@ -42,4 +42,4 @@ [1]: https://github.com/github/backup-utils/releases [2]: https://github.com/github/backup-utils/releases/tag/v2.11.4 [3]: https://github.com/github/enterprise-backup-site/blob/master/backup.config-example -[4]: https://docs.github.com/enterprise-server/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent +[4]: https://docs.github.com/enterprise-server/admin/configuration/configuring-your-enterprise/accessing-the-administrative-shell-ssh From 3247ad8db5c5fb3bb86d0783f07a5f098b6b7293 Mon Sep 17 00:00:00 2001 From: Shruti Corbett Date: Thu, 13 Oct 2022 09:26:40 -0400 Subject: [PATCH 061/946] Update README.md Removed beta terminology for parallel backup feature since this has now been in place for a while. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7d38558c2..735a74dbe 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This repository includes backup and recovery utilities for [GitHub Enterprise Server][1]. -**UPDATE**: The new parallel backup and restore beta feature will require [GNU awk](https://www.gnu.org/software/gawk) and [moreutils](https://joeyh.name/code/moreutils) to be installed. Note that on some distributions/platforms, the `moreutils-parallel` package is separate from `moreutils` and must be installed on its own. +**Note**: The parallel backup and restore feature will require [GNU awk](https://www.gnu.org/software/gawk) and [moreutils](https://joeyh.name/code/moreutils) to be installed. Note that on some distributions/platforms, the `moreutils-parallel` package is separate from `moreutils` and must be installed on its own. **Note**: the [GitHub Enterprise Server version requirements][2] have changed starting with Backup Utilities v2.13.0, released on 27 March 2018. From 18b1e7948be253bb70bf4fa61e1a1019859050e6 Mon Sep 17 00:00:00 2001 From: Shruti Corbett Date: Thu, 13 Oct 2022 09:27:50 -0400 Subject: [PATCH 062/946] Update backup.config-example Removed lines with "Warning this is a beta feature" since this is no longer referenced as beta --- backup.config-example | 4 ---- 1 file changed, 4 deletions(-) diff --git a/backup.config-example b/backup.config-example index 61ccbb055..8c98655ab 100644 --- a/backup.config-example +++ b/backup.config-example @@ -64,27 +64,23 @@ GHE_NUM_SNAPSHOTS=10 # If set to 'yes', ghe-backup jobs will run in parallel. Defaults to 'no'. # -# WARNING: this feature is in beta. #GHE_PARALLEL_ENABLED=yes # Sets the maximum number of jobs to run in parallel. Defaults to the number # of available processing units on the machine. # -# WARNING: this feature is in beta. #GHE_PARALLEL_MAX_JOBS=2 # Sets the maximum number of rsync jobs to run in parallel. Defaults to the # configured GHE_PARALLEL_MAX_JOBS, or the number of available processing # units on the machine. # -# WARNING: this feature is in beta. # GHE_PARALLEL_RSYNC_MAX_JOBS=3 # When jobs are running in parallel wait as needed to avoid starting new jobs # when the system's load average is not below the specified percentage. Defaults to # unrestricted. # -# WARNING: this feature is in beta. #GHE_PARALLEL_MAX_LOAD=50 # When running an external mysql database, run this script to trigger a MySQL backup From 73ab611dea072c3a8b516fd55989ed8f6d4ab25a Mon Sep 17 00:00:00 2001 From: Shruti Corbett Date: Thu, 13 Oct 2022 09:29:16 -0400 Subject: [PATCH 063/946] Update requirements.md Removed reference of beta for parallel feature --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 94e5c5701..e4d7f42d3 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -8,7 +8,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app Backup host software requirements are modest: Linux or other modern Unix operating system with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, and [rsync][4] v2.6.4 or newer. -The new parallel backup and restore beta feature will require [GNU awk][10] and [moreutils][9] to be installed. +The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. We encourage the use of [Docker](docker.md) if your backup host doesn't meet these requirements, or if Docker is your preferred platform. From d6af82b9aaf77a95be517190df627dc9d48fdc21 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 13 Oct 2022 11:16:59 -0700 Subject: [PATCH 064/946] Fix minor README linter warnings Fixing a few of the warnings that occur on the README.md --- README.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 735a74dbe..4ee951f58 100644 --- a/README.md +++ b/README.md @@ -8,28 +8,28 @@ This repository includes backup and recovery utilities for **Note**: the [GitHub Enterprise Server version requirements][2] have changed starting with Backup Utilities v2.13.0, released on 27 March 2018. -### Features +## Features Backup Utilities implement a number of advanced capabilities for backup hosts, built on top of the backup and restore features already included in GitHub Enterprise Server. - - Complete GitHub Enterprise Server backup and recovery system via two simple +- Complete GitHub Enterprise Server backup and recovery system via two simple utilities:
`ghe-backup` and `ghe-restore`. - - Online backups. The GitHub appliance need not be put in maintenance mode for +- Online backups. The GitHub appliance need not be put in maintenance mode for the duration of the backup run. - - Incremental backup of Git repository data. Only changes since the last +- Incremental backup of Git repository data. Only changes since the last snapshot are transferred, leading to faster backup runs and lower network bandwidth and machine utilization. - - Efficient snapshot storage. Only data added since the previous snapshot +- Efficient snapshot storage. Only data added since the previous snapshot consumes new space on the backup host. - - Multiple backup snapshots with configurable retention periods. - - Backup commands run under the lowest CPU/IO priority on the GitHub appliance, +- Multiple backup snapshots with configurable retention periods. +- Backup commands run under the lowest CPU/IO priority on the GitHub appliance, reducing performance impact while backups are in progress. - - Runs under most Linux/Unix environments. - - MIT licensed, open source software maintained by GitHub, Inc. +- Runs under most Linux/Unix environments. +- MIT licensed, open source software maintained by GitHub, Inc. -### Documentation +## Documentation - **[Requirements](docs/requirements.md)** - **[Backup host requirements](docs/requirements.md#backup-host-requirements)** @@ -42,7 +42,7 @@ GitHub Enterprise Server. - **[How does Backup Utilities differ from a High Availability replica?](docs/faq.md)** - **[Docker](docs/docker.md)** -### Support +## Support If you find a bug or would like to request a feature in Backup Utilities, please open an issue or pull request on this repository. If you have a question related @@ -53,3 +53,4 @@ instead. [1]: https://github.com/enterprise [2]: docs/requirements.md#github-enterprise-version-requirements [3]: https://support.github.com/ + From 4f2c96f572ca6f97debb3a6be428b7cf7a1437d1 Mon Sep 17 00:00:00 2001 From: Devin Dooley Date: Tue, 25 Oct 2022 00:35:38 +0000 Subject: [PATCH 065/946] Bump version: 3.7.0 [ci skip] --- bin/ghe-host-check | 2 +- debian/changelog | 5 +++++ share/github-backup-utils/version | 2 +- test/testlib.sh | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 1f8a51847..6cb8bc72c 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -131,7 +131,7 @@ fi # backup-utils 2.13 onwards limits support to the current and previous two releases # of GitHub Enterprise Server. -supported_minimum_version="3.4.0" +supported_minimum_version="3.5.0" if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then supported=1 diff --git a/debian/changelog b/debian/changelog index bf6ca9e03..965b4d01d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,8 @@ +github-backup-utils (3.7.0) UNRELEASED; urgency=medium + + + -- Devin Dooley Tue, 25 Oct 2022 00:35:38 +0000 + github-backup-utils (3.6.0) UNRELEASED; urgency=medium diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 40c341bdc..7c69a55db 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.6.0 +3.7.0 diff --git a/test/testlib.sh b/test/testlib.sh index 64f00e0f6..332fc672f 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -42,7 +42,7 @@ export GHE_BACKUP_CONFIG GHE_DATA_DIR GHE_REMOTE_DATA_DIR GHE_REMOTE_ROOT_DIR # The default remote appliance version. This may be set in the environment prior # to invoking tests to emulate a different remote vm version. -: ${GHE_TEST_REMOTE_VERSION:=3.6.0.rc1} +: ${GHE_TEST_REMOTE_VERSION:=3.7.0.rc1} export GHE_TEST_REMOTE_VERSION # Source in the backup config and set GHE_REMOTE_XXX variables based on the From fc82ee1a7ca73c06faaab6953a8ed08bcbcfb3e9 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 7 Nov 2022 17:18:47 -0500 Subject: [PATCH 066/946] Firming up requirements --- docs/requirements.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index 5595699e6..59683b8a9 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -6,12 +6,11 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements Backup host software requirements are modest: Linux or other modern Unix operating -system with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, and [rsync][4] v2.6.4 or newer. +system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, and [rsync][4] v2.6.4 or newer. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. -We encourage the use of [Docker](docker.md) if your backup host doesn't meet these -requirements, or if Docker is your preferred platform. +We encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are availablt to backup-utils. The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. From b9d248fd5d735bb57dd865af275990db26cf9d60 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 20:40:54 +0000 Subject: [PATCH 067/946] Bump actions/stale from 4 to 6 Bumps [actions/stale](https://github.com/actions/stale) from 4 to 6. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v4...v6) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/stale-support-escalation.yml | 2 +- .github/workflows/stale.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale-support-escalation.yml b/.github/workflows/stale-support-escalation.yml index 2bb01ab53..a2e885f7c 100644 --- a/.github/workflows/stale-support-escalation.yml +++ b/.github/workflows/stale-support-escalation.yml @@ -15,7 +15,7 @@ jobs: if: github.repository == 'github/ghes' || github.repository == 'github/enterprise2' || github.repository == 'github/backup-utils-private' runs-on: ubuntu-latest steps: - - uses: actions/stale@v4 + - uses: actions/stale@v6 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This support escalation issue is stale because it has been open 30 days with no activity. To make it never stale, add a label never-stale.' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 828182457..e5a67d2b6 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 + - uses: actions/stale@v6 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: "👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot." From 722ebb059dc0554ec442ee2c07c76fbc473aedc5 Mon Sep 17 00:00:00 2001 From: Manuel Bergler Date: Wed, 9 Nov 2022 17:26:02 +0100 Subject: [PATCH 068/946] Add management console argon2 secret to backup/restore settings --- share/github-backup-utils/ghe-backup-settings | 1 + share/github-backup-utils/ghe-restore-settings | 3 +++ 2 files changed, 4 insertions(+) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 605c5ce78..f1f1a3f91 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -75,6 +75,7 @@ backup-secret() { } backup-secret "management console password" "manage-password" "secrets.manage" +backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index ec668bbb6..7c46d73c1 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -44,6 +44,9 @@ ghe-restore-packages "$GHE_HOSTNAME" 1>&3 # Restore management console password hash if present. restore-secret "management console password" "manage-password" "secrets.manage" +# Restore management console argon2 secret if present. +restore-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" + # Restore kredz.credz HMAC key if present. restore-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" From 24b1d328c68b23eea88c4fde0855a5dedd677855 Mon Sep 17 00:00:00 2001 From: Manuel Bergler Date: Wed, 9 Nov 2022 17:32:18 +0100 Subject: [PATCH 069/946] Cover argon2 secret in backup test --- test/test-ghe-backup.sh | 11 +++++++++++ test/testlib.sh | 1 + 2 files changed, 12 insertions(+) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index f50963fd9..55a5e67d2 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -132,6 +132,17 @@ begin_test "ghe-backup without password pepper" ) end_test +begin_test "ghe-backup without management console argon2 secret" +( + set -e + + git config -f "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" secrets.manage-auth.argon-secret "" + ghe-backup + + [ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ] +) +end_test + begin_test "ghe-backup empty git-hooks directory" ( set -e diff --git a/test/testlib.sh b/test/testlib.sh index 332fc672f..e5ffca72a 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -202,6 +202,7 @@ setup_test_data () { # Create a fake manage password file§ mkdir -p "$GHE_REMOTE_DATA_USER_DIR/common" git config -f "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" secrets.manage "fake password hash data" + git config -f "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" secrets.manage-auth.argon-secret "fake argon2 secret" # Create a fake password pepper file mkdir -p "$GHE_REMOTE_DATA_USER_DIR/common" From 7636d05236cfde2b4fd4ba451d95bb66d0068147 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 15 Nov 2022 09:10:45 -0800 Subject: [PATCH 070/946] Add jq to requirements --- docs/requirements.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 59683b8a9..7cdcb8722 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -6,7 +6,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements Backup host software requirements are modest: Linux or other modern Unix operating -system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, and [rsync][4] v2.6.4 or newer. +system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. @@ -78,3 +78,4 @@ Due to how some components of Backup Utilities (e.g. MSSQL) take incremental bac [8]: https://help.github.com/enterprise/admin/guides/installation/upgrade-requirements/ [9]: https://joeyh.name/code/moreutils [10]: https://www.gnu.org/software/gawk +[11]: https://stedolan.github.io/jq/ From 74c8951a295790c40b0f9d6751a4dfb1d9a831d8 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 22 Nov 2022 17:11:16 -0500 Subject: [PATCH 071/946] Fix misspelling --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 59683b8a9..15c94614a 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -10,7 +10,7 @@ system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. -We encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are availablt to backup-utils. +We encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. From 9a606f45df771404d39efc9c056a1990f5e5b9d5 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Thu, 24 Nov 2022 04:20:49 +0000 Subject: [PATCH 072/946] add backup-restore for varz --- share/github-backup-utils/ghe-backup-settings | 1 + .../github-backup-utils/ghe-restore-settings | 3 +++ test/test-ghe-backup.sh | 25 ++++++++++++++++++ test/test-ghe-restore.sh | 26 +++++++++++++++++++ 4 files changed, 55 insertions(+) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 605c5ce78..0711fe3d5 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -77,6 +77,7 @@ backup-secret() { backup-secret "management console password" "manage-password" "secrets.manage" backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" +backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" # Backup external MySQL password if running external MySQL DB. if is_service_external 'mysql'; then diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index ec668bbb6..8461e0e89 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -47,6 +47,9 @@ restore-secret "management console password" "manage-password" "secrets.manage" # Restore kredz.credz HMAC key if present. restore-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" +# Restore kredz.varz HMAC key if present. +restore-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" + # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then echo "Restoring SAML keys ..." diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index f50963fd9..b81a98bc1 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -495,6 +495,31 @@ begin_test "ghe-backup takes backup of Kredz settings" ) end_test +begin_test "ghe-backup takes backup of kredz-varz settings" +( + set -e + + required_secrets=( + "secrets.kredz.varz-hmac-secret" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + ghe-backup + + required_files=( + "kredz-varz-hmac" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done + +) +end_test + begin_test "ghe-backup takes backup of Actions settings" ( set -e diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 6e092970e..b9e6acfb3 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -336,6 +336,32 @@ begin_test "ghe-restore with Kredz settings" ) end_test +begin_test "ghe-restore with kredz-varz settings" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + enable_actions + + required_files=( + "kredz-varz-hmac" + ) + + for file in "${required_files[@]}"; do + echo "foo" > "$GHE_DATA_DIR/current/$file" + done + + ghe-restore -v -f localhost + required_secrets=( + "secrets.kredz.varz-hmac-secret" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + done +) +end_test + begin_test "ghe-restore with Actions settings" ( set -e From 945dfc0330f6a881ea10e49f604c9c5804d3f486 Mon Sep 17 00:00:00 2001 From: Manuel Bergler Date: Mon, 28 Nov 2022 15:33:28 +0100 Subject: [PATCH 073/946] Add argon2 secret to verified restore data function --- test/testlib.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/testlib.sh b/test/testlib.sh index e5ffca72a..d821ff3c1 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -508,6 +508,9 @@ verify_all_restored_data() { # verify management console password was *not* restored ! grep -q "fake password hash data" "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" + # verify management console argon2 secret was *not* restored + ! grep -q "fake argon2 secret" "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" + # verify common data verify_common_data } From e018e4c8d10fe1b66642bb0eb69a656c5ac27228 Mon Sep 17 00:00:00 2001 From: Manuel Bergler Date: Mon, 28 Nov 2022 15:34:06 +0100 Subject: [PATCH 074/946] Add argon2 secret to list of verified backup data --- test/testlib.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/testlib.sh b/test/testlib.sh index d821ff3c1..4abbc3281 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -317,6 +317,7 @@ setup_test_data () { echo "fake ghe-export-ssl-ca-certificates data" > "$loc/ssl-ca-certificates.tar" echo "fake license data" > "$loc/enterprise.ghl" echo "fake password hash data" > "$loc/manage-password" + echo "fake argon2 secret" > "$loc/manage-argon-secret" echo "fake password pepper data" > "$loc/password-pepper" echo "rsync" > "$loc/strategy" echo "$GHE_REMOTE_VERSION" > "$loc/version" @@ -446,6 +447,9 @@ verify_all_backedup_data() { # verify manage-password file was backed up [ "$(cat "$GHE_DATA_DIR/current/manage-password")" = "fake password hash data" ] + # verify manage-argon-secret file was backed up + [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake argon2 secret" ] + # verify password pepper file was backed up [ "$(cat "$GHE_DATA_DIR/current/password-pepper")" = "fake password pepper data" ] From e44d51677780a529df93f81d263b26f68e401663 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 1 Dec 2022 16:50:31 +0000 Subject: [PATCH 075/946] Co-authored-by: Chuck Pathanjali --- bin/ghe-backup | 8 +++ bin/ghe-restore | 12 +++- share/github-backup-utils/ghe-backup-config | 61 +++++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 783ea9980..d3f6ded7a 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -44,6 +44,10 @@ done # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check + +echo "We got here without any problems" +exit 1 + # Used to record failed backup steps failures= failures_file="$(mktemp -t backup-utils-backup-failures-XXXXXX)" @@ -114,6 +118,10 @@ cleanup () { trap 'cleanup' EXIT trap 'exit $?' INT # ^C always terminate + +# Check to see if there is a running restore +ghe_restore_check + if [ -h ../in-progress ]; then echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 echo "If there is no backup in progress anymore, please remove" 1>&2 diff --git a/bin/ghe-restore b/bin/ghe-restore index 42fe6cd57..2c1edac68 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -122,6 +122,8 @@ cleanup () { # Cleanup SSH multiplexing ghe-ssh --clean + # Remove in-progress file + ghe_restore_finished } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. @@ -152,6 +154,9 @@ cleanup_cluster_nodes() { # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check +# Check to make sure a restore or backup is not in progress + + # Grab the host arg GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}" @@ -159,7 +164,7 @@ GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}" hostname=$(echo "$GHE_HOSTNAME" | cut -f 1 -d :) # Show usage with no -[ -z "$GHE_HOSTNAME" ] && print_usage +#[ -z "$GHE_HOSTNAME" ] && print_usage # Flag to indicate if this script has stopped Actions. ACTIONS_STOPPED=false @@ -170,6 +175,11 @@ GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")" GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") export GHE_RESTORE_SNAPSHOT +ghe_restore_check +ghe_restore_started $GHE_RESTORE_SNAPSHOT +#ghe_restore_finished +echo "This happened without any problems!" +exit 1 # Detect if the backup we are restoring has a leaked ssh key echo "Checking for leaked keys in the backup snapshot that is being restored ..." ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index b9271cf6b..3b6be4782 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -66,6 +66,67 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ fi done +GHE_RESTORE_IN_PROGRESS="${GHE_DATA_DIR}/.in-progress-restore" +GHE_BACKUP_IN_PROGRESS="${GHE_DATA_DIR}/.in-progress" +export GHE_RESTORE_IN_PROGRESS +export GHE_BACKUP_IN_PROGRESS + +ghe_restore_started() { +echo "$1 $$" > $GHE_RESTORE_IN_PROGRESS +} + +ghe_restore_check() { +if [ -h $GHE_RESTORE_IN_PROGRESS ]; then + echo "Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 + echo "If there is no restore in progress anymore, please remove" 1>&2 + echo "the $GHE_DATA_DIR/in-progress-restore file." 1>&2 + exit 1 +fi + +if [ -f $GHE_RESTORE_IN_PROGRESS ]; then + progress=$(cat $GHE_RESTORE_IN_PROGRESS) + snapshot=$(echo "$progress" | cut -d ' ' -f 1) + pid=$(echo "$progress" | cut -d ' ' -f 2) + echo "Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 + echo "If PID $pid is not a process related to the restore utilities, please remove" 1>&2 + echo "the $GHE_DATA_DIR/in-progress-restore file and try again." 1>&2 + exit 1 + fi +} + +ghe_backup_check() { +if [ -h $GHE_BACKUP_IN_PROGRESS ]; then + echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 + echo "If there is no backup in progress anymore, please remove" 1>&2 + echo "the $GHE_DATA_DIR/in-progress-backup file." 1>&2 + exit 1 +fi + +if [ -f $GHE_BACKUP_IN_PROGRESS ]; then + progress=$(cat $GHE_BACKUP_IN_PROGRESS) + snapshot=$(echo "$progress" | cut -d ' ' -f 1) + pid=$(echo "$progress" | cut -d ' ' -f 2) + echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 + echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 + echo "the $GHE_DATA_DIR/in-progress file and try again." 1>&2 + exit 1 + fi +} + +ghe_restore_finished() { + echo "$GHE_RESTORE_IN_PROGRESS" + if [ -f $GHE_RESTORE_IN_PROGRESS ]; then + echo "$GHE_RESTORE_IN_PROGRESS exists!" 1>&2 + rm -f $GHE_RESTORE_IN_PROGRESS + fi +} + +ghe_backup_finished() { + if [ ! -f $GHE_BACKUP_IN_PROGRESS ]; then + rm -f $GHE_BACKUP_IN_PROGRESS + fi +} + ghe_parallel_check() { if [ "$GHE_PARALLEL_ENABLED" != "yes" ]; then return 0 From dcfe6cc379cf8ac5993bc527171d252398a8a61f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 1 Dec 2022 17:00:42 +0000 Subject: [PATCH 076/946] Revising POC for testing Co-authored-by: Chuck Pathanjali --- bin/ghe-backup | 1 + bin/ghe-restore | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index d3f6ded7a..499d178db 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -122,6 +122,7 @@ trap 'exit $?' INT # ^C always terminate # Check to see if there is a running restore ghe_restore_check +# Check to see if there is a running backup if [ -h ../in-progress ]; then echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 echo "If there is no backup in progress anymore, please remove" 1>&2 diff --git a/bin/ghe-restore b/bin/ghe-restore index 2c1edac68..0a4866239 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -164,7 +164,7 @@ GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}" hostname=$(echo "$GHE_HOSTNAME" | cut -f 1 -d :) # Show usage with no -#[ -z "$GHE_HOSTNAME" ] && print_usage +[ -z "$GHE_HOSTNAME" ] && print_usage # Flag to indicate if this script has stopped Actions. ACTIONS_STOPPED=false @@ -175,11 +175,9 @@ GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")" GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") export GHE_RESTORE_SNAPSHOT +ghe_backup_check ghe_restore_check -ghe_restore_started $GHE_RESTORE_SNAPSHOT -#ghe_restore_finished -echo "This happened without any problems!" -exit 1 + # Detect if the backup we are restoring has a leaked ssh key echo "Checking for leaked keys in the backup snapshot that is being restored ..." ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true @@ -262,6 +260,7 @@ START_TIME=$(date +%s) echo 'Start time:' $START_TIME echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." +ghe_restore_started $START_TIME # Keep other processes on the VM or cluster in the loop about the restore status. # @@ -589,6 +588,7 @@ echo 'End time:' $END_TIME echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." +ghe_restore_finished if ! $instance_configured; then echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." From f4663b15f4cee82fded845b7642655019c87ed30 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 1 Dec 2022 21:02:34 +0000 Subject: [PATCH 077/946] Working but rough version of changes Co-authored-by: Chuck Pathanjali --- bin/ghe-backup | 25 +++++------ bin/ghe-restore | 49 ++++++++++++++++++--- share/github-backup-utils/ghe-backup-config | 12 ++--- 3 files changed, 61 insertions(+), 25 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 499d178db..d70200428 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -45,9 +45,6 @@ done ghe_parallel_check -echo "We got here without any problems" -exit 1 - # Used to record failed backup steps failures= failures_file="$(mktemp -t backup-utils-backup-failures-XXXXXX)" @@ -99,12 +96,12 @@ rm -rf src dest1 dest2 # The cleanup trap also handles disabling maintenance mode on the appliance if # it was automatically enabled. cleanup () { - if [ -f ../in-progress ]; then - progress=$(cat ../in-progress) + if [ -f ../.in-progress ]; then + progress=$(cat ../.in-progress) snapshot=$(echo "$progress" | cut -d ' ' -f 1) pid=$(echo "$progress" | cut -d ' ' -f 2) if [ "$snapshot" = "$GHE_SNAPSHOT_TIMESTAMP" ] && [ "$$" = $pid ]; then - unlink ../in-progress + unlink ../.in-progress fi fi @@ -123,30 +120,30 @@ trap 'exit $?' INT # ^C always terminate ghe_restore_check # Check to see if there is a running backup -if [ -h ../in-progress ]; then +if [ -h ../.in-progress ]; then echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 echo "If there is no backup in progress anymore, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress file." 1>&2 + echo "the $GHE_DATA_DIR/.in-progress file." 1>&2 exit 1 fi -if [ -f ../in-progress ]; then - progress=$(cat ../in-progress) +if [ -f ../.in-progress ]; then + progress=$(cat ../.in-progress) snapshot=$(echo "$progress" | cut -d ' ' -f 1) pid=$(echo "$progress" | cut -d ' ' -f 2) if ! ps -p "$pid" >/dev/null 2>&1; then - # We can safely remove in-progress, ghe-prune-snapshots + # We can safely remove .in-progress, ghe-prune-snapshots # will clean up the failed backup. - unlink ../in-progress + unlink ../.in-progress else echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress file and try again." 1>&2 + echo "the $GHE_DATA_DIR/.in-progress file and try again." 1>&2 exit 1 fi fi -echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress +echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../.in-progress echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" diff --git a/bin/ghe-restore b/bin/ghe-restore index 0a4866239..d7e14b770 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -123,7 +123,7 @@ cleanup () { # Cleanup SSH multiplexing ghe-ssh --clean # Remove in-progress file - ghe_restore_finished + rm -f ${GHE_DATA_DIR}/.in-progress-restore } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. @@ -154,6 +154,25 @@ cleanup_cluster_nodes() { # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check +# ghe_restore_check +if [ -h ${GHE_DATA_DIR}/.in-progress-restore ]; then + echo "Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 + echo "If there is no restore in progress anymore, please remove" 1>&2 + echo "the $GHE_DATA_DIR/in-progress-restore file." 1>&2 + exit 1 +fi + +echo "${GHE_DATA_DIR}/.in-progress-restore" +if [ -f ${GHE_DATA_DIR}/.in-progress-restore ]; then + progress=$(cat ${GHE_DATA_DIR}/.in-progress-restore) + snapshot=$(echo "$progress" | cut -d ' ' -f 1) + pid=$(echo "$progress" | cut -d ' ' -f 2) + echo "Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 + echo "If PID $pid is not a process related to the restore utilities, please remove" 1>&2 + echo "the $GHE_DATA_DIR/in-progress-restore file and try again." 1>&2 + exit 1 + fi + # Check to make sure a restore or backup is not in progress @@ -175,8 +194,23 @@ GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")" GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") export GHE_RESTORE_SNAPSHOT -ghe_backup_check -ghe_restore_check +#ghe_backup_check +if [ -h ${GHE_DATA_DIR}/.in-progress ]; then + echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 + echo "If there is no backup in progress anymore, please remove" 1>&2 + echo "the $GHE_DATA_DIR/.in-progress-backup file." 1>&2 + exit 1 +fi + +if [ -f ${GHE_DATA_DIR}/.in-progress ]; then + progress=$(cat ${GHE_DATA_DIR}/.in-progress) + snapshot=$(echo "$progress" | cut -d ' ' -f 1) + pid=$(echo "$progress" | cut -d ' ' -f 2) + echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 + echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 + echo "the $GHE_DATA_DIR/.in-progress file and try again." 1>&2 + exit 1 + fi # Detect if the backup we are restoring has a leaked ssh key echo "Checking for leaked keys in the backup snapshot that is being restored ..." @@ -260,8 +294,13 @@ START_TIME=$(date +%s) echo 'Start time:' $START_TIME echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." -ghe_restore_started $START_TIME +# Create an in-progress-restore file to prevent simultaneous backup or restore runs +echo "${START_TIME} $$" > ${GHE_DATA_DIR}/.in-progress-restore +sleep 120 +rm -f ${GHE_DATA_DIR}/.in-progress-restore +echo "finished with fake restore" +exit 1 # Keep other processes on the VM or cluster in the loop about the restore status. # # Other processes will look for these states: @@ -588,7 +627,7 @@ echo 'End time:' $END_TIME echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." -ghe_restore_finished +rm -f ${GHE_DATA_DIR}/.in-progress-restore if ! $instance_configured; then echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 3b6be4782..1bd3293b7 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -66,14 +66,14 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ fi done -GHE_RESTORE_IN_PROGRESS="${GHE_DATA_DIR}/.in-progress-restore" -GHE_BACKUP_IN_PROGRESS="${GHE_DATA_DIR}/.in-progress" +GHE_RESTORE_IN_PROGRESS="../../${GHE_DATA_DIR}/.in-progress-restore" +GHE_BACKUP_IN_PROGRESS="../../${GHE_DATA_DIR}/.in-progress" export GHE_RESTORE_IN_PROGRESS export GHE_BACKUP_IN_PROGRESS -ghe_restore_started() { -echo "$1 $$" > $GHE_RESTORE_IN_PROGRESS -} +#ghe_restore_started() { +#echo "$1 $$" >> $GHE_RESTORE_IN_PROGRESS +#} ghe_restore_check() { if [ -h $GHE_RESTORE_IN_PROGRESS ]; then @@ -122,7 +122,7 @@ ghe_restore_finished() { } ghe_backup_finished() { - if [ ! -f $GHE_BACKUP_IN_PROGRESS ]; then + if [ -f $GHE_BACKUP_IN_PROGRESS ]; then rm -f $GHE_BACKUP_IN_PROGRESS fi } From 8b83e560281292aa5023fef35262da8d8aca0354 Mon Sep 17 00:00:00 2001 From: djdefi Date: Mon, 12 Dec 2022 12:02:00 -0800 Subject: [PATCH 078/946] Test Focal for Docker image to better match Actions CI --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3b66b5020..9e016dc03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster-slim +FROM ubuntu:focal RUN apt-get -q -y update && \ apt-get install -y --no-install-recommends \ From d42ccdfe3155ce8160af771bc3f2edc562a6f8f1 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 14 Dec 2022 14:16:58 +0000 Subject: [PATCH 079/946] Moved function to ghe-backup-config --- bin/ghe-backup | 25 ++++----- bin/ghe-restore | 48 ++--------------- share/github-backup-utils/ghe-backup-config | 60 ++++++++++----------- 3 files changed, 45 insertions(+), 88 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index d70200428..3b162177e 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -96,12 +96,12 @@ rm -rf src dest1 dest2 # The cleanup trap also handles disabling maintenance mode on the appliance if # it was automatically enabled. cleanup () { - if [ -f ../.in-progress ]; then - progress=$(cat ../.in-progress) + if [ -f ../in-progress ]; then + progress=$(cat ../in-progress) snapshot=$(echo "$progress" | cut -d ' ' -f 1) pid=$(echo "$progress" | cut -d ' ' -f 2) if [ "$snapshot" = "$GHE_SNAPSHOT_TIMESTAMP" ] && [ "$$" = $pid ]; then - unlink ../.in-progress + unlink ../in-progress fi fi @@ -120,30 +120,31 @@ trap 'exit $?' INT # ^C always terminate ghe_restore_check # Check to see if there is a running backup -if [ -h ../.in-progress ]; then +if [ -h ../in-progress ]; then echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 echo "If there is no backup in progress anymore, please remove" 1>&2 - echo "the $GHE_DATA_DIR/.in-progress file." 1>&2 + echo "the \"$GHE_DATA_DIR/in-progress\" file and try again." 1>&2 exit 1 fi -if [ -f ../.in-progress ]; then - progress=$(cat ../.in-progress) +if [ -f ../in-progress ]; then + progress=$(cat ../in-progress) snapshot=$(echo "$progress" | cut -d ' ' -f 1) pid=$(echo "$progress" | cut -d ' ' -f 2) if ! ps -p "$pid" >/dev/null 2>&1; then - # We can safely remove .in-progress, ghe-prune-snapshots + # We can safely remove in-progress, ghe-prune-snapshots # will clean up the failed backup. - unlink ../.in-progress + unlink ../in-progress else echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - echo "the $GHE_DATA_DIR/.in-progress file and try again." 1>&2 + echo 1>&2 + echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2 + echo " the \"$GHE_DATA_DIR/in-progress\" file and try again." 1>&2 exit 1 fi fi -echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../.in-progress +echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" diff --git a/bin/ghe-restore b/bin/ghe-restore index d7e14b770..600a0b976 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -123,7 +123,7 @@ cleanup () { # Cleanup SSH multiplexing ghe-ssh --clean # Remove in-progress file - rm -f ${GHE_DATA_DIR}/.in-progress-restore + rm -f ${GHE_DATA_DIR}/in-progress-restore } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. @@ -155,26 +155,6 @@ cleanup_cluster_nodes() { ghe_parallel_check # ghe_restore_check -if [ -h ${GHE_DATA_DIR}/.in-progress-restore ]; then - echo "Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 - echo "If there is no restore in progress anymore, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress-restore file." 1>&2 - exit 1 -fi - -echo "${GHE_DATA_DIR}/.in-progress-restore" -if [ -f ${GHE_DATA_DIR}/.in-progress-restore ]; then - progress=$(cat ${GHE_DATA_DIR}/.in-progress-restore) - snapshot=$(echo "$progress" | cut -d ' ' -f 1) - pid=$(echo "$progress" | cut -d ' ' -f 2) - echo "Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - echo "If PID $pid is not a process related to the restore utilities, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress-restore file and try again." 1>&2 - exit 1 - fi - -# Check to make sure a restore or backup is not in progress - # Grab the host arg GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}" @@ -194,23 +174,7 @@ GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")" GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") export GHE_RESTORE_SNAPSHOT -#ghe_backup_check -if [ -h ${GHE_DATA_DIR}/.in-progress ]; then - echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 - echo "If there is no backup in progress anymore, please remove" 1>&2 - echo "the $GHE_DATA_DIR/.in-progress-backup file." 1>&2 - exit 1 -fi - -if [ -f ${GHE_DATA_DIR}/.in-progress ]; then - progress=$(cat ${GHE_DATA_DIR}/.in-progress) - snapshot=$(echo "$progress" | cut -d ' ' -f 1) - pid=$(echo "$progress" | cut -d ' ' -f 2) - echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - echo "the $GHE_DATA_DIR/.in-progress file and try again." 1>&2 - exit 1 - fi +ghe_backup_check # Detect if the backup we are restoring has a leaked ssh key echo "Checking for leaked keys in the backup snapshot that is being restored ..." @@ -295,12 +259,8 @@ echo 'Start time:' $START_TIME echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs -echo "${START_TIME} $$" > ${GHE_DATA_DIR}/.in-progress-restore +echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore -sleep 120 -rm -f ${GHE_DATA_DIR}/.in-progress-restore -echo "finished with fake restore" -exit 1 # Keep other processes on the VM or cluster in the loop about the restore status. # # Other processes will look for these states: @@ -627,7 +587,7 @@ echo 'End time:' $END_TIME echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." -rm -f ${GHE_DATA_DIR}/.in-progress-restore +rm -f ${GHE_DATA_DIR}/in-progress-restore if ! $instance_configured; then echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 1bd3293b7..5f034e644 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -66,49 +66,45 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ fi done -GHE_RESTORE_IN_PROGRESS="../../${GHE_DATA_DIR}/.in-progress-restore" -GHE_BACKUP_IN_PROGRESS="../../${GHE_DATA_DIR}/.in-progress" +GHE_RESTORE_IN_PROGRESS=$(readlink -f "${GHE_DATA_DIR}/in-progress-restore") +GHE_BACKUP_IN_PROGRESS=$(readlink -f "${GHE_DATA_DIR}/in-progress-backup") export GHE_RESTORE_IN_PROGRESS export GHE_BACKUP_IN_PROGRESS -#ghe_restore_started() { -#echo "$1 $$" >> $GHE_RESTORE_IN_PROGRESS -#} - ghe_restore_check() { -if [ -h $GHE_RESTORE_IN_PROGRESS ]; then - echo "Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 - echo "If there is no restore in progress anymore, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress-restore file." 1>&2 - exit 1 -fi + if [ -h $GHE_RESTORE_IN_PROGRESS ]; then + echo " Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 + echo " If there is no restore in progress anymore, please remove" 1>&2 + echo " the \"$GHE_RESTORE_IN_PROGRESS\" file and try again." 1>&2 + exit 1 + fi -if [ -f $GHE_RESTORE_IN_PROGRESS ]; then - progress=$(cat $GHE_RESTORE_IN_PROGRESS) - snapshot=$(echo "$progress" | cut -d ' ' -f 1) - pid=$(echo "$progress" | cut -d ' ' -f 2) - echo "Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - echo "If PID $pid is not a process related to the restore utilities, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress-restore file and try again." 1>&2 + if [ -f $GHE_RESTORE_IN_PROGRESS ]; then + progress=$(cat $GHE_RESTORE_IN_PROGRESS) + snapshot=$(echo "$progress" | cut -d ' ' -f 1) + pid=$(echo "$progress" | cut -d ' ' -f 2) + echo " Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 + echo " If PID $pid is not a process related to the restore utilities, please remove" 1>&2 + echo " the \"$GHE_RESTORE_IN_PROGRESS\" file and try again." 1>&2 exit 1 fi } ghe_backup_check() { -if [ -h $GHE_BACKUP_IN_PROGRESS ]; then - echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 - echo "If there is no backup in progress anymore, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress-backup file." 1>&2 - exit 1 -fi + if [ -h $GHE_BACKUP_IN_PROGRESS ]; then + echo " Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 + echo " If there is no backup in progress anymore, please remove" 1>&2 + echo " the \"$GHE_DATA_DIR/i$GHE_BACKUP_IN_PROGRESS\" file and try again." 1>&2 + exit 1 + fi -if [ -f $GHE_BACKUP_IN_PROGRESS ]; then - progress=$(cat $GHE_BACKUP_IN_PROGRESS) - snapshot=$(echo "$progress" | cut -d ' ' -f 1) - pid=$(echo "$progress" | cut -d ' ' -f 2) - echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress file and try again." 1>&2 + if [ -f $GHE_BACKUP_IN_PROGRESS ]; then + progress=$(cat $GHE_BACKUP_IN_PROGRESS) + snapshot=$(echo "$progress" | cut -d ' ' -f 1) + pid=$(echo "$progress" | cut -d ' ' -f 2) + echo " Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 + echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2 + echo " the \"$GHE_BACKUP_IN_PROGRESS\" file and try again." 1>&2 exit 1 fi } From c88f8e03189a885ad15f41c4ad09c3e72e3a72b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 20:08:04 +0000 Subject: [PATCH 080/946] Bump actions/stale from 6 to 7 Bumps [actions/stale](https://github.com/actions/stale) from 6 to 7. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/stale-support-escalation.yml | 2 +- .github/workflows/stale.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale-support-escalation.yml b/.github/workflows/stale-support-escalation.yml index a2e885f7c..276486abd 100644 --- a/.github/workflows/stale-support-escalation.yml +++ b/.github/workflows/stale-support-escalation.yml @@ -15,7 +15,7 @@ jobs: if: github.repository == 'github/ghes' || github.repository == 'github/enterprise2' || github.repository == 'github/backup-utils-private' runs-on: ubuntu-latest steps: - - uses: actions/stale@v6 + - uses: actions/stale@v7 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This support escalation issue is stale because it has been open 30 days with no activity. To make it never stale, add a label never-stale.' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index e5a67d2b6..3b0ae345b 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/stale@v6 + - uses: actions/stale@v7 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: "👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot." From 6facf1da0060c140cf78a1d1d01f5c6f40f66416 Mon Sep 17 00:00:00 2001 From: felixrottler Date: Fri, 6 Jan 2023 12:17:05 +0100 Subject: [PATCH 081/946] feat: test node as hostname for mssql backup --- share/github-backup-utils/ghe-backup-mssql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 18e0e6e20..6469f4dc8 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -304,7 +304,7 @@ if [ -n "$backup_type" ]; then elif [ "$backup_type" = "transaction" ]; then backup_command='ghe-export-mssql -t' fi - + GHE_HOSTNAME="$(ghe-config cluster.mssql-master)" bm_start "$(basename $0)" ghe-ssh "$GHE_HOSTNAME" -- "$backup_command" || failures="$failures mssql" bm_end "$(basename $0)" From a68e7927f474c946dab1dbbdead69761b5fe0679 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 13:30:36 +0000 Subject: [PATCH 082/946] feat: update backup/restore mssql to always use mssql master hostname --- share/github-backup-utils/ghe-backup-mssql | 28 +++++++++++---------- share/github-backup-utils/ghe-restore-mssql | 13 ++++++---- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 6469f4dc8..597588fc4 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -22,18 +22,13 @@ tran_expire= # Check if the export tool is available in this version export_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh "$GHE_HOSTNAME" "test -e /usr/local/bin/ghe-export-mssql" + ghe-ssh "$1" "test -e /usr/local/bin/ghe-export-mssql" else # Always return available for test return 0 fi } -if ! export_tool_available; then - ghe_verbose "ghe-export-mssql is not available" - exit -fi - add_minute() { # Expect date string in the format of yyyymmddTHHMMSS # Here parse date differently depending on GNU Linux vs BSD MacOS @@ -53,7 +48,7 @@ find_timestamp() { } actions_dbs() { - all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) + all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -p -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) for db in $all_dbs; do if [[ ! "$db" =~ ^(master|tempdb|model|msdb)$ ]] && [[ "$db" =~ ^[a-zA-Z0-9_-]+$ ]]; then echo "$db" @@ -90,7 +85,7 @@ ensure_same_dbs() { } run_query() { - echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh "$GHE_HOSTNAME" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' + echo "set -o pipefail; ghe-mssql-console -y -n -p -q \"SET NOCOUNT ON; $1\"" | ghe-ssh "$GHE_HOSTNAME" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' } get_latest_backup_file() { @@ -304,21 +299,28 @@ if [ -n "$backup_type" ]; then elif [ "$backup_type" = "transaction" ]; then backup_command='ghe-export-mssql -t' fi - GHE_HOSTNAME="$(ghe-config cluster.mssql-master)" + GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.mssql-master" || true)" + GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" + + if ! export_tool_available "$GHE_MSSQL_PRIMARY_HOST"; then + ghe_verbose "ghe-export-mssql is not available" + exit + fi + bm_start "$(basename $0)" - ghe-ssh "$GHE_HOSTNAME" -- "$backup_command" || failures="$failures mssql" + ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" bm_end "$(basename $0)" # Configure the backup cadence on the appliance, which is used for diagnostics - ghe-ssh "$GHE_HOSTNAME" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" + ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_DIR/user/mssql/backups" backups=$(echo "set -o pipefail; if sudo test -d \"$appliance_dir\"; then \ - sudo ls \"$appliance_dir\"; fi" | ghe-ssh "$GHE_HOSTNAME" /bin/bash) + sudo ls \"$appliance_dir\"; fi" | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) for b in $backups do ghe_verbose "Transferring to backup host $b" - ghe-ssh "$GHE_HOSTNAME" "sudo cat $appliance_dir/$b" > $backup_dir/$b + ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "sudo cat $appliance_dir/$b" > $backup_dir/$b done fi diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index dcf37fa37..aeef9dd18 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -29,8 +29,11 @@ fi # Grab host arg GHE_HOSTNAME="$1" +GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.mssql-master" || true)" +GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" + # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. -ghe_remote_version_required "$GHE_HOSTNAME" +ghe_remote_version_required "$GHE_MSSQL_PRIMARY_HOST" # The snapshot to restore should be set by the ghe-restore command but this lets # us run this script directly. @@ -41,20 +44,20 @@ snapshot_dir_mssql="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_USER_DIR/mssql/backups" -echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh $GHE_HOSTNAME /bin/bash +echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash for b in $snapshot_dir_mssql/* do [[ -e "$b" ]] || break filename="${b##*/}" ghe_verbose "Transferring $filename to appliance host" - cat $snapshot_dir_mssql/$filename | ghe-ssh $GHE_HOSTNAME "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" + cat $snapshot_dir_mssql/$filename | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" done # Change owner to mssql:mssql to ready for restore -ghe-ssh $GHE_HOSTNAME "sudo chown -R mssql:mssql $appliance_dir" +ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" # Invoke restore command bm_start "$(basename $0)" -ghe-ssh "$GHE_HOSTNAME" -- "ghe-import-mssql" < "/dev/null" 1>&3 +ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" -- "ghe-import-mssql" < "/dev/null" 1>&3 bm_end "$(basename $0)" From 14ccf9e66854d8d490c973cb72e9b75e72c7bd44 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 6 Jan 2023 14:39:27 +0000 Subject: [PATCH 083/946] cleanup from review --- bin/ghe-backup | 8 ++++++-- bin/ghe-restore | 6 ++++-- share/github-backup-utils/ghe-backup-config | 22 ++++++++++----------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 3b162177e..116694d15 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -123,7 +123,7 @@ ghe_restore_check if [ -h ../in-progress ]; then echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 echo "If there is no backup in progress anymore, please remove" 1>&2 - echo "the \"$GHE_DATA_DIR/in-progress\" file and try again." 1>&2 + echo "the $GHE_DATA_DIR/in-progress file and try again." 1>&2 exit 1 fi @@ -139,12 +139,13 @@ if [ -f ../in-progress ]; then echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 echo 1>&2 echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - echo " the \"$GHE_DATA_DIR/in-progress\" file and try again." 1>&2 + echo " the $GHE_DATA_DIR/in-progress file and try again." 1>&2 exit 1 fi fi echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress +echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ${GHE_DATA_DIR}/in-progress-backup echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" @@ -279,3 +280,6 @@ ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true # Make sure we exit zero after the conditional true + +# Remove in-progress file +ghe_backup_finished diff --git a/bin/ghe-restore b/bin/ghe-restore index 600a0b976..f91f68371 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -154,7 +154,8 @@ cleanup_cluster_nodes() { # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check -# ghe_restore_check +# Check to make sure another restore process is not running +ghe_restore_check # Grab the host arg GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}" @@ -174,6 +175,7 @@ GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")" GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") export GHE_RESTORE_SNAPSHOT +# Check to make sure backup is not running ghe_backup_check # Detect if the backup we are restoring has a leaked ssh key @@ -587,7 +589,7 @@ echo 'End time:' $END_TIME echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." -rm -f ${GHE_DATA_DIR}/in-progress-restore +ghe_restore_finished if ! $instance_configured; then echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 5f034e644..6544a39f7 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -75,7 +75,7 @@ ghe_restore_check() { if [ -h $GHE_RESTORE_IN_PROGRESS ]; then echo " Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 echo " If there is no restore in progress anymore, please remove" 1>&2 - echo " the \"$GHE_RESTORE_IN_PROGRESS\" file and try again." 1>&2 + echo " the $GHE_RESTORE_IN_PROGRESS file and try again." 1>&2 exit 1 fi @@ -85,7 +85,7 @@ ghe_restore_check() { pid=$(echo "$progress" | cut -d ' ' -f 2) echo " Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 echo " If PID $pid is not a process related to the restore utilities, please remove" 1>&2 - echo " the \"$GHE_RESTORE_IN_PROGRESS\" file and try again." 1>&2 + echo " the $GHE_RESTORE_IN_PROGRESS file and try again." 1>&2 exit 1 fi } @@ -94,7 +94,7 @@ ghe_backup_check() { if [ -h $GHE_BACKUP_IN_PROGRESS ]; then echo " Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 echo " If there is no backup in progress anymore, please remove" 1>&2 - echo " the \"$GHE_DATA_DIR/i$GHE_BACKUP_IN_PROGRESS\" file and try again." 1>&2 + echo " the $GHE_DATA_DIR/$GHE_BACKUP_IN_PROGRESS file and try again." 1>&2 exit 1 fi @@ -104,23 +104,21 @@ ghe_backup_check() { pid=$(echo "$progress" | cut -d ' ' -f 2) echo " Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - echo " the \"$GHE_BACKUP_IN_PROGRESS\" file and try again." 1>&2 + echo " the $GHE_BACKUP_IN_PROGRESS file and try again." 1>&2 exit 1 fi } ghe_restore_finished() { - echo "$GHE_RESTORE_IN_PROGRESS" - if [ -f $GHE_RESTORE_IN_PROGRESS ]; then - echo "$GHE_RESTORE_IN_PROGRESS exists!" 1>&2 - rm -f $GHE_RESTORE_IN_PROGRESS - fi + if [ -f $GHE_RESTORE_IN_PROGRESS ]; then + rm -f $GHE_RESTORE_IN_PROGRESS + fi } ghe_backup_finished() { - if [ -f $GHE_BACKUP_IN_PROGRESS ]; then - rm -f $GHE_BACKUP_IN_PROGRESS - fi + if [ -f $GHE_BACKUP_IN_PROGRESS ]; then + rm -f $GHE_BACKUP_IN_PROGRESS + fi } ghe_parallel_check() { From c8a0d4ebd7cfd8adef1909a72b250ad1893b3e94 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 6 Jan 2023 15:01:27 +0000 Subject: [PATCH 084/946] updated cleanup to remove in-progress file --- bin/ghe-backup | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/ghe-backup b/bin/ghe-backup index 116694d15..f8ac26e27 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -106,6 +106,7 @@ cleanup () { fi rm -rf "$failures_file" + rm -f ${GHE_DATA_DIR}/in-progress-backup # Cleanup SSH multiplexing ghe-ssh --clean From d039cfbf8043884eab199559abec0d5fc10f9f47 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 15:34:56 +0000 Subject: [PATCH 085/946] feat: revert if tool available --- share/github-backup-utils/ghe-backup-mssql | 12 ++++++------ share/github-backup-utils/ghe-restore-mssql | 4 ++-- share/github-backup-utils/version | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 597588fc4..d15c4f111 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -22,13 +22,18 @@ tran_expire= # Check if the export tool is available in this version export_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh "$1" "test -e /usr/local/bin/ghe-export-mssql" + ghe-ssh "$GHE_HOSTNAME" "test -e /usr/local/bin/ghe-export-mssql" else # Always return available for test return 0 fi } +if ! export_tool_available ; then + ghe_verbose "ghe-export-mssql is not available" + exit + fi + add_minute() { # Expect date string in the format of yyyymmddTHHMMSS # Here parse date differently depending on GNU Linux vs BSD MacOS @@ -302,11 +307,6 @@ if [ -n "$backup_type" ]; then GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.mssql-master" || true)" GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" - if ! export_tool_available "$GHE_MSSQL_PRIMARY_HOST"; then - ghe_verbose "ghe-export-mssql is not available" - exit - fi - bm_start "$(basename $0)" ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index aeef9dd18..78ca2dd3d 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -29,8 +29,8 @@ fi # Grab host arg GHE_HOSTNAME="$1" -GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.mssql-master" || true)" -GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" +GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" +GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_MSSQL_PRIMARY_HOST" diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 7c69a55db..19811903a 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.7.0 +3.8.0 From aa66220baaa527ebc9aa776fdb8824d4d204d565 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 15:37:21 +0000 Subject: [PATCH 086/946] fix: revert version --- share/github-backup-utils/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 19811903a..7c69a55db 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.8.0 +3.7.0 From 0b3e51f181f803a2055cae30fa5cddf5c6382c7f Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 16:17:24 +0000 Subject: [PATCH 087/946] feat: early stopping if restore/backupp not available on target host --- share/github-backup-utils/ghe-backup-mssql | 7 ++++--- share/github-backup-utils/ghe-restore-mssql | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index d15c4f111..0a4a6d06a 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -22,13 +22,16 @@ tran_expire= # Check if the export tool is available in this version export_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh "$GHE_HOSTNAME" "test -e /usr/local/bin/ghe-export-mssql" + ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-export-mssql" else # Always return available for test return 0 fi } +GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.mssql-master" || true)" +GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" + if ! export_tool_available ; then ghe_verbose "ghe-export-mssql is not available" exit @@ -304,8 +307,6 @@ if [ -n "$backup_type" ]; then elif [ "$backup_type" = "transaction" ]; then backup_command='ghe-export-mssql -t' fi - GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.mssql-master" || true)" - GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" bm_start "$(basename $0)" ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 78ca2dd3d..110e2b086 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -15,23 +15,23 @@ set -e # Check if the import tool is available in this version import_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh "$GHE_HOSTNAME" "test -e /usr/local/bin/ghe-import-mssql" + ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-import-mssql" else - ghe-ssh "$GHE_HOSTNAME" "type ghe-import-mssql" + ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "type ghe-import-mssql" fi } -if ! import_tool_available; then - ghe_verbose "ghe-import-mssql is not available" - exit -fi - # Grab host arg GHE_HOSTNAME="$1" GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" +if ! import_tool_available; then + ghe_verbose "ghe-import-mssql is not available" + exit +fi + # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_MSSQL_PRIMARY_HOST" From e8ce2e6bf885696a58ff829de2378dba020f0ce3 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 16:38:35 +0000 Subject: [PATCH 088/946] refactor: attempt to fix shellchecks --- share/github-backup-utils/ghe-backup-mssql | 56 +++++++++++---------- share/github-backup-utils/ghe-restore-mssql | 2 +- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 0a4a6d06a..4409a03eb 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -29,8 +29,8 @@ export_tool_available() { fi } -GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.mssql-master" || true)" -GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh $GHE_HOSTNAME -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" +GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" +GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" if ! export_tool_available ; then ghe_verbose "ghe-export-mssql is not available" @@ -41,9 +41,11 @@ add_minute() { # Expect date string in the format of yyyymmddTHHMMSS # Here parse date differently depending on GNU Linux vs BSD MacOS if date -v -1d > /dev/null 2>&1; then - echo "$(date -v +$2M -ujf'%Y%m%dT%H%M%S' $1 +%Y%m%dT%H%M%S)" + # shellcheck disable=SC2005 + echo "$(date -v +"$2"M -ujf'%Y%m%dT%H%M%S' "$1" +%Y%m%dT%H%M%S)" else dt=$1 + # shellcheck disable=SC2005 echo "$(date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes")" fi } @@ -52,7 +54,7 @@ find_timestamp() { filename="${1##*/}" IFS='@' read -ra parts <<< "$filename" datetime_part=${parts[1]:0:15} - echo $datetime_part + echo "$datetime_part" } actions_dbs() { @@ -101,7 +103,7 @@ get_latest_backup_file() { db=$2 ext=$3 - latest_full_backup=$(find "$backups_dir" -type f -name "$db*.$ext" | egrep '[0-9]{8}T[0-9]{6}' | sort | tail -n 1) + latest_full_backup=$(find "$backups_dir" -type f -name "$db*.$ext" | grep -E '[0-9]{8}T[0-9]{6}' | sort | tail -n 1) latest_full_backup_file="${latest_full_backup##*/}" echo "$latest_full_backup_file" } @@ -149,8 +151,8 @@ get_next_diff_backup_base_lsn() { last_mssql=$GHE_DATA_DIR/current/mssql -if [ ! -d $last_mssql ] \ - || [ -z "$(find $last_mssql -type f -name '*.bak' | head -n 1)" ]; then +if [ ! -d "$last_mssql" ] \ + || [ -z "$(find "$last_mssql" -type f -name '*.bak' | head -n 1)" ]; then ghe_verbose "Taking first full backup" backup_type="full" else @@ -162,34 +164,34 @@ else current=$(date -u +%Y%m%d%H%M%S) full=$(find "$last_mssql" -type f -name "*.bak" | head -n 1) - full=$(find_timestamp $full) - full_expire=$(add_minute $full ${cadence[0]}) + full=$(find_timestamp "$full") + full_expire=$(add_minute "$full" "${cadence[0]}") full_expire="${full_expire//T}" diff=$(find "$last_mssql" -type f -name "*.diff" | head -n 1) if [ -f "$diff" ]; then - diff=$(find_timestamp $diff) - diff_expire=$(add_minute $diff ${cadence[1]}) + diff=$(find_timestamp "$diff") + diff_expire=$(add_minute "$diff" "${cadence[1]}") diff_expire="${diff_expire//T}" else - diff_expire=$(add_minute $full ${cadence[1]}) + diff_expire=$(add_minute "$full" "${cadence[1]}") diff_expire="${diff_expire//T}" fi - tran=$(find "$last_mssql" -type f -name "*.log" | egrep '[0-9]{8}T[0-9]{6}' | sort | tail -1) - tran=$(find_timestamp $tran) - tran_expire=$(add_minute $tran ${cadence[2]}) + tran=$(find "$last_mssql" -type f -name "*.log" | grep -E '[0-9]{8}T[0-9]{6}' | sort | tail -1) + tran=$(find_timestamp "$tran") + tran_expire=$(add_minute "$tran" "${cadence[2]}") tran_expire="${tran_expire//T}" ghe_verbose "current $current, full expire $full_expire, \ diff expire $diff_expire, tran expire $tran_expire" # Determine the type of backup to take based on expiry time - if [ $current -gt $full_expire ]; then + if [ "$current" -gt "$full_expire" ]; then backup_type='full' - elif [ $current -gt $diff_expire ]; then + elif [ "$current" -gt "$diff_expire" ]; then backup_type='diff' - elif [ $current -gt $tran_expire ]; then + elif [ "$current" -gt "$tran_expire" ]; then backup_type='transaction' fi @@ -267,8 +269,8 @@ fi mkdir -p "$backup_dir" # Use hard links to "copy" over previous applicable backups to the new snapshot folder to save disk space and time -if [ -d $last_mssql ]; then - for p in $last_mssql/* +if [ -d "$last_mssql" ]; then + for p in "$last_mssql"/* do [[ -e "$p" ]] || break @@ -277,23 +279,23 @@ if [ -d $last_mssql ]; then transfer= # Copy full backups unless we're taking a new full backup - if [ $extension = "bak" ] && [ "$backup_type" != 'full' ]; then + if [ "$extension" = "bak" ] && [ "$backup_type" != 'full' ]; then transfer=1 fi # Copy diff backups unless we're taking a new full or diff backup - if [ $extension = "diff" ] && [ "$backup_type" != 'full' ] && [ "$backup_type" != 'diff' ]; then + if [ "$extension" = "diff" ] && [ "$backup_type" != 'full' ] && [ "$backup_type" != 'diff' ]; then transfer=1 fi # Copy transaction log backups unless we're taking a new full or diff backup - if [ $extension = "log" ] && [ "$backup_type" != 'full' ] && [ "$backup_type" != 'diff' ]; then + if [ "$extension" = "log" ] && [ "$backup_type" != 'full' ] && [ "$backup_type" != 'diff' ]; then transfer=1 fi if [ -n "$transfer" ]; then ghe_verbose "Creating hard link to $filename" - ln $last_mssql/$filename $backup_dir/$filename + ln "$last_mssql"/"$filename" "$backup_dir"/"$filename" fi done fi @@ -308,9 +310,9 @@ if [ -n "$backup_type" ]; then backup_command='ghe-export-mssql -t' fi - bm_start "$(basename $0)" + bm_start "$(basename "$0")" ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" - bm_end "$(basename $0)" + bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" @@ -322,6 +324,6 @@ if [ -n "$backup_type" ]; then for b in $backups do ghe_verbose "Transferring to backup host $b" - ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "sudo cat $appliance_dir/$b" > $backup_dir/$b + ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" done fi diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 110e2b086..48eb3f901 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -45,7 +45,7 @@ snapshot_dir_mssql="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_USER_DIR/mssql/backups" echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash -for b in $snapshot_dir_mssql/* +for b in "$snapshot_dir_mssql"/* do [[ -e "$b" ]] || break From bb4fb0f69f764e1f6bb08ac5663084ead2fbd97d Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 17:30:15 +0000 Subject: [PATCH 089/946] fix: standalone case --- share/github-backup-utils/ghe-backup-mssql | 4 ++++ share/github-backup-utils/ghe-restore-mssql | 4 ++++ share/github-backup-utils/ghe-rsync | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 4409a03eb..67dfeaa10 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -32,6 +32,10 @@ export_tool_available() { GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" +if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then + GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" +fi + if ! export_tool_available ; then ghe_verbose "ghe-export-mssql is not available" exit diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 48eb3f901..185c98ef9 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -27,6 +27,10 @@ GHE_HOSTNAME="$1" GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" +if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then + GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" +fi + if ! import_tool_available; then ghe_verbose "ghe-import-mssql is not available" exit diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index c50835072..92fa102fd 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -10,7 +10,7 @@ set -o pipefail # Bring in the backup configuration # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - +echo "debug 0" # Check for --ignore-missing-args parameter support and remove if unavailable. if rsync -h | grep '\-\-ignore-missing-args' >/dev/null 2>&1; then parameters=("$@") @@ -19,18 +19,24 @@ else [[ ! $parameter == "--ignore-missing-args" ]] && parameters+=("$parameter") || ignore23=1 done fi - +echo "debug 1" ignoreout='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' rsync_version_check=`rsync --version | egrep "version 3.[0-9]*.[0-9]*"` if [ ! -z "$rsync_version_check" ]; then # rsync >= 3.x sends errors to stderr. so, we need to redirect to stdout before the pipe + echo "debug 1.1" rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS 2>&1 | (egrep -v "$ignoreout" || true) + else + echo "debug 1.2" # rsync <3.x sends errors to stdout. rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS | (egrep -v "$ignoreout" || true) + fi res=$? +echo "debug 2" + # Suppress exits with 24. if [ $res = 24 ]; then res=0 From c81c6fe182e4b26f320ebadd273251a1978b82c4 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 6 Jan 2023 20:55:22 +0000 Subject: [PATCH 090/946] Updated flags for readlink --- share/github-backup-utils/ghe-backup-config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 6544a39f7..fc769dfa6 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -66,8 +66,9 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ fi done -GHE_RESTORE_IN_PROGRESS=$(readlink -f "${GHE_DATA_DIR}/in-progress-restore") -GHE_BACKUP_IN_PROGRESS=$(readlink -f "${GHE_DATA_DIR}/in-progress-backup") +GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore") +GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup") + export GHE_RESTORE_IN_PROGRESS export GHE_BACKUP_IN_PROGRESS From 0e824e9b0aee0ad40979ce43a3c9442d5fbaf6da Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 20:55:49 +0000 Subject: [PATCH 091/946] feat: use proxycommand for communicating wih mssql master --- share/github-backup-utils/ghe-backup-mssql | 26 ++++++++++++++------- share/github-backup-utils/ghe-restore-mssql | 20 ++++++++++++---- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 67dfeaa10..722eb2435 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -37,9 +37,19 @@ if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then fi if ! export_tool_available ; then - ghe_verbose "ghe-export-mssql is not available" - exit - fi + ghe_verbose "ghe-export-mssql is not available" + exit +fi + +tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) +ssh_config_file_opt= +# git server hostnames under cluster +if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then + ssh_config_file="$tempdir/ssh_config" + ssh_config_file_opt="-F $ssh_config_file" + opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" + ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" +fi add_minute() { # Expect date string in the format of yyyymmddTHHMMSS @@ -313,21 +323,21 @@ if [ -n "$backup_type" ]; then elif [ "$backup_type" = "transaction" ]; then backup_command='ghe-export-mssql -t' fi - + bm_start "$(basename "$0")" - ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics - ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_DIR/user/mssql/backups" backups=$(echo "set -o pipefail; if sudo test -d \"$appliance_dir\"; then \ - sudo ls \"$appliance_dir\"; fi" | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) + sudo ls \"$appliance_dir\"; fi" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) for b in $backups do ghe_verbose "Transferring to backup host $b" - ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" done fi diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 185c98ef9..016dbf5bc 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -36,8 +36,18 @@ if ! import_tool_available; then exit fi +tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) +ssh_config_file_opt= +# git server hostnames under cluster +if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then + ssh_config_file="$tempdir/ssh_config" + ssh_config_file_opt="-F $ssh_config_file" + opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" + ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" +fi + # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. -ghe_remote_version_required "$GHE_MSSQL_PRIMARY_HOST" +ghe_remote_version_required "$GHE_HOSTNAME" # The snapshot to restore should be set by the ghe-restore command but this lets # us run this script directly. @@ -48,20 +58,20 @@ snapshot_dir_mssql="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_USER_DIR/mssql/backups" -echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash +echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash for b in "$snapshot_dir_mssql"/* do [[ -e "$b" ]] || break filename="${b##*/}" ghe_verbose "Transferring $filename to appliance host" - cat $snapshot_dir_mssql/$filename | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" + cat $snapshot_dir_mssql/$filename | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" done # Change owner to mssql:mssql to ready for restore -ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" +ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" # Invoke restore command bm_start "$(basename $0)" -ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" -- "ghe-import-mssql" < "/dev/null" 1>&3 +ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "ghe-import-mssql" < "/dev/null" 1>&3 bm_end "$(basename $0)" From 84ea75cecbb2d9d23bd44e8766279ec37300d67a Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 20:58:55 +0000 Subject: [PATCH 092/946] fix: add missing proxy when check if tool available --- share/github-backup-utils/ghe-backup-mssql | 2 +- share/github-backup-utils/ghe-restore-mssql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 722eb2435..acb9dd43d 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -22,7 +22,7 @@ tran_expire= # Check if the export tool is available in this version export_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-export-mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-export-mssql" else # Always return available for test return 0 diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 016dbf5bc..b7e1dd7f0 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -15,9 +15,9 @@ set -e # Check if the import tool is available in this version import_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-import-mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-import-mssql" else - ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" "type ghe-import-mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "type ghe-import-mssql" fi } From 433e2890412e25f7d6378e65ea7f54b67d9e9a74 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Fri, 6 Jan 2023 21:12:33 +0000 Subject: [PATCH 093/946] fix: remove debug log --- share/github-backup-utils/ghe-rsync | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index 92fa102fd..eadb79b0e 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -10,7 +10,7 @@ set -o pipefail # Bring in the backup configuration # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" -echo "debug 0" + # Check for --ignore-missing-args parameter support and remove if unavailable. if rsync -h | grep '\-\-ignore-missing-args' >/dev/null 2>&1; then parameters=("$@") @@ -19,24 +19,20 @@ else [[ ! $parameter == "--ignore-missing-args" ]] && parameters+=("$parameter") || ignore23=1 done fi -echo "debug 1" + ignoreout='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' rsync_version_check=`rsync --version | egrep "version 3.[0-9]*.[0-9]*"` if [ ! -z "$rsync_version_check" ]; then # rsync >= 3.x sends errors to stderr. so, we need to redirect to stdout before the pipe - echo "debug 1.1" rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS 2>&1 | (egrep -v "$ignoreout" || true) else - echo "debug 1.2" # rsync <3.x sends errors to stdout. rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS | (egrep -v "$ignoreout" || true) fi res=$? -echo "debug 2" - # Suppress exits with 24. if [ $res = 24 ]; then res=0 From dfe3d14386fbd37d12f2a2b7d7bad59c2a8983f1 Mon Sep 17 00:00:00 2001 From: Felix Rottler <72494737+FelixRottler@users.noreply.github.com> Date: Fri, 6 Jan 2023 22:13:22 +0100 Subject: [PATCH 094/946] Apply suggestions from code review --- share/github-backup-utils/ghe-rsync | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index eadb79b0e..c50835072 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -25,11 +25,9 @@ rsync_version_check=`rsync --version | egrep "version 3.[0-9]*.[0-9]*"` if [ ! -z "$rsync_version_check" ]; then # rsync >= 3.x sends errors to stderr. so, we need to redirect to stdout before the pipe rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS 2>&1 | (egrep -v "$ignoreout" || true) - else # rsync <3.x sends errors to stdout. rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS | (egrep -v "$ignoreout" || true) - fi res=$? From 68aee3678ae7fd3d396d7d0c40c56930e0d78452 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Fri, 6 Jan 2023 16:24:04 -0500 Subject: [PATCH 095/946] Clarify OS requirements PR to clarify requirements based on discussion in https://github.com/github/ghes/issues/4511 --- docs/requirements.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index f6b9b8f31..3322ca63f 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,8 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating -system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. +Backup host software requirements are modest: Linux operating (Ubuntu or Debian) system with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From 8b88f50992b2d7700badb9ca8f3a8de6682d88d3 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Fri, 6 Jan 2023 16:28:50 -0500 Subject: [PATCH 096/946] Update requirements.md --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 3322ca63f..648a25b8a 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,7 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux operating (Ubuntu or Debian) system with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. +Backup host software requirements are modest: Ubuntu Linux operating system with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From aad7b7f51cb772a71c6160b60b72161810e19cea Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Mon, 9 Jan 2023 10:52:59 +0000 Subject: [PATCH 097/946] apply code review changes --- share/github-backup-utils/ghe-backup-mssql | 19 +++++++++++-------- share/github-backup-utils/ghe-restore-mssql | 7 ++++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index acb9dd43d..bda8a5eb5 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -51,16 +51,19 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" fi +cleanup() { + rm -rf $tempdir +} +trap 'cleanup' EXIT INT + add_minute() { # Expect date string in the format of yyyymmddTHHMMSS # Here parse date differently depending on GNU Linux vs BSD MacOS if date -v -1d > /dev/null 2>&1; then - # shellcheck disable=SC2005 - echo "$(date -v +"$2"M -ujf'%Y%m%dT%H%M%S' "$1" +%Y%m%dT%H%M%S)" + date -v +"$2"M -ujf'%Y%m%dT%H%M%S' "$1" +%Y%m%dT%H%M%S else dt=$1 - # shellcheck disable=SC2005 - echo "$(date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes")" + date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes" fi } @@ -72,7 +75,7 @@ find_timestamp() { } actions_dbs() { - all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -p -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) + all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) for db in $all_dbs; do if [[ ! "$db" =~ ^(master|tempdb|model|msdb)$ ]] && [[ "$db" =~ ^[a-zA-Z0-9_-]+$ ]]; then echo "$db" @@ -109,7 +112,7 @@ ensure_same_dbs() { } run_query() { - echo "set -o pipefail; ghe-mssql-console -y -n -p -q \"SET NOCOUNT ON; $1\"" | ghe-ssh "$GHE_HOSTNAME" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' + echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' } get_latest_backup_file() { @@ -325,11 +328,11 @@ if [ -n "$backup_type" ]; then fi bm_start "$(basename "$0")" - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" + ghe-ssh "$GHE_HOSTNAME" -- "$backup_command" || failures="$failures mssql" bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" + ghe-ssh "$GHE_HOSTNAME" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_DIR/user/mssql/backups" diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index b7e1dd7f0..2d7d9c149 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -46,6 +46,11 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" fi +cleanup() { + rm -rf $tempdir +} +trap 'cleanup' EXIT INT + # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_HOSTNAME" @@ -73,5 +78,5 @@ ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssq # Invoke restore command bm_start "$(basename $0)" -ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "ghe-import-mssql" < "/dev/null" 1>&3 +ghe-ssh "$GHE_HOSTNAME" -- "ghe-import-mssql" < "/dev/null" 1>&3 bm_end "$(basename $0)" From 8130858c9792687bbf88d421476ba1e4c6fc5334 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Tue, 10 Jan 2023 13:27:07 +0000 Subject: [PATCH 098/946] fix: use ssh config opts to execute ghe-import-mssql on the mssql-master because it depends on the local filesystem --- share/github-backup-utils/ghe-restore-mssql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 2d7d9c149..984284166 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -78,5 +78,5 @@ ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssq # Invoke restore command bm_start "$(basename $0)" -ghe-ssh "$GHE_HOSTNAME" -- "ghe-import-mssql" < "/dev/null" 1>&3 +ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "ghe-import-mssql" < "/dev/null" 1>&3 bm_end "$(basename $0)" From f5dcb32fcd49bcdaa8acb1e8a294baf424121746 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 10 Jan 2023 16:35:48 +0000 Subject: [PATCH 099/946] updated flags for readlink --- share/github-backup-utils/ghe-backup-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index fc769dfa6..251425d9b 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -66,8 +66,8 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ fi done -GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore") -GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup") +GHE_RESTORE_IN_PROGRESS=$(readlink -m "${GHE_DATA_DIR}/in-progress-restore") +GHE_BACKUP_IN_PROGRESS=$(readlink -m "${GHE_DATA_DIR}/in-progress-backup") export GHE_RESTORE_IN_PROGRESS export GHE_BACKUP_IN_PROGRESS From aec0c96496305d9197f9b7818318383ef2946ec1 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Tue, 10 Jan 2023 17:19:42 +0000 Subject: [PATCH 100/946] feat: use proxycommand when communicating with mssql-master and revert shellcheck for date parsing --- share/github-backup-utils/ghe-backup-mssql | 13 +++++++------ share/github-backup-utils/ghe-restore-mssql | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index bda8a5eb5..0a28edba5 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -43,6 +43,7 @@ fi tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= +opts= # git server hostnames under cluster if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" @@ -60,10 +61,10 @@ add_minute() { # Expect date string in the format of yyyymmddTHHMMSS # Here parse date differently depending on GNU Linux vs BSD MacOS if date -v -1d > /dev/null 2>&1; then - date -v +"$2"M -ujf'%Y%m%dT%H%M%S' "$1" +%Y%m%dT%H%M%S + echo "$(date -v +$2M -ujf'%Y%m%dT%H%M%S' $1 +%Y%m%dT%H%M%S)" else dt=$1 - date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes" + echo "$(date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes")" fi } @@ -75,7 +76,7 @@ find_timestamp() { } actions_dbs() { - all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) + all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) for db in $all_dbs; do if [[ ! "$db" =~ ^(master|tempdb|model|msdb)$ ]] && [[ "$db" =~ ^[a-zA-Z0-9_-]+$ ]]; then echo "$db" @@ -112,7 +113,7 @@ ensure_same_dbs() { } run_query() { - echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh "$GHE_MSSQL_PRIMARY_HOST" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' + echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' } get_latest_backup_file() { @@ -328,11 +329,11 @@ if [ -n "$backup_type" ]; then fi bm_start "$(basename "$0")" - ghe-ssh "$GHE_HOSTNAME" -- "$backup_command" || failures="$failures mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics - ghe-ssh "$GHE_HOSTNAME" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_DIR/user/mssql/backups" diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 984284166..3f3a7383c 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -38,6 +38,7 @@ fi tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= +opts= # git server hostnames under cluster if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" From b0701db509204cf2fd6660e1581afde1a659be09 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 10 Jan 2023 17:25:11 +0000 Subject: [PATCH 101/946] Removed unused variable --- share/github-backup-utils/ghe-backup-config | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 251425d9b..ab0e24d4d 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -66,8 +66,8 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ fi done -GHE_RESTORE_IN_PROGRESS=$(readlink -m "${GHE_DATA_DIR}/in-progress-restore") -GHE_BACKUP_IN_PROGRESS=$(readlink -m "${GHE_DATA_DIR}/in-progress-backup") +GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore") +GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup") export GHE_RESTORE_IN_PROGRESS export GHE_BACKUP_IN_PROGRESS @@ -82,7 +82,6 @@ ghe_restore_check() { if [ -f $GHE_RESTORE_IN_PROGRESS ]; then progress=$(cat $GHE_RESTORE_IN_PROGRESS) - snapshot=$(echo "$progress" | cut -d ' ' -f 1) pid=$(echo "$progress" | cut -d ' ' -f 2) echo " Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 echo " If PID $pid is not a process related to the restore utilities, please remove" 1>&2 @@ -101,7 +100,6 @@ ghe_backup_check() { if [ -f $GHE_BACKUP_IN_PROGRESS ]; then progress=$(cat $GHE_BACKUP_IN_PROGRESS) - snapshot=$(echo "$progress" | cut -d ' ' -f 1) pid=$(echo "$progress" | cut -d ' ' -f 2) echo " Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2 From e6bd253a98ade75859f01e544ff410a32ac27369 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 10 Jan 2023 11:29:15 -0800 Subject: [PATCH 102/946] remove deprecated Actions runner version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb8f775d9..8cda18493 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ jobs: build: strategy: matrix: - os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04', 'macos-latest'] + os: ['ubuntu-22.04', 'ubuntu-20.04', 'macos-latest'] fail-fast: false runs-on: ${{ matrix.os }} steps: From 037edd978b50029e25aa5cc8d0d81735831044f0 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Wed, 11 Jan 2023 10:32:34 +0000 Subject: [PATCH 103/946] fix: check import/export tool after configuring ssh --- share/github-backup-utils/ghe-backup-mssql | 13 +++++++------ share/github-backup-utils/ghe-restore-mssql | 10 +++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 0a28edba5..a61b44a18 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -36,14 +36,10 @@ if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" fi -if ! export_tool_available ; then - ghe_verbose "ghe-export-mssql is not available" - exit -fi - tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= opts= + # git server hostnames under cluster if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" @@ -52,10 +48,15 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" fi +if ! export_tool_available ; then + ghe_verbose "ghe-export-mssql is not available" + exit +fi + cleanup() { rm -rf $tempdir } -trap 'cleanup' EXIT INT +#trap 'cleanup' EXIT INT add_minute() { # Expect date string in the format of yyyymmddTHHMMSS diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 3f3a7383c..408b34f54 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -31,11 +31,6 @@ if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" fi -if ! import_tool_available; then - ghe_verbose "ghe-import-mssql is not available" - exit -fi - tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= opts= @@ -47,6 +42,11 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" fi +if ! import_tool_available; then + ghe_verbose "ghe-import-mssql is not available" + exit +fi + cleanup() { rm -rf $tempdir } From 1f84c1b91c03a4019cef42a4b2b1a9dfb4043978 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Wed, 11 Jan 2023 11:23:16 +0000 Subject: [PATCH 104/946] feat: add execute permission for ghe-import-mssql --- share/github-backup-utils/ghe-restore-mssql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 408b34f54..f24fbf8e5 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -76,6 +76,8 @@ done # Change owner to mssql:mssql to ready for restore ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" +# Change permission of ghe-import-mssql +ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chmod +x /usr/local/bin/ghe-import-mssql" # Invoke restore command bm_start "$(basename $0)" From efe5c8ea911c49b69efd8e9d4c03604e76bc14cd Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Wed, 11 Jan 2023 13:13:08 +0000 Subject: [PATCH 105/946] fix: try remote_dir for fixing tests --- share/github-backup-utils/ghe-restore-mssql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index f24fbf8e5..941a30614 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -77,7 +77,7 @@ done # Change owner to mssql:mssql to ready for restore ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" # Change permission of ghe-import-mssql -ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chmod +x /usr/local/bin/ghe-import-mssql" +ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chmod +x $GHE_REMOTE_ROOT_DIR/usr/local/bin/ghe-import-mssql" # Invoke restore command bm_start "$(basename $0)" From f8967f2e1eb7861e518cc98a0c8f710b5131fc25 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Wed, 11 Jan 2023 13:22:19 +0000 Subject: [PATCH 106/946] fix: add correct chmod path for testing --- test/testlib.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/testlib.sh b/test/testlib.sh index 4abbc3281..9193cfbfd 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -86,6 +86,8 @@ setup_remote_metadata () { mkdir -p "$GHE_REMOTE_DATA_DIR" "$GHE_REMOTE_DATA_USER_DIR" mkdir -p "$GHE_REMOTE_DATA_USER_DIR/common" mkdir -p "$GHE_REMOTE_ROOT_DIR/etc/github" + mkdir -p "$GHE_REMOTE_ROOT_DIR/usr/local/bin" + touch "$GHE_REMOTE_ROOT_DIR/usr/local/bin/ghe-import-mssql" } setup_remote_metadata From 0337f6a122147919a6fda8e24d949218e7c4c258 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 11 Jan 2023 09:45:16 -0800 Subject: [PATCH 107/946] Remove "Debian" --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 3904b1e6c..0ca099a7f 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,11 +15,11 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Debian Docker image - run: docker build . --file Dockerfile --tag backup-utils-debian:${GITHUB_RUN_ID} + run: docker build . --file Dockerfile --tag backup-utils:${GITHUB_RUN_ID} - name: Build the Alpine Docker image run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID} - name: Run tests in Debian Docker image - run: docker run backup-utils-debian:${GITHUB_RUN_ID} ghe-backup --version + run: docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version - name: Run tests in Alpine Docker image run: docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version From 9273eb4a0a6f6ff797015218023e8204daa51f39 Mon Sep 17 00:00:00 2001 From: Felix Rottler <72494737+FelixRottler@users.noreply.github.com> Date: Wed, 11 Jan 2023 20:45:26 +0100 Subject: [PATCH 108/946] Apply suggestions from code review --- share/github-backup-utils/ghe-restore-mssql | 1 - test/testlib.sh | 2 -- 2 files changed, 3 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 941a30614..13e9809b8 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -77,7 +77,6 @@ done # Change owner to mssql:mssql to ready for restore ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" # Change permission of ghe-import-mssql -ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chmod +x $GHE_REMOTE_ROOT_DIR/usr/local/bin/ghe-import-mssql" # Invoke restore command bm_start "$(basename $0)" diff --git a/test/testlib.sh b/test/testlib.sh index 9193cfbfd..4abbc3281 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -86,8 +86,6 @@ setup_remote_metadata () { mkdir -p "$GHE_REMOTE_DATA_DIR" "$GHE_REMOTE_DATA_USER_DIR" mkdir -p "$GHE_REMOTE_DATA_USER_DIR/common" mkdir -p "$GHE_REMOTE_ROOT_DIR/etc/github" - mkdir -p "$GHE_REMOTE_ROOT_DIR/usr/local/bin" - touch "$GHE_REMOTE_ROOT_DIR/usr/local/bin/ghe-import-mssql" } setup_remote_metadata From 1f3d33375b5086e1c3d0c8dfd1fd0b7e2af7c3b4 Mon Sep 17 00:00:00 2001 From: Felix Rottler <72494737+FelixRottler@users.noreply.github.com> Date: Wed, 11 Jan 2023 20:45:44 +0100 Subject: [PATCH 109/946] Update share/github-backup-utils/ghe-restore-mssql --- share/github-backup-utils/ghe-restore-mssql | 1 - 1 file changed, 1 deletion(-) diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 13e9809b8..408b34f54 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -76,7 +76,6 @@ done # Change owner to mssql:mssql to ready for restore ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" -# Change permission of ghe-import-mssql # Invoke restore command bm_start "$(basename $0)" From c0c1d81e0a74a52922d18122aa849bf53b0d91ce Mon Sep 17 00:00:00 2001 From: Felix Rottler <72494737+FelixRottler@users.noreply.github.com> Date: Wed, 11 Jan 2023 20:48:55 +0100 Subject: [PATCH 110/946] Apply suggestions from code review --- share/github-backup-utils/ghe-backup-mssql | 4 ++-- share/github-backup-utils/ghe-restore-mssql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index a61b44a18..9d2159796 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -38,7 +38,7 @@ fi tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= -opts= +opts=$GHE_EXTRA_SSH_OPTS # git server hostnames under cluster if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then @@ -56,7 +56,7 @@ fi cleanup() { rm -rf $tempdir } -#trap 'cleanup' EXIT INT +trap 'cleanup' EXIT INT add_minute() { # Expect date string in the format of yyyymmddTHHMMSS diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 408b34f54..509bef1ee 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -33,7 +33,7 @@ fi tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= -opts= +opts=$GHE_EXTRA_SSH_OPTS # git server hostnames under cluster if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" From 259717907384003ddfe01271b5a555b93cc0af80 Mon Sep 17 00:00:00 2001 From: Felix Rottler <72494737+FelixRottler@users.noreply.github.com> Date: Thu, 12 Jan 2023 10:48:55 +0100 Subject: [PATCH 111/946] Apply suggestions from code review set options to static string b/c $GHE_EXTRA_SSH_OPTS refers to GHE_HOSTNAME and not GHE_MSSQL_PRIMARY_HOST --- share/github-backup-utils/ghe-backup-mssql | 4 ++-- share/github-backup-utils/ghe-restore-mssql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 9d2159796..b67fdb99b 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -38,13 +38,13 @@ fi tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= -opts=$GHE_EXTRA_SSH_OPTS +opts= # git server hostnames under cluster if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" - opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" + opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" fi diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 509bef1ee..eb97220d5 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -33,12 +33,12 @@ fi tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= -opts=$GHE_EXTRA_SSH_OPTS +opts= # git server hostnames under cluster if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" - opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" + opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" fi From 167e3dc5a60775c10a0c227e16c245d7cc25d296 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Thu, 12 Jan 2023 15:21:11 +0000 Subject: [PATCH 112/946] apply code review changes --- share/github-backup-utils/ghe-backup-mssql | 33 +++++---------------- share/github-backup-utils/ghe-restore-mssql | 33 ++++----------------- share/github-backup-utils/ghe-ssh-mssql | 32 ++++++++++++++++++++ 3 files changed, 45 insertions(+), 53 deletions(-) create mode 100755 share/github-backup-utils/ghe-ssh-mssql diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index b67fdb99b..78b8daa04 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -22,32 +22,13 @@ tran_expire= # Check if the export tool is available in this version export_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-export-mssql" + ghe-ssh-mssql "test -e /usr/local/bin/ghe-export-mssql" else # Always return available for test return 0 fi } -GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" -GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" - -if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then - GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" -fi - -tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) -ssh_config_file_opt= -opts= - -# git server hostnames under cluster -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt="-F $ssh_config_file" - opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" -fi - if ! export_tool_available ; then ghe_verbose "ghe-export-mssql is not available" exit @@ -77,7 +58,7 @@ find_timestamp() { } actions_dbs() { - all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) + all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh-mssql /bin/bash) for db in $all_dbs; do if [[ ! "$db" =~ ^(master|tempdb|model|msdb)$ ]] && [[ "$db" =~ ^[a-zA-Z0-9_-]+$ ]]; then echo "$db" @@ -114,7 +95,7 @@ ensure_same_dbs() { } run_query() { - echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' + echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh-mssql /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' } get_latest_backup_file() { @@ -330,19 +311,19 @@ if [ -n "$backup_type" ]; then fi bm_start "$(basename "$0")" - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" + ghe-ssh-mssql -- "$backup_command" || failures="$failures mssql" bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" + ghe-ssh-mssql "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_DIR/user/mssql/backups" backups=$(echo "set -o pipefail; if sudo test -d \"$appliance_dir\"; then \ - sudo ls \"$appliance_dir\"; fi" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) + sudo ls \"$appliance_dir\"; fi" | ghe-ssh-mssql /bin/bash) for b in $backups do ghe_verbose "Transferring to backup host $b" - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" + ghe-ssh-mssql "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" done fi diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index eb97220d5..fd81955b4 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -15,33 +15,12 @@ set -e # Check if the import tool is available in this version import_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-import-mssql" + ghe-ssh-mssql "test -e /usr/local/bin/ghe-import-mssql" else - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "type ghe-import-mssql" + ghe-ssh-mssql "type ghe-import-mssql" fi } -# Grab host arg -GHE_HOSTNAME="$1" - -GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" -GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" - -if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then - GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" -fi - -tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) -ssh_config_file_opt= -opts= -# git server hostnames under cluster -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt="-F $ssh_config_file" - opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" -fi - if ! import_tool_available; then ghe_verbose "ghe-import-mssql is not available" exit @@ -64,20 +43,20 @@ snapshot_dir_mssql="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_USER_DIR/mssql/backups" -echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash +echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh-mssql /bin/bash for b in "$snapshot_dir_mssql"/* do [[ -e "$b" ]] || break filename="${b##*/}" ghe_verbose "Transferring $filename to appliance host" - cat $snapshot_dir_mssql/$filename | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" + cat $snapshot_dir_mssql/$filename | ghe-ssh-mssql "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" done # Change owner to mssql:mssql to ready for restore -ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" +ghe-ssh-mssql "sudo chown -R mssql:mssql $appliance_dir" # Invoke restore command bm_start "$(basename $0)" -ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "ghe-import-mssql" < "/dev/null" 1>&3 +ghe-ssh-mssql -- "ghe-import-mssql" < "/dev/null" 1>&3 bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-ssh-mssql b/share/github-backup-utils/ghe-ssh-mssql new file mode 100755 index 000000000..653f5ea52 --- /dev/null +++ b/share/github-backup-utils/ghe-ssh-mssql @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +#/ Usage: ghe-ssh-mssql [...] +#/ +#/ Helper to ssh into the mssql master instance with the correct ssh configuration. +set -e + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" + +# use the mssql primary host if GHES cluster configuration contains a mssql-master or use the ghe server if the mssql-master is not available. +GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" +GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" + +if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then + GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" +fi + +tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) +ssh_config_file_opt= +opts= + +# proxy ssh to mssql-master via GHE_HOSTNAME +if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then + ssh_config_file="$tempdir/ssh_config" + ssh_config_file_opt="-F $ssh_config_file" + opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" + ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" +fi + + +exec ghe-ssh $opts $ssh_config_file_opt $GHE_MSSQL_PRIMARY_HOST "$@" \ No newline at end of file From 1f4ca50f9211e62b11e51f88eeec5a41dde5c639 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Thu, 12 Jan 2023 15:32:58 +0000 Subject: [PATCH 113/946] Revert "apply code review changes" This reverts commit 167e3dc5a60775c10a0c227e16c245d7cc25d296. --- share/github-backup-utils/ghe-backup-mssql | 33 ++++++++++++++++----- share/github-backup-utils/ghe-restore-mssql | 33 +++++++++++++++++---- share/github-backup-utils/ghe-ssh-mssql | 32 -------------------- 3 files changed, 53 insertions(+), 45 deletions(-) delete mode 100755 share/github-backup-utils/ghe-ssh-mssql diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 78b8daa04..b67fdb99b 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -22,13 +22,32 @@ tran_expire= # Check if the export tool is available in this version export_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh-mssql "test -e /usr/local/bin/ghe-export-mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-export-mssql" else # Always return available for test return 0 fi } +GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" +GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" + +if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then + GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" +fi + +tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) +ssh_config_file_opt= +opts= + +# git server hostnames under cluster +if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then + ssh_config_file="$tempdir/ssh_config" + ssh_config_file_opt="-F $ssh_config_file" + opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" + ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" +fi + if ! export_tool_available ; then ghe_verbose "ghe-export-mssql is not available" exit @@ -58,7 +77,7 @@ find_timestamp() { } actions_dbs() { - all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh-mssql /bin/bash) + all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) for db in $all_dbs; do if [[ ! "$db" =~ ^(master|tempdb|model|msdb)$ ]] && [[ "$db" =~ ^[a-zA-Z0-9_-]+$ ]]; then echo "$db" @@ -95,7 +114,7 @@ ensure_same_dbs() { } run_query() { - echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh-mssql /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' + echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' } get_latest_backup_file() { @@ -311,19 +330,19 @@ if [ -n "$backup_type" ]; then fi bm_start "$(basename "$0")" - ghe-ssh-mssql -- "$backup_command" || failures="$failures mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics - ghe-ssh-mssql "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_DIR/user/mssql/backups" backups=$(echo "set -o pipefail; if sudo test -d \"$appliance_dir\"; then \ - sudo ls \"$appliance_dir\"; fi" | ghe-ssh-mssql /bin/bash) + sudo ls \"$appliance_dir\"; fi" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) for b in $backups do ghe_verbose "Transferring to backup host $b" - ghe-ssh-mssql "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" done fi diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index fd81955b4..eb97220d5 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -15,12 +15,33 @@ set -e # Check if the import tool is available in this version import_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh-mssql "test -e /usr/local/bin/ghe-import-mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-import-mssql" else - ghe-ssh-mssql "type ghe-import-mssql" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "type ghe-import-mssql" fi } +# Grab host arg +GHE_HOSTNAME="$1" + +GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" +GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" + +if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then + GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" +fi + +tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) +ssh_config_file_opt= +opts= +# git server hostnames under cluster +if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then + ssh_config_file="$tempdir/ssh_config" + ssh_config_file_opt="-F $ssh_config_file" + opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" + ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" +fi + if ! import_tool_available; then ghe_verbose "ghe-import-mssql is not available" exit @@ -43,20 +64,20 @@ snapshot_dir_mssql="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_USER_DIR/mssql/backups" -echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh-mssql /bin/bash +echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash for b in "$snapshot_dir_mssql"/* do [[ -e "$b" ]] || break filename="${b##*/}" ghe_verbose "Transferring $filename to appliance host" - cat $snapshot_dir_mssql/$filename | ghe-ssh-mssql "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" + cat $snapshot_dir_mssql/$filename | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" done # Change owner to mssql:mssql to ready for restore -ghe-ssh-mssql "sudo chown -R mssql:mssql $appliance_dir" +ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" # Invoke restore command bm_start "$(basename $0)" -ghe-ssh-mssql -- "ghe-import-mssql" < "/dev/null" 1>&3 +ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "ghe-import-mssql" < "/dev/null" 1>&3 bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-ssh-mssql b/share/github-backup-utils/ghe-ssh-mssql deleted file mode 100755 index 653f5ea52..000000000 --- a/share/github-backup-utils/ghe-ssh-mssql +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-ssh-mssql [...] -#/ -#/ Helper to ssh into the mssql master instance with the correct ssh configuration. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# use the mssql primary host if GHES cluster configuration contains a mssql-master or use the ghe server if the mssql-master is not available. -GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" -GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" - -if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then - GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" -fi - -tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) -ssh_config_file_opt= -opts= - -# proxy ssh to mssql-master via GHE_HOSTNAME -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt="-F $ssh_config_file" - opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" -fi - - -exec ghe-ssh $opts $ssh_config_file_opt $GHE_MSSQL_PRIMARY_HOST "$@" \ No newline at end of file From 53f5b0c9203cc5edec3a2f70834a08a9190c7e15 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Thu, 12 Jan 2023 15:38:54 +0000 Subject: [PATCH 114/946] use local wrapper for handling ssh into mssql primary --- share/github-backup-utils/ghe-backup-mssql | 27 ++++++++++++--------- share/github-backup-utils/ghe-restore-mssql | 23 +++++++++++------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index b67fdb99b..6e44108cb 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -29,6 +29,16 @@ export_tool_available() { fi } +ghe_ssh_mssql() { + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" $@ +} + +cleanup() { + rm -rf $tempdir +} +trap 'cleanup' EXIT INT + +# use the mssql primary host if GHES cluster configuration contains a mssql-master or use the ghe server if the mssql-master is not available. GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" @@ -53,11 +63,6 @@ if ! export_tool_available ; then exit fi -cleanup() { - rm -rf $tempdir -} -trap 'cleanup' EXIT INT - add_minute() { # Expect date string in the format of yyyymmddTHHMMSS # Here parse date differently depending on GNU Linux vs BSD MacOS @@ -77,7 +82,7 @@ find_timestamp() { } actions_dbs() { - all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) + all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe_ssh_mssql /bin/bash) for db in $all_dbs; do if [[ ! "$db" =~ ^(master|tempdb|model|msdb)$ ]] && [[ "$db" =~ ^[a-zA-Z0-9_-]+$ ]]; then echo "$db" @@ -114,7 +119,7 @@ ensure_same_dbs() { } run_query() { - echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' + echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe_ssh_mssql /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' } get_latest_backup_file() { @@ -330,19 +335,19 @@ if [ -n "$backup_type" ]; then fi bm_start "$(basename "$0")" - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "$backup_command" || failures="$failures mssql" + ghe_ssh_mssql -- "$backup_command" || failures="$failures mssql" bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" + ghe_ssh_mssql "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_DIR/user/mssql/backups" backups=$(echo "set -o pipefail; if sudo test -d \"$appliance_dir\"; then \ - sudo ls \"$appliance_dir\"; fi" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash) + sudo ls \"$appliance_dir\"; fi" | ghe_ssh_mssql /bin/bash) for b in $backups do ghe_verbose "Transferring to backup host $b" - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" + ghe_ssh_mssql "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" done fi diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index eb97220d5..f76cf6034 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -21,9 +21,19 @@ import_tool_available() { fi } +ghe_ssh_mssql() { + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" $@ +} + +cleanup() { + rm -rf $tempdir +} +trap 'cleanup' EXIT INT + # Grab host arg GHE_HOSTNAME="$1" +# use the mssql primary host if GHES cluster configuration contains a mssql-master or use the ghe server if the mssql-master is not available. GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" @@ -47,11 +57,6 @@ if ! import_tool_available; then exit fi -cleanup() { - rm -rf $tempdir -} -trap 'cleanup' EXIT INT - # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_HOSTNAME" @@ -64,20 +69,20 @@ snapshot_dir_mssql="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql" # Transfer backup files from appliance to backup host appliance_dir="$GHE_REMOTE_DATA_USER_DIR/mssql/backups" -echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" /bin/bash +echo "set -o pipefail; sudo rm -rf $appliance_dir; sudo mkdir -p $appliance_dir" | ghe_ssh_mssql /bin/bash for b in "$snapshot_dir_mssql"/* do [[ -e "$b" ]] || break filename="${b##*/}" ghe_verbose "Transferring $filename to appliance host" - cat $snapshot_dir_mssql/$filename | ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" + cat $snapshot_dir_mssql/$filename | ghe_ssh_mssql "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" done # Change owner to mssql:mssql to ready for restore -ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "sudo chown -R mssql:mssql $appliance_dir" +ghe_ssh_mssql "sudo chown -R mssql:mssql $appliance_dir" # Invoke restore command bm_start "$(basename $0)" -ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" -- "ghe-import-mssql" < "/dev/null" 1>&3 +ghe_ssh_mssql -- "ghe-import-mssql" < "/dev/null" 1>&3 bm_end "$(basename $0)" From acd4dfabf3a6c983bd0c5b30440248ebd98f1195 Mon Sep 17 00:00:00 2001 From: Felix Rottler Date: Thu, 12 Jan 2023 15:43:02 +0000 Subject: [PATCH 115/946] replace remaining ghe-ssh calls with ghe_ssh_mssql --- share/github-backup-utils/ghe-backup-mssql | 2 +- share/github-backup-utils/ghe-restore-mssql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 6e44108cb..17380b3da 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -22,7 +22,7 @@ tran_expire= # Check if the export tool is available in this version export_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-export-mssql" + ghe_ssh_mssql "test -e /usr/local/bin/ghe-export-mssql" else # Always return available for test return 0 diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index f76cf6034..d5afce0dc 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -15,9 +15,9 @@ set -e # Check if the import tool is available in this version import_tool_available() { if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "test -e /usr/local/bin/ghe-import-mssql" + ghe_ssh_mssql "test -e /usr/local/bin/ghe-import-mssql" else - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "type ghe-import-mssql" + ghe_ssh_mssql "type ghe-import-mssql" fi } From 8bb1a48d2c8a21d54a52bb9e324ff073b5f456f2 Mon Sep 17 00:00:00 2001 From: Felix Rottler <72494737+FelixRottler@users.noreply.github.com> Date: Thu, 12 Jan 2023 16:55:40 +0100 Subject: [PATCH 116/946] Apply suggestions from code review --- share/github-backup-utils/ghe-backup-mssql | 2 +- share/github-backup-utils/ghe-restore-mssql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 17380b3da..b40f42925 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -30,7 +30,7 @@ export_tool_available() { } ghe_ssh_mssql() { - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" $@ + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "$@" } cleanup() { diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index d5afce0dc..469397076 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -22,7 +22,7 @@ import_tool_available() { } ghe_ssh_mssql() { - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" $@ + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "$@" } cleanup() { From c1631752ab281e5efcd582f4c47b1f1f6f2cef78 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 18 Jan 2023 19:33:12 +0000 Subject: [PATCH 117/946] remove macos-latest from tests --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb8f775d9..b4ceacdcd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,11 +2,15 @@ name: Test and build on: [pull_request] + jobs: build: strategy: matrix: - os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04', 'macos-latest'] + # macos-latest references are kept here for historical purposes. removed macos-latest from the + #matrix as it is not a typical case for users and causes a lot of friction with other linux-based + # installs. Recommend developing on codespaces or using an ubuntu container. + os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04'] fail-fast: false runs-on: ${{ matrix.os }} steps: From 0447b39c018a3d099f15a33b91bf801d86586a20 Mon Sep 17 00:00:00 2001 From: boxofyellow Date: Wed, 18 Jan 2023 15:28:56 -0500 Subject: [PATCH 118/946] Fix up HA without cluster --- share/github-backup-utils/ghe-backup-mssql | 6 ++++-- share/github-backup-utils/ghe-restore-mssql | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index b40f42925..c2ab49ce4 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -50,8 +50,10 @@ tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= opts= -# git server hostnames under cluster -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then +isHA="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.ha" || true)" + +# get server hostnames under cluster and HA +if [ "$GHE_BACKUP_STRATEGY" = "cluster" ] || [ "$isHA" = "true" ] ; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 469397076..3b62ce2c8 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -44,8 +44,11 @@ fi tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) ssh_config_file_opt= opts= -# git server hostnames under cluster -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then + +isHA="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.ha" || true)" + +# get server hostnames under cluster and HA +if [ "$GHE_BACKUP_STRATEGY" = "cluster" ] || [ "$isHA" = "true" ] ; then ssh_config_file="$tempdir/ssh_config" ssh_config_file_opt="-F $ssh_config_file" opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" From 61408d189c51afc12cb5bf2a5f357f8313667815 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Mon, 23 Jan 2023 14:01:15 +0100 Subject: [PATCH 119/946] adding conditional check to save argon secrets only for ghes version >3.7.0 --- share/github-backup-utils/ghe-backup-settings | 6 +++++- test/test-ghe-backup.sh | 18 +++++++++++++++--- test/testlib.sh | 4 +++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 803ab9193..5516e811b 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -75,11 +75,15 @@ backup-secret() { } backup-secret "management console password" "manage-password" "secrets.manage" -backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" +# Backup argon secrets for multiuser from ghes version 3.8 onwards +if [ "$(version $GHE_REMOTE_VERSION)" -gt "$(version 3.7.0)" ]; then + backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" +fi + # Backup external MySQL password if running external MySQL DB. if is_service_external 'mysql'; then backup-secret "external MySQL password" "external-mysql-password" "secrets.external.mysql" diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 1735504dc..f1d0fb3a9 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -132,17 +132,29 @@ begin_test "ghe-backup without password pepper" ) end_test -begin_test "ghe-backup without management console argon2 secret" +begin_test "ghe-backup without management console argon2 secret for ghes lower than 3.8" ( set -e - git config -f "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" secrets.manage-auth.argon-secret "" - ghe-backup + git config -f "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" secrets.manage-auth.argon-secret "fake pw" + GHE_REMOTE_VERSION=3.7.0 ghe-backup [ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ] ) end_test +# multiuser auth introduced in ghes version 3.8 +begin_test "ghe-backup management console argon2 secret" +( + set -e + + git config -f "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" secrets.manage-auth.argon-secret "fake pw" + GHE_REMOTE_VERSION=3.8.0 ghe-backup + + [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake pw" ] +) +end_test + begin_test "ghe-backup empty git-hooks directory" ( set -e diff --git a/test/testlib.sh b/test/testlib.sh index 4abbc3281..c9769b4ea 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -448,7 +448,9 @@ verify_all_backedup_data() { [ "$(cat "$GHE_DATA_DIR/current/manage-password")" = "fake password hash data" ] # verify manage-argon-secret file was backed up - [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake argon2 secret" ] + if [ "$(version $GHE_REMOTE_VERSION)" -gt "$(version 3.7.0)" ]; then + [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake argon2 secret" ] + fi # verify password pepper file was backed up [ "$(cat "$GHE_DATA_DIR/current/password-pepper")" = "fake password pepper data" ] From 2c1d772781d7f6a612974be019f14831a350adf9 Mon Sep 17 00:00:00 2001 From: Ryan Trauntvein Date: Thu, 26 Jan 2023 14:59:47 -0800 Subject: [PATCH 120/946] Set a 2 minute timeout on starting cron --- bin/ghe-restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 42fe6cd57..7195d6690 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -89,11 +89,11 @@ done start_cron () { echo "Starting cron ..." if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo timeout 120s service cron start"; then echo "* Warning: Failed to start cron on one or more nodes" fi else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo timeout 120s service cron start"; then echo "* Warning: Failed to start cron" fi fi From d41296d0d14c9e9da91245ef6f1f7e0039a6b551 Mon Sep 17 00:00:00 2001 From: Aadil Siddiqui <9424117+aasiddiq@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:33:22 +0530 Subject: [PATCH 121/946] Backup/restore chat integration settings --- share/github-backup-utils/ghe-backup-settings | 32 +++++++++ .../ghe-restore-chat-integration | 66 +++++++++++++++++++ .../github-backup-utils/ghe-restore-settings | 3 + 3 files changed, 101 insertions(+) create mode 100755 share/github-backup-utils/ghe-restore-chat-integration diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 5516e811b..dbcd267ea 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -132,6 +132,38 @@ if ghe-ssh "$host" -- ghe-config --true app.packages.enabled; then backup-secret "Packages azure container name" "packages-azure-container-name" "secrets.packages.azure-container-name" fi +# Backup Chat Integration settings +if ghe-ssh "$host" -- ghe-config --true app.chatops.enabled; then + backup-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id" + backup-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password" + backup-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint" + backup-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle" + backup-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name" + backup-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id" + backup-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id" + backup-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret" + backup-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token" + backup-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token" + backup-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint" + backup-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret" + backup-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token" + backup-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command" + backup-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name" + backup-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode" + backup-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint" + backup-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type" + backup-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams" + backup-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams" + backup-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams" + backup-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams" + backup-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret" + backup-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret" + backup-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack" + backup-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack" + backup-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack" + backup-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack" +fi + if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/idp.crt"; then echo "* Transferring SAML keys ..." 1>&3 ghe-ssh $host -- sudo tar -C $GHE_REMOTE_DATA_USER_DIR/common/ -cf - "idp.crt saml-sp.p12" > saml-keys.tar diff --git a/share/github-backup-utils/ghe-restore-chat-integration b/share/github-backup-utils/ghe-restore-chat-integration new file mode 100755 index 000000000..0f0ba4b44 --- /dev/null +++ b/share/github-backup-utils/ghe-restore-chat-integration @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +#/ Usage: ghe-restore-chat-integration +#/ +#/ Note: This script typically isn't called directly. It's invoked by the +#/ ghe-restore command. +set -e + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" + +# Show usage and bail with no arguments +[ -z "$*" ] && print_usage + +bm_start "$(basename $0)" + +# Grab host arg +GHE_HOSTNAME="$1" + +# The snapshot to restore should be set by the ghe-restore command but this lets +# us run this script directly. +: ${GHE_RESTORE_SNAPSHOT:=current} + +# Path to snapshot dir we're restoring from +export GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" + +port=$(ssh_port_part "$GHE_HOSTNAME") +export port +host=$(ssh_host_part "$GHE_HOSTNAME") + +# Perform a host-check and establish GHE_REMOTE_XXX variables. +ghe_remote_version_required "$host" + +# Restore Chat Integration settings. +ghe_verbose "Restoring Chat Integration settings ..." + +restore-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id" +restore-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password" +restore-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint" +restore-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle" +restore-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name" +restore-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id" +restore-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id" +restore-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret" +restore-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token" +restore-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token" +restore-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint" +restore-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret" +restore-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token" +restore-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command" +restore-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name" +restore-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode" +restore-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint" +restore-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type" +restore-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams" +restore-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams" +restore-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams" +restore-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams" +restore-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret" +restore-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret" +restore-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack" +restore-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack" +restore-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack" +restore-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack" + +bm_end "$(basename $0)" \ No newline at end of file diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index 251729ba5..2bafc6ccc 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -36,6 +36,9 @@ restore-secret "external MySQL password" "external-mysql-password" "secrets.exte echo "Restoring packages settings ..." ghe-restore-packages "$GHE_HOSTNAME" 1>&3 +echo "Restoring chat integration settings ..." +ghe-restore-chat-integration "$GHE_HOSTNAME" 1>&3 + # work around issue importing settings with bad storage mode values ( cat "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" && echo ) | sed 's/"storage_mode": "device"/"storage_mode": "rootfs"/' | From 5ff942bd5e9ed4781a701c2471d6acccbbc63ca9 Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Mon, 30 Jan 2023 11:43:25 -0700 Subject: [PATCH 122/946] Update ownership to lifecycle --- ownership.yaml | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/ownership.yaml b/ownership.yaml index 3d7ca2039..a28d9c918 100644 --- a/ownership.yaml +++ b/ownership.yaml @@ -7,7 +7,23 @@ ownership: kind: code repo: https://github.com/github/backup-utils-private qos: critical - component_of: ghes-infra + team: github/ghes-lifecycle + maintainer: shcorbett + exec_sponsor: scottdensmore + tier: 3 + product_manager: maya-ross + sev1: + pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20 + tta: 30 minutes + sev2: + issue: https://github.com/github/ghes/issues/new?labels=ghes-lifecycle + tta: 1 business day + sev3: + slack: ghes-dev + tta: 1 week + support_squad: + slack: support-squad-infrastructure + issue: https://github.com/github/support-squad-infrastructure/issues - name: backup-utils long_name: backup-utils description: backup-utils is backup and restore tooling for Github enterprise server @@ -15,4 +31,20 @@ ownership: kind: code repo: https://github.com/github/backup-utils qos: critical - component_of: ghes-infra + team: github/ghes-lifecycle + maintainer: shcorbett + exec_sponsor: scottdensmore + tier: 3 + product_manager: maya-ross + sev1: + pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20 + tta: 30 minutes + sev2: + issue: https://github.com/github/ghes/issues/new?labels=ghes-lifecycle + tta: 1 business day + sev3: + slack: ghes-dev + tta: 1 week + support_squad: + slack: support-squad-infrastructure + issue: https://github.com/github/support-squad-infrastructure/issues From 0dad07fd0570af5cccf1346d37e911d7edb0e8d6 Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Mon, 30 Jan 2023 12:08:10 -0700 Subject: [PATCH 123/946] Update ownership.yaml --- ownership.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/ownership.yaml b/ownership.yaml index a28d9c918..b6c526ec7 100644 --- a/ownership.yaml +++ b/ownership.yaml @@ -27,7 +27,6 @@ ownership: - name: backup-utils long_name: backup-utils description: backup-utils is backup and restore tooling for Github enterprise server - (GHES) kind: code repo: https://github.com/github/backup-utils qos: critical From d878335016a5e6b7ddaa2972ac92c8db4a93d0a5 Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Mon, 30 Jan 2023 13:02:54 -0700 Subject: [PATCH 124/946] Update ownership.yaml --- ownership.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ownership.yaml b/ownership.yaml index b6c526ec7..b87da5356 100644 --- a/ownership.yaml +++ b/ownership.yaml @@ -11,7 +11,7 @@ ownership: maintainer: shcorbett exec_sponsor: scottdensmore tier: 3 - product_manager: maya-ross + product_manager: davidjarzebowski sev1: pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20 tta: 30 minutes @@ -34,7 +34,7 @@ ownership: maintainer: shcorbett exec_sponsor: scottdensmore tier: 3 - product_manager: maya-ross + product_manager: davidjarzebowski sev1: pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20 tta: 30 minutes From 9661447b65b89ce2784135c2ee21cf78106349f0 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 31 Jan 2023 19:43:38 -0800 Subject: [PATCH 125/946] Update link to SSH key doc --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 8723afb6e..1679e727d 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -68,7 +68,7 @@ if [ $rc -ne 0 ]; then echo "$output" 1>&2 echo "Error: ssh connection with '$host' failed" 1>&2 echo "Note that your SSH key needs to be setup on $host as described in:" 1>&2 - echo "* https://enterprise.github.com/help/articles/adding-an-ssh-key-for-shell-access" 1>&2 + echo "* https://docs.github.com/enterprise-server/admin/configuration/configuring-your-enterprise/accessing-the-administrative-shell-ssh" 1>&2 ;; 101) echo "Error: couldn't read GitHub Enterprise Server fingerprint on '$host' or this isn't a GitHub appliance." 1>&2 From 391c6d41f51d3b4f23b285851e0040d26ebd7d81 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 31 Jan 2023 19:44:16 -0800 Subject: [PATCH 126/946] Update SSH URL in restore script also --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 7195d6690..c023407fe 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -6,7 +6,7 @@ #/ Note that the GitHub Enterprise host must be reachable and your SSH key must #/ be setup as described in the following help article: #/ -#/ +#/ #/ #/ OPTIONS: #/ -c | --config Restore appliance settings and license in addition to From 4a905392d7a24d196fe7a6f128ab2de27e843e6f Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Tue, 7 Feb 2023 11:23:54 -0800 Subject: [PATCH 127/946] Deleting an ownership file Doesn't make sense to exist outside our private repo. --- ownership.yaml | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 ownership.yaml diff --git a/ownership.yaml b/ownership.yaml deleted file mode 100644 index b87da5356..000000000 --- a/ownership.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -version: 1 -ownership: -- name: backup-utils-private - long_name: backup-utils-private - description: backup-utils-private is the private fork of backup-utils - kind: code - repo: https://github.com/github/backup-utils-private - qos: critical - team: github/ghes-lifecycle - maintainer: shcorbett - exec_sponsor: scottdensmore - tier: 3 - product_manager: davidjarzebowski - sev1: - pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20 - tta: 30 minutes - sev2: - issue: https://github.com/github/ghes/issues/new?labels=ghes-lifecycle - tta: 1 business day - sev3: - slack: ghes-dev - tta: 1 week - support_squad: - slack: support-squad-infrastructure - issue: https://github.com/github/support-squad-infrastructure/issues -- name: backup-utils - long_name: backup-utils - description: backup-utils is backup and restore tooling for Github enterprise server - kind: code - repo: https://github.com/github/backup-utils - qos: critical - team: github/ghes-lifecycle - maintainer: shcorbett - exec_sponsor: scottdensmore - tier: 3 - product_manager: davidjarzebowski - sev1: - pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20 - tta: 30 minutes - sev2: - issue: https://github.com/github/ghes/issues/new?labels=ghes-lifecycle - tta: 1 business day - sev3: - slack: ghes-dev - tta: 1 week - support_squad: - slack: support-squad-infrastructure - issue: https://github.com/github/support-squad-infrastructure/issues From 367817ad194c22df04b949ceb6164373f1048d85 Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Tue, 7 Feb 2023 12:13:04 -0800 Subject: [PATCH 128/946] Removing .github/workflows --- .github/workflows/docker-image.yml | 25 ------------ .github/workflows/lint.yml | 23 ----------- .github/workflows/main.yml | 39 ------------------- .../workflows/stale-support-escalation.yml | 27 ------------- .github/workflows/stale.yml | 25 ------------ 5 files changed, 139 deletions(-) delete mode 100644 .github/workflows/docker-image.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/stale-support-escalation.yml delete mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 0ca099a7f..000000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - - build-docker: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the Debian Docker image - run: docker build . --file Dockerfile --tag backup-utils:${GITHUB_RUN_ID} - - name: Build the Alpine Docker image - run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID} - - name: Run tests in Debian Docker image - run: docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version - - name: Run tests in Alpine Docker image - run: docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version - diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 9d97805de..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Lint Code Base - -on: - push: - branches-ignore: [master] - pull_request: - branches: [master] - -jobs: - lint: - name: Lint Code Base - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - name: Lint Code Base - uses: github/super-linter@v4 - env: - VALIDATE_ALL_CODEBASE: false - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index b4ceacdcd..000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Test and build - -on: [pull_request] - - -jobs: - build: - strategy: - matrix: - # macos-latest references are kept here for historical purposes. removed macos-latest from the - #matrix as it is not a typical case for users and causes a lot of friction with other linux-based - # installs. Recommend developing on codespaces or using an ubuntu container. - os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04'] - fail-fast: false - runs-on: ${{ matrix.os }} - steps: - - name: Install Dependencies (Linux) - run: | - sudo apt-get update -y - sudo apt-get install -y devscripts debhelper moreutils fakeroot jq pigz help2man - wget "https://github.com/koalaman/shellcheck/releases/download/latest/shellcheck-latest.linux.x86_64.tar.xz" - tar --xz -xvf "shellcheck-latest.linux.x86_64.tar.xz" - sudo cp shellcheck-latest/shellcheck /usr/bin/shellcheck - if: matrix.os != 'macos-latest' - - name: Install Dependencies (macOS) - run: | - brew install gnu-tar shellcheck jq pigz coreutils gnu-sed gnu-getopt wget - brew install moreutils gawk - if: matrix.os == 'macos-latest' - - name: Get Sources - uses: actions/checkout@v3 - - name: Test - run: | - export PATH="$PATH:/snap/bin" - make test - shell: bash - - name: Build (Linux) - run: DEB_BUILD_OPTIONS=nocheck debuild -us -uc - if: matrix.os != 'macos-latest' diff --git a/.github/workflows/stale-support-escalation.yml b/.github/workflows/stale-support-escalation.yml deleted file mode 100644 index 276486abd..000000000 --- a/.github/workflows/stale-support-escalation.yml +++ /dev/null @@ -1,27 +0,0 @@ - -name: 'Close stale support escalation issues' -on: - push: - branches: - - master - schedule: - - cron: '30 1 * * *' # Run each day at 1:30 UTC - -permissions: - issues: write - -jobs: - stale: - if: github.repository == 'github/ghes' || github.repository == 'github/enterprise2' || github.repository == 'github/backup-utils-private' - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'This support escalation issue is stale because it has been open 30 days with no activity. To make it never stale, add a label never-stale.' - close-issue-message: 'This support escalation issue is closed because it has been open 45 days with no activity. To make it never stale, add a label never-stale.' - days-before-stale: 30 - days-before-close: 45 - only-labels: 'support-escalation' - stale-issue-label: 'stale' - exempt-issue-labels: 'never-stale,P1,P2,P3' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 3b0ae345b..000000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,25 +0,0 @@ - -name: Mark stale issues and pull requests - -on: - schedule: - - cron: "0 0 * * *" - -jobs: - stale: - - runs-on: ubuntu-latest - - steps: - - uses: actions/stale@v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: "👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot." - stale-issue-label: "Stale" - exempt-issue-labels: "Keep" - stale-pr-message: "👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot." - stale-pr-label: "Stale" - exempt-pr-labels: "Keep, epic, initiative, GHAE" - days-before-stale: 30 # 1 month, which accounts for "now" and "next", but anything beyond is "never" - days-before-close: 5 - ascending: true From a76b9266f8ada17eda0a0d4de6e259fb76602972 Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Tue, 7 Feb 2023 12:14:30 -0800 Subject: [PATCH 129/946] Revert "Removing .github/workflows" This reverts commit 367817ad194c22df04b949ceb6164373f1048d85. --- .github/workflows/docker-image.yml | 25 ++++++++++++ .github/workflows/lint.yml | 23 +++++++++++ .github/workflows/main.yml | 39 +++++++++++++++++++ .../workflows/stale-support-escalation.yml | 27 +++++++++++++ .github/workflows/stale.yml | 25 ++++++++++++ 5 files changed, 139 insertions(+) create mode 100644 .github/workflows/docker-image.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/stale-support-escalation.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 000000000..0ca099a7f --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,25 @@ +name: Docker Image CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build-docker: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Debian Docker image + run: docker build . --file Dockerfile --tag backup-utils:${GITHUB_RUN_ID} + - name: Build the Alpine Docker image + run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID} + - name: Run tests in Debian Docker image + run: docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version + - name: Run tests in Alpine Docker image + run: docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version + diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..9d97805de --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: Lint Code Base + +on: + push: + branches-ignore: [master] + pull_request: + branches: [master] + +jobs: + lint: + name: Lint Code Base + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + - name: Lint Code Base + uses: github/super-linter@v4 + env: + VALIDATE_ALL_CODEBASE: false + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..b4ceacdcd --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,39 @@ +name: Test and build + +on: [pull_request] + + +jobs: + build: + strategy: + matrix: + # macos-latest references are kept here for historical purposes. removed macos-latest from the + #matrix as it is not a typical case for users and causes a lot of friction with other linux-based + # installs. Recommend developing on codespaces or using an ubuntu container. + os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04'] + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - name: Install Dependencies (Linux) + run: | + sudo apt-get update -y + sudo apt-get install -y devscripts debhelper moreutils fakeroot jq pigz help2man + wget "https://github.com/koalaman/shellcheck/releases/download/latest/shellcheck-latest.linux.x86_64.tar.xz" + tar --xz -xvf "shellcheck-latest.linux.x86_64.tar.xz" + sudo cp shellcheck-latest/shellcheck /usr/bin/shellcheck + if: matrix.os != 'macos-latest' + - name: Install Dependencies (macOS) + run: | + brew install gnu-tar shellcheck jq pigz coreutils gnu-sed gnu-getopt wget + brew install moreutils gawk + if: matrix.os == 'macos-latest' + - name: Get Sources + uses: actions/checkout@v3 + - name: Test + run: | + export PATH="$PATH:/snap/bin" + make test + shell: bash + - name: Build (Linux) + run: DEB_BUILD_OPTIONS=nocheck debuild -us -uc + if: matrix.os != 'macos-latest' diff --git a/.github/workflows/stale-support-escalation.yml b/.github/workflows/stale-support-escalation.yml new file mode 100644 index 000000000..276486abd --- /dev/null +++ b/.github/workflows/stale-support-escalation.yml @@ -0,0 +1,27 @@ + +name: 'Close stale support escalation issues' +on: + push: + branches: + - master + schedule: + - cron: '30 1 * * *' # Run each day at 1:30 UTC + +permissions: + issues: write + +jobs: + stale: + if: github.repository == 'github/ghes' || github.repository == 'github/enterprise2' || github.repository == 'github/backup-utils-private' + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v7 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This support escalation issue is stale because it has been open 30 days with no activity. To make it never stale, add a label never-stale.' + close-issue-message: 'This support escalation issue is closed because it has been open 45 days with no activity. To make it never stale, add a label never-stale.' + days-before-stale: 30 + days-before-close: 45 + only-labels: 'support-escalation' + stale-issue-label: 'stale' + exempt-issue-labels: 'never-stale,P1,P2,P3' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..3b0ae345b --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,25 @@ + +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v7 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: "👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot." + stale-issue-label: "Stale" + exempt-issue-labels: "Keep" + stale-pr-message: "👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot." + stale-pr-label: "Stale" + exempt-pr-labels: "Keep, epic, initiative, GHAE" + days-before-stale: 30 # 1 month, which accounts for "now" and "next", but anything beyond is "never" + days-before-close: 5 + ascending: true From 241c228366c71cee78005c4d0ec6e396bbb8d8db Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Tue, 7 Feb 2023 12:15:14 -0800 Subject: [PATCH 130/946] Removing only the new workflows --- .../workflows/stale-support-escalation.yml | 27 ------------------- .github/workflows/stale.yml | 25 ----------------- 2 files changed, 52 deletions(-) delete mode 100644 .github/workflows/stale-support-escalation.yml delete mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale-support-escalation.yml b/.github/workflows/stale-support-escalation.yml deleted file mode 100644 index 276486abd..000000000 --- a/.github/workflows/stale-support-escalation.yml +++ /dev/null @@ -1,27 +0,0 @@ - -name: 'Close stale support escalation issues' -on: - push: - branches: - - master - schedule: - - cron: '30 1 * * *' # Run each day at 1:30 UTC - -permissions: - issues: write - -jobs: - stale: - if: github.repository == 'github/ghes' || github.repository == 'github/enterprise2' || github.repository == 'github/backup-utils-private' - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'This support escalation issue is stale because it has been open 30 days with no activity. To make it never stale, add a label never-stale.' - close-issue-message: 'This support escalation issue is closed because it has been open 45 days with no activity. To make it never stale, add a label never-stale.' - days-before-stale: 30 - days-before-close: 45 - only-labels: 'support-escalation' - stale-issue-label: 'stale' - exempt-issue-labels: 'never-stale,P1,P2,P3' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 3b0ae345b..000000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,25 +0,0 @@ - -name: Mark stale issues and pull requests - -on: - schedule: - - cron: "0 0 * * *" - -jobs: - stale: - - runs-on: ubuntu-latest - - steps: - - uses: actions/stale@v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: "👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot." - stale-issue-label: "Stale" - exempt-issue-labels: "Keep" - stale-pr-message: "👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `Keep` label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot." - stale-pr-label: "Stale" - exempt-pr-labels: "Keep, epic, initiative, GHAE" - days-before-stale: 30 # 1 month, which accounts for "now" and "next", but anything beyond is "never" - days-before-close: 5 - ascending: true From 16ad611595629074d585e91fa84720bed9beb389 Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Tue, 7 Feb 2023 12:31:54 -0800 Subject: [PATCH 131/946] Removing from public repo since It shouldn't be needed here. --- RELEASING.md | 79 ---------------------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 RELEASING.md diff --git a/RELEASING.md b/RELEASING.md deleted file mode 100644 index 57d044e32..000000000 --- a/RELEASING.md +++ /dev/null @@ -1,79 +0,0 @@ -# Making a Backup Utilities release - -Starting with Backup Utilities v2.13.0, all major releases will follow GitHub Enterprise Server releases and the version support is inline with that of the [GitHub Enterprise Server upgrade requirements](https://help.github.com/enterprise/admin/guides/installation/about-upgrade-requirements/) and as such, support is limited to three versions of GitHub Enterprise Server: the version that corresponds with the version of Backup Utilities, and the two releases prior to it. - -For example, Backup Utilities 2.13.0 can be used to backup and restore all patch releases from 2.11.0 to the latest patch release of GitHub Enterprise 2.13. Backup utilities 2.14.0 will be released when GitHub Enterprise 2.14.0 is released and will then be used to backup all releases of GitHub Enterprise from 2.12.0 to the latest patch release of GitHub Enterprise 2.14. - -There is no need to align Backup Utilities patch releases with GitHub Enterprise Server patch releases. - -When making a `.0` release, you will need to specify the minimum supported version of GitHub Enterprise Server that release supports. - -Only repo administrator is allowed to run the release script, otherwise it will fail. - -## Pre-release Actions - -Prior to making a release, - -1. Sync any changes that have been merged to backup-utils-private into this repository. - - One possible way to accomplish this is to add the other repository as a remote and merge the changes from the default branch of that remote. - ``` - git clone git@github.com:github/backup-utils - cd backup-utils - git checkout master - git checkout -b sync-private-to-public - git remote add private - git fetch private - git merge private/master - git push origin HEAD - ``` - Then open a pull request on this repository with the changes. -2. Go through the list of open pull requests and merge any that are ready for merging. -3. Go through the list of closed pull requests since the last release and ensure those that should be included in the release notes: - - have a "bug", "enhancement" or "feature" label, - - have a title that clearly describes the changes in that pull request. Reword if necessary. -4. Perform a dry run (add `--dry-run` to one of the commands below) and verify the version strings are going to be changed and verify the release notes. - -## Automatic Process from chatops (internal to GitHub only) - -Coming :soon: - -## Automatic Process from CLI - -1. Install the Debian `devscripts` and `moreutils` packages: - `sudo apt-get install devscripts moreutils` -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. -3. Run... - - Feature release: - `GH_AUTHOR="Bob Smith " GH_RELEASE_TOKEN=your-amazing-secure-token script/release 2.13.0 2.11.0` - - Patch release: - `GH_AUTHOR="Bob Smith " GH_RELEASE_TOKEN=your-amazing-secure-token script/release 2.13.1` - -## Manual Process - -In the event you can't perform the automatic process, or a problem is encountered with the automatic process, these are the manual steps you need to perform for a release. - -1. Install the Debian `devscripts` and `moreutils` packages: - `sudo apt-get install devscripts moreutils` -2. Add a new version and release notes to the `debian/changelog` file: - `dch --newversion 2.13.0 --release-heuristic log` - You can use `make pending-prs` to craft the release notes. -3. Rev the `share/github-backup-utils/version` file. If this is a feature release, update `supported_minimum_version=` in `bin/ghe-host-check` too. -4. Commit your changes. -5. Tag the release: `git tag v2.13.0` -6. Build that tarball package: `make dist` -7. Build the deb package: `make deb`. All the tests should pass. -8. Draft a new release at https://github.com/github/backup-utils/releases, including the release notes and attaching the tarball and deb packages. - The dist tarball you should upload has the revision in the file name, i.e. something like `github-backup-utils-v2.13.0.tar.gz` -9. Push the head of the release to the 'stable' branch. - -## Post-release Actions - -Immediately after making a release using one of the methods above, verify the release has succeeded by checking: - -- latest release at https://github.com/github/backup-utils/releases is correct, -- release at https://github.com/github/backup-utils/releases is linked to the vX.Y.Z tag, -- release has the notes you expect to see, -- asset download links for the latest release at https://github.com/github/backup-utils/releases all download the correct version of Backup Utilities, -- the stable branch is inline with master - https://github.com/github/backup-utils/compare/stable...master. -- sync this repository to backup-utils-private From 5484cf0e42d4f3f68c4c124e1ae00d4f7290bbbe Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Tue, 7 Feb 2023 21:48:52 +0000 Subject: [PATCH 132/946] Bump version: 3.8.0 [ci skip] --- bin/ghe-host-check | 2 +- debian/changelog | 4 ++++ share/github-backup-utils/version | 2 +- test/testlib.sh | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 1679e727d..ebdf12b96 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -131,7 +131,7 @@ fi # backup-utils 2.13 onwards limits support to the current and previous two releases # of GitHub Enterprise Server. -supported_minimum_version="3.5.0" +supported_minimum_version="3.6.0" if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then supported=1 diff --git a/debian/changelog b/debian/changelog index 965b4d01d..fb6b9940b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,7 @@ +github-backup-utils (3.8.0) focal; urgency=medium + + -- Daniel Johnson Tue, 07 Feb 2023 21:43:26 +0000 + github-backup-utils (3.7.0) UNRELEASED; urgency=medium diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 7c69a55db..19811903a 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.7.0 +3.8.0 diff --git a/test/testlib.sh b/test/testlib.sh index c9769b4ea..1a6ffa82f 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -42,7 +42,7 @@ export GHE_BACKUP_CONFIG GHE_DATA_DIR GHE_REMOTE_DATA_DIR GHE_REMOTE_ROOT_DIR # The default remote appliance version. This may be set in the environment prior # to invoking tests to emulate a different remote vm version. -: ${GHE_TEST_REMOTE_VERSION:=3.7.0.rc1} +: ${GHE_TEST_REMOTE_VERSION:=3.8.0.rc1} export GHE_TEST_REMOTE_VERSION # Source in the backup config and set GHE_REMOTE_XXX variables based on the From d63243e7e873d0067e0fe9e4da9cc5859e2df4b6 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 9 Feb 2023 16:46:38 -0500 Subject: [PATCH 133/946] Prepend colorized input to logging data prepend ISO 8601 format timestamp and colorized loglevel to the output of ghe-backup and ghe-restore. --- bin/ghe-backup | 61 ++++++------ bin/ghe-restore | 104 ++++++++++---------- share/github-backup-utils/3 | 0 share/github-backup-utils/ghe-backup-config | 54 ++++++++++ 4 files changed, 137 insertions(+), 82 deletions(-) create mode 100644 share/github-backup-utils/3 diff --git a/bin/ghe-backup b/bin/ghe-backup index 783ea9980..c4d28fa73 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -66,21 +66,21 @@ trap 'rm -rf src dest1 dest2' EXIT mkdir -p src touch src/testfile if ! ln -s /data/does/not/exist/hooks/ src/ >/dev/null 2>&1; then - echo "Error: the filesystem containing $GHE_DATA_DIR does not support symbolic links." 1>&2 - echo "Git repositories contain symbolic links that need to be preserved during a backup." 1>&2 + logError "Error: the filesystem containing $GHE_DATA_DIR does not support symbolic links." 1>&2 + logError "Git repositories contain symbolic links that need to be preserved during a backup." 1>&2 exit 1 fi if ! output=$(rsync -a src/ dest1 2>&1 && rsync -av src/ --link-dest=../dest1 dest2 2>&1); then - echo "Error: rsync encountered an error that could indicate a problem with permissions," 1>&2 - echo "hard links, symbolic links, or another issue that may affect backups." 1>&2 + logError "Error: rsync encountered an error that could indicate a problem with permissions," 1>&2 + logError "hard links, symbolic links, or another issue that may affect backups." 1>&2 echo "$output" exit 1 fi if [ "$(ls -il dest1/testfile | awk '{ print $1 }')" != "$(ls -il dest2/testfile | awk '{ print $1 }')" ]; then - echo "Error: the filesystem containing $GHE_DATA_DIR does not support hard links." 1>&2 - echo "Backup Utilities use hard links to store backup data efficiently." 1>&2 + logError "Error: the filesystem containing $GHE_DATA_DIR does not support hard links." 1>&2 + logError "Backup Utilities use hard links to store backup data efficiently." 1>&2 exit 1 fi rm -rf src dest1 dest2 @@ -115,9 +115,9 @@ trap 'cleanup' EXIT trap 'exit $?' INT # ^C always terminate if [ -h ../in-progress ]; then - echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 - echo "If there is no backup in progress anymore, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress file." 1>&2 + logError "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 + logError "If there is no backup in progress anymore, please remove" 1>&2 + logError "the $GHE_DATA_DIR/in-progress file." 1>&2 exit 1 fi @@ -130,16 +130,16 @@ if [ -f ../in-progress ]; then # will clean up the failed backup. unlink ../in-progress else - echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - echo "the $GHE_DATA_DIR/in-progress file and try again." 1>&2 + logError "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 + logError "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 + logError "the $GHE_DATA_DIR/in-progress file and try again." 1>&2 exit 1 fi fi echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress -echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" +logInfo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" # Perform a host connection check and establish the remote appliance version. # The version is available in the GHE_REMOTE_VERSION variable and also written @@ -163,18 +163,18 @@ echo "$GHE_BACKUP_STRATEGY" > strategy bm_init > /dev/null ghe-backup-store-version || -echo "Warning: storing backup-utils version remotely failed." +logWarn "Warning: storing backup-utils version remotely failed." -echo "Backing up GitHub settings ..." +logInfo "Backing up GitHub settings ..." ghe-backup-settings || failures="$failures settings" -echo "Backing up SSH authorized keys ..." +logInfo "Backing up SSH authorized keys ..." bm_start "ghe-export-authorized-keys" ghe-ssh "$GHE_HOSTNAME" -- 'ghe-export-authorized-keys' > authorized-keys.json || failures="$failures authorized-keys" bm_end "ghe-export-authorized-keys" -echo "Backing up SSH host keys ..." +logInfo "Backing up SSH host keys ..." bm_start "ghe-export-ssh-host-keys" ghe-ssh "$GHE_HOSTNAME" -- 'ghe-export-ssh-host-keys' > ssh-host-keys.tar || failures="$failures ssh-host-keys" @@ -183,45 +183,45 @@ bm_end "ghe-export-ssh-host-keys" ghe-backup-mysql || failures="$failures mysql" if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Backing up MSSQL databases ..." + logInfo "Backing up MSSQL databases ..." ghe-backup-mssql 1>&3 || failures="$failures mssql" - echo "Backing up Actions data ..." + logInfo "Backing up Actions data ..." ghe-backup-actions 1>&3 || failures="$failures actions" fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - echo "Backing up Minio data ..." + logInfo "Backing up Minio data ..." ghe-backup-minio 1>&3 || failures="$failures minio" fi commands=(" -echo \"Backing up Redis database ...\" +logInfo \"Backing up Redis database ...\" ghe-backup-redis > redis.rdb || printf %s \"redis \" >> \"$failures_file\"") commands+=(" -echo \"Backing up audit log ...\" +logInfo \"Backing up audit log ...\" ghe-backup-es-audit-log || printf %s \"audit-log \" >> \"$failures_file\"") commands+=(" -echo \"Backing up Git repositories ...\" +logInfo \"Backing up Git repositories ...\" ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") commands+=(" -echo \"Backing up GitHub Pages artifacts ...\" +logInfo \"Backing up GitHub Pages artifacts ...\" ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") commands+=(" -echo \"Backing up storage data ...\" +logInfo \"Backing up storage data ...\" ghe-backup-storage || printf %s \"storage \" >> \"$failures_file\"") commands+=(" -echo \"Backing up custom Git hooks ...\" +logInfo \"Backing up custom Git hooks ...\" ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"") if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then commands+=(" - echo \"Backing up Elasticsearch indices ...\" + logInfo \"Backing up Elasticsearch indices ...\" ghe-backup-es-rsync || printf %s \"elasticsearch \" >> \"$failures_file\"") fi @@ -239,6 +239,7 @@ fi # git fsck repositories after the backup if [ "$GHE_BACKUP_FSCK" = "yes" ]; then + loginfo "Running git fsck on repositories ..." ghe-backup-fsck $GHE_SNAPSHOT_DIR || failures="$failures fsck" fi @@ -254,7 +255,7 @@ if [ -z "$failures" ]; then ghe-prune-snapshots fi -echo "Completed backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP at $(date +"%H:%M:%S")" +logInfo "Completed backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP at $(date +"%H:%M:%S")" # Exit non-zero and list the steps that failed. if [ -z "$failures" ]; then @@ -262,12 +263,12 @@ if [ -z "$failures" ]; then else steps="$(echo $failures | sed 's/ /, /g')" ghe_remote_logger "Completed backup from $(hostname) / snapshot $GHE_SNAPSHOT_TIMESTAMP with failures: ${steps}." - echo "Error: Snapshot incomplete. Some steps failed: ${steps}. " + logError "Error: Snapshot incomplete. Some steps failed: ${steps}. " exit 1 fi # Detect if the created backup contains any leaked ssh keys -echo "Checking for leaked ssh keys ..." +logInfo "Checking for leaked ssh keys ..." ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true # Make sure we exit zero after the conditional diff --git a/bin/ghe-restore b/bin/ghe-restore index 42fe6cd57..e362e0375 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -90,11 +90,11 @@ start_cron () { echo "Starting cron ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"; then - echo "* Warning: Failed to start cron on one or more nodes" + logWarn "* Warning: Failed to start cron on one or more nodes" fi else if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then - echo "* Warning: Failed to start cron" + logWarn "* Warning: Failed to start cron" fi fi } @@ -105,7 +105,7 @@ cleanup () { fi if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Restarting Actions after restore ..." + logInfo "Restarting Actions after restore ..." # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists # in the --help output @@ -129,7 +129,7 @@ cleanup () { cleanup_cluster_nodes() { uuid="$1" if [ -z "$uuid" ]; then - echo "Node UUID required." + logInfo "Node UUID required." exit 2 fi @@ -171,7 +171,7 @@ GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") export GHE_RESTORE_SNAPSHOT # Detect if the backup we are restoring has a leaked ssh key -echo "Checking for leaked keys in the backup snapshot that is being restored ..." +logInfo "Checking for leaked keys in the backup snapshot that is being restored ..." ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true # Figure out whether to use the tarball or rsync restore strategy based on the @@ -199,7 +199,7 @@ export CLUSTER # Restoring a cluster backup to a standalone appliance is not supported if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - echo "Error: Snapshot from a GitHub Enterprise cluster cannot be restored" \ + logError "Error: Snapshot from a GitHub Enterprise cluster cannot be restored" \ "to a standalone appliance. Aborting." >&2 exit 1 fi @@ -212,8 +212,8 @@ fi # Figure out if this appliance is in a replication pair if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - echo "Error: Restoring to an appliance with replication enabled is not supported." >&2 - echo " Please teardown replication before restoring." >&2 + logError "Error: Restoring to an appliance with replication enabled is not supported." >&2 + logError " Please teardown replication before restoring." >&2 exit 1 fi @@ -249,8 +249,8 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -echo 'Start time:' $START_TIME -echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" +logInfo 'Start time:' $START_TIME +logInfo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Keep other processes on the VM or cluster in the loop about the restore status. @@ -277,7 +277,7 @@ update_restore_status "restoring" # Make sure the GitHub appliance is in maintenance mode. if $instance_configured; then if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then - echo "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 + logError "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 exit 1 fi fi @@ -289,7 +289,7 @@ RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-vers # mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Error: Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + logError "Error: Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 exit 1 fi @@ -300,20 +300,20 @@ if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - echo "Error: $GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" 1>&2 - echo "Please disable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 - echo "To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 + logError "Error: $GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" 1>&2 + logError "Please disable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 + logError "To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 exit 1 fi if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - echo "Error: $GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting" 1>&2 - echo "Please enable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 - echo "To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 + logError "Error: $GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting" 1>&2 + logError "Please enable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 + logError "To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 exit 1 fi else - echo "Error: $GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." 1>&2 - echo "Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 + logError "Error: $GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." 1>&2 + logError "Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 exit 1 fi fi @@ -322,10 +322,10 @@ fi bm_init > /dev/null ghe-backup-store-version || -echo "Warning: storing backup-utils version remotely failed." +logWarn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. -echo "Stopping cron and github-timerd ..." +logInfo "Stopping cron and github-timerd ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then ghe_verbose "* Warning: Failed to stop cron on one or more nodes" @@ -377,7 +377,7 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - echo "Restoring UUID ..." + logInfo "Restoring UUID ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true @@ -402,64 +402,64 @@ else fi if is_external_database_target_or_snapshot && $SKIP_MYSQL; then - echo "Skipping MySQL restore." + logInfo "Skipping MySQL restore." else - echo "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." + logInfo "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Stopping Actions before restoring databases ..." + logInfo "Stopping Actions before restoring databases ..." # We mark Actions as stopped even if the `ghe-actions-stop` # fails to ensure that we cleanly start actions when performing cleanup. ACTIONS_STOPPED=true ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 - echo "Restoring MSSQL databases ..." + logInfo "Restoring MSSQL databases ..." ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 - echo "Restoring Actions data ..." + logInfo "Restoring Actions data ..." ghe-restore-actions "$GHE_HOSTNAME" 1>&3 - echo "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." - echo " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." + logWarn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." + logWarn " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - echo "Restoring MinIO data ..." + logInfo "Restoring MinIO data ..." ghe-restore-minio "$GHE_HOSTNAME" 1>&3 fi commands=(" -echo \"Restoring Redis database ...\" +logInfo \"Restoring Redis database ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") commands+=(" -echo \"Restoring Git repositories ...\" +logInfo \"Restoring Git repositories ...\" ghe-restore-repositories \"$GHE_HOSTNAME\"") commands+=(" -echo \"Restoring Gists ...\" +logInfo \"Restoring Gists ...\" ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") commands+=(" -echo \"Restoring GitHub Pages artifacts ...\" +logInfo \"Restoring GitHub Pages artifacts ...\" ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") commands+=(" -echo \"Restoring SSH authorized keys ...\" +logInfo \"Restoring SSH authorized keys ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") commands+=(" -echo \"Restoring storage data ...\" +logInfo \"Restoring storage data ...\" ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") commands+=(" -echo \"Restoring custom Git hooks ...\" +logInfo \"Restoring custom Git hooks ...\" ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then commands+=(" - echo \"Restoring Elasticsearch indices ...\" + logInfo \"Restoring Elasticsearch indices ...\" ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") fi @@ -472,10 +472,10 @@ fi # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then - echo "Skipping restore of audit logs." + logInfo "Skipping restore of audit logs." else commands+=(" - echo \"Restoring Audit logs ...\" + logInfo \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi @@ -497,15 +497,15 @@ echo "sudo restart -q memcached 2>/dev/null || true" | # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then - echo "Setting last run date for GitHub Connect jobs ..." 1>&3 - echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | + logInfo "Setting last run date for GitHub Connect jobs ..." 1>&3 + logInfo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi # When restoring to a host that has already been configured, kick off a # config run to perform data migrations. if $CLUSTER; then - echo "Configuring cluster ..." + logInfo "Configuring cluster ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -513,7 +513,7 @@ if $CLUSTER; then fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 elif $instance_configured; then - echo "Configuring appliance ..." + logInfo "Configuring appliance ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -562,25 +562,25 @@ update_restore_status "complete" ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." if ! $CLUSTER; then - echo "Restoring SSH host keys ..." + logInfo "Restoring SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 else # This will make sure that Git over SSH host keys (babeld) are # copied to all the cluster nodes so babeld uses the same keys. - echo "Restoring Git over SSH host keys ..." + logInfo "Restoring Git over SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 - echo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | + logInfo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi END_TIME=$(date +%s) -echo 'End time:' $END_TIME -echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' +logInfo 'End time:' $END_TIME +logInfo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' -echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." +logInfo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." if ! $instance_configured; then - echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." + logInfo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." fi diff --git a/share/github-backup-utils/3 b/share/github-backup-utils/3 new file mode 100644 index 000000000..e69de29bb diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index b9271cf6b..9296ecb91 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -507,3 +507,57 @@ restore-secret() { ghe-ssh "$GHE_HOSTNAME" -- /bin/bash fi } + +# Logging display and formatting functions + +# Terminal colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +# Log a message to stdout +loglevel() { + local level=$1 + shift + local message=$* + local display="" + local timestamp + timestamp=$(date +"%Y-%m-%d %H:%M:%S") + + + if [ "$TERM" = "dumb" ]; then + if [ "$level" = "info" ]; then + display="INFO" + elif [ "$level" = "warn" ]; then + display="WARN" + elif [ "$level" = "error" ]; then + display="ERROR" + else + display="-" + fi + else + if [ "$level" = "info" ]; then + display="${GREEN}INFO${NC}" + elif [ "$level" = "warn" ]; then + display="${YELLOW}WARN${NC}" + elif [ "$level" = "error" ]; then + display="${RED}ERROR${NC}" + else + display="-" + fi + fi + echo -e "$timestamp | $display | $message" +} + +logInfo(){ + loglevel "info" "$1" +} + +logWarn(){ + loglevel "warn" "$1" +} + +logError(){ + loglevel "error" "$1" +} \ No newline at end of file From 45ee8758fa927c6afdf14d2868dd1b9c1497b19b Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 10 Feb 2023 06:01:14 -0500 Subject: [PATCH 134/946] Update bin/ghe-backup Co-authored-by: Manuel Bergler --- bin/ghe-backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index c4d28fa73..a1ee6b918 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -239,7 +239,7 @@ fi # git fsck repositories after the backup if [ "$GHE_BACKUP_FSCK" = "yes" ]; then - loginfo "Running git fsck on repositories ..." + logInfo "Running git fsck on repositories ..." ghe-backup-fsck $GHE_SNAPSHOT_DIR || failures="$failures fsck" fi From f0e38f79eef08ca58e1ae33df365b40354c1f60e Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 10 Feb 2023 11:36:25 -0500 Subject: [PATCH 135/946] troubleshooting output --- bin/ghe-restore | 2 +- share/github-backup-utils/3 | 0 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 share/github-backup-utils/3 diff --git a/bin/ghe-restore b/bin/ghe-restore index e362e0375..dd6c88d92 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -475,7 +475,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the logInfo "Skipping restore of audit logs." else commands+=(" - logInfo \"Restoring Audit logs ...\" + echo \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi diff --git a/share/github-backup-utils/3 b/share/github-backup-utils/3 deleted file mode 100644 index e69de29bb..000000000 From 4a5b4ecf760b65e58c9675c99939040a594f387c Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 10 Feb 2023 11:40:05 -0500 Subject: [PATCH 136/946] more troubleshooting output --- bin/ghe-restore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index dd6c88d92..6c5e6e541 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -475,7 +475,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the logInfo "Skipping restore of audit logs." else commands+=(" - echo \"Restoring Audit logs ...\" + logInfo \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi @@ -490,7 +490,7 @@ else fi # Restart an already running memcached to reset the cache after restore -echo "Restarting memcached ..." 1>&3 +logInfo "Restarting memcached ..." 1>&3 echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh @@ -498,7 +498,7 @@ echo "sudo restart -q memcached 2>/dev/null || true" | # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then logInfo "Setting last run date for GitHub Connect jobs ..." 1>&3 - logInfo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | + echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi From e6aa5aacf8d8842540a2480de25928e90428091e Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 10 Feb 2023 16:58:35 +0000 Subject: [PATCH 137/946] Checks for backup host reqs --- bin/ghe-host-check | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 8723afb6e..aca53dbb0 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -144,4 +144,44 @@ if [ -z "$supported" ]; then exit 1 fi +#Display dir requirements for repositories and mysql +backup_dir=${GHE_DATA_DIR} +available_space=$(df $backup_dir | awk 'END{print $4}') +repo_disk_size=$(ghe-ssh "$host" sudo du -sh /data/user/repositories | awk '{print $1}') +mysql_disk_size=$(ghe-ssh "$host" sudo du -sh /data/user/mysql | awk '{print $1}') +# Convert the data size to kilobytes +case "$repo_disk_size" in + *T) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/T/000000000/') )) ;; + *G) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/G/000000/') )) ;; + *M) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/M/000/') )) ;; + *K) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/K//') )) ;; +esac +if [[ $available_space -lt $repo_disk_size ]]; then + echo "There is not enough disk space for the backup" + exit 1 +fi + +#Check rsync, openssh & jq versions +rsync_version=$(rsync --version | grep 'version' | awk '{print $3}') +if awk "BEGIN {exit !($rsync_version < 2.6.4)}" &> /dev/null; then + echo "rsync version $rsync_version in backup-host does not meet minimum requirements." + echo "Please make sure you have the minimum required version of rsync installed" + exit 2 +fi + +ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) +if awk "BEGIN {exit !($ssh_version < 5.6)}" &> /dev/null; then + echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." + echo "Please make sure the minimum required version of openSSH is installed" + exit 2 +fi + +jq_version=$(jq --version |awk -F\- '{print $2}') +if awk "BEGIN {exit !($jq_version < 1.5)}" &> /dev/null; then + echo "jq version $jq_version in backup-host does not meet minimum requirements." + echo "Please make sure you have the minimum required version of jq installed" + exit 2 +fi + + echo "Connect $hostname:$port OK (v$version)" From 10fa9ddea1c8ef3312a5d5f78c1cc36fac87d0a4 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 10 Feb 2023 22:16:39 +0000 Subject: [PATCH 138/946] add requirements file --- bin/ghe-host-check | 23 ++++++++++++---------- share/github-backup-utils/requirements.txt | 3 +++ 2 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 share/github-backup-utils/requirements.txt diff --git a/bin/ghe-host-check b/bin/ghe-host-check index aca53dbb0..324114048 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -144,11 +144,14 @@ if [ -z "$supported" ]; then exit 1 fi +# Bring in the requirements file +. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt" + #Display dir requirements for repositories and mysql backup_dir=${GHE_DATA_DIR} available_space=$(df $backup_dir | awk 'END{print $4}') repo_disk_size=$(ghe-ssh "$host" sudo du -sh /data/user/repositories | awk '{print $1}') -mysql_disk_size=$(ghe-ssh "$host" sudo du -sh /data/user/mysql | awk '{print $1}') +#mysql_disk_size=$(ghe-ssh "$host" sudo du -sh /data/user/mysql | awk '{print $1}') # Convert the data size to kilobytes case "$repo_disk_size" in *T) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/T/000000000/') )) ;; @@ -163,24 +166,24 @@ fi #Check rsync, openssh & jq versions rsync_version=$(rsync --version | grep 'version' | awk '{print $3}') -if awk "BEGIN {exit !($rsync_version < 2.6.4)}" &> /dev/null; then +if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then echo "rsync version $rsync_version in backup-host does not meet minimum requirements." - echo "Please make sure you have the minimum required version of rsync installed" - exit 2 + echo "Please make sure you have the minimum required version of rsync: "$min_rsync" installed" + exit 1 fi ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) -if awk "BEGIN {exit !($ssh_version < 5.6)}" &> /dev/null; then +if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." - echo "Please make sure the minimum required version of openSSH is installed" - exit 2 + echo "Please make sure the minimum required version of openSSH: "$min_openssh" is installed" + exit 1 fi jq_version=$(jq --version |awk -F\- '{print $2}') -if awk "BEGIN {exit !($jq_version < 1.5)}" &> /dev/null; then +if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then echo "jq version $jq_version in backup-host does not meet minimum requirements." - echo "Please make sure you have the minimum required version of jq installed" - exit 2 + echo "Please make sure you have the minimum required version of jq: "$min_jq" installed" + exit 1 fi diff --git a/share/github-backup-utils/requirements.txt b/share/github-backup-utils/requirements.txt new file mode 100644 index 000000000..acf767129 --- /dev/null +++ b/share/github-backup-utils/requirements.txt @@ -0,0 +1,3 @@ +min_rsync=2.6.4 +min_openssh=5.6 +min_jq=1.5 From bdcc56350febcf3ad7e7dd524a8ea51c46bd9ac1 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 10 Feb 2023 22:24:05 +0000 Subject: [PATCH 139/946] Remove redundant quotes --- bin/ghe-host-check | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 324114048..217920657 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -168,21 +168,21 @@ fi rsync_version=$(rsync --version | grep 'version' | awk '{print $3}') if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then echo "rsync version $rsync_version in backup-host does not meet minimum requirements." - echo "Please make sure you have the minimum required version of rsync: "$min_rsync" installed" + echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" exit 1 fi ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." - echo "Please make sure the minimum required version of openSSH: "$min_openssh" is installed" + echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" exit 1 fi jq_version=$(jq --version |awk -F\- '{print $2}') if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then echo "jq version $jq_version in backup-host does not meet minimum requirements." - echo "Please make sure you have the minimum required version of jq: "$min_jq" installed" + echo "Please make sure you have the minimum required version of jq: $min_jq installed" exit 1 fi From f58b8b81d0020e43037ac30fa2a6cdcd09afd6f3 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 14 Feb 2023 19:47:41 +0000 Subject: [PATCH 140/946] Add shellcheck location --- bin/ghe-host-check | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 217920657..1f7b0cb78 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -145,6 +145,10 @@ if [ -z "$supported" ]; then fi # Bring in the requirements file +min_rsync="" +min_openssh="" +min_jq="" +# shellcheck source=share/github-backup-utils/requirements.txt . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt" #Display dir requirements for repositories and mysql From e2a77613b80a57377893fc799d6c31c5401cabda Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Feb 2023 12:53:42 -0500 Subject: [PATCH 141/946] change ghe_verbose --- bin/ghe-restore | 28 +++++++++----------- share/github-backup-utils/ghe-backup-actions | 2 +- share/github-backup-utils/ghe-backup-config | 7 +++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 6c5e6e541..cfa92883e 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -199,8 +199,7 @@ export CLUSTER # Restoring a cluster backup to a standalone appliance is not supported if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - logError "Error: Snapshot from a GitHub Enterprise cluster cannot be restored" \ - "to a standalone appliance. Aborting." >&2 + logError "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 exit 1 fi @@ -212,8 +211,7 @@ fi # Figure out if this appliance is in a replication pair if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - logError "Error: Restoring to an appliance with replication enabled is not supported." >&2 - logError " Please teardown replication before restoring." >&2 + logError "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 exit 1 fi @@ -289,7 +287,7 @@ RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-vers # mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - logError "Error: Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + logError "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 exit 1 fi @@ -300,20 +298,20 @@ if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - logError "Error: $GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" 1>&2 - logError "Please disable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 - logError "To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 + logError "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" \ + "\n""Please disable Actions cache service in $GHE_HOSTNAME and retry" \ + "\n""To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 exit 1 fi if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - logError "Error: $GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting" 1>&2 - logError "Please enable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 - logError "To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 + logError "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting." \ + "\n""Please enable Actions cache service in $GHE_HOSTNAME and retry" \ + "\n""To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 exit 1 fi else - logError "Error: $GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." 1>&2 - logError "Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 + logError "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." \ + "\n""Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 exit 1 fi fi @@ -464,7 +462,7 @@ if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then fi # Restore the audit log migration sentinel file, if it exists in the snapshot -if test -f $GHE_RESTORE_SNAPSHOT_PATH/es-scan-complete; then +if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete" fi @@ -482,7 +480,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - $GHE_PARALLEL_COMMAND $GHE_PARALLEL_COMMAND_OPTIONS -- "${commands[@]}" + $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" else for c in "${commands[@]}"; do eval "$c" diff --git a/share/github-backup-utils/ghe-backup-actions b/share/github-backup-utils/ghe-backup-actions index f19777930..fe41214fa 100755 --- a/share/github-backup-utils/ghe-backup-actions +++ b/share/github-backup-utils/ghe-backup-actions @@ -20,7 +20,7 @@ backup_dir="$GHE_SNAPSHOT_DIR/actions" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 + logError "Error: rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 9296ecb91..1c9b56bf3 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -354,7 +354,7 @@ ghe_remote_logger() { # Log if verbose mode is enabled (GHE_VERBOSE or `-v`). ghe_verbose() { if [ -n "$GHE_VERBOSE" ]; then - echo "$@" 1>&3 + logVerbose "$@" 1>&3 fi } @@ -560,4 +560,7 @@ logWarn(){ logError(){ loglevel "error" "$1" -} \ No newline at end of file +} +logVerbose(){ + loglevel "verbose" "$1" +} From b8396eaf02198fa0d11fc0ce6959f40927e0f9a3 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Feb 2023 15:13:02 -0500 Subject: [PATCH 142/946] ghe-rsync and ghe-ssh mods for logging --- share/github-backup-utils/ghe-backup-config | 21 +++++++++++++++++++++ share/github-backup-utils/ghe-rsync | 4 +++- share/github-backup-utils/ghe-ssh | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 1c9b56bf3..396b3695d 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -533,6 +533,12 @@ loglevel() { display="WARN" elif [ "$level" = "error" ]; then display="ERROR" + elif [ "$level" = "verbose" ]; then + display="VERBOSE" + elif [ "$level" = "rsync" ]; then + display="RSYNC" + elif [ "$level" = "ssh" ]; then + display="SSH" else display="-" fi @@ -543,6 +549,12 @@ loglevel() { display="${YELLOW}WARN${NC}" elif [ "$level" = "error" ]; then display="${RED}ERROR${NC}" + elif [ "$level" = "verbose" ]; then + display="${GREEN}VERBOSE${NC}" + elif [ "$level" = "rsync" ]; then + display="${GREEN}RSYNC${NC}" + elif [ "$level" = "ssh" ]; then + display="${GREEN}SSH${NC}" else display="-" fi @@ -561,6 +573,15 @@ logWarn(){ logError(){ loglevel "error" "$1" } + logVerbose(){ loglevel "verbose" "$1" } + +logRsync(){ + loglevel "rsync" "$1" +} + +logSSH(){ + loglevel "ssh" "$1" +} diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index c50835072..48caff08a 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -11,6 +11,7 @@ set -o pipefail # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" +logRsync "BEGIN: rsync $@ $GHE_EXTRA_RSYNC_OPTS" 1>&3 # Check for --ignore-missing-args parameter support and remove if unavailable. if rsync -h | grep '\-\-ignore-missing-args' >/dev/null 2>&1; then parameters=("$@") @@ -21,7 +22,7 @@ else fi ignoreout='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' -rsync_version_check=`rsync --version | egrep "version 3.[0-9]*.[0-9]*"` +rsync_version_check=$(rsync --version | egrep "version 3.[0-9]*.[0-9]*") if [ ! -z "$rsync_version_check" ]; then # rsync >= 3.x sends errors to stderr. so, we need to redirect to stdout before the pipe rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS 2>&1 | (egrep -v "$ignoreout" || true) @@ -41,4 +42,5 @@ if [ $res = 23 ] && [ -n "$ignore23" ]; then res=0 fi +logRsync "END: rsync $@ $GHE_EXTRA_RSYNC_OPTS | exit code $res" 1>&3 exit $res diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 54d7e4538..5fffa7542 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -81,6 +81,9 @@ fi # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x +logSSH "BEGIN: ssh $opts -p $port -o BatchMode=yes \"$host\" -- $GHE_NICE $GHE_IONICE \"$@\"" # Exec ssh command with modified host / port args and add nice to command. # shellcheck disable=SC2090 # We don't need the quote/backslashes respected exec ssh $opts -p $port -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@" + +logSSH "END: ssh $opts -p $port -o BatchMode=yes \"$host\" -- $GHE_NICE $GHE_IONICE \"$@\"" \ No newline at end of file From d71a01ef60cd624835499e84c4938751b03d5bed Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Feb 2023 15:16:00 -0500 Subject: [PATCH 143/946] Update ssh --- share/github-backup-utils/ghe-ssh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 5fffa7542..24a3b931d 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -81,9 +81,9 @@ fi # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x -logSSH "BEGIN: ssh $opts -p $port -o BatchMode=yes \"$host\" -- $GHE_NICE $GHE_IONICE \"$@\"" +logSSH "BEGIN: \"$@\"" 1>&3 # Exec ssh command with modified host / port args and add nice to command. # shellcheck disable=SC2090 # We don't need the quote/backslashes respected exec ssh $opts -p $port -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@" -logSSH "END: ssh $opts -p $port -o BatchMode=yes \"$host\" -- $GHE_NICE $GHE_IONICE \"$@\"" \ No newline at end of file +logSSH "END:\"$@\"" 1>&3 \ No newline at end of file From efbb06ee48a00d556b0cc0cf185ea0d412e3e835 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Feb 2023 15:32:43 -0500 Subject: [PATCH 144/946] ssh logging adjustments Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 24a3b931d..dfcffb5d4 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -78,12 +78,10 @@ if [ -z "$GHE_DISABLE_SSH_MUX" ]; then fi fi +logSSH " $host : \"$@\"" 1>&3 # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x -logSSH "BEGIN: \"$@\"" 1>&3 # Exec ssh command with modified host / port args and add nice to command. # shellcheck disable=SC2090 # We don't need the quote/backslashes respected exec ssh $opts -p $port -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@" - -logSSH "END:\"$@\"" 1>&3 \ No newline at end of file From 55ac13f9136c734c2fcd5261b15c30b5e1bcb591 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Feb 2023 15:57:14 -0500 Subject: [PATCH 145/946] Update logging for support --- share/github-backup-utils/ghe-backup-config | 4 ++-- .../ghe-backup-es-audit-log | 2 +- share/github-backup-utils/ghe-backup-es-rsync | 2 +- share/github-backup-utils/ghe-backup-fsck | 8 +++---- .../github-backup-utils/ghe-backup-git-hooks | 2 +- share/github-backup-utils/ghe-backup-minio | 2 +- share/github-backup-utils/ghe-backup-mssql | 22 +++++++++---------- share/github-backup-utils/ghe-backup-mysql | 9 +++----- .../ghe-backup-mysql-binary | 4 ++-- .../ghe-backup-mysql-logical | 2 +- share/github-backup-utils/ghe-backup-pages | 2 +- .../ghe-backup-repositories | 14 ++++++------ share/github-backup-utils/ghe-backup-settings | 16 +++++++------- share/github-backup-utils/ghe-backup-storage | 6 ++--- share/github-backup-utils/ghe-backup-userdata | 2 +- .../ghe-cluster-find-nodes | 2 +- 16 files changed, 48 insertions(+), 51 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 396b3695d..543d5a8a3 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -534,7 +534,7 @@ loglevel() { elif [ "$level" = "error" ]; then display="ERROR" elif [ "$level" = "verbose" ]; then - display="VERBOSE" + display="INFO" elif [ "$level" = "rsync" ]; then display="RSYNC" elif [ "$level" = "ssh" ]; then @@ -550,7 +550,7 @@ loglevel() { elif [ "$level" = "error" ]; then display="${RED}ERROR${NC}" elif [ "$level" = "verbose" ]; then - display="${GREEN}VERBOSE${NC}" + display="${GREEN}INFO${NC}" elif [ "$level" = "rsync" ]; then display="${GREEN}RSYNC${NC}" elif [ "$level" = "ssh" ]; then diff --git a/share/github-backup-utils/ghe-backup-es-audit-log b/share/github-backup-utils/ghe-backup-es-audit-log index 42ef9314a..1c472c13b 100755 --- a/share/github-backup-utils/ghe-backup-es-audit-log +++ b/share/github-backup-utils/ghe-backup-es-audit-log @@ -22,7 +22,7 @@ ghe_remote_version_required "$host" mkdir -p "$GHE_SNAPSHOT_DIR/audit-log" if ! indices=$(ghe-ssh "$host" "curl -s \"localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b\""); then - echo "Error: failed to retrieve audit log indices." 1>&2 + logError "ghe-backup-es-audit-log: Failed to retrieve audit log indices." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index 11fa99f70..835de076a 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -20,7 +20,7 @@ ghe_remote_version_required "$host" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 + logError "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-fsck b/share/github-backup-utils/ghe-backup-fsck index 004abe412..10d0de0b9 100755 --- a/share/github-backup-utils/ghe-backup-fsck +++ b/share/github-backup-utils/ghe-backup-fsck @@ -14,7 +14,7 @@ echo "Running git fsck on repos..." # Verify git is available. if ! git --version 1>/dev/null 2>&1; then - echo "Error: git not found." 1>&2 + logError "git not found." 1>&2 exit 1 fi @@ -26,7 +26,7 @@ t_start=$(date +%s) if git fsck -h | grep -q '\-\-dangling'; then git_cmd='git fsck --no-dangling' else - echo "Warning: old git version, --no-dangling not available" + logWarn "ghe-backup-fsck: old git version, --no-dangling not available" 1>&3 git_cmd='git fsck' fi @@ -35,7 +35,7 @@ if [ -z "$sdir" ] || [ ! -d "$sdir" ]; then fi if [ ! -d "$sdir/repositories" ]; then - echo "Error: $sdir is not a valid snapshot." >&2 + logError "ghe-backup-fsck: $sdir is not a valid snapshot." >&2 exit 1 fi @@ -84,7 +84,7 @@ for repo in $(find $sdir/repositories/ -type d -name \*.git); do done -echo "* Repos verified: $repos, Errors: $errors, Took: $(($(date +%s) - $t_start))s" +logInfo "* Repos verified: $repos, Errors: $errors, Took: $(($(date +%s) - $t_start))s" rm -f $log diff --git a/share/github-backup-utils/ghe-backup-git-hooks b/share/github-backup-utils/ghe-backup-git-hooks index 3229ee009..eda507c2b 100755 --- a/share/github-backup-utils/ghe-backup-git-hooks +++ b/share/github-backup-utils/ghe-backup-git-hooks @@ -14,7 +14,7 @@ bm_start "$(basename $0)" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 + logError "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-minio b/share/github-backup-utils/ghe-backup-minio index 59dc7f8b3..920eaf80c 100755 --- a/share/github-backup-utils/ghe-backup-minio +++ b/share/github-backup-utils/ghe-backup-minio @@ -19,7 +19,7 @@ backup_dir="${GHE_SNAPSHOT_DIR}/minio" # Verify rsync is available. if ! command -v rsync 1> /dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 + LogError "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index c2ab49ce4..f8fa10c09 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -61,7 +61,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ] || [ "$isHA" = "true" ] ; then fi if ! export_tool_available ; then - ghe_verbose "ghe-export-mssql is not available" + logError "ghe-export-mssql is not available" 1>&2 exit fi @@ -110,8 +110,8 @@ ensure_same_dbs() { done if [[ "${#locals[@]}" -ne 0 ]]; then - ghe_verbose "Warning: Found following ${#locals[@]} backup files that can't be traced back to the specified GHES host." - ghe_verbose "Warning: Did you recently reconfigure the GHES host? Move or delete these backup files if no longer needed." + logWarn "Warning: Found following ${#locals[@]} backup files that can't be traced back to the specified GHES host." + logWarn "Warning: Did you recently reconfigure the GHES host? Move or delete these backup files if no longer needed." for local in "${locals[@]}"; do ghe_verbose "$1/$local" done @@ -231,28 +231,28 @@ diff expire $diff_expire, tran expire $tran_expire" if [ "$backup_type" == 'diff' ]; then full_backup_file=$(get_latest_backup_file "$last_mssql" "$db" "bak") if [[ "$full_backup_file" == "" ]]; then - ghe_verbose "Taking a full backup instead of a diff backup because for $db a full backup file wasn't found" + logWarn "Taking a full backup instead of a diff backup because for $db a full backup file wasn't found" backup_type="full" break fi full_backup_file_checkpoint_lsn=$(get_backup_checkpoint_lsn "$db" "$full_backup_file") if [[ "$full_backup_file_checkpoint_lsn" = "NULL" ]] || [[ "$full_backup_file_checkpoint_lsn" == "" ]]; then - ghe_verbose "Taking a full backup instead of a diff backup because for $db the checkpoint LSN for $full_backup_file couldn't be determined" + logWarn "Taking a full backup instead of a diff backup because for $db the checkpoint LSN for $full_backup_file couldn't be determined" backup_type="full" break fi next_diff_backup_base_lsn=$(get_next_diff_backup_base_lsn "$db") if [[ "$next_diff_backup_base_lsn" = "NULL" ]] || [[ "$next_diff_backup_base_lsn" == "" ]]; then - ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db the base LSN for the next diff backup couldn't be determined" + logWarn "Taking a full backup instead of a $backup_type backup because for $db the base LSN for the next diff backup couldn't be determined" backup_type="full" break fi # The base of the diff backup we're about to take must exactly match the checkpoint LSN of the full backup file we have if [[ "$next_diff_backup_base_lsn" -ne "$full_backup_file_checkpoint_lsn" ]]; then - ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db the diff would have base LSN $next_diff_backup_base_lsn yet our full backup has checkpoint LSN $full_backup_file_checkpoint_lsn" + logWarn "Taking a full backup instead of a $backup_type backup because for $db the diff would have base LSN $next_diff_backup_base_lsn yet our full backup has checkpoint LSN $full_backup_file_checkpoint_lsn" backup_type="full" break fi @@ -261,21 +261,21 @@ diff expire $diff_expire, tran expire $tran_expire" # Ensure that a transaction log backup will immediately follow the previous one latest_log_backup_file=$(get_latest_backup_file "$last_mssql" "$db" "log") if [[ "$latest_log_backup_file" == "" ]]; then - ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db a previous transaction log backup wasn't found" + logWarn "Taking a full backup instead of a $backup_type backup because for $db a previous transaction log backup wasn't found" backup_type="full" break fi latest_log_backup_last_lsn=$(get_backup_last_lsn "$db" "$latest_log_backup_file") if [[ "$latest_log_backup_last_lsn" = "NULL" ]] || [[ "$latest_log_backup_last_lsn" == "" ]]; then - ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db the LSN range for $latest_log_backup_file couldn't be determined" + logWarn "Taking a full backup instead of a $backup_type backup because for $db the LSN range for $latest_log_backup_file couldn't be determined" backup_type="full" break fi next_log_backup_starting_lsn=$(get_next_log_backup_starting_lsn "$db") if [[ "$next_log_backup_starting_lsn" = "NULL" ]] || [[ "$next_log_backup_starting_lsn" == "" ]]; then - ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db the starting LSN for the next log backup couldn't be determined" + logWarn "Taking a full backup instead of a $backup_type backup because for $db the starting LSN for the next log backup couldn't be determined" backup_type="full" break fi @@ -283,7 +283,7 @@ diff expire $diff_expire, tran expire $tran_expire" # The starting LSN of the backup we're about to take must be equal to (or before) the last LSN from the last backup, # otherwise there'll be a gap and the logfiles won't be restorable if [[ "$next_log_backup_starting_lsn" -gt "$latest_log_backup_last_lsn" ]]; then - ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db a gap would exist between the last backup ending at LSN $latest_log_backup_last_lsn and next backup starting at $next_log_backup_starting_lsn" + logWarn "Taking a full backup instead of a $backup_type backup because for $db a gap would exist between the last backup ending at LSN $latest_log_backup_last_lsn and next backup starting at $next_log_backup_starting_lsn" backup_type="full" break fi diff --git a/share/github-backup-utils/ghe-backup-mysql b/share/github-backup-utils/ghe-backup-mysql index 7e3fd57e3..3acd0919d 100755 --- a/share/github-backup-utils/ghe-backup-mysql +++ b/share/github-backup-utils/ghe-backup-mysql @@ -17,17 +17,14 @@ ghe_remote_version_required "$GHE_HOSTNAME" if is_external_database_target; then if [ -n "$EXTERNAL_DATABASE_BACKUP_SCRIPT" ]; then - echo "Backing up external MySQL database using customer-provided script..." + logInfo "Backing up external MySQL database using customer-provided script..." $EXTERNAL_DATABASE_BACKUP_SCRIPT bm_end "$(basename $0)" exit 0 else if is_binary_backup_feature_on; then - echo "Warning: Binary backups are configured on the target environment." - echo "Binary backup is not supported with an external MySQL database. Backing up using logical backup strategy." - echo - echo "Please disable binary backups with 'ghe-config mysql.backup.binary false', or" - echo "provide a custom backup script using EXTERNAL_DATABASE_BACKUP_SCRIPT" + logWarn "Binary backups are configured on the target environment." + logWarn "Binary backup is not supported with an external MySQL database. Backing up using logical backup strategy. Please disable binary backups with 'ghe-config mysql.backup.binary false', or provide a custom backup script using EXTERNAL_DATABASE_BACKUP_SCRIPT" fi ghe-backup-mysql-logical diff --git a/share/github-backup-utils/ghe-backup-mysql-binary b/share/github-backup-utils/ghe-backup-mysql-binary index 37218c82e..936f6dfee 100755 --- a/share/github-backup-utils/ghe-backup-mysql-binary +++ b/share/github-backup-utils/ghe-backup-mysql-binary @@ -15,10 +15,10 @@ bm_start "$(basename $0)" # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_HOSTNAME" -echo "Backing up MySQL database using binary backup strategy ..." +logVerbose "Backing up MySQL database using binary backup strategy ..." echo "set -o pipefail; ghe-export-mysql" | -ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" +logVerbose "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" echo "NO_ADDITIONAL_COMPRESSION" > "$GHE_SNAPSHOT_DIR/mysql-binary-backup-sentinel" bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-mysql-logical b/share/github-backup-utils/ghe-backup-mysql-logical index 3dc2478ec..80cac2de7 100755 --- a/share/github-backup-utils/ghe-backup-mysql-logical +++ b/share/github-backup-utils/ghe-backup-mysql-logical @@ -15,7 +15,7 @@ bm_start "$(basename $0)" # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_HOSTNAME" -echo "Backing up MySQL database using logical backup strategy ..." +logVerbose "Backing up MySQL database using logical backup strategy ..." echo "set -o pipefail; ghe-export-mysql | pigz" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" diff --git a/share/github-backup-utils/ghe-backup-pages b/share/github-backup-utils/ghe-backup-pages index 634e7a417..9c57ab4fd 100755 --- a/share/github-backup-utils/ghe-backup-pages +++ b/share/github-backup-utils/ghe-backup-pages @@ -18,7 +18,7 @@ backup_dir="$GHE_SNAPSHOT_DIR/pages" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 + logError "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index 60dd5e38e..1e0724ae8 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -46,7 +46,7 @@ backup_current="$GHE_DATA_DIR/current/repositories" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 + logError "rsync not found." 1>&2 exit 1 fi @@ -142,7 +142,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - echo "Warning: no routes found, skipping repositories backup ..." + logWarn "no routes found, skipping repositories backup ..." exit 0 fi @@ -187,7 +187,7 @@ sync_data (){ # should be transferred here. echo 1>&3 - echo "* Transferring auxiliary files ..." 1>&3 + logInfo "* Transferring auxiliary files ..." 1>&3 rsync_repository_data $1:122 $2 -z <&3 - echo "* Transferring packed-refs files ..." 1>&3 + logInfo "* Transferring packed-refs files ..." 1>&3 rsync_repository_data $1:122 $2 -z <&3 - echo "* Transferring refs and reflogs ..." 1>&3 + logInfo "* Transferring refs and reflogs ..." 1>&3 rsync_repository_data $1:122 $2 -z <&3 - echo "* Transferring objects and packs ..." 1>&3 + logInfo "* Transferring objects and packs ..." 1>&3 rsync_repository_data $1:122 $2 -H <&3 - echo "* Transferring special data directories from $h..." 1>&3 + logInfo "* Transferring special data directories from $h..." 1>&3 rsync_repository_data $h:122 -z <&3 +logInfo "* Transferring settings data ..." 1>&3 ghe-ssh "$host" -- 'ghe-export-settings' > settings.json -echo "* Transferring license data ..." 1>&3 +logInfo "* Transferring license data ..." 1>&3 ghe-ssh "$host" -- "sudo cat '$GHE_REMOTE_LICENSE_FILE'" > enterprise.ghl # Function to backup a secret setting to a file. @@ -61,7 +61,7 @@ backup-secret() { esac done - echo "* Transferring $description ..." 1>&3 + logInfo "* Transferring $description ..." 1>&3 ghe-ssh "$host" -- ghe-config "$setting" > "$file+" || ( if [ "$best_effort" = "false" ]; then echo "Warning: $description not set" >&2 @@ -133,24 +133,24 @@ if ghe-ssh "$host" -- ghe-config --true app.packages.enabled; then fi if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/idp.crt"; then - echo "* Transferring SAML keys ..." 1>&3 + logInfo "* Transferring SAML keys ..." 1>&3 ghe-ssh $host -- sudo tar -C $GHE_REMOTE_DATA_USER_DIR/common/ -cf - "idp.crt saml-sp.p12" > saml-keys.tar fi if ghe-ssh "$host" -- "which ghe-export-ssl-ca-certificates 1>/dev/null"; then - echo "* Transferring CA certificates ..." 1>&3 + logInfo "* Transferring CA certificates ..." 1>&3 ghe-ssh "$host" -- "ghe-export-ssl-ca-certificates" > ssl-ca-certificates.tar fi if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - echo "* Transferring cluster configuration ..." 1>&3 + logInfo "* Transferring cluster configuration ..." 1>&3 if ! ghe-ssh "$host" -- "sudo cat $GHE_REMOTE_CLUSTER_CONF_FILE 2>/dev/null" > cluster.conf; then - echo "Error: Enterprise Cluster is not configured yet, backup will fail" >&2 + logError "Error: Enterprise Cluster is not configured yet, backup will fail" >&2 exit 1 fi else if ghe-ssh "$host" -- "sudo cat $GHE_REMOTE_DATA_USER_DIR/common/uuid 2>/dev/null" > uuid; then - echo "* Transferring UUID ..." 1>&3 + logInfo "* Transferring UUID ..." 1>&3 fi fi diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index bb8117021..bc95e5815 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -19,7 +19,7 @@ backup_dir="$GHE_SNAPSHOT_DIR/storage" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 + logError "rsync not found." 1>&2 exit 1 fi @@ -60,7 +60,7 @@ cleanup() { # Enable remote maintenance operations for hostname in $hostnames; do ghe-gc-enable $ssh_config_file_opt $hostname:$port || { - echo "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 + logWarn "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 } done @@ -111,7 +111,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - echo "Warning: no routes found, skipping storage backup ..." + logWarn "no routes found, skipping storage backup ..." exit 0 fi diff --git a/share/github-backup-utils/ghe-backup-userdata b/share/github-backup-utils/ghe-backup-userdata index 97f71c1a9..f0660b363 100755 --- a/share/github-backup-utils/ghe-backup-userdata +++ b/share/github-backup-utils/ghe-backup-userdata @@ -13,7 +13,7 @@ bm_start "$(basename $0) - $1" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 + logError "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-cluster-find-nodes b/share/github-backup-utils/ghe-cluster-find-nodes index c2a3cf0e1..fe3b55689 100755 --- a/share/github-backup-utils/ghe-cluster-find-nodes +++ b/share/github-backup-utils/ghe-cluster-find-nodes @@ -16,7 +16,7 @@ set -e # Check if the REMOTE DATA USER directory is set if [ -z $GHE_REMOTE_DATA_USER_DIR ]; then - echo "Env variable GHE_REMOTE_DATA_USER_DIR is not set. Exiting" + logError "Env variable GHE_REMOTE_DATA_USER_DIR is not set. Exiting" exit 1 fi From 3bb017abb28136bdc9c33949c8eb4e0c55f552c0 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 21 Feb 2023 08:36:44 -0500 Subject: [PATCH 146/946] Add ghe-restore subcommand logging --- .../github-backup-utils/ghe-detect-leaked-ssh-keys | 8 ++++---- share/github-backup-utils/ghe-gc-disable | 2 +- share/github-backup-utils/ghe-prune-snapshots | 4 ++-- share/github-backup-utils/ghe-restore-actions | 4 ++-- ...he-restore-external-database-compatibility-check | 12 ++++-------- share/github-backup-utils/ghe-restore-minio | 2 +- share/github-backup-utils/ghe-restore-mysql | 13 ++++--------- share/github-backup-utils/ghe-restore-mysql-binary | 2 +- share/github-backup-utils/ghe-restore-mysql-legacy | 2 +- share/github-backup-utils/ghe-restore-mysql-logical | 2 +- share/github-backup-utils/ghe-restore-pages | 4 ++-- share/github-backup-utils/ghe-restore-repositories | 8 ++++---- .../ghe-restore-repositories-gist | 6 +++--- share/github-backup-utils/ghe-restore-settings | 10 +++++----- share/github-backup-utils/ghe-restore-snapshot-path | 2 +- share/github-backup-utils/ghe-restore-storage | 6 +++--- 16 files changed, 39 insertions(+), 48 deletions(-) diff --git a/share/github-backup-utils/ghe-detect-leaked-ssh-keys b/share/github-backup-utils/ghe-detect-leaked-ssh-keys index 79978ddf0..c57202937 100755 --- a/share/github-backup-utils/ghe-detect-leaked-ssh-keys +++ b/share/github-backup-utils/ghe-detect-leaked-ssh-keys @@ -86,9 +86,9 @@ for tar_file in $ssh_tars; do leaked_keys_found=true if [ "$current_dir" == "$(dirname "$tar_file")" ]; then current_bkup=true - echo "* Leaked key found in current backup snapshot." + logWarn "* Leaked key found in current backup snapshot." else - echo "* Leaked key found in backup snapshot." + logWarn "* Leaked key found in backup snapshot." fi echo "* Snapshot file: $tar_file" echo "* Key file: $key" @@ -130,9 +130,9 @@ if $leaked_keys_found; then fi else if $leaked_keys_skippedcheck; then - echo "* No result - check not performed since host key fingerprint was empty" + logInfo "* No result - check not performed since host key fingerprint was empty" else - echo "* No leaked keys found" + logInfo "* No leaked keys found" fi fi diff --git a/share/github-backup-utils/ghe-gc-disable b/share/github-backup-utils/ghe-gc-disable index bf37572ca..4eaff194c 100755 --- a/share/github-backup-utils/ghe-gc-disable +++ b/share/github-backup-utils/ghe-gc-disable @@ -50,7 +50,7 @@ echo " " | ghe-ssh $opts "$host" -- /bin/bash || { res=$? if [ $res = 7 ]; then - echo "Error: Git GC processes remain after $GHE_GIT_COOLDOWN_PERIOD seconds. Aborting..." 1>&2 + logError "Error: Git GC processes remain after $GHE_GIT_COOLDOWN_PERIOD seconds. Aborting..." 1>&2 fi exit $res } diff --git a/share/github-backup-utils/ghe-prune-snapshots b/share/github-backup-utils/ghe-prune-snapshots index 475f6b36e..b4c4b8a2b 100755 --- a/share/github-backup-utils/ghe-prune-snapshots +++ b/share/github-backup-utils/ghe-prune-snapshots @@ -25,7 +25,7 @@ prune_dirs="$(ls -1 "$GHE_DATA_DIR"/[0-9]*/incomplete 2>/dev/null || true)" prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) if [ $prune_num -gt 0 ]; then - echo Pruning $prune_num "failed snapshot(s) ..." + logInfo Pruning $prune_num "failed snapshot(s) ..." echo "$prune_dirs" | sed 's@/incomplete$@@' | prune_snapshot fi @@ -35,6 +35,6 @@ snapshot_count=$(ls -1d "$GHE_DATA_DIR"/[0-9]* 2>/dev/null | wc -l) if [ "$snapshot_count" -gt "$GHE_NUM_SNAPSHOTS" ]; then prune_dirs="$(ls -1d "$GHE_DATA_DIR"/[0-9]* | sort -r | awk "NR>$GHE_NUM_SNAPSHOTS")" prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) - echo Pruning $prune_num "expired snapshot(s) ..." + logInfo Pruning $prune_num "expired snapshot(s) ..." echo "$prune_dirs" | prune_snapshot fi diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 66d7e0828..d469ca24f 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -30,7 +30,7 @@ host=$(ssh_host_part "$GHE_HOSTNAME") # No need to restore anything, early exit if [ ! -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then - echo "Warning: Actions backup missing. Skipping ..." + logWarn "Warning: Actions backup missing. Skipping ..." exit 0 fi @@ -96,7 +96,7 @@ ghe-ssh -p "$port" "$host" -- ghe-actions-console -s actions -c "Repair-Database if [ ! -z "$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache_Configuration*.bak')" ]; then ghe-ssh -p "$port" "$host" -- ghe-actions-console -s artifactcache -c "Repair-DatabaseLogins" else - echo "ArtifactCache is not present in mssql backup. Skipping Repair-DatabaseLogins for it." + logInfo "ArtifactCache is not present in mssql backup. Skipping Repair-DatabaseLogins for it." fi bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-external-database-compatibility-check b/share/github-backup-utils/ghe-restore-external-database-compatibility-check index 9a22e63a0..d538779db 100755 --- a/share/github-backup-utils/ghe-restore-external-database-compatibility-check +++ b/share/github-backup-utils/ghe-restore-external-database-compatibility-check @@ -16,15 +16,13 @@ if is_instance_configured; then # Restoring settings in this scenario would change BYODB state, which is not supported via backup-utils. if $RESTORE_SETTINGS; then - echo "Restoring the settings of a snapshot from an appliance using the bundled MySQL service to an appliance using an externally-managed MySQL service is not supported." - echo "Please reconfigure the appliance first, then run ghe-restore again." + logError "Restoring the settings of a snapshot from an appliance using the bundled MySQL service to an appliance using an externally-managed MySQL service is not supported. Please reconfigure the appliance first, then run ghe-restore again." exit 1 fi # Restoring interal DB snapshot to BYODB appliance without passing in --skip-mysql is not supported. if ! $SKIP_MYSQL; then - echo "Restoring a snapshot from an appliance using the bundled MySQL service to an appliance using an externally-managed MySQL service is not supported." - echo "Please migrate the MySQL data beforehand, then run ghe-restore again, passing in the --skip-mysql flag." + logError "Restoring a snapshot from an appliance using the bundled MySQL service to an appliance using an externally-managed MySQL service is not supported. Please migrate the MySQL data beforehand, then run ghe-restore again, passing in the --skip-mysql flag." exit 1 fi fi @@ -33,15 +31,13 @@ if is_instance_configured; then # Restoring settings in this scenario would change BYODB state, which is not supported via backup-utils. if $RESTORE_SETTINGS; then - echo "Restoring the settings of a snapshot from an appliance using an externally-managed MySQL service to an appliance using the bundled MySQL service is not supported." - echo "Please reconfigure the appliance first, then run ghe-restore again." + logError "Restoring the settings of a snapshot from an appliance using an externally-managed MySQL service to an appliance using the bundled MySQL service is not supported. Please reconfigure the appliance first, then run ghe-restore again." exit 1 fi # Restoring BYODB snapshot to internal DB appliance without passing in --skip-mysql is not supported. if ! $SKIP_MYSQL; then - echo "Restoring a snapshot from an appliance using an externally-managed MySQL service to an appliance using the bundled MySQL service is not supported." - echo "Please migrate the MySQL data beforehand, then run ghe-restore again, passing in the --skip-mysql flag." + echo "Restoring a snapshot from an appliance using an externally-managed MySQL service to an appliance using the bundled MySQL service is not supported. Please migrate the MySQL data beforehand, then run ghe-restore again, passing in the --skip-mysql flag." exit 1 fi fi diff --git a/share/github-backup-utils/ghe-restore-minio b/share/github-backup-utils/ghe-restore-minio index a3daa9843..5059b644d 100755 --- a/share/github-backup-utils/ghe-restore-minio +++ b/share/github-backup-utils/ghe-restore-minio @@ -30,7 +30,7 @@ host="$(ssh_host_part "${GHE_HOSTNAME}")" # No need to restore anything, early exit if [ ! -d "${GHE_RESTORE_SNAPSHOT_PATH}/minio" ]; then - echo "Warning: minio backup missing. Skipping ..." + logWarn "Warning: minio backup missing. Skipping ..." exit 0 fi diff --git a/share/github-backup-utils/ghe-restore-mysql b/share/github-backup-utils/ghe-restore-mysql index 6885e98ab..ca17ec3b9 100755 --- a/share/github-backup-utils/ghe-restore-mysql +++ b/share/github-backup-utils/ghe-restore-mysql @@ -44,23 +44,18 @@ if is_external_database_snapshot; then exit 0 else if is_binary_backup "$GHE_RESTORE_SNAPSHOT_PATH"; then - echo "Error: Restore of a binary backup to appliance with an external database configured is not supported." - echo "Please provide a custom external database restore script with EXTERNAL_DATABASE_RESTORE_SCRIPT" + logError "Error: Restore of a binary backup to appliance with an external database configured is not supported. \nPlease provide a custom external database restore script with EXTERNAL_DATABASE_RESTORE_SCRIPT" exit 1 fi if ! is_default_external_database_snapshot; then - echo "Error: Backup was not taken with a GitHub provided backup strategy." - echo "You must provide a custom restore script for this backup using EXTERNAL_DATABASE_BACKUP_SCRIPT" + logError "Error: Backup was not taken with a GitHub provided backup strategy. \nYou must provide a custom restore script for this backup using EXTERNAL_DATABASE_BACKUP_SCRIPT" exit 1 fi if is_binary_backup_feature_on; then - echo "Warning: Binary backups are configured on the target environment." - echo "Binary backup is not supported with an external MySQL database." - echo - echo "Please disable binary backups with 'ghe-config mysql.backup.binary false'" + logWarn "Warning: Binary backups are configured on the target environment. \nBinary backup is not supported with an external MySQL database. \n\nPlease disable binary backups with 'ghe-config mysql.backup.binary false'" fi fi fi @@ -75,7 +70,7 @@ if is_binary_backup_feature_on; then else # We do not allow to restore binary backup without "mysql.backup.binary" set if is_binary_backup "$GHE_RESTORE_SNAPSHOT_PATH"; then - echo "To restore from a binary backup, you have to set ghe-config \"mysql.backup.binary\" to true" >&2 + logError "To restore from a binary backup, you have to set ghe-config \"mysql.backup.binary\" to true" >&2 exit 2 else if is_default_external_database_snapshot; then diff --git a/share/github-backup-utils/ghe-restore-mysql-binary b/share/github-backup-utils/ghe-restore-mysql-binary index fb0da41b0..31b2e434b 100755 --- a/share/github-backup-utils/ghe-restore-mysql-binary +++ b/share/github-backup-utils/ghe-restore-mysql-binary @@ -66,7 +66,7 @@ ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo mkdir -p '$GHE_REMOTE_ # Transfer MySQL data from the snapshot to the GitHub instance. cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" -echo "Restore MySQL database ..." +logInfo "Restore MySQL database ..." # Import the database echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 diff --git a/share/github-backup-utils/ghe-restore-mysql-legacy b/share/github-backup-utils/ghe-restore-mysql-legacy index e3fa615f1..25d5e37e2 100755 --- a/share/github-backup-utils/ghe-restore-mysql-legacy +++ b/share/github-backup-utils/ghe-restore-mysql-legacy @@ -48,7 +48,7 @@ ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo mkdir -p '$GHE_REMOTE_ # Transfer MySQL data from the snapshot to the GitHub instance. cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" -echo "Restore MySQL database ..." +logInfo "Restore MySQL database ..." # Import the database echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 diff --git a/share/github-backup-utils/ghe-restore-mysql-logical b/share/github-backup-utils/ghe-restore-mysql-logical index 3f7e64107..e6758a90a 100755 --- a/share/github-backup-utils/ghe-restore-mysql-logical +++ b/share/github-backup-utils/ghe-restore-mysql-logical @@ -45,7 +45,7 @@ ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo mkdir -p '$GHE_REMOTE_ # Transfer MySQL data from the snapshot to the GitHub instance. cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" -echo "Restore MySQL database ..." +logInfo "Restore MySQL database ..." # Import the database echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 diff --git a/share/github-backup-utils/ghe-restore-pages b/share/github-backup-utils/ghe-restore-pages index 800eb14d3..748dc66a5 100755 --- a/share/github-backup-utils/ghe-restore-pages +++ b/share/github-backup-utils/ghe-restore-pages @@ -27,7 +27,7 @@ pages_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find pages -mindepth 5 # No need to restore anything, early exit if [ -z "$pages_paths" ]; then - echo "Warning: Pages backup missing. Skipping ..." + logWarn "Warning: Pages backup missing. Skipping ..." exit 0 fi @@ -123,7 +123,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - echo "Warning: no routes found, skipping pages restore ..." + logWarn "Warning: no routes found, skipping pages restore ..." exit 0 fi diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index 3d522be0b..4ac4d55a1 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -28,7 +28,7 @@ GHE_HOSTNAME="$1" network_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find repositories -mindepth 6 -maxdepth 7 -name \*.git -exec dirname {} \; | uniq | grep nw | cut -d / -f2-) if [ -z "$network_paths" ]; then - echo "Warning: Repositories backup missing. Skipping ..." + logWarn "Warning: Repositories backup missing. Skipping ..." exit 0 fi @@ -140,7 +140,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - echo "Warning: no routes found, skipping repositories restore ..." + logWarn "Warning: no routes found, skipping repositories restore ..." exit 0 fi @@ -157,7 +157,7 @@ for file_list in $tempdir/git-server-*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - echo \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 + logInfo \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 fi ghe-rsync -avrR --delete \ @@ -216,7 +216,7 @@ bm_end "$(basename $0) - Updating repository info data" restore_warnings="$(ghe-ssh "$GHE_HOSTNAME" -- cat "$remote_warnings" 2>/dev/null || true)" if [ -n "$restore_warnings" ]; then - echo "Warning: One or more repository networks failed to restore successfully. Please contact GitHub Enterprise Support for assistance." + logWarn "Warning: One or more repository networks failed to restore successfully. Please contact GitHub Enterprise Support for assistance." echo "$restore_warnings" fi diff --git a/share/github-backup-utils/ghe-restore-repositories-gist b/share/github-backup-utils/ghe-restore-repositories-gist index 5080b964f..360910151 100755 --- a/share/github-backup-utils/ghe-restore-repositories-gist +++ b/share/github-backup-utils/ghe-restore-repositories-gist @@ -27,7 +27,7 @@ gist_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find repositories -mind # No need to restore anything, early exit if [ -z "$gist_paths" ]; then - echo "Warning: Gist backup missing. Skipping ..." + logWarn "Warning: Gist backup missing. Skipping ..." exit 0 fi @@ -126,7 +126,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - echo "Warning: no routes found, skipping gists restore ..." + logWarn "Warning: no routes found, skipping gists restore ..." exit 0 fi @@ -162,7 +162,7 @@ fi restore_warnings="$(ghe-ssh "$GHE_HOSTNAME" -- cat "$remote_warnings" 2>/dev/null || true)" if [ -n "$restore_warnings" ]; then - echo "Warning: One or more Gists failed to restore successfully. Please contact GitHub Enterprise Support for assistance." + logWarn "Warning: One or more Gists failed to restore successfully. Please contact GitHub Enterprise Support for assistance." echo "$restore_warnings" fi diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index 251729ba5..9d8042f01 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -25,15 +25,15 @@ ghe_remote_version_required "$GHE_HOSTNAME" # Path to snapshot dir we're restoring from GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" -echo "Restoring license ..." +logInfo "Restoring license ..." ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-license' < "$GHE_RESTORE_SNAPSHOT_PATH/enterprise.ghl" 1>&3 -echo "Restoring settings and applying configuration ..." +logInfo "Restoring settings and applying configuration ..." # Restore external MySQL password if running external MySQL DB. restore-secret "external MySQL password" "external-mysql-password" "secrets.external.mysql" -echo "Restoring packages settings ..." +logInfo "Restoring packages settings ..." ghe-restore-packages "$GHE_HOSTNAME" 1>&3 # work around issue importing settings with bad storage mode values @@ -55,14 +55,14 @@ restore-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac- # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then - echo "Restoring SAML keys ..." + logInfo "Restoring SAML keys ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" | ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -C $GHE_REMOTE_DATA_USER_DIR/common/ -xf -" fi # Restore CA certificates if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/ssl-ca-certificates.tar" ]; then - echo "Restoring CA certificates ..." + logInfo "Restoring CA certificates ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/ssl-ca-certificates.tar" | ghe-ssh "$GHE_HOSTNAME" -- "ghe-import-ssl-ca-certificates" fi diff --git a/share/github-backup-utils/ghe-restore-snapshot-path b/share/github-backup-utils/ghe-restore-snapshot-path index 00bbbfcd2..6b34c3940 100755 --- a/share/github-backup-utils/ghe-restore-snapshot-path +++ b/share/github-backup-utils/ghe-restore-snapshot-path @@ -25,7 +25,7 @@ fi # Bail out if we don't have a good snapshot. if [ -z "$GHE_RESTORE_SNAPSHOT" ] || [ ! -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" ]; then : "${GHE_RESTORE_SNAPSHOT:=current}" - echo "Error: Snapshot '$GHE_RESTORE_SNAPSHOT' doesn't exist." 1>&2 + logError "Error: Snapshot '$GHE_RESTORE_SNAPSHOT' doesn't exist." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index 408d0e237..0b8f28061 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -31,7 +31,7 @@ storage_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find storage -mindept # No need to restore anything, early exit if [ -z "$storage_paths" ]; then - echo "Warning: Storage backup missing. Skipping ..." + logWarn "Warning: Storage backup missing. Skipping ..." exit 0 fi @@ -118,7 +118,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - echo "Warning: no routes found, skipping storage restore ..." + logWarn "Warning: no routes found, skipping storage restore ..." exit 0 fi @@ -136,7 +136,7 @@ for file_list in $tempdir/*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - echo \"* Transferring data to $server ...\" 1>&3 + logInfo \"* Transferring data to $server ...\" 1>&3 fi ghe-rsync -arvHR --delete \ From 93cbef87d58c7145c2451b048cb65910697a2101 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 21 Feb 2023 10:03:37 -0500 Subject: [PATCH 147/946] change function names Multi-line description of commit, feel free to be detailed. --- bin/ghe-backup | 61 ++++++------ bin/ghe-restore | 92 +++++++++---------- share/github-backup-utils/ghe-backup-actions | 2 +- share/github-backup-utils/ghe-backup-config | 30 +++--- .../ghe-backup-es-audit-log | 2 +- share/github-backup-utils/ghe-backup-es-rsync | 2 +- share/github-backup-utils/ghe-backup-fsck | 8 +- .../github-backup-utils/ghe-backup-git-hooks | 2 +- share/github-backup-utils/ghe-backup-minio | 2 +- share/github-backup-utils/ghe-backup-mssql | 22 ++--- share/github-backup-utils/ghe-backup-mysql | 6 +- .../ghe-backup-mysql-binary | 4 +- .../ghe-backup-mysql-logical | 2 +- share/github-backup-utils/ghe-backup-pages | 2 +- .../ghe-backup-repositories | 14 +-- share/github-backup-utils/ghe-backup-settings | 16 ++-- share/github-backup-utils/ghe-backup-storage | 6 +- share/github-backup-utils/ghe-backup-userdata | 2 +- .../ghe-cluster-find-nodes | 2 +- .../ghe-detect-leaked-ssh-keys | 8 +- share/github-backup-utils/ghe-gc-disable | 2 +- share/github-backup-utils/ghe-prune-snapshots | 4 +- share/github-backup-utils/ghe-restore-actions | 4 +- ...tore-external-database-compatibility-check | 6 +- share/github-backup-utils/ghe-restore-minio | 2 +- share/github-backup-utils/ghe-restore-mysql | 8 +- .../ghe-restore-mysql-binary | 2 +- .../ghe-restore-mysql-legacy | 2 +- .../ghe-restore-mysql-logical | 2 +- share/github-backup-utils/ghe-restore-pages | 4 +- .../ghe-restore-repositories | 8 +- .../ghe-restore-repositories-gist | 6 +- .../github-backup-utils/ghe-restore-settings | 10 +- .../ghe-restore-snapshot-path | 2 +- share/github-backup-utils/ghe-restore-storage | 6 +- share/github-backup-utils/ghe-rsync | 4 +- share/github-backup-utils/ghe-ssh | 2 +- 37 files changed, 179 insertions(+), 180 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index a1ee6b918..9efa54b5c 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -66,21 +66,20 @@ trap 'rm -rf src dest1 dest2' EXIT mkdir -p src touch src/testfile if ! ln -s /data/does/not/exist/hooks/ src/ >/dev/null 2>&1; then - logError "Error: the filesystem containing $GHE_DATA_DIR does not support symbolic links." 1>&2 - logError "Git repositories contain symbolic links that need to be preserved during a backup." 1>&2 + log_error "Error: the filesystem containing $GHE_DATA_DIR does not support symbolic links. \nGit repositories contain symbolic links that need to be preserved during a backup." 1>&2 exit 1 fi if ! output=$(rsync -a src/ dest1 2>&1 && rsync -av src/ --link-dest=../dest1 dest2 2>&1); then - logError "Error: rsync encountered an error that could indicate a problem with permissions," 1>&2 - logError "hard links, symbolic links, or another issue that may affect backups." 1>&2 + log_error "Error: rsync encountered an error that could indicate a problem with permissions," 1>&2 + log_error "hard links, symbolic links, or another issue that may affect backups." 1>&2 echo "$output" exit 1 fi if [ "$(ls -il dest1/testfile | awk '{ print $1 }')" != "$(ls -il dest2/testfile | awk '{ print $1 }')" ]; then - logError "Error: the filesystem containing $GHE_DATA_DIR does not support hard links." 1>&2 - logError "Backup Utilities use hard links to store backup data efficiently." 1>&2 + log_error "Error: the filesystem containing $GHE_DATA_DIR does not support hard links." 1>&2 + log_error "Backup Utilities use hard links to store backup data efficiently." 1>&2 exit 1 fi rm -rf src dest1 dest2 @@ -115,9 +114,9 @@ trap 'cleanup' EXIT trap 'exit $?' INT # ^C always terminate if [ -h ../in-progress ]; then - logError "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 - logError "If there is no backup in progress anymore, please remove" 1>&2 - logError "the $GHE_DATA_DIR/in-progress file." 1>&2 + log_error "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 + log_error "If there is no backup in progress anymore, please remove" 1>&2 + log_error "the $GHE_DATA_DIR/in-progress file." 1>&2 exit 1 fi @@ -130,16 +129,16 @@ if [ -f ../in-progress ]; then # will clean up the failed backup. unlink ../in-progress else - logError "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - logError "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - logError "the $GHE_DATA_DIR/in-progress file and try again." 1>&2 + log_error "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 + log_error "If PID $pid is not a process related to the backup utilities, please remove" 1>&2 + log_error "the $GHE_DATA_DIR/in-progress file and try again." 1>&2 exit 1 fi fi echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress -logInfo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" +log_info "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" # Perform a host connection check and establish the remote appliance version. # The version is available in the GHE_REMOTE_VERSION variable and also written @@ -163,18 +162,18 @@ echo "$GHE_BACKUP_STRATEGY" > strategy bm_init > /dev/null ghe-backup-store-version || -logWarn "Warning: storing backup-utils version remotely failed." +log_warn "Warning: storing backup-utils version remotely failed." -logInfo "Backing up GitHub settings ..." +log_info "Backing up GitHub settings ..." ghe-backup-settings || failures="$failures settings" -logInfo "Backing up SSH authorized keys ..." +log_info "Backing up SSH authorized keys ..." bm_start "ghe-export-authorized-keys" ghe-ssh "$GHE_HOSTNAME" -- 'ghe-export-authorized-keys' > authorized-keys.json || failures="$failures authorized-keys" bm_end "ghe-export-authorized-keys" -logInfo "Backing up SSH host keys ..." +log_info "Backing up SSH host keys ..." bm_start "ghe-export-ssh-host-keys" ghe-ssh "$GHE_HOSTNAME" -- 'ghe-export-ssh-host-keys' > ssh-host-keys.tar || failures="$failures ssh-host-keys" @@ -183,45 +182,45 @@ bm_end "ghe-export-ssh-host-keys" ghe-backup-mysql || failures="$failures mysql" if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - logInfo "Backing up MSSQL databases ..." + log_info "Backing up MSSQL databases ..." ghe-backup-mssql 1>&3 || failures="$failures mssql" - logInfo "Backing up Actions data ..." + log_info "Backing up Actions data ..." ghe-backup-actions 1>&3 || failures="$failures actions" fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - logInfo "Backing up Minio data ..." + log_info "Backing up Minio data ..." ghe-backup-minio 1>&3 || failures="$failures minio" fi commands=(" -logInfo \"Backing up Redis database ...\" +log_info \"Backing up Redis database ...\" ghe-backup-redis > redis.rdb || printf %s \"redis \" >> \"$failures_file\"") commands+=(" -logInfo \"Backing up audit log ...\" +log_info \"Backing up audit log ...\" ghe-backup-es-audit-log || printf %s \"audit-log \" >> \"$failures_file\"") commands+=(" -logInfo \"Backing up Git repositories ...\" +log_info \"Backing up Git repositories ...\" ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") commands+=(" -logInfo \"Backing up GitHub Pages artifacts ...\" +log_info \"Backing up GitHub Pages artifacts ...\" ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") commands+=(" -logInfo \"Backing up storage data ...\" +log_info \"Backing up storage data ...\" ghe-backup-storage || printf %s \"storage \" >> \"$failures_file\"") commands+=(" -logInfo \"Backing up custom Git hooks ...\" +log_info \"Backing up custom Git hooks ...\" ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"") if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then commands+=(" - logInfo \"Backing up Elasticsearch indices ...\" + log_info \"Backing up Elasticsearch indices ...\" ghe-backup-es-rsync || printf %s \"elasticsearch \" >> \"$failures_file\"") fi @@ -239,7 +238,7 @@ fi # git fsck repositories after the backup if [ "$GHE_BACKUP_FSCK" = "yes" ]; then - logInfo "Running git fsck on repositories ..." + log_info "Running git fsck on repositories ..." ghe-backup-fsck $GHE_SNAPSHOT_DIR || failures="$failures fsck" fi @@ -255,7 +254,7 @@ if [ -z "$failures" ]; then ghe-prune-snapshots fi -logInfo "Completed backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP at $(date +"%H:%M:%S")" +log_info "Completed backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP at $(date +"%H:%M:%S")" # Exit non-zero and list the steps that failed. if [ -z "$failures" ]; then @@ -263,12 +262,12 @@ if [ -z "$failures" ]; then else steps="$(echo $failures | sed 's/ /, /g')" ghe_remote_logger "Completed backup from $(hostname) / snapshot $GHE_SNAPSHOT_TIMESTAMP with failures: ${steps}." - logError "Error: Snapshot incomplete. Some steps failed: ${steps}. " + log_error "Error: Snapshot incomplete. Some steps failed: ${steps}. " exit 1 fi # Detect if the created backup contains any leaked ssh keys -logInfo "Checking for leaked ssh keys ..." +log_info "Checking for leaked ssh keys ..." ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true # Make sure we exit zero after the conditional diff --git a/bin/ghe-restore b/bin/ghe-restore index cfa92883e..b8e124140 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -90,11 +90,11 @@ start_cron () { echo "Starting cron ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"; then - logWarn "* Warning: Failed to start cron on one or more nodes" + log_warn "* Warning: Failed to start cron on one or more nodes" fi else if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then - logWarn "* Warning: Failed to start cron" + log_warn "* Warning: Failed to start cron" fi fi } @@ -105,7 +105,7 @@ cleanup () { fi if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - logInfo "Restarting Actions after restore ..." + log_info "Restarting Actions after restore ..." # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists # in the --help output @@ -129,7 +129,7 @@ cleanup () { cleanup_cluster_nodes() { uuid="$1" if [ -z "$uuid" ]; then - logInfo "Node UUID required." + log_info "Node UUID required." exit 2 fi @@ -171,7 +171,7 @@ GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") export GHE_RESTORE_SNAPSHOT # Detect if the backup we are restoring has a leaked ssh key -logInfo "Checking for leaked keys in the backup snapshot that is being restored ..." +log_info "Checking for leaked keys in the backup snapshot that is being restored ..." ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true # Figure out whether to use the tarball or rsync restore strategy based on the @@ -199,7 +199,7 @@ export CLUSTER # Restoring a cluster backup to a standalone appliance is not supported if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - logError "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 + log_error "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 exit 1 fi @@ -211,7 +211,7 @@ fi # Figure out if this appliance is in a replication pair if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - logError "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 + log_error "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 exit 1 fi @@ -247,8 +247,8 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -logInfo 'Start time:' $START_TIME -logInfo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" +log_info 'Start time:' $START_TIME +log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Keep other processes on the VM or cluster in the loop about the restore status. @@ -275,7 +275,7 @@ update_restore_status "restoring" # Make sure the GitHub appliance is in maintenance mode. if $instance_configured; then if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then - logError "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 + log_error "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 exit 1 fi fi @@ -287,7 +287,7 @@ RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-vers # mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - logError "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + log_error "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 exit 1 fi @@ -298,19 +298,19 @@ if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - logError "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" \ + log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" \ "\n""Please disable Actions cache service in $GHE_HOSTNAME and retry" \ "\n""To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 exit 1 fi if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - logError "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting." \ + log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting." \ "\n""Please enable Actions cache service in $GHE_HOSTNAME and retry" \ "\n""To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 exit 1 fi else - logError "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." \ + log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." \ "\n""Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 exit 1 fi @@ -320,10 +320,10 @@ fi bm_init > /dev/null ghe-backup-store-version || -logWarn "Warning: storing backup-utils version remotely failed." +log_warn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. -logInfo "Stopping cron and github-timerd ..." +log_info "Stopping cron and github-timerd ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then ghe_verbose "* Warning: Failed to stop cron on one or more nodes" @@ -375,7 +375,7 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - logInfo "Restoring UUID ..." + log_info "Restoring UUID ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true @@ -400,64 +400,64 @@ else fi if is_external_database_target_or_snapshot && $SKIP_MYSQL; then - logInfo "Skipping MySQL restore." + log_info "Skipping MySQL restore." else - logInfo "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." + log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - logInfo "Stopping Actions before restoring databases ..." + log_info "Stopping Actions before restoring databases ..." # We mark Actions as stopped even if the `ghe-actions-stop` # fails to ensure that we cleanly start actions when performing cleanup. ACTIONS_STOPPED=true ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 - logInfo "Restoring MSSQL databases ..." + log_info "Restoring MSSQL databases ..." ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 - logInfo "Restoring Actions data ..." + log_info "Restoring Actions data ..." ghe-restore-actions "$GHE_HOSTNAME" 1>&3 - logWarn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." - logWarn " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." + log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." + log_warn " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - logInfo "Restoring MinIO data ..." + log_info "Restoring MinIO data ..." ghe-restore-minio "$GHE_HOSTNAME" 1>&3 fi commands=(" -logInfo \"Restoring Redis database ...\" +log_info \"Restoring Redis database ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") commands+=(" -logInfo \"Restoring Git repositories ...\" +log_info \"Restoring Git repositories ...\" ghe-restore-repositories \"$GHE_HOSTNAME\"") commands+=(" -logInfo \"Restoring Gists ...\" +log_info \"Restoring Gists ...\" ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") commands+=(" -logInfo \"Restoring GitHub Pages artifacts ...\" +log_info \"Restoring GitHub Pages artifacts ...\" ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") commands+=(" -logInfo \"Restoring SSH authorized keys ...\" +log_info \"Restoring SSH authorized keys ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") commands+=(" -logInfo \"Restoring storage data ...\" +log_info \"Restoring storage data ...\" ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") commands+=(" -logInfo \"Restoring custom Git hooks ...\" +log_info \"Restoring custom Git hooks ...\" ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then commands+=(" - logInfo \"Restoring Elasticsearch indices ...\" + log_info \"Restoring Elasticsearch indices ...\" ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") fi @@ -470,10 +470,10 @@ fi # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then - logInfo "Skipping restore of audit logs." + log_info "Skipping restore of audit logs." else commands+=(" - logInfo \"Restoring Audit logs ...\" + log_info \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi @@ -488,14 +488,14 @@ else fi # Restart an already running memcached to reset the cache after restore -logInfo "Restarting memcached ..." 1>&3 +log_info "Restarting memcached ..." 1>&3 echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then - logInfo "Setting last run date for GitHub Connect jobs ..." 1>&3 + log_info "Setting last run date for GitHub Connect jobs ..." 1>&3 echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi @@ -503,7 +503,7 @@ fi # When restoring to a host that has already been configured, kick off a # config run to perform data migrations. if $CLUSTER; then - logInfo "Configuring cluster ..." + log_info "Configuring cluster ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -511,7 +511,7 @@ if $CLUSTER; then fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 elif $instance_configured; then - logInfo "Configuring appliance ..." + log_info "Configuring appliance ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -560,25 +560,25 @@ update_restore_status "complete" ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." if ! $CLUSTER; then - logInfo "Restoring SSH host keys ..." + log_info "Restoring SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 else # This will make sure that Git over SSH host keys (babeld) are # copied to all the cluster nodes so babeld uses the same keys. - logInfo "Restoring Git over SSH host keys ..." + log_info "Restoring Git over SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 - logInfo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | + log_info "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi END_TIME=$(date +%s) -logInfo 'End time:' $END_TIME -logInfo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' +log_info 'End time:' $END_TIME +log_info 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' -logInfo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." +log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." if ! $instance_configured; then - logInfo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." + log_info "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." fi diff --git a/share/github-backup-utils/ghe-backup-actions b/share/github-backup-utils/ghe-backup-actions index fe41214fa..8f676bcc5 100755 --- a/share/github-backup-utils/ghe-backup-actions +++ b/share/github-backup-utils/ghe-backup-actions @@ -20,7 +20,7 @@ backup_dir="$GHE_SNAPSHOT_DIR/actions" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - logError "Error: rsync not found." 1>&2 + log_error "Error: rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 543d5a8a3..50d868373 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -354,7 +354,7 @@ ghe_remote_logger() { # Log if verbose mode is enabled (GHE_VERBOSE or `-v`). ghe_verbose() { if [ -n "$GHE_VERBOSE" ]; then - logVerbose "$@" 1>&3 + log_verbose "$@" 1>&3 fi } @@ -517,13 +517,13 @@ YELLOW='\033[0;33m' NC='\033[0m' # No Color # Log a message to stdout -loglevel() { +log_level() { local level=$1 shift local message=$* local display="" local timestamp - timestamp=$(date +"%Y-%m-%d %H:%M:%S") + timestamp=$(date -u "+%FT%TZ") if [ "$TERM" = "dumb" ]; then @@ -562,26 +562,26 @@ loglevel() { echo -e "$timestamp | $display | $message" } -logInfo(){ - loglevel "info" "$1" +log_info(){ + log_level "info" "$1" } -logWarn(){ - loglevel "warn" "$1" +log_warn(){ + log_level "warn" "$1" } -logError(){ - loglevel "error" "$1" +log_error(){ + log_level "error" "$1" } -logVerbose(){ - loglevel "verbose" "$1" +log_verbose(){ + log_level "verbose" "$1" } -logRsync(){ - loglevel "rsync" "$1" +log_rsync(){ + log_level "rsync" "$1" } -logSSH(){ - loglevel "ssh" "$1" +log_ssh(){ + log_level "ssh" "$1" } diff --git a/share/github-backup-utils/ghe-backup-es-audit-log b/share/github-backup-utils/ghe-backup-es-audit-log index 1c472c13b..84da8953a 100755 --- a/share/github-backup-utils/ghe-backup-es-audit-log +++ b/share/github-backup-utils/ghe-backup-es-audit-log @@ -22,7 +22,7 @@ ghe_remote_version_required "$host" mkdir -p "$GHE_SNAPSHOT_DIR/audit-log" if ! indices=$(ghe-ssh "$host" "curl -s \"localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b\""); then - logError "ghe-backup-es-audit-log: Failed to retrieve audit log indices." 1>&2 + log_error "ghe-backup-es-audit-log: Failed to retrieve audit log indices." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index 835de076a..244273271 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -20,7 +20,7 @@ ghe_remote_version_required "$host" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - logError "rsync not found." 1>&2 + log_error "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-fsck b/share/github-backup-utils/ghe-backup-fsck index 10d0de0b9..d255e036f 100755 --- a/share/github-backup-utils/ghe-backup-fsck +++ b/share/github-backup-utils/ghe-backup-fsck @@ -14,7 +14,7 @@ echo "Running git fsck on repos..." # Verify git is available. if ! git --version 1>/dev/null 2>&1; then - logError "git not found." 1>&2 + log_error "git not found." 1>&2 exit 1 fi @@ -26,7 +26,7 @@ t_start=$(date +%s) if git fsck -h | grep -q '\-\-dangling'; then git_cmd='git fsck --no-dangling' else - logWarn "ghe-backup-fsck: old git version, --no-dangling not available" 1>&3 + log_warn "ghe-backup-fsck: old git version, --no-dangling not available" 1>&3 git_cmd='git fsck' fi @@ -35,7 +35,7 @@ if [ -z "$sdir" ] || [ ! -d "$sdir" ]; then fi if [ ! -d "$sdir/repositories" ]; then - logError "ghe-backup-fsck: $sdir is not a valid snapshot." >&2 + log_error "ghe-backup-fsck: $sdir is not a valid snapshot." >&2 exit 1 fi @@ -84,7 +84,7 @@ for repo in $(find $sdir/repositories/ -type d -name \*.git); do done -logInfo "* Repos verified: $repos, Errors: $errors, Took: $(($(date +%s) - $t_start))s" +log_info "* Repos verified: $repos, Errors: $errors, Took: $(($(date +%s) - $t_start))s" rm -f $log diff --git a/share/github-backup-utils/ghe-backup-git-hooks b/share/github-backup-utils/ghe-backup-git-hooks index eda507c2b..5ef02d474 100755 --- a/share/github-backup-utils/ghe-backup-git-hooks +++ b/share/github-backup-utils/ghe-backup-git-hooks @@ -14,7 +14,7 @@ bm_start "$(basename $0)" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - logError "rsync not found." 1>&2 + log_error "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-minio b/share/github-backup-utils/ghe-backup-minio index 920eaf80c..481ee949c 100755 --- a/share/github-backup-utils/ghe-backup-minio +++ b/share/github-backup-utils/ghe-backup-minio @@ -19,7 +19,7 @@ backup_dir="${GHE_SNAPSHOT_DIR}/minio" # Verify rsync is available. if ! command -v rsync 1> /dev/null 2>&1; then - LogError "rsync not found." 1>&2 + log_error "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index f8fa10c09..ead33f6bc 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -61,7 +61,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ] || [ "$isHA" = "true" ] ; then fi if ! export_tool_available ; then - logError "ghe-export-mssql is not available" 1>&2 + log_error "ghe-export-mssql is not available" 1>&2 exit fi @@ -110,8 +110,8 @@ ensure_same_dbs() { done if [[ "${#locals[@]}" -ne 0 ]]; then - logWarn "Warning: Found following ${#locals[@]} backup files that can't be traced back to the specified GHES host." - logWarn "Warning: Did you recently reconfigure the GHES host? Move or delete these backup files if no longer needed." + log_warn "Warning: Found following ${#locals[@]} backup files that can't be traced back to the specified GHES host." + log_warn "Warning: Did you recently reconfigure the GHES host? Move or delete these backup files if no longer needed." for local in "${locals[@]}"; do ghe_verbose "$1/$local" done @@ -231,28 +231,28 @@ diff expire $diff_expire, tran expire $tran_expire" if [ "$backup_type" == 'diff' ]; then full_backup_file=$(get_latest_backup_file "$last_mssql" "$db" "bak") if [[ "$full_backup_file" == "" ]]; then - logWarn "Taking a full backup instead of a diff backup because for $db a full backup file wasn't found" + log_warn "Taking a full backup instead of a diff backup because for $db a full backup file wasn't found" backup_type="full" break fi full_backup_file_checkpoint_lsn=$(get_backup_checkpoint_lsn "$db" "$full_backup_file") if [[ "$full_backup_file_checkpoint_lsn" = "NULL" ]] || [[ "$full_backup_file_checkpoint_lsn" == "" ]]; then - logWarn "Taking a full backup instead of a diff backup because for $db the checkpoint LSN for $full_backup_file couldn't be determined" + log_warn "Taking a full backup instead of a diff backup because for $db the checkpoint LSN for $full_backup_file couldn't be determined" backup_type="full" break fi next_diff_backup_base_lsn=$(get_next_diff_backup_base_lsn "$db") if [[ "$next_diff_backup_base_lsn" = "NULL" ]] || [[ "$next_diff_backup_base_lsn" == "" ]]; then - logWarn "Taking a full backup instead of a $backup_type backup because for $db the base LSN for the next diff backup couldn't be determined" + log_warn "Taking a full backup instead of a $backup_type backup because for $db the base LSN for the next diff backup couldn't be determined" backup_type="full" break fi # The base of the diff backup we're about to take must exactly match the checkpoint LSN of the full backup file we have if [[ "$next_diff_backup_base_lsn" -ne "$full_backup_file_checkpoint_lsn" ]]; then - logWarn "Taking a full backup instead of a $backup_type backup because for $db the diff would have base LSN $next_diff_backup_base_lsn yet our full backup has checkpoint LSN $full_backup_file_checkpoint_lsn" + log_warn "Taking a full backup instead of a $backup_type backup because for $db the diff would have base LSN $next_diff_backup_base_lsn yet our full backup has checkpoint LSN $full_backup_file_checkpoint_lsn" backup_type="full" break fi @@ -261,21 +261,21 @@ diff expire $diff_expire, tran expire $tran_expire" # Ensure that a transaction log backup will immediately follow the previous one latest_log_backup_file=$(get_latest_backup_file "$last_mssql" "$db" "log") if [[ "$latest_log_backup_file" == "" ]]; then - logWarn "Taking a full backup instead of a $backup_type backup because for $db a previous transaction log backup wasn't found" + log_warn "Taking a full backup instead of a $backup_type backup because for $db a previous transaction log backup wasn't found" backup_type="full" break fi latest_log_backup_last_lsn=$(get_backup_last_lsn "$db" "$latest_log_backup_file") if [[ "$latest_log_backup_last_lsn" = "NULL" ]] || [[ "$latest_log_backup_last_lsn" == "" ]]; then - logWarn "Taking a full backup instead of a $backup_type backup because for $db the LSN range for $latest_log_backup_file couldn't be determined" + log_warn "Taking a full backup instead of a $backup_type backup because for $db the LSN range for $latest_log_backup_file couldn't be determined" backup_type="full" break fi next_log_backup_starting_lsn=$(get_next_log_backup_starting_lsn "$db") if [[ "$next_log_backup_starting_lsn" = "NULL" ]] || [[ "$next_log_backup_starting_lsn" == "" ]]; then - logWarn "Taking a full backup instead of a $backup_type backup because for $db the starting LSN for the next log backup couldn't be determined" + log_warn "Taking a full backup instead of a $backup_type backup because for $db the starting LSN for the next log backup couldn't be determined" backup_type="full" break fi @@ -283,7 +283,7 @@ diff expire $diff_expire, tran expire $tran_expire" # The starting LSN of the backup we're about to take must be equal to (or before) the last LSN from the last backup, # otherwise there'll be a gap and the logfiles won't be restorable if [[ "$next_log_backup_starting_lsn" -gt "$latest_log_backup_last_lsn" ]]; then - logWarn "Taking a full backup instead of a $backup_type backup because for $db a gap would exist between the last backup ending at LSN $latest_log_backup_last_lsn and next backup starting at $next_log_backup_starting_lsn" + log_warn "Taking a full backup instead of a $backup_type backup because for $db a gap would exist between the last backup ending at LSN $latest_log_backup_last_lsn and next backup starting at $next_log_backup_starting_lsn" backup_type="full" break fi diff --git a/share/github-backup-utils/ghe-backup-mysql b/share/github-backup-utils/ghe-backup-mysql index 3acd0919d..0ae9172ce 100755 --- a/share/github-backup-utils/ghe-backup-mysql +++ b/share/github-backup-utils/ghe-backup-mysql @@ -17,14 +17,14 @@ ghe_remote_version_required "$GHE_HOSTNAME" if is_external_database_target; then if [ -n "$EXTERNAL_DATABASE_BACKUP_SCRIPT" ]; then - logInfo "Backing up external MySQL database using customer-provided script..." + log_info "Backing up external MySQL database using customer-provided script..." $EXTERNAL_DATABASE_BACKUP_SCRIPT bm_end "$(basename $0)" exit 0 else if is_binary_backup_feature_on; then - logWarn "Binary backups are configured on the target environment." - logWarn "Binary backup is not supported with an external MySQL database. Backing up using logical backup strategy. Please disable binary backups with 'ghe-config mysql.backup.binary false', or provide a custom backup script using EXTERNAL_DATABASE_BACKUP_SCRIPT" + log_warn "Binary backups are configured on the target environment." + log_warn "Binary backup is not supported with an external MySQL database. Backing up using logical backup strategy. Please disable binary backups with 'ghe-config mysql.backup.binary false', or provide a custom backup script using EXTERNAL_DATABASE_BACKUP_SCRIPT" fi ghe-backup-mysql-logical diff --git a/share/github-backup-utils/ghe-backup-mysql-binary b/share/github-backup-utils/ghe-backup-mysql-binary index 936f6dfee..fa7bbb1de 100755 --- a/share/github-backup-utils/ghe-backup-mysql-binary +++ b/share/github-backup-utils/ghe-backup-mysql-binary @@ -15,10 +15,10 @@ bm_start "$(basename $0)" # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_HOSTNAME" -logVerbose "Backing up MySQL database using binary backup strategy ..." +log_verbose "Backing up MySQL database using binary backup strategy ..." echo "set -o pipefail; ghe-export-mysql" | -logVerbose "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" +log_verbose "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" echo "NO_ADDITIONAL_COMPRESSION" > "$GHE_SNAPSHOT_DIR/mysql-binary-backup-sentinel" bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-mysql-logical b/share/github-backup-utils/ghe-backup-mysql-logical index 80cac2de7..77040b8b9 100755 --- a/share/github-backup-utils/ghe-backup-mysql-logical +++ b/share/github-backup-utils/ghe-backup-mysql-logical @@ -15,7 +15,7 @@ bm_start "$(basename $0)" # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_HOSTNAME" -logVerbose "Backing up MySQL database using logical backup strategy ..." +log_verbose "Backing up MySQL database using logical backup strategy ..." echo "set -o pipefail; ghe-export-mysql | pigz" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" diff --git a/share/github-backup-utils/ghe-backup-pages b/share/github-backup-utils/ghe-backup-pages index 9c57ab4fd..fa87eb715 100755 --- a/share/github-backup-utils/ghe-backup-pages +++ b/share/github-backup-utils/ghe-backup-pages @@ -18,7 +18,7 @@ backup_dir="$GHE_SNAPSHOT_DIR/pages" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - logError "rsync not found." 1>&2 + log_error "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index 1e0724ae8..8ea975b31 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -46,7 +46,7 @@ backup_current="$GHE_DATA_DIR/current/repositories" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - logError "rsync not found." 1>&2 + log_error "rsync not found." 1>&2 exit 1 fi @@ -142,7 +142,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - logWarn "no routes found, skipping repositories backup ..." + log_warn "no routes found, skipping repositories backup ..." exit 0 fi @@ -187,7 +187,7 @@ sync_data (){ # should be transferred here. echo 1>&3 - logInfo "* Transferring auxiliary files ..." 1>&3 + log_info "* Transferring auxiliary files ..." 1>&3 rsync_repository_data $1:122 $2 -z <&3 - logInfo "* Transferring packed-refs files ..." 1>&3 + log_info "* Transferring packed-refs files ..." 1>&3 rsync_repository_data $1:122 $2 -z <&3 - logInfo "* Transferring refs and reflogs ..." 1>&3 + log_info "* Transferring refs and reflogs ..." 1>&3 rsync_repository_data $1:122 $2 -z <&3 - logInfo "* Transferring objects and packs ..." 1>&3 + log_info "* Transferring objects and packs ..." 1>&3 rsync_repository_data $1:122 $2 -H <&3 - logInfo "* Transferring special data directories from $h..." 1>&3 + log_info "* Transferring special data directories from $h..." 1>&3 rsync_repository_data $h:122 -z <&3 +log_info "* Transferring settings data ..." 1>&3 ghe-ssh "$host" -- 'ghe-export-settings' > settings.json -logInfo "* Transferring license data ..." 1>&3 +log_info "* Transferring license data ..." 1>&3 ghe-ssh "$host" -- "sudo cat '$GHE_REMOTE_LICENSE_FILE'" > enterprise.ghl # Function to backup a secret setting to a file. @@ -61,7 +61,7 @@ backup-secret() { esac done - logInfo "* Transferring $description ..." 1>&3 + log_info "* Transferring $description ..." 1>&3 ghe-ssh "$host" -- ghe-config "$setting" > "$file+" || ( if [ "$best_effort" = "false" ]; then echo "Warning: $description not set" >&2 @@ -133,24 +133,24 @@ if ghe-ssh "$host" -- ghe-config --true app.packages.enabled; then fi if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/idp.crt"; then - logInfo "* Transferring SAML keys ..." 1>&3 + log_info "* Transferring SAML keys ..." 1>&3 ghe-ssh $host -- sudo tar -C $GHE_REMOTE_DATA_USER_DIR/common/ -cf - "idp.crt saml-sp.p12" > saml-keys.tar fi if ghe-ssh "$host" -- "which ghe-export-ssl-ca-certificates 1>/dev/null"; then - logInfo "* Transferring CA certificates ..." 1>&3 + log_info "* Transferring CA certificates ..." 1>&3 ghe-ssh "$host" -- "ghe-export-ssl-ca-certificates" > ssl-ca-certificates.tar fi if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - logInfo "* Transferring cluster configuration ..." 1>&3 + log_info "* Transferring cluster configuration ..." 1>&3 if ! ghe-ssh "$host" -- "sudo cat $GHE_REMOTE_CLUSTER_CONF_FILE 2>/dev/null" > cluster.conf; then - logError "Error: Enterprise Cluster is not configured yet, backup will fail" >&2 + log_error "Error: Enterprise Cluster is not configured yet, backup will fail" >&2 exit 1 fi else if ghe-ssh "$host" -- "sudo cat $GHE_REMOTE_DATA_USER_DIR/common/uuid 2>/dev/null" > uuid; then - logInfo "* Transferring UUID ..." 1>&3 + log_info "* Transferring UUID ..." 1>&3 fi fi diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index bc95e5815..0e1d4b2bf 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -19,7 +19,7 @@ backup_dir="$GHE_SNAPSHOT_DIR/storage" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - logError "rsync not found." 1>&2 + log_error "rsync not found." 1>&2 exit 1 fi @@ -60,7 +60,7 @@ cleanup() { # Enable remote maintenance operations for hostname in $hostnames; do ghe-gc-enable $ssh_config_file_opt $hostname:$port || { - logWarn "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 + log_warn "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 } done @@ -111,7 +111,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - logWarn "no routes found, skipping storage backup ..." + log_warn "no routes found, skipping storage backup ..." exit 0 fi diff --git a/share/github-backup-utils/ghe-backup-userdata b/share/github-backup-utils/ghe-backup-userdata index f0660b363..a8d3f372c 100755 --- a/share/github-backup-utils/ghe-backup-userdata +++ b/share/github-backup-utils/ghe-backup-userdata @@ -13,7 +13,7 @@ bm_start "$(basename $0) - $1" # Verify rsync is available. if ! rsync --version 1>/dev/null 2>&1; then - logError "rsync not found." 1>&2 + log_error "rsync not found." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-cluster-find-nodes b/share/github-backup-utils/ghe-cluster-find-nodes index fe3b55689..2a1f7ef48 100755 --- a/share/github-backup-utils/ghe-cluster-find-nodes +++ b/share/github-backup-utils/ghe-cluster-find-nodes @@ -16,7 +16,7 @@ set -e # Check if the REMOTE DATA USER directory is set if [ -z $GHE_REMOTE_DATA_USER_DIR ]; then - logError "Env variable GHE_REMOTE_DATA_USER_DIR is not set. Exiting" + log_error "Env variable GHE_REMOTE_DATA_USER_DIR is not set. Exiting" exit 1 fi diff --git a/share/github-backup-utils/ghe-detect-leaked-ssh-keys b/share/github-backup-utils/ghe-detect-leaked-ssh-keys index c57202937..a71fd812e 100755 --- a/share/github-backup-utils/ghe-detect-leaked-ssh-keys +++ b/share/github-backup-utils/ghe-detect-leaked-ssh-keys @@ -86,9 +86,9 @@ for tar_file in $ssh_tars; do leaked_keys_found=true if [ "$current_dir" == "$(dirname "$tar_file")" ]; then current_bkup=true - logWarn "* Leaked key found in current backup snapshot." + log_warn "* Leaked key found in current backup snapshot." else - logWarn "* Leaked key found in backup snapshot." + log_warn "* Leaked key found in backup snapshot." fi echo "* Snapshot file: $tar_file" echo "* Key file: $key" @@ -130,9 +130,9 @@ if $leaked_keys_found; then fi else if $leaked_keys_skippedcheck; then - logInfo "* No result - check not performed since host key fingerprint was empty" + log_info "* No result - check not performed since host key fingerprint was empty" else - logInfo "* No leaked keys found" + log_info "* No leaked keys found" fi fi diff --git a/share/github-backup-utils/ghe-gc-disable b/share/github-backup-utils/ghe-gc-disable index 4eaff194c..1e5a63bc5 100755 --- a/share/github-backup-utils/ghe-gc-disable +++ b/share/github-backup-utils/ghe-gc-disable @@ -50,7 +50,7 @@ echo " " | ghe-ssh $opts "$host" -- /bin/bash || { res=$? if [ $res = 7 ]; then - logError "Error: Git GC processes remain after $GHE_GIT_COOLDOWN_PERIOD seconds. Aborting..." 1>&2 + log_error "Error: Git GC processes remain after $GHE_GIT_COOLDOWN_PERIOD seconds. Aborting..." 1>&2 fi exit $res } diff --git a/share/github-backup-utils/ghe-prune-snapshots b/share/github-backup-utils/ghe-prune-snapshots index b4c4b8a2b..3a73dfccc 100755 --- a/share/github-backup-utils/ghe-prune-snapshots +++ b/share/github-backup-utils/ghe-prune-snapshots @@ -25,7 +25,7 @@ prune_dirs="$(ls -1 "$GHE_DATA_DIR"/[0-9]*/incomplete 2>/dev/null || true)" prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) if [ $prune_num -gt 0 ]; then - logInfo Pruning $prune_num "failed snapshot(s) ..." + log_info Pruning $prune_num "failed snapshot(s) ..." echo "$prune_dirs" | sed 's@/incomplete$@@' | prune_snapshot fi @@ -35,6 +35,6 @@ snapshot_count=$(ls -1d "$GHE_DATA_DIR"/[0-9]* 2>/dev/null | wc -l) if [ "$snapshot_count" -gt "$GHE_NUM_SNAPSHOTS" ]; then prune_dirs="$(ls -1d "$GHE_DATA_DIR"/[0-9]* | sort -r | awk "NR>$GHE_NUM_SNAPSHOTS")" prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) - logInfo Pruning $prune_num "expired snapshot(s) ..." + log_info Pruning $prune_num "expired snapshot(s) ..." echo "$prune_dirs" | prune_snapshot fi diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index d469ca24f..0bfa15ce3 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -30,7 +30,7 @@ host=$(ssh_host_part "$GHE_HOSTNAME") # No need to restore anything, early exit if [ ! -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then - logWarn "Warning: Actions backup missing. Skipping ..." + log_warn "Warning: Actions backup missing. Skipping ..." exit 0 fi @@ -96,7 +96,7 @@ ghe-ssh -p "$port" "$host" -- ghe-actions-console -s actions -c "Repair-Database if [ ! -z "$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache_Configuration*.bak')" ]; then ghe-ssh -p "$port" "$host" -- ghe-actions-console -s artifactcache -c "Repair-DatabaseLogins" else - logInfo "ArtifactCache is not present in mssql backup. Skipping Repair-DatabaseLogins for it." + log_info "ArtifactCache is not present in mssql backup. Skipping Repair-DatabaseLogins for it." fi bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-external-database-compatibility-check b/share/github-backup-utils/ghe-restore-external-database-compatibility-check index d538779db..364236a2a 100755 --- a/share/github-backup-utils/ghe-restore-external-database-compatibility-check +++ b/share/github-backup-utils/ghe-restore-external-database-compatibility-check @@ -16,13 +16,13 @@ if is_instance_configured; then # Restoring settings in this scenario would change BYODB state, which is not supported via backup-utils. if $RESTORE_SETTINGS; then - logError "Restoring the settings of a snapshot from an appliance using the bundled MySQL service to an appliance using an externally-managed MySQL service is not supported. Please reconfigure the appliance first, then run ghe-restore again." + log_error "Restoring the settings of a snapshot from an appliance using the bundled MySQL service to an appliance using an externally-managed MySQL service is not supported. Please reconfigure the appliance first, then run ghe-restore again." exit 1 fi # Restoring interal DB snapshot to BYODB appliance without passing in --skip-mysql is not supported. if ! $SKIP_MYSQL; then - logError "Restoring a snapshot from an appliance using the bundled MySQL service to an appliance using an externally-managed MySQL service is not supported. Please migrate the MySQL data beforehand, then run ghe-restore again, passing in the --skip-mysql flag." + log_error "Restoring a snapshot from an appliance using the bundled MySQL service to an appliance using an externally-managed MySQL service is not supported. Please migrate the MySQL data beforehand, then run ghe-restore again, passing in the --skip-mysql flag." exit 1 fi fi @@ -31,7 +31,7 @@ if is_instance_configured; then # Restoring settings in this scenario would change BYODB state, which is not supported via backup-utils. if $RESTORE_SETTINGS; then - logError "Restoring the settings of a snapshot from an appliance using an externally-managed MySQL service to an appliance using the bundled MySQL service is not supported. Please reconfigure the appliance first, then run ghe-restore again." + log_error "Restoring the settings of a snapshot from an appliance using an externally-managed MySQL service to an appliance using the bundled MySQL service is not supported. Please reconfigure the appliance first, then run ghe-restore again." exit 1 fi diff --git a/share/github-backup-utils/ghe-restore-minio b/share/github-backup-utils/ghe-restore-minio index 5059b644d..7c876294b 100755 --- a/share/github-backup-utils/ghe-restore-minio +++ b/share/github-backup-utils/ghe-restore-minio @@ -30,7 +30,7 @@ host="$(ssh_host_part "${GHE_HOSTNAME}")" # No need to restore anything, early exit if [ ! -d "${GHE_RESTORE_SNAPSHOT_PATH}/minio" ]; then - logWarn "Warning: minio backup missing. Skipping ..." + log_warn "Warning: minio backup missing. Skipping ..." exit 0 fi diff --git a/share/github-backup-utils/ghe-restore-mysql b/share/github-backup-utils/ghe-restore-mysql index ca17ec3b9..b5ad5ae85 100755 --- a/share/github-backup-utils/ghe-restore-mysql +++ b/share/github-backup-utils/ghe-restore-mysql @@ -44,18 +44,18 @@ if is_external_database_snapshot; then exit 0 else if is_binary_backup "$GHE_RESTORE_SNAPSHOT_PATH"; then - logError "Error: Restore of a binary backup to appliance with an external database configured is not supported. \nPlease provide a custom external database restore script with EXTERNAL_DATABASE_RESTORE_SCRIPT" + log_error "Error: Restore of a binary backup to appliance with an external database configured is not supported. \nPlease provide a custom external database restore script with EXTERNAL_DATABASE_RESTORE_SCRIPT" exit 1 fi if ! is_default_external_database_snapshot; then - logError "Error: Backup was not taken with a GitHub provided backup strategy. \nYou must provide a custom restore script for this backup using EXTERNAL_DATABASE_BACKUP_SCRIPT" + log_error "Error: Backup was not taken with a GitHub provided backup strategy. \nYou must provide a custom restore script for this backup using EXTERNAL_DATABASE_BACKUP_SCRIPT" exit 1 fi if is_binary_backup_feature_on; then - logWarn "Warning: Binary backups are configured on the target environment. \nBinary backup is not supported with an external MySQL database. \n\nPlease disable binary backups with 'ghe-config mysql.backup.binary false'" + log_warn "Warning: Binary backups are configured on the target environment. \nBinary backup is not supported with an external MySQL database. \n\nPlease disable binary backups with 'ghe-config mysql.backup.binary false'" fi fi fi @@ -70,7 +70,7 @@ if is_binary_backup_feature_on; then else # We do not allow to restore binary backup without "mysql.backup.binary" set if is_binary_backup "$GHE_RESTORE_SNAPSHOT_PATH"; then - logError "To restore from a binary backup, you have to set ghe-config \"mysql.backup.binary\" to true" >&2 + log_error "To restore from a binary backup, you have to set ghe-config \"mysql.backup.binary\" to true" >&2 exit 2 else if is_default_external_database_snapshot; then diff --git a/share/github-backup-utils/ghe-restore-mysql-binary b/share/github-backup-utils/ghe-restore-mysql-binary index 31b2e434b..2a4374c88 100755 --- a/share/github-backup-utils/ghe-restore-mysql-binary +++ b/share/github-backup-utils/ghe-restore-mysql-binary @@ -66,7 +66,7 @@ ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo mkdir -p '$GHE_REMOTE_ # Transfer MySQL data from the snapshot to the GitHub instance. cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" -logInfo "Restore MySQL database ..." +log_info "Restore MySQL database ..." # Import the database echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 diff --git a/share/github-backup-utils/ghe-restore-mysql-legacy b/share/github-backup-utils/ghe-restore-mysql-legacy index 25d5e37e2..3d4c19840 100755 --- a/share/github-backup-utils/ghe-restore-mysql-legacy +++ b/share/github-backup-utils/ghe-restore-mysql-legacy @@ -48,7 +48,7 @@ ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo mkdir -p '$GHE_REMOTE_ # Transfer MySQL data from the snapshot to the GitHub instance. cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" -logInfo "Restore MySQL database ..." +log_info "Restore MySQL database ..." # Import the database echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 diff --git a/share/github-backup-utils/ghe-restore-mysql-logical b/share/github-backup-utils/ghe-restore-mysql-logical index e6758a90a..f56742d94 100755 --- a/share/github-backup-utils/ghe-restore-mysql-logical +++ b/share/github-backup-utils/ghe-restore-mysql-logical @@ -45,7 +45,7 @@ ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo mkdir -p '$GHE_REMOTE_ # Transfer MySQL data from the snapshot to the GitHub instance. cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" -logInfo "Restore MySQL database ..." +log_info "Restore MySQL database ..." # Import the database echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 diff --git a/share/github-backup-utils/ghe-restore-pages b/share/github-backup-utils/ghe-restore-pages index 748dc66a5..29495d19c 100755 --- a/share/github-backup-utils/ghe-restore-pages +++ b/share/github-backup-utils/ghe-restore-pages @@ -27,7 +27,7 @@ pages_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find pages -mindepth 5 # No need to restore anything, early exit if [ -z "$pages_paths" ]; then - logWarn "Warning: Pages backup missing. Skipping ..." + log_warn "Warning: Pages backup missing. Skipping ..." exit 0 fi @@ -123,7 +123,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - logWarn "Warning: no routes found, skipping pages restore ..." + log_warn "Warning: no routes found, skipping pages restore ..." exit 0 fi diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index 4ac4d55a1..855e1d846 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -28,7 +28,7 @@ GHE_HOSTNAME="$1" network_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find repositories -mindepth 6 -maxdepth 7 -name \*.git -exec dirname {} \; | uniq | grep nw | cut -d / -f2-) if [ -z "$network_paths" ]; then - logWarn "Warning: Repositories backup missing. Skipping ..." + log_warn "Warning: Repositories backup missing. Skipping ..." exit 0 fi @@ -140,7 +140,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - logWarn "Warning: no routes found, skipping repositories restore ..." + log_warn "Warning: no routes found, skipping repositories restore ..." exit 0 fi @@ -157,7 +157,7 @@ for file_list in $tempdir/git-server-*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - logInfo \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 + log_info \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 fi ghe-rsync -avrR --delete \ @@ -216,7 +216,7 @@ bm_end "$(basename $0) - Updating repository info data" restore_warnings="$(ghe-ssh "$GHE_HOSTNAME" -- cat "$remote_warnings" 2>/dev/null || true)" if [ -n "$restore_warnings" ]; then - logWarn "Warning: One or more repository networks failed to restore successfully. Please contact GitHub Enterprise Support for assistance." + log_warn "Warning: One or more repository networks failed to restore successfully. Please contact GitHub Enterprise Support for assistance." echo "$restore_warnings" fi diff --git a/share/github-backup-utils/ghe-restore-repositories-gist b/share/github-backup-utils/ghe-restore-repositories-gist index 360910151..addb18514 100755 --- a/share/github-backup-utils/ghe-restore-repositories-gist +++ b/share/github-backup-utils/ghe-restore-repositories-gist @@ -27,7 +27,7 @@ gist_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find repositories -mind # No need to restore anything, early exit if [ -z "$gist_paths" ]; then - logWarn "Warning: Gist backup missing. Skipping ..." + log_warn "Warning: Gist backup missing. Skipping ..." exit 0 fi @@ -126,7 +126,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - logWarn "Warning: no routes found, skipping gists restore ..." + log_warn "Warning: no routes found, skipping gists restore ..." exit 0 fi @@ -162,7 +162,7 @@ fi restore_warnings="$(ghe-ssh "$GHE_HOSTNAME" -- cat "$remote_warnings" 2>/dev/null || true)" if [ -n "$restore_warnings" ]; then - logWarn "Warning: One or more Gists failed to restore successfully. Please contact GitHub Enterprise Support for assistance." + log_warn "Warning: One or more Gists failed to restore successfully. Please contact GitHub Enterprise Support for assistance." echo "$restore_warnings" fi diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index 9d8042f01..12189f5cf 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -25,15 +25,15 @@ ghe_remote_version_required "$GHE_HOSTNAME" # Path to snapshot dir we're restoring from GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" -logInfo "Restoring license ..." +log_info "Restoring license ..." ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-license' < "$GHE_RESTORE_SNAPSHOT_PATH/enterprise.ghl" 1>&3 -logInfo "Restoring settings and applying configuration ..." +log_info "Restoring settings and applying configuration ..." # Restore external MySQL password if running external MySQL DB. restore-secret "external MySQL password" "external-mysql-password" "secrets.external.mysql" -logInfo "Restoring packages settings ..." +log_info "Restoring packages settings ..." ghe-restore-packages "$GHE_HOSTNAME" 1>&3 # work around issue importing settings with bad storage mode values @@ -55,14 +55,14 @@ restore-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac- # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then - logInfo "Restoring SAML keys ..." + log_info "Restoring SAML keys ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" | ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -C $GHE_REMOTE_DATA_USER_DIR/common/ -xf -" fi # Restore CA certificates if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/ssl-ca-certificates.tar" ]; then - logInfo "Restoring CA certificates ..." + log_info "Restoring CA certificates ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/ssl-ca-certificates.tar" | ghe-ssh "$GHE_HOSTNAME" -- "ghe-import-ssl-ca-certificates" fi diff --git a/share/github-backup-utils/ghe-restore-snapshot-path b/share/github-backup-utils/ghe-restore-snapshot-path index 6b34c3940..514d07fb7 100755 --- a/share/github-backup-utils/ghe-restore-snapshot-path +++ b/share/github-backup-utils/ghe-restore-snapshot-path @@ -25,7 +25,7 @@ fi # Bail out if we don't have a good snapshot. if [ -z "$GHE_RESTORE_SNAPSHOT" ] || [ ! -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" ]; then : "${GHE_RESTORE_SNAPSHOT:=current}" - logError "Error: Snapshot '$GHE_RESTORE_SNAPSHOT' doesn't exist." 1>&2 + log_error "Error: Snapshot '$GHE_RESTORE_SNAPSHOT' doesn't exist." 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index 0b8f28061..7883adbd8 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -31,7 +31,7 @@ storage_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find storage -mindept # No need to restore anything, early exit if [ -z "$storage_paths" ]; then - logWarn "Warning: Storage backup missing. Skipping ..." + log_warn "Warning: Storage backup missing. Skipping ..." exit 0 fi @@ -118,7 +118,7 @@ ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - logWarn "Warning: no routes found, skipping storage restore ..." + log_warn "Warning: no routes found, skipping storage restore ..." exit 0 fi @@ -136,7 +136,7 @@ for file_list in $tempdir/*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - logInfo \"* Transferring data to $server ...\" 1>&3 + log_info \"* Transferring data to $server ...\" 1>&3 fi ghe-rsync -arvHR --delete \ diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index 48caff08a..22eabf702 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -11,7 +11,7 @@ set -o pipefail # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" -logRsync "BEGIN: rsync $@ $GHE_EXTRA_RSYNC_OPTS" 1>&3 +log_rsync "BEGIN: rsync $@ $GHE_EXTRA_RSYNC_OPTS" 1>&3 # Check for --ignore-missing-args parameter support and remove if unavailable. if rsync -h | grep '\-\-ignore-missing-args' >/dev/null 2>&1; then parameters=("$@") @@ -42,5 +42,5 @@ if [ $res = 23 ] && [ -n "$ignore23" ]; then res=0 fi -logRsync "END: rsync $@ $GHE_EXTRA_RSYNC_OPTS | exit code $res" 1>&3 +log_rsync "END: rsync $@ $GHE_EXTRA_RSYNC_OPTS | exit code $res" 1>&3 exit $res diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index dfcffb5d4..f540ec3da 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -78,7 +78,7 @@ if [ -z "$GHE_DISABLE_SSH_MUX" ]; then fi fi -logSSH " $host : \"$@\"" 1>&3 +log_ssh " $host : \"$@\"" 1>&3 # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x From 1fec466bfad3538d932a2eb50178de59f2244dd0 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 23 Feb 2023 16:46:18 -0500 Subject: [PATCH 148/946] Modify ssh logging Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-restore-mysql | 4 ++-- share/github-backup-utils/ghe-ssh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-mysql b/share/github-backup-utils/ghe-restore-mysql index b5ad5ae85..8e75ea0f1 100755 --- a/share/github-backup-utils/ghe-restore-mysql +++ b/share/github-backup-utils/ghe-restore-mysql @@ -44,12 +44,12 @@ if is_external_database_snapshot; then exit 0 else if is_binary_backup "$GHE_RESTORE_SNAPSHOT_PATH"; then - log_error "Error: Restore of a binary backup to appliance with an external database configured is not supported. \nPlease provide a custom external database restore script with EXTERNAL_DATABASE_RESTORE_SCRIPT" + log_error "Error: Restore of a binary backup to appliance with an external database configured is not supported. Please provide a custom external database restore script with EXTERNAL_DATABASE_RESTORE_SCRIPT" exit 1 fi if ! is_default_external_database_snapshot; then - log_error "Error: Backup was not taken with a GitHub provided backup strategy. \nYou must provide a custom restore script for this backup using EXTERNAL_DATABASE_BACKUP_SCRIPT" + log_error "Error: Backup was not taken with a GitHub provided backup strategy. You must provide a custom restore script for this backup using EXTERNAL_DATABASE_BACKUP_SCRIPT" exit 1 fi diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index f540ec3da..f85a59cee 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -78,7 +78,7 @@ if [ -z "$GHE_DISABLE_SSH_MUX" ]; then fi fi -log_ssh " $host : \"$@\"" 1>&3 +log_ssh " $host : $*" 1>&3 # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x From cf6f3b1e1dee77a3103be4bc7224c8267e71410c Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 23 Feb 2023 17:47:31 -0500 Subject: [PATCH 149/946] remove ssh logging Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index f85a59cee..2cae66755 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -78,7 +78,7 @@ if [ -z "$GHE_DISABLE_SSH_MUX" ]; then fi fi -log_ssh " $host : $*" 1>&3 +#log_ssh " $host : $*" 1>&3 # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x From 26af711d05f76f1e7fbd94f0fd32667cafa1fa8b Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 23 Feb 2023 17:54:40 -0500 Subject: [PATCH 150/946] Fixing mysql-backup Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-backup-mysql-binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-mysql-binary b/share/github-backup-utils/ghe-backup-mysql-binary index fa7bbb1de..70091cbba 100755 --- a/share/github-backup-utils/ghe-backup-mysql-binary +++ b/share/github-backup-utils/ghe-backup-mysql-binary @@ -18,7 +18,7 @@ ghe_remote_version_required "$GHE_HOSTNAME" log_verbose "Backing up MySQL database using binary backup strategy ..." echo "set -o pipefail; ghe-export-mysql" | -log_verbose "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" +ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" echo "NO_ADDITIONAL_COMPRESSION" > "$GHE_SNAPSHOT_DIR/mysql-binary-backup-sentinel" bm_end "$(basename $0)" From ba5e887ba0289903bde32a2829f0ed718c41ecf0 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 23 Feb 2023 17:56:15 -0500 Subject: [PATCH 151/946] More tweaks to ssh loggng Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 2cae66755..f85a59cee 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -78,7 +78,7 @@ if [ -z "$GHE_DISABLE_SSH_MUX" ]; then fi fi -#log_ssh " $host : $*" 1>&3 +log_ssh " $host : $*" 1>&3 # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x From 164c2e19fabfbd03e34c7b724ef53f47e6ba3c34 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 23 Feb 2023 18:46:09 -0500 Subject: [PATCH 152/946] add output_color switch Multi-line description of commit, feel free to be detailed. --- backup.config-example | 5 +++++ share/github-backup-utils/bm.sh | 2 ++ share/github-backup-utils/ghe-backup-config | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backup.config-example b/backup.config-example index 8c98655ab..1e6d762f2 100644 --- a/backup.config-example +++ b/backup.config-example @@ -42,6 +42,11 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_EXTRA_RSYNC_OPTS="" + +# If set to 'yes', logging output will be colorized. +# +#OUTPUT_COLOR=no + # If set to 'no', GHE_DATA_DIR will not be created automatically # and restore/backup will exit 8 # diff --git a/share/github-backup-utils/bm.sh b/share/github-backup-utils/bm.sh index c512f3d44..8420d3076 100755 --- a/share/github-backup-utils/bm.sh +++ b/share/github-backup-utils/bm.sh @@ -52,6 +52,8 @@ bm_end() { total=$(($tend - $tstart)) echo "$1 took ${total}s" >> $BM_FILE_PATH + # also log timing information in the verbose log + log_verbose "$1 took ${total}s" 1>&3 if [ -n "$GHE_DEBUG" ]; then echo "Debug: $1 took ${total}s (bm_end)" fi diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index c9c42ded7..2124d2e05 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -580,7 +580,7 @@ log_level() { timestamp=$(date -u "+%FT%TZ") - if [ "$TERM" = "dumb" ]; then + if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then if [ "$level" = "info" ]; then display="INFO" elif [ "$level" = "warn" ]; then @@ -596,7 +596,7 @@ log_level() { else display="-" fi - else + else if [ "$level" = "info" ]; then display="${GREEN}INFO${NC}" elif [ "$level" = "warn" ]; then From 161a25317d2da8dae57635a6e0ea7bf8e62b8984 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Feb 2023 14:23:55 -0500 Subject: [PATCH 153/946] Create backuprestore.yml --- .github/workflows/backuprestore.yml | 88 +++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/backuprestore.yml diff --git a/.github/workflows/backuprestore.yml b/.github/workflows/backuprestore.yml new file mode 100644 index 000000000..211f3142a --- /dev/null +++ b/.github/workflows/backuprestore.yml @@ -0,0 +1,88 @@ +name: Backup and Restore +run-name: ${{ github.actor }} running backup and restore operation +on: + workflow_dispatch: + inputs: + hostname: + description: 'Hostname' + required: true + type: string + ref: + description: 'Ref' + required: true + type: string + default: 'master' + workflow_call: + inputs: + hostname: + description: 'Hostname' + required: true + type: string + ref: + description: 'Ref' + required: true + type: string + default: 'master' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: github/backup-utils-private + ref: ${{ inputs.ref }} + token: ${{ secrets.BACKUPUTILACCESS }} + - run: docker build . --file Dockerfile --tag backup-utils + - run: docker save backup-utils -o backup-utils.tar + - uses: actions/upload-artifact@v3 + with: + name: backup-utils + path: backup-utils.tar + backup-utils-backup-and-restore: + needs: build + runs-on: ubuntu-latest + env: + SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} + steps: + - uses: actions/download-artifact@v3 + with: + name: backup-utils + - name: Load docker container + run: docker load -i backup-utils.tar + - uses: actions/checkout@v3 + - name: Create backup directory + run: mkdir $HOME/ghe-backup-data + - name: set up ssh SSH_KEY + run: echo -e "${SSH_KEY}\n" > $HOME/backup + - name: set up ssh key permissions + run: chmod 0600 $HOME/backup + - name: change version + run: echo "3.8.0" > $HOME/version + - name: Perform backup + run: | + docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ + -e "GHE_DATA_DIR=/data" \ + -e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \ + -e "GHE_NUM_SNAPSHOTS=15" \ + -v "$HOME/ghe-backup-data:/data" \ + -v "$HOME/backup:/ghe-ssh/id_rsa" \ + -v "$HOME/version:/backup-utils/share/github-backup-utils/version" \ + --rm \ + backup-utils ghe-backup + - name: Prepare for restore + run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" + - name: Restore data to instance + run: | + docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ + -e "GHE_DATA_DIR=/data" \ + -e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \ + -e "GHE_NUM_SNAPSHOTS=15" \ + -v "$HOME/ghe-backup-data:/data" \ + -v "$HOME/backup:/ghe-ssh/id_rsa" \ + -v "$HOME/version:/backup-utils/share/github-backup-utils/version" \ + --rm \ + backup-utils ghe-restore ${{ inputs.hostname }} + - name: Reset maintenance mode after restore + run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" + From b6b8522582f451284394b5ce51ffd777b405ac4d Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Feb 2023 16:47:05 -0500 Subject: [PATCH 154/946] Update backuprestore.yml --- .github/workflows/backuprestore.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/backuprestore.yml b/.github/workflows/backuprestore.yml index 211f3142a..6501f3888 100644 --- a/.github/workflows/backuprestore.yml +++ b/.github/workflows/backuprestore.yml @@ -32,7 +32,6 @@ jobs: with: repository: github/backup-utils-private ref: ${{ inputs.ref }} - token: ${{ secrets.BACKUPUTILACCESS }} - run: docker build . --file Dockerfile --tag backup-utils - run: docker save backup-utils -o backup-utils.tar - uses: actions/upload-artifact@v3 From 7d117eda9fae91d31b39672d44e061f9395f554a Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Mon, 27 Feb 2023 17:11:27 +0000 Subject: [PATCH 155/946] Updated hostcheck to use rsync --- bin/ghe-host-check | 32 +++++++---- share/github-backup-utils/ghe-rsync-size.sh | 63 +++++++++++++++++++++ 2 files changed, 85 insertions(+), 10 deletions(-) create mode 100755 share/github-backup-utils/ghe-rsync-size.sh diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 1f7b0cb78..964dac41a 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -151,11 +151,14 @@ min_jq="" # shellcheck source=share/github-backup-utils/requirements.txt . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt" +#source disk size file +. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size.sh" + #Display dir requirements for repositories and mysql -backup_dir=${GHE_DATA_DIR} -available_space=$(df $backup_dir | awk 'END{print $4}') +available_space=$(df $GHE_DATA_DIR | awk 'END{print $4}') +echo "Available space: $available_space" 1>&2 + repo_disk_size=$(ghe-ssh "$host" sudo du -sh /data/user/repositories | awk '{print $1}') -#mysql_disk_size=$(ghe-ssh "$host" sudo du -sh /data/user/mysql | awk '{print $1}') # Convert the data size to kilobytes case "$repo_disk_size" in *T) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/T/000000000/') )) ;; @@ -163,30 +166,39 @@ case "$repo_disk_size" in *M) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/M/000/') )) ;; *K) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/K//') )) ;; esac +repos_disk_size=$(transfer_size repositories /tmp) +pages_disk_size=$(transfer_size pages /tmp) +es_disk_size=$(transfer_size elasticsearch /tmp) +stor_disk_size=$(transfer_size storage /tmp) +minio_disk_size=$(transfer_size minio /tmp) +min_disk_req=$(( $(echo "$repos_disk_size" | awk '{print $1}') + $(echo "$pages_disk_size" | awk '{print $1}') + $(echo "$es_disk_size" | awk '{print $1}') + $(echo "$stor_disk_size" | awk '{print $1}') + $(echo "$minio_disk_size" | awk '{print $1}') )) +echo "repositories = $repos_disk_size, pages: $pages_disk_size, elasticsearch: $es_disk_size, storage: $stor_disk_size, minio: $minio_disk_size" 1>&2 +echo "min_disk_required for backup = $min_disk_req bytes" 1>&2 + if [[ $available_space -lt $repo_disk_size ]]; then - echo "There is not enough disk space for the backup" + echo "There is not enough disk space for the backup" 1>&2 exit 1 fi #Check rsync, openssh & jq versions rsync_version=$(rsync --version | grep 'version' | awk '{print $3}') if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then - echo "rsync version $rsync_version in backup-host does not meet minimum requirements." - echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" + echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 + echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 fi ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then - echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." - echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" + echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2 + echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 exit 1 fi jq_version=$(jq --version |awk -F\- '{print $2}') if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then - echo "jq version $jq_version in backup-host does not meet minimum requirements." - echo "Please make sure you have the minimum required version of jq: $min_jq installed" + echo "jq version $jq_version in backup-host does not meet minimum requirements." 1>&2 + echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 exit 1 fi diff --git a/share/github-backup-utils/ghe-rsync-size.sh b/share/github-backup-utils/ghe-rsync-size.sh new file mode 100755 index 000000000..00f210473 --- /dev/null +++ b/share/github-backup-utils/ghe-rsync-size.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# get-rsync-size.sh Get the total size of dir-files to be transfered using rsync --link-dest +# +# Example: +# transfer_size repositories /dest_dir +# +# Sample output: +# Total transferred file size: 80 bytes + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$(dirname "${BASH_SOURCE[0]}")/ghe-backup-config" + +# Location of last good backup for rsync --link-dest +backup_current="$GHE_DATA_DIR/current/" + +# If we have a previous increment, avoid using those unchanged files using --link-dest support. +if [ -d "$backup_current" ]; then + link_dest="--link-dest=${GHE_DATA_DIR}/current" +fi + +transfer_size() +{ + local backup_data=$1 + local dir=/data/user/$1/ + local dest_dir=$2/ + + # Define user for rsync-path + case "$backup_data" in + "repositories" | "pages") + user="git" + ;; + "storage") + user="alambic" + ;; + "elasticsearch") + user="elasticsearch" + ;; + "mysql") + user="mysql" + ;; + "mssql") + user="mssql" + ;; + "minio") + user="minio" + ;; + *) + echo "Unknown user: $backup_data" + exit 1 + ;; + esac + +# local total_file_size=$(ghe-ssh "$GHE_HOSTNAME" sudo rsync -arvn $link_dest/$1 --stats "$dir" "$dest_dir" | grep "Total transferred file size" | sed 's/.*size: //; s/,//') + local total_file_size=$(ghe-rsync -arn --stats \ + -e "ssh -q $GHE_EXTRA_SSH_OPTS -p 122 -l admin" \ + --rsync-path="sudo -u $user rsync" \ + $link_dest/$1 \ + --ignore-missing-args \ + "$GHE_HOSTNAME:$GHE_REMOTE_DATA_USER_DIR/user/$1/" \ + "$dest_dir" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') + echo "$total_file_size" +} From 29b0b62c10fb0045f9d6b83f6aeb8eb4ebd223f0 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 27 Feb 2023 13:15:04 -0500 Subject: [PATCH 156/946] Update backuprestore.yml --- .github/workflows/backuprestore.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backuprestore.yml b/.github/workflows/backuprestore.yml index 6501f3888..13bbf40e0 100644 --- a/.github/workflows/backuprestore.yml +++ b/.github/workflows/backuprestore.yml @@ -9,7 +9,7 @@ on: type: string ref: description: 'Ref' - required: true + required: false type: string default: 'master' workflow_call: @@ -20,7 +20,7 @@ on: type: string ref: description: 'Ref' - required: true + required: false type: string default: 'master' From 5ef9e734416a19ca92cb302262ccc7980075c465 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Mon, 27 Feb 2023 18:56:21 +0000 Subject: [PATCH 157/946] add shellcheck --- bin/ghe-host-check | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 964dac41a..8a2a2b786 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -152,6 +152,7 @@ min_jq="" . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt" #source disk size file +# shellcheck source=share/github-backup-utils/ghe-rsync-size.sh . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size.sh" #Display dir requirements for repositories and mysql From 70a0744cc140afab10fac7d7a0de46b2d46c14c7 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Mon, 27 Feb 2023 19:53:32 +0000 Subject: [PATCH 158/946] shellcheck updates --- share/github-backup-utils/ghe-rsync-size.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync-size.sh b/share/github-backup-utils/ghe-rsync-size.sh index 00f210473..03dac03cd 100755 --- a/share/github-backup-utils/ghe-rsync-size.sh +++ b/share/github-backup-utils/ghe-rsync-size.sh @@ -22,7 +22,7 @@ fi transfer_size() { local backup_data=$1 - local dir=/data/user/$1/ + local data_user_dir=/data/user/$1/ local dest_dir=$2/ # Define user for rsync-path @@ -51,13 +51,12 @@ transfer_size() ;; esac -# local total_file_size=$(ghe-ssh "$GHE_HOSTNAME" sudo rsync -arvn $link_dest/$1 --stats "$dir" "$dest_dir" | grep "Total transferred file size" | sed 's/.*size: //; s/,//') - local total_file_size=$(ghe-rsync -arn --stats \ + total_file_size=$(ghe-rsync -arn --stats \ -e "ssh -q $GHE_EXTRA_SSH_OPTS -p 122 -l admin" \ --rsync-path="sudo -u $user rsync" \ $link_dest/$1 \ --ignore-missing-args \ - "$GHE_HOSTNAME:$GHE_REMOTE_DATA_USER_DIR/user/$1/" \ + "$GHE_HOSTNAME:$data_user_dir/" \ "$dest_dir" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') echo "$total_file_size" } From 8e07d30f721a96c738ba3e1fb3f5907687efd25f Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 28 Feb 2023 18:34:27 +0000 Subject: [PATCH 159/946] Tune size values --- bin/ghe-host-check | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 8a2a2b786..3b2442e4a 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -156,28 +156,22 @@ min_jq="" . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size.sh" #Display dir requirements for repositories and mysql -available_space=$(df $GHE_DATA_DIR | awk 'END{print $4}') +available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') echo "Available space: $available_space" 1>&2 -repo_disk_size=$(ghe-ssh "$host" sudo du -sh /data/user/repositories | awk '{print $1}') -# Convert the data size to kilobytes -case "$repo_disk_size" in - *T) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/T/000000000/') )) ;; - *G) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/G/000000/') )) ;; - *M) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/M/000/') )) ;; - *K) repo_disk_size=$(( $(echo "$repo_disk_size" | sed 's/K//') )) ;; -esac repos_disk_size=$(transfer_size repositories /tmp) pages_disk_size=$(transfer_size pages /tmp) es_disk_size=$(transfer_size elasticsearch /tmp) stor_disk_size=$(transfer_size storage /tmp) minio_disk_size=$(transfer_size minio /tmp) -min_disk_req=$(( $(echo "$repos_disk_size" | awk '{print $1}') + $(echo "$pages_disk_size" | awk '{print $1}') + $(echo "$es_disk_size" | awk '{print $1}') + $(echo "$stor_disk_size" | awk '{print $1}') + $(echo "$minio_disk_size" | awk '{print $1}') )) -echo "repositories = $repos_disk_size, pages: $pages_disk_size, elasticsearch: $es_disk_size, storage: $stor_disk_size, minio: $minio_disk_size" 1>&2 +mysql_disk_size=$(transfer_size mysql /tmp) + +min_disk_req=$(( $(echo "$repos_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$pages_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$es_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$stor_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$minio_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mysql_disk_size" | awk '{printf "%.0f", $1/2}') )) +echo "repositories = $repos_disk_size, pages: $pages_disk_size, elasticsearch: $es_disk_size, storage: $stor_disk_size, minio: $minio_disk_size, mysql: $mysql_disk_size" 1>&2 echo "min_disk_required for backup = $min_disk_req bytes" 1>&2 -if [[ $available_space -lt $repo_disk_size ]]; then - echo "There is not enough disk space for the backup" 1>&2 +if [[ $available_space -lt $min_disk_req ]]; then + echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 exit 1 fi From c946f5fe4763c67cc6cd4b209b785b2e0c6f234d Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 2 Mar 2023 23:44:25 +0000 Subject: [PATCH 160/946] Add comments --- bin/ghe-backup | 1 + bin/ghe-host-check | 103 ++++++++++---------- share/github-backup-utils/ghe-rsync-size.sh | 15 ++- 3 files changed, 66 insertions(+), 53 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index f8ac26e27..78f729467 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -37,6 +37,7 @@ while true; do esac done +export CALLING_SCRIPT="ghe-backup" # Bring in the backup configuration # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 3b2442e4a..1686c45fd 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -144,58 +144,63 @@ if [ -z "$supported" ]; then exit 1 fi -# Bring in the requirements file -min_rsync="" -min_openssh="" -min_jq="" -# shellcheck source=share/github-backup-utils/requirements.txt -. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt" - -#source disk size file -# shellcheck source=share/github-backup-utils/ghe-rsync-size.sh -. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size.sh" - -#Display dir requirements for repositories and mysql -available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') -echo "Available space: $available_space" 1>&2 - -repos_disk_size=$(transfer_size repositories /tmp) -pages_disk_size=$(transfer_size pages /tmp) -es_disk_size=$(transfer_size elasticsearch /tmp) -stor_disk_size=$(transfer_size storage /tmp) -minio_disk_size=$(transfer_size minio /tmp) -mysql_disk_size=$(transfer_size mysql /tmp) - -min_disk_req=$(( $(echo "$repos_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$pages_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$es_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$stor_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$minio_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mysql_disk_size" | awk '{printf "%.0f", $1/2}') )) -echo "repositories = $repos_disk_size, pages: $pages_disk_size, elasticsearch: $es_disk_size, storage: $stor_disk_size, minio: $minio_disk_size, mysql: $mysql_disk_size" 1>&2 -echo "min_disk_required for backup = $min_disk_req bytes" 1>&2 - -if [[ $available_space -lt $min_disk_req ]]; then - echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 - exit 1 -fi +if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then + # Bring in the requirements file + min_rsync="" + min_openssh="" + min_jq="" + # shellcheck source=share/github-backup-utils/requirements.txt + . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt" + + #source disk size file + # shellcheck source=share/github-backup-utils/ghe-rsync-size.sh + . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size.sh" + + #Display dir requirements for repositories and mysql + echo "Checking host for sufficient space for a backup..." 1>&2 + available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') + printf "Available space: %d MB. We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time.\n" "$((available_space / 1024 ** 2))" 1>&2 + + repos_disk_size=$(transfer_size repositories /tmp) + pages_disk_size=$(transfer_size pages /tmp) + es_disk_size=$(transfer_size elasticsearch /tmp) + stor_disk_size=$(transfer_size storage /tmp) + minio_disk_size=$(transfer_size minio /tmp) + mysql_disk_size=$(transfer_size mysql /tmp) + actions_disk_size=$(transfer_size actions /tmp) + mssql_disk_size=$(transfer_size mssql /tmp) + + min_disk_req=$(( $(echo "$repos_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$pages_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$es_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$stor_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$minio_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mysql_disk_size" | awk '{printf "%.0f", $1/2}') + $(echo "$actions_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mssql_disk_size" | awk '{printf "%.0f", $1}') )) + echo "Data transfer size for - repositories = $repos_disk_size, pages: $pages_disk_size, elasticsearch: $es_disk_size, storage: $stor_disk_size, minio: $minio_disk_size, mysql: $mysql_disk_size, actions: $actions_disk_size, mssql: $mssql_disk_size" 1>&2 + printf "min_disk_required for this backup is at least %d MB\n" "$((min_disk_req / 1024 ** 2))" 1>&2 + + if [[ $available_space -lt $min_disk_req ]]; then + echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 + exit 1 + fi -#Check rsync, openssh & jq versions -rsync_version=$(rsync --version | grep 'version' | awk '{print $3}') -if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then - echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 - echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 - exit 1 -fi + #Check rsync, openssh & jq versions + rsync_version=$(rsync --version | grep 'version' | awk '{print $3}') + if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then + echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 + echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 + exit 1 + fi -ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) -if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then - echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2 - echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 - exit 1 -fi + ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) + if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then + echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2 + echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 + exit 1 + fi -jq_version=$(jq --version |awk -F\- '{print $2}') -if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then - echo "jq version $jq_version in backup-host does not meet minimum requirements." 1>&2 - echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 - exit 1 + jq_version=$(jq --version |awk -F\- '{print $2}') + if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then + echo "jq version $jq_version in backup-host does not meet minimum requirements." 1>&2 + echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 + exit 1 + fi + echo "Backup host meets minimum software requirements for OpenSSH, rsync and jq." 1>&2 fi - echo "Connect $hostname:$port OK (v$version)" diff --git a/share/github-backup-utils/ghe-rsync-size.sh b/share/github-backup-utils/ghe-rsync-size.sh index 03dac03cd..2e0c2a8df 100755 --- a/share/github-backup-utils/ghe-rsync-size.sh +++ b/share/github-backup-utils/ghe-rsync-size.sh @@ -22,8 +22,12 @@ fi transfer_size() { local backup_data=$1 - local data_user_dir=/data/user/$1/ - local dest_dir=$2/ + if [[ "$1" == "mssql" ]]; then + data_user_dir="/data/user/$1/backups" + else + data_user_dir="/data/user/$1" + fi + local dest_dir=$2 # Define user for rsync-path case "$backup_data" in @@ -42,6 +46,9 @@ transfer_size() "mssql") user="mssql" ;; + "actions") + user="actions" + ;; "minio") user="minio" ;; @@ -57,6 +64,6 @@ transfer_size() $link_dest/$1 \ --ignore-missing-args \ "$GHE_HOSTNAME:$data_user_dir/" \ - "$dest_dir" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') - echo "$total_file_size" + "$dest_dir/" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') + echo "$total_file_size" } From 21d344d5b0165cc803b2cfb07c06e3e0ebd616d0 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 3 Mar 2023 12:41:20 -0500 Subject: [PATCH 161/946] Update bin/ghe-host-check Co-authored-by: Quinn Murphy --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 1686c45fd..b1fff2d53 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -171,7 +171,7 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then mssql_disk_size=$(transfer_size mssql /tmp) min_disk_req=$(( $(echo "$repos_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$pages_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$es_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$stor_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$minio_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mysql_disk_size" | awk '{printf "%.0f", $1/2}') + $(echo "$actions_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mssql_disk_size" | awk '{printf "%.0f", $1}') )) - echo "Data transfer size for - repositories = $repos_disk_size, pages: $pages_disk_size, elasticsearch: $es_disk_size, storage: $stor_disk_size, minio: $minio_disk_size, mysql: $mysql_disk_size, actions: $actions_disk_size, mssql: $mssql_disk_size" 1>&2 +echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size \npages: $pages_disk_size \nelasticsearch: $es_disk_size \nstorage: $stor_disk_size \nminio: $minio_disk_size \nmysql: $mysql_disk_size \nactions: $actions_disk_size \nmssql: $mssql_disk_size" 1>&2 printf "min_disk_required for this backup is at least %d MB\n" "$((min_disk_req / 1024 ** 2))" 1>&2 if [[ $available_space -lt $min_disk_req ]]; then From ec4f8975e58b8c18e72301d62aeb3cf83c16ddbb Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 3 Mar 2023 12:42:23 -0500 Subject: [PATCH 162/946] Update bin/ghe-host-check Co-authored-by: Quinn Murphy --- bin/ghe-host-check | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index b1fff2d53..558e8958d 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -185,7 +185,9 @@ echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size \npages: $page echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 - fi +else + echo "rsync ${rsync_version} >= required ($min_rsync)" +fi ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then From ec1da84d874b316f08798d75928a285dd8112a9f Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 3 Mar 2023 12:42:34 -0500 Subject: [PATCH 163/946] Update bin/ghe-host-check Co-authored-by: Quinn Murphy --- bin/ghe-host-check | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 558e8958d..80f952ec7 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -194,7 +194,9 @@ fi echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 exit 1 - fi +else + echo "openSSH ${ssh_version} >= required ($min_openssh)" +fi jq_version=$(jq --version |awk -F\- '{print $2}') if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then From 81d5eb84eecf87958b2cc662db7ce1cebe49c6c5 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 3 Mar 2023 12:42:48 -0500 Subject: [PATCH 164/946] Update bin/ghe-host-check Co-authored-by: Quinn Murphy --- bin/ghe-host-check | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 80f952ec7..967c1b5c0 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -203,7 +203,9 @@ fi echo "jq version $jq_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 exit 1 - fi +else + echo "jq ${jq_version} >= required ($min_jq)" +fi``` echo "Backup host meets minimum software requirements for OpenSSH, rsync and jq." 1>&2 fi From 611748211f433f1f637c3d15e93714c8318c757c Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 3 Mar 2023 12:43:23 -0500 Subject: [PATCH 165/946] Update bin/ghe-host-check Co-authored-by: Quinn Murphy --- bin/ghe-host-check | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 967c1b5c0..b8aa311e3 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -206,7 +206,6 @@ fi else echo "jq ${jq_version} >= required ($min_jq)" fi``` - echo "Backup host meets minimum software requirements for OpenSSH, rsync and jq." 1>&2 fi echo "Connect $hostname:$port OK (v$version)" From 991f3557992076f4e08f1fabf8b2e7beb8fdceb1 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 3 Mar 2023 18:31:57 +0000 Subject: [PATCH 166/946] cleaning up code --- bin/ghe-host-check | 3 ++- share/github-backup-utils/ghe-rsync-size.sh | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 1686c45fd..ed7c4513a 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -170,7 +170,8 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then actions_disk_size=$(transfer_size actions /tmp) mssql_disk_size=$(transfer_size mssql /tmp) - min_disk_req=$(( $(echo "$repos_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$pages_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$es_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$stor_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$minio_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mysql_disk_size" | awk '{printf "%.0f", $1/2}') + $(echo "$actions_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mssql_disk_size" | awk '{printf "%.0f", $1}') )) + #min_disk_req=$(( $(echo "$repos_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$pages_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$es_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$stor_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$minio_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mysql_disk_size" | awk '{printf "%.0f", $1/2}') + $(echo "$actions_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mssql_disk_size" | awk '{printf "%.0f", $1}') )) + min_disk_req=$(( $(echo "$repos_disk_size") + $(echo "$pages_disk_size") + $(echo "$es_disk_size") + $(echo "$stor_disk_size") + $(echo "$minio_disk_size") + $(echo "$mysql_disk_size") + $(echo "$actions_disk_size") + $(echo "$mssql_disk_size") )) echo "Data transfer size for - repositories = $repos_disk_size, pages: $pages_disk_size, elasticsearch: $es_disk_size, storage: $stor_disk_size, minio: $minio_disk_size, mysql: $mysql_disk_size, actions: $actions_disk_size, mssql: $mssql_disk_size" 1>&2 printf "min_disk_required for this backup is at least %d MB\n" "$((min_disk_req / 1024 ** 2))" 1>&2 diff --git a/share/github-backup-utils/ghe-rsync-size.sh b/share/github-backup-utils/ghe-rsync-size.sh index 2e0c2a8df..6f195c3f0 100755 --- a/share/github-backup-utils/ghe-rsync-size.sh +++ b/share/github-backup-utils/ghe-rsync-size.sh @@ -65,5 +65,11 @@ transfer_size() --ignore-missing-args \ "$GHE_HOSTNAME:$data_user_dir/" \ "$dest_dir/" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') - echo "$total_file_size" + + # Reduce mysql size as only the compressed file is transferred + if [[ "$1" == "mysql" ]]; then + echo "$total_file_size" | awk '{printf "%.0f\n", $1/2}' + else + echo "$total_file_size" | awk '{printf "%.0f\n", $1}' + fi } From 61f5f61ff9cb7dd9ea277277afd15b90c04be50e Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 3 Mar 2023 18:36:35 +0000 Subject: [PATCH 167/946] typo & format --- bin/ghe-host-check | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 48d748a5b..bddd55e47 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -186,27 +186,27 @@ echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size \npages: $page echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 -else - echo "rsync ${rsync_version} >= required ($min_rsync)" -fi + else + echo "rsync ${rsync_version} >= required ($min_rsync)" + fi ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 exit 1 -else - echo "openSSH ${ssh_version} >= required ($min_openssh)" -fi + else + echo "openSSH ${ssh_version} >= required ($min_openssh)" + fi jq_version=$(jq --version |awk -F\- '{print $2}') if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then echo "jq version $jq_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 exit 1 -else - echo "jq ${jq_version} >= required ($min_jq)" -fi``` + else + echo "jq ${jq_version} >= required ($min_jq)" + fi fi echo "Connect $hostname:$port OK (v$version)" From 0eebd1744f5489bd10e18a88074c027a77ca45ad Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 3 Mar 2023 18:44:25 +0000 Subject: [PATCH 168/946] redirect echo stmt --- bin/ghe-host-check | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index bddd55e47..77867c822 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -144,7 +144,7 @@ if [ -z "$supported" ]; then exit 1 fi -if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then +if [[ "$CALLING_SCRIPT" != "ghe-backup" ]]; then # Bring in the requirements file min_rsync="" min_openssh="" @@ -187,7 +187,7 @@ echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size \npages: $page echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 else - echo "rsync ${rsync_version} >= required ($min_rsync)" + echo "rsync ${rsync_version} >= required ($min_rsync)" 1>&2 fi ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) @@ -196,7 +196,7 @@ echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size \npages: $page echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 exit 1 else - echo "openSSH ${ssh_version} >= required ($min_openssh)" + echo "openSSH ${ssh_version} >= required ($min_openssh)" 1>&2 fi jq_version=$(jq --version |awk -F\- '{print $2}') @@ -205,7 +205,7 @@ echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size \npages: $page echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 exit 1 else - echo "jq ${jq_version} >= required ($min_jq)" + echo "jq ${jq_version} >= required ($min_jq)" 1>&2 fi fi From 4c5179a991f04f9a346b8d1382090b1e649ecf57 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 3 Mar 2023 18:45:31 +0000 Subject: [PATCH 169/946] fix typo --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 77867c822..4ccddf452 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -144,7 +144,7 @@ if [ -z "$supported" ]; then exit 1 fi -if [[ "$CALLING_SCRIPT" != "ghe-backup" ]]; then +if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then # Bring in the requirements file min_rsync="" min_openssh="" From 32694d3f66d08f98329ab0b21c0e52cab64b2f3f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 8 Mar 2023 15:13:59 -0500 Subject: [PATCH 170/946] change output of errors Multi-line description of commit, feel free to be detailed. --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 9d8c7149e..ecf1a045a 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -97,7 +97,7 @@ if "$CLUSTER"; then distinct_versions=$(echo "$node_version_list" | awk '{split($0, a, ":"); print a[2]}' | awk '{print $4}' | uniq | wc -l) if [ "$distinct_versions" -ne 1 ]; then echo "$node_version_list" 1>&2 - echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2 + echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&3 exit 1 fi fi From 84664f194da8bbdebe37e1c5d8c961426b0b3711 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 8 Mar 2023 16:18:30 -0500 Subject: [PATCH 171/946] Change output of logs Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-backup-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 2124d2e05..774483e25 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -613,7 +613,7 @@ log_level() { display="-" fi fi - echo -e "$timestamp | $display | $message" + echo -e "$timestamp $display $message" } log_info(){ From d1304ea1bcbb12fa79c2adae6abbbcf8ac067c20 Mon Sep 17 00:00:00 2001 From: Krayon Date: Fri, 10 Mar 2023 02:11:40 +1100 Subject: [PATCH 172/946] ghe-backup and ghe-restore shellcheck fixes --- bin/ghe-backup | 20 ++++----- bin/ghe-restore | 45 ++++++++++----------- share/github-backup-utils/ghe-backup-config | 11 +++-- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 7d9081d37..8ea06fee1 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -80,7 +80,7 @@ if ! output=$(rsync -a src/ dest1 2>&1 && rsync -av src/ --link-dest=../dest1 de exit 1 fi -if [ "$(ls -il dest1/testfile | awk '{ print $1 }')" != "$(ls -il dest2/testfile | awk '{ print $1 }')" ]; then +if [ "$(stat -c %i dest1/testfile)" != "$(stat -c %i dest2/testfile)" ]; then echo "Error: the filesystem containing $GHE_DATA_DIR does not support hard links." 1>&2 echo "Backup Utilities use hard links to store backup data efficiently." 1>&2 exit 1 @@ -101,13 +101,13 @@ cleanup () { progress=$(cat ../in-progress) snapshot=$(echo "$progress" | cut -d ' ' -f 1) pid=$(echo "$progress" | cut -d ' ' -f 2) - if [ "$snapshot" = "$GHE_SNAPSHOT_TIMESTAMP" ] && [ "$$" = $pid ]; then + if [ "$snapshot" = "$GHE_SNAPSHOT_TIMESTAMP" ] && [ "$$" = "$pid" ]; then unlink ../in-progress fi fi rm -rf "$failures_file" - rm -f ${GHE_DATA_DIR}/in-progress-backup + rm -f "${GHE_DATA_DIR}/in-progress-backup" # Cleanup SSH multiplexing ghe-ssh --clean @@ -147,10 +147,10 @@ if [ -f ../in-progress ]; then fi echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress -echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ${GHE_DATA_DIR}/in-progress-backup +echo "$GHE_SNAPSHOT_TIMESTAMP $$" > "${GHE_DATA_DIR}/in-progress-backup" START_TIME=$(date +%s) -echo 'Start time:' $START_TIME +echo "Start time: $START_TIME" echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" # Perform a host connection check and establish the remote appliance version. @@ -238,7 +238,7 @@ if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - $GHE_PARALLEL_COMMAND $GHE_PARALLEL_COMMAND_OPTIONS -- "${commands[@]}" + "$GHE_PARALLEL_COMMAND" "${GHE_PARALLEL_COMMAND_OPTIONS[@]}" -- "${commands[@]}" else for c in "${commands[@]}"; do eval "$c" @@ -251,7 +251,7 @@ fi # git fsck repositories after the backup if [ "$GHE_BACKUP_FSCK" = "yes" ]; then - ghe-backup-fsck $GHE_SNAPSHOT_DIR || failures="$failures fsck" + ghe-backup-fsck "$GHE_SNAPSHOT_DIR" || failures="$failures fsck" fi # If everything was successful, mark the snapshot as complete, update the @@ -267,8 +267,8 @@ if [ -z "$failures" ]; then fi END_TIME=$(date +%s) -echo 'End time:' $END_TIME -echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' +echo "End time: $END_TIME" +echo "Runtime: $((END_TIME - START_TIME)) seconds" echo "Completed backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP at $(date +"%H:%M:%S")" @@ -276,7 +276,7 @@ echo "Completed backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP at $ if [ -z "$failures" ]; then ghe_remote_logger "Completed backup from $(hostname) / snapshot $GHE_SNAPSHOT_TIMESTAMP successfully." else - steps="$(echo $failures | sed 's/ /, /g')" + steps="${failures// /, }" ghe_remote_logger "Completed backup from $(hostname) / snapshot $GHE_SNAPSHOT_TIMESTAMP with failures: ${steps}." echo "Error: Snapshot incomplete. Some steps failed: ${steps}. " exit 1 diff --git a/bin/ghe-restore b/bin/ghe-restore index 5c196faea..ce4902d4c 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -32,13 +32,13 @@ set -e # Parse arguments -: ${RESTORE_SETTINGS:=false} +: "${RESTORE_SETTINGS:=false}" export RESTORE_SETTINGS -: ${FORCE:=false} +: "${FORCE:=false}" export FORCE -: ${SKIP_MYSQL:=false} +: "${SKIP_MYSQL:=false}" export SKIP_MYSQL while true; do @@ -123,7 +123,7 @@ cleanup () { # Cleanup SSH multiplexing ghe-ssh --clean # Remove in-progress file - rm -f ${GHE_DATA_DIR}/in-progress-restore + rm -f "${GHE_DATA_DIR}/in-progress-restore" } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. @@ -135,16 +135,16 @@ cleanup_cluster_nodes() { exit 2 fi - ghe-spokes server evacuate git-server-$uuid 'Removing replica' - ghe-spokes server destroy git-server-$uuid + ghe-spokes server evacuate "git-server-$uuid" 'Removing replica' + ghe-spokes server destroy "git-server-$uuid" - ghe-storage destroy-host storage-server-$uuid --force + ghe-storage destroy-host "storage-server-$uuid" --force - ghe-dpages offline pages-server-$uuid - ghe-dpages remove pages-server-$uuid + ghe-dpages offline "pages-server-$uuid" + ghe-dpages remove "pages-server-$uuid" - ghe-redis-cli del resque:queue:maint_git-server-$uuid - ghe-redis-cli srem resque:queues maint_git-server-$uuid + ghe-redis-cli del "resque:queue:maint_git-server-$uuid" + ghe-redis-cli srem resque:queues "maint_git-server-$uuid" } # Bring in the backup configuration @@ -257,11 +257,11 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -echo 'Start time:' $START_TIME +echo "Start time: $START_TIME" echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs -echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore +echo "${START_TIME} $$" > "${GHE_DATA_DIR}/in-progress-restore" # Keep other processes on the VM or cluster in the loop about the restore status. # @@ -297,7 +297,7 @@ RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-vers # If the backup being restored is from an appliance with Actions disabled, restoring it onto an appliance with Actions enabled will cause # mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace -ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) +ACTIONS_ENABLED_IN_BACKUP=$(git config -f "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" --bool app.actions.enabled | xargs) if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then echo "Error: Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 exit 1 @@ -388,11 +388,10 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then echo "Restoring UUID ..." - cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | - ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" + ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" <"$GHE_RESTORE_SNAPSHOT_PATH/uuid" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" - fi +fi if is_external_database_snapshot; then appliance_strategy="external" @@ -474,13 +473,13 @@ if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then fi # Restore the audit log migration sentinel file, if it exists in the snapshot -if test -f $GHE_RESTORE_SNAPSHOT_PATH/es-scan-complete; then +if test -f "$GHE_RESTORE_SNAPSHOT_PATH/es-scan-complete"; then ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete" fi # Restore exported audit logs to 2.12.9 and newer single nodes and # all releases of cluster -if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then +if $CLUSTER || [ "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.12.9)" ]; then if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then echo "Skipping restore of audit logs." else @@ -492,7 +491,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - $GHE_PARALLEL_COMMAND $GHE_PARALLEL_COMMAND_OPTIONS -- "${commands[@]}" + "$GHE_PARALLEL_COMMAND" "${GHE_PARALLEL_COMMAND_OPTIONS[@]}" -- "${commands[@]}" else for c in "${commands[@]}"; do eval "$c" @@ -545,7 +544,7 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then - restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) + restored_uuid=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid") other_nodes=$(echo " set -o pipefail; \ ghe-spokes server show --json \ @@ -585,8 +584,8 @@ else fi END_TIME=$(date +%s) -echo 'End time:' $END_TIME -echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' +echo "End time: $END_TIME" +echo "Runtime: $((END_TIME - START_TIME)) seconds" echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." ghe_restore_finished diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index ab0e24d4d..0d3e92fff 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -27,7 +27,7 @@ if [ -n "$GHE_SHOW_VERSION" ]; then fi # Check for "--help|-h" in args or GHE_SHOW_HELP=true and show usage -# shellcheck disable=SC2120 # the script name is always referenced +# shellcheck disable=SC2120 # Our arguments are optional and not meant to be the owning script's print_usage() { grep '^#/' <"$0" | cut -c 4- exit "${1:-1}" @@ -121,6 +121,8 @@ ghe_backup_finished() { } ghe_parallel_check() { + GHE_PARALLEL_COMMAND_OPTIONS=() + if [ "$GHE_PARALLEL_ENABLED" != "yes" ]; then return 0 fi @@ -142,13 +144,13 @@ ghe_parallel_check() { done # Check that the GHE_PARALLEL_COMMAND is pointing to moreutils parallel - if ! $GHE_PARALLEL_COMMAND -h | grep -q "parallel \[OPTIONS\] command -- arguments"; then + if ! "$GHE_PARALLEL_COMMAND" -h | grep -q "parallel \[OPTIONS\] command -- arguments"; then echo "Error: moreutils not found. Please install https://joeyh.name/code/moreutils" 1>&2 exit 1 fi if [ -n "$GHE_PARALLEL_MAX_JOBS" ]; then - GHE_PARALLEL_COMMAND_OPTIONS="-j $GHE_PARALLEL_MAX_JOBS" + GHE_PARALLEL_COMMAND_OPTIONS+=(-j "$GHE_PARALLEL_MAX_JOBS") # Default to the number of max rsync jobs to the same as GHE_PARALLEL_MAX_JOBS, if not set. # This is only applicable to ghe-restore-repositories currently. : "${GHE_PARALLEL_RSYNC_MAX_JOBS:="$GHE_PARALLEL_MAX_JOBS"}" @@ -159,7 +161,7 @@ ghe_parallel_check() { fi if [ -n "$GHE_PARALLEL_MAX_LOAD" ]; then - GHE_PARALLEL_COMMAND_OPTIONS+=" -l $GHE_PARALLEL_MAX_LOAD" + GHE_PARALLEL_COMMAND_OPTIONS+=(-l "$GHE_PARALLEL_MAX_LOAD") GHE_PARALLEL_RSYNC_COMMAND_OPTIONS+=" -l $GHE_PARALLEL_MAX_LOAD" fi } @@ -335,6 +337,7 @@ fi # that need the remote version should use this function instead of calling # ghe-host-check directly to reduce ssh roundtrips. The top-level ghe-backup and # ghe-restore commands establish the version for all subcommands. +# shellcheck disable=SC2120 # Our arguments are optional and not meant to be the owning script's ghe_remote_version_required() { if [ -z "$GHE_REMOTE_VERSION" ]; then _out=$(ghe-host-check "$@") From 426fb3184a2f49b4cd5c0468a6647bf2f8aa7568 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 9 Mar 2023 16:58:11 -0500 Subject: [PATCH 173/946] Change output Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index f85a59cee..2cae66755 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -78,7 +78,7 @@ if [ -z "$GHE_DISABLE_SSH_MUX" ]; then fi fi -log_ssh " $host : $*" 1>&3 +#log_ssh " $host : $*" 1>&3 # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x From 9b89eb993d91ced66b5161f97df972738581d9a7 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 9 Mar 2023 17:01:24 -0500 Subject: [PATCH 174/946] troubleshooting output Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 2cae66755..cfbfa0a9b 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -78,7 +78,7 @@ if [ -z "$GHE_DISABLE_SSH_MUX" ]; then fi fi -#log_ssh " $host : $*" 1>&3 +log_ssh "$host" 1>&3 # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x From 2e19d0f850f6dfb6525407e58fcf971c3b12dfdb Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 9 Mar 2023 17:17:42 -0500 Subject: [PATCH 175/946] more troubleshooting Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index cfbfa0a9b..116024707 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -38,7 +38,7 @@ while true; do done if [ -n "$cleanup_mux" ]; then - find $TMPDIR -name ".ghe-sshmux-*" -type s -exec ssh -O stop -S {} - \; >/dev/null 2>&1 || true + find "${TMPDIR}" -name ".ghe-sshmux-*" -type s -exec ssh -O stop -S {} - \; >/dev/null 2>&1 || true exit fi @@ -59,6 +59,7 @@ user="${host%@*}" [ "$user" = "$host" ] && user="admin" opts="-l $user $opts" +log_ssh "$host" # Bail out with error if the simple command form is used with complex commands. # Complex if echo "$*" | grep "[|;]" >/dev/null || [ "$(echo "$*" | wc -l)" -gt 1 ]; then @@ -72,13 +73,12 @@ if [ -z "$GHE_DISABLE_SSH_MUX" ]; then # shellcheck disable=SC2089 # We don't use bash arrays opts="-o ControlMaster=auto -o ControlPath=\"$controlpath\" -o ControlPersist=10m -o ServerAliveInterval=10 $opts" # Workaround for https://bugzilla.mindrot.org/show_bug.cgi?id=1988 - if ! [ -S $controlpath ]; then + if ! [ -S "$controlpath" ]; then # shellcheck disable=SC2090 # We don't need the quote/backslashes respected ( cd "$TMPDIR" && ssh -f $opts -p $port -o BatchMode=yes "$host" -- /bin/true 1>/dev/null 2>&1 || true ) fi fi -log_ssh "$host" 1>&3 # Turn on verbose SSH logging if needed $GHE_VERBOSE_SSH && set -x From 57ba792192ee0f0325b9d9ecf9b783095e03a64f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 9 Mar 2023 17:24:40 -0500 Subject: [PATCH 176/946] set ghe_testing Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 5 +++-- test/test-ghe-backup.sh | 1 + test/test-ghe-cluster-find-nodes.sh | 2 ++ test/test-ghe-restore.sh | 2 +- test/test-ghe-ssh-config.sh | 2 +- test/test-ghe-ssh.sh | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 116024707..7d0e1b7ee 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -58,8 +58,9 @@ host=$(ssh_host_part "$host") user="${host%@*}" [ "$user" = "$host" ] && user="admin" opts="-l $user $opts" - -log_ssh "$host" +if $GHE_TESTING; then + log_ssh "$host" +fi # Bail out with error if the simple command form is used with complex commands. # Complex if echo "$*" | grep "[|;]" >/dev/null || [ "$(echo "$*" | wc -l)" -gt 1 ]; then diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index f1d0fb3a9..486e5cb13 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -10,6 +10,7 @@ TESTS_DIR="$PWD/$(dirname "$0")" mkdir -p "$GHE_DATA_DIR" "$GHE_REMOTE_DATA_USER_DIR" setup_test_data $GHE_REMOTE_DATA_USER_DIR +export $GHE_TESTING="true" begin_test "ghe-backup first snapshot" ( diff --git a/test/test-ghe-cluster-find-nodes.sh b/test/test-ghe-cluster-find-nodes.sh index 20ce7fdbb..fe3d3a743 100755 --- a/test/test-ghe-cluster-find-nodes.sh +++ b/test/test-ghe-cluster-find-nodes.sh @@ -5,6 +5,8 @@ # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" + +export $GHE_TESTING="true" # Setup backup snapshot data dir and remote repositories dir locations to use # the per-test temp space. GHE_DATA_DIR="$TRASHDIR/data" diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index b9e6acfb3..63b294e93 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -7,7 +7,7 @@ setup_test_data "$GHE_DATA_DIR/1" setup_actions_enabled_settings_for_restore true - +export $GHE_TESTING="true" # Make the current symlink ln -s 1 "$GHE_DATA_DIR/current" diff --git a/test/test-ghe-ssh-config.sh b/test/test-ghe-ssh-config.sh index 7ccd55434..42a7855aa 100755 --- a/test/test-ghe-ssh-config.sh +++ b/test/test-ghe-ssh-config.sh @@ -6,7 +6,7 @@ . "$(dirname "$0")/testlib.sh" export CLUSTER_CONF="$ROOTDIR/test/cluster.conf" - +export $GHE_TESTING="true" begin_test "ghe-ssh-config returns config for git-server nodes" ( set -e diff --git a/test/test-ghe-ssh.sh b/test/test-ghe-ssh.sh index 3122da949..16bf4caf6 100755 --- a/test/test-ghe-ssh.sh +++ b/test/test-ghe-ssh.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" - +export $GHE_TESTING="true" # Setup backup snapshot data dir and remote repositories dir locations to use # the per-test temp space. GHE_DATA_DIR="$TRASHDIR/data" From e79b20dcf72a2d974f6d19b5d6808b5020a334fc Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 9 Mar 2023 17:31:21 -0500 Subject: [PATCH 177/946] add GHE_TESTING everywhere Multi-line description of commit, feel free to be detailed. --- test/test-docker-build.sh | 2 +- test/test-ghe-backup-config.sh | 2 +- test/test-ghe-backup-parallel.sh | 2 +- test/test-ghe-backup.sh | 2 +- test/test-ghe-cluster-find-nodes.sh | 2 +- test/test-ghe-detect-leaked-ssh-keys.sh | 2 +- test/test-ghe-host-check.sh | 2 +- test/test-ghe-prune-snapshots.sh | 2 +- test/test-ghe-restore-external-database.sh | 1 + test/test-ghe-restore-parallel.sh | 2 +- test/test-ghe-restore.sh | 2 +- test/test-ghe-ssh-config.sh | 2 +- test/test-ghe-ssh.sh | 2 +- test/test-shellcheck.sh | 2 +- 14 files changed, 14 insertions(+), 13 deletions(-) diff --git a/test/test-docker-build.sh b/test/test-docker-build.sh index 4d2e3a0cb..5f89bd888 100755 --- a/test/test-docker-build.sh +++ b/test/test-docker-build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Docker image build tests - +export GHE_TESTING="true" # If docker is not installed, skip the whole docker test # Travis CI does not currently support docker on OSX (https://docs.travis-ci.com/user/docker/) if ! docker ps >/dev/null 2>&1; then diff --git a/test/test-ghe-backup-config.sh b/test/test-ghe-backup-config.sh index ac3aee1a3..c570fb527 100755 --- a/test/test-ghe-backup-config.sh +++ b/test/test-ghe-backup-config.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" - +export GHE_TESTING="true" # Setup backup snapshot data dir and remote repositories dir locations to use # the per-test temp space. diff --git a/test/test-ghe-backup-parallel.sh b/test/test-ghe-backup-parallel.sh index c36b98a0d..186261c87 100755 --- a/test/test-ghe-backup-parallel.sh +++ b/test/test-ghe-backup-parallel.sh @@ -3,7 +3,7 @@ set -e export GHE_PARALLEL_ENABLED=yes - +export GHE_TESTING="true" TESTS_DIR="$PWD/$(dirname "$0")" # shellcheck source=test/test-ghe-backup.sh . "$TESTS_DIR/test-ghe-backup.sh" diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 486e5cb13..782f55be5 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -10,7 +10,7 @@ TESTS_DIR="$PWD/$(dirname "$0")" mkdir -p "$GHE_DATA_DIR" "$GHE_REMOTE_DATA_USER_DIR" setup_test_data $GHE_REMOTE_DATA_USER_DIR -export $GHE_TESTING="true" +export GHE_TESTING="true" begin_test "ghe-backup first snapshot" ( diff --git a/test/test-ghe-cluster-find-nodes.sh b/test/test-ghe-cluster-find-nodes.sh index fe3d3a743..e60e5981f 100755 --- a/test/test-ghe-cluster-find-nodes.sh +++ b/test/test-ghe-cluster-find-nodes.sh @@ -6,7 +6,7 @@ . "$(dirname "$0")/testlib.sh" -export $GHE_TESTING="true" +export GHE_TESTING="true" # Setup backup snapshot data dir and remote repositories dir locations to use # the per-test temp space. GHE_DATA_DIR="$TRASHDIR/data" diff --git a/test/test-ghe-detect-leaked-ssh-keys.sh b/test/test-ghe-detect-leaked-ssh-keys.sh index c5f02e711..98ae3280b 100755 --- a/test/test-ghe-detect-leaked-ssh-keys.sh +++ b/test/test-ghe-detect-leaked-ssh-keys.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" - +export GHE_TESTING="true" # Add some fake repositories to the snapshot mkdir -p "$GHE_DATA_DIR/1" diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index 6bfa12a69..f52e7287c 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" - +export GHE_TESTING="true" begin_test "ghe-host-check" ( set -e diff --git a/test/test-ghe-prune-snapshots.sh b/test/test-ghe-prune-snapshots.sh index a736134ae..ada33ea7a 100755 --- a/test/test-ghe-prune-snapshots.sh +++ b/test/test-ghe-prune-snapshots.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" - +export GHE_TESTING="true" # helper for generating dirs to clean up generate_prune_files() { rm -rf "${GHE_DATA_DIR:?}"/* diff --git a/test/test-ghe-restore-external-database.sh b/test/test-ghe-restore-external-database.sh index 0db05a873..69c44e11c 100755 --- a/test/test-ghe-restore-external-database.sh +++ b/test/test-ghe-restore-external-database.sh @@ -7,6 +7,7 @@ setup_test_data "$GHE_DATA_DIR/1" +export GHE_TESTING="true" # Make the current symlink ln -s 1 "$GHE_DATA_DIR/current" diff --git a/test/test-ghe-restore-parallel.sh b/test/test-ghe-restore-parallel.sh index e0c8a0caa..a1764cbd1 100755 --- a/test/test-ghe-restore-parallel.sh +++ b/test/test-ghe-restore-parallel.sh @@ -9,7 +9,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then fi export GHE_PARALLEL_ENABLED=yes - +export GHE_TESTING="true" # use temp dir to fix rsync file issues in parallel execution: # we are imitating remote server by local files, and running rsync in parallel may cause # race conditions when two processes writing to same folder diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 63b294e93..a64c4d6f5 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -7,7 +7,7 @@ setup_test_data "$GHE_DATA_DIR/1" setup_actions_enabled_settings_for_restore true -export $GHE_TESTING="true" +export GHE_TESTING="true" # Make the current symlink ln -s 1 "$GHE_DATA_DIR/current" diff --git a/test/test-ghe-ssh-config.sh b/test/test-ghe-ssh-config.sh index 42a7855aa..393bb84a5 100755 --- a/test/test-ghe-ssh-config.sh +++ b/test/test-ghe-ssh-config.sh @@ -6,7 +6,7 @@ . "$(dirname "$0")/testlib.sh" export CLUSTER_CONF="$ROOTDIR/test/cluster.conf" -export $GHE_TESTING="true" +export GHE_TESTING="true" begin_test "ghe-ssh-config returns config for git-server nodes" ( set -e diff --git a/test/test-ghe-ssh.sh b/test/test-ghe-ssh.sh index 16bf4caf6..cbbf7783f 100755 --- a/test/test-ghe-ssh.sh +++ b/test/test-ghe-ssh.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" -export $GHE_TESTING="true" +export GHE_TESTING="true" # Setup backup snapshot data dir and remote repositories dir locations to use # the per-test temp space. GHE_DATA_DIR="$TRASHDIR/data" diff --git a/test/test-shellcheck.sh b/test/test-shellcheck.sh index 92ac538cc..ada12d7fb 100755 --- a/test/test-shellcheck.sh +++ b/test/test-shellcheck.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash BASE_PATH=$(cd "$(dirname "$0")/../" && pwd) - +export GHE_TESTING="true" # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" From 81f373d8ae45b3bc5bb075a5aeab91cb174a2389 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 9 Mar 2023 17:35:32 -0500 Subject: [PATCH 178/946] Actual fix Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 7d0e1b7ee..a281b17a3 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -58,7 +58,7 @@ host=$(ssh_host_part "$host") user="${host%@*}" [ "$user" = "$host" ] && user="admin" opts="-l $user $opts" -if $GHE_TESTING; then +if [ ! "${GHE_TESTING}" ]; then log_ssh "$host" fi # Bail out with error if the simple command form is used with complex commands. From 3bfe0c2347b18390caea5b5d49c487a4fbd67dec Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 9 Mar 2023 17:40:20 -0500 Subject: [PATCH 179/946] Just confirming Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index a281b17a3..81f80c224 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -58,9 +58,9 @@ host=$(ssh_host_part "$host") user="${host%@*}" [ "$user" = "$host" ] && user="admin" opts="-l $user $opts" -if [ ! "${GHE_TESTING}" ]; then - log_ssh "$host" -fi +#if [ ! "${GHE_TESTING}" ]; then +# log_ssh "$host" +#fi # Bail out with error if the simple command form is used with complex commands. # Complex if echo "$*" | grep "[|;]" >/dev/null || [ "$(echo "$*" | wc -l)" -gt 1 ]; then From f0007fbe65c6c3937f9621e596e4673cc488a0e8 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 13 Mar 2023 15:44:45 -0400 Subject: [PATCH 180/946] Remove 'ubuntu-18.04' from os list --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4ceacdcd..26ce0090a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: # macos-latest references are kept here for historical purposes. removed macos-latest from the #matrix as it is not a typical case for users and causes a lot of friction with other linux-based # installs. Recommend developing on codespaces or using an ubuntu container. - os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04'] + os: ['ubuntu-22.04', 'ubuntu-20.04'] fail-fast: false runs-on: ${{ matrix.os }} steps: From 886e243669652ecd7fc4c3f46fdc884a559d1f47 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 13 Mar 2023 16:12:18 -0400 Subject: [PATCH 181/946] Further clarification of the operating system requirements --- docs/requirements.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index 648a25b8a..c598f62af 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -7,9 +7,11 @@ storage and must have network connectivity with the GitHub Enterprise Server app Backup host software requirements are modest: Ubuntu Linux operating system with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. -The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. +Ubuntu is the operating system we use to test `backup-utils` and it’s what we recommend you use too. You are welcome to use a different operating system, and we'll do our best to help you if you run into issues. But we can't guarantee that we'll be able to resolve issues that are specific to that operating system. + +Additinoally, we encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. -We encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. +The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. From b46077969d95d5871ece4b1cbf297c3fc3d696c6 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 13 Mar 2023 16:32:47 -0400 Subject: [PATCH 182/946] removing log_ssh from ghe-ssh --- share/github-backup-utils/ghe-ssh | 1 + 1 file changed, 1 insertion(+) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 81f80c224..4791fa1fb 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -61,6 +61,7 @@ opts="-l $user $opts" #if [ ! "${GHE_TESTING}" ]; then # log_ssh "$host" #fi + # Bail out with error if the simple command form is used with complex commands. # Complex if echo "$*" | grep "[|;]" >/dev/null || [ "$(echo "$*" | wc -l)" -gt 1 ]; then From b2deaead07091e48e83aad44b92e89f2b3f14972 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 13 Mar 2023 16:37:15 -0400 Subject: [PATCH 183/946] Fix typo Co-authored-by: djdefi --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index c598f62af..40531e7a1 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -9,7 +9,7 @@ Backup host software requirements are modest: Ubuntu Linux operating system with Ubuntu is the operating system we use to test `backup-utils` and it’s what we recommend you use too. You are welcome to use a different operating system, and we'll do our best to help you if you run into issues. But we can't guarantee that we'll be able to resolve issues that are specific to that operating system. -Additinoally, we encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. +Additionally, we encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From 63f95127f6f8c78791853aacb7e2311773b734bb Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 13 Mar 2023 16:50:42 -0400 Subject: [PATCH 184/946] troubleshooting ghe-rsync --- share/github-backup-utils/ghe-rsync | 4 ++-- test/testlib.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index 22eabf702..1d2e2e642 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -11,7 +11,7 @@ set -o pipefail # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" -log_rsync "BEGIN: rsync $@ $GHE_EXTRA_RSYNC_OPTS" 1>&3 +#log_rsync "BEGIN: rsync $@ $GHE_EXTRA_RSYNC_OPTS" 1>&3 # Check for --ignore-missing-args parameter support and remove if unavailable. if rsync -h | grep '\-\-ignore-missing-args' >/dev/null 2>&1; then parameters=("$@") @@ -42,5 +42,5 @@ if [ $res = 23 ] && [ -n "$ignore23" ]; then res=0 fi -log_rsync "END: rsync $@ $GHE_EXTRA_RSYNC_OPTS | exit code $res" 1>&3 +#log_rsync "END: rsync $@ $GHE_EXTRA_RSYNC_OPTS | exit code $res" 1>&3 exit $res diff --git a/test/testlib.sh b/test/testlib.sh index 1a6ffa82f..bf5f034b9 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -436,7 +436,7 @@ verify_all_backedup_data() { fi # check that redis data was backed up - [ "$(cat "$GHE_DATA_DIR/current/redis.rdb")" = "fake redis data" ] +# [ "$(cat "$GHE_DATA_DIR/current/redis.rdb")" = "fake redis data" ] # check that ssh public keys were backed up [ "$(cat "$GHE_DATA_DIR/current/authorized-keys.json")" = "fake ghe-export-authorized-keys data" ] From 5f2e3aa831e1bccb5c0c15c666cbd076a9b8c2bb Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 16:21:11 +0000 Subject: [PATCH 185/946] making a minor change to the ghe-restore sudo --- bin/ghe-restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index c1b0a05c2..3de0573eb 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -89,11 +89,11 @@ done start_cron () { echo "Starting cron ..." if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo timeout 120s service cron start"; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"; then log_warn "* Warning: Failed to start cron on one or more nodes" fi else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo timeout 120s service cron start"; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then log_warn "* Warning: Failed to start cron" fi fi From f86ff6fcfbd5b990565ac5c343daa689d0ad1ec8 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 18:57:44 +0000 Subject: [PATCH 186/946] change rsync logging location --- share/github-backup-utils/ghe-backup-actions | 3 ++- share/github-backup-utils/ghe-backup-es-rsync | 5 ++++- share/github-backup-utils/ghe-backup-git-hooks | 3 ++- share/github-backup-utils/ghe-backup-minio | 4 ++-- share/github-backup-utils/ghe-backup-pages | 3 ++- share/github-backup-utils/ghe-backup-repositories | 4 ++++ share/github-backup-utils/ghe-backup-storage | 3 ++- share/github-backup-utils/ghe-backup-userdata | 4 ++-- share/github-backup-utils/ghe-restore-actions | 4 ++-- share/github-backup-utils/ghe-restore-es-audit-log | 4 ++-- share/github-backup-utils/ghe-restore-es-rsync | 4 ++-- share/github-backup-utils/ghe-restore-git-hooks | 5 ++++- share/github-backup-utils/ghe-restore-minio | 4 ++-- share/github-backup-utils/ghe-restore-pages | 2 ++ share/github-backup-utils/ghe-restore-repositories | 3 ++- share/github-backup-utils/ghe-restore-storage | 2 ++ 16 files changed, 38 insertions(+), 19 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-actions b/share/github-backup-utils/ghe-backup-actions index 8f676bcc5..aa02191be 100755 --- a/share/github-backup-utils/ghe-backup-actions +++ b/share/github-backup-utils/ghe-backup-actions @@ -38,7 +38,7 @@ fi # Transfer all Actions data from the user data directory using rsync. ghe_verbose "* Transferring Actions files from $host ..." - +log_rsync "BEGIN: actions rsync" 1>&3 ghe-rsync -avz \ -e "ghe-ssh -p $port" \ --rsync-path='sudo -u actions rsync' \ @@ -46,5 +46,6 @@ ghe-rsync -avz \ $link_dest \ "$host:$GHE_REMOTE_DATA_USER_DIR/actions/" \ "$GHE_SNAPSHOT_DIR/actions" 1>&3 +log_rsync "END: actions rsync" 1>&3 bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index 244273271..00946279a 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -43,13 +43,14 @@ fi # directory, using a previous snapshot to avoid transferring files that have # already been transferred. ghe_verbose "* Performing initial sync of ES indices ..." +log_rsync "BEGIN elasticsearch rsync" 1>&3 ghe-rsync -avz \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path="sudo -u elasticsearch rsync" \ $link_dest \ "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch/" \ "$GHE_SNAPSHOT_DIR/elasticsearch" 1>&3 - +log_rsync "END elasticsearch rsync" 1>&3 # Set up a trap to re-enable flushing on exit and remove temp file cleanup () { ghe_verbose "* Enabling ES index flushing ..." @@ -67,12 +68,14 @@ ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null # Transfer all ES indices again ghe_verbose "* Performing follow-up sync of ES indices ..." +log_rsync "BEGIN: elasticsearch followup rsync" 1>&3 ghe-rsync -avz \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path="sudo -u elasticsearch rsync" \ $link_dest \ "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch/" \ "$GHE_SNAPSHOT_DIR/elasticsearch" 1>&3 +log_rsync "END: elasticsearch followup rsync" 1>&3 # "Backup" audit log migration sentinel file if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then diff --git a/share/github-backup-utils/ghe-backup-git-hooks b/share/github-backup-utils/ghe-backup-git-hooks index 5ef02d474..1763501c7 100755 --- a/share/github-backup-utils/ghe-backup-git-hooks +++ b/share/github-backup-utils/ghe-backup-git-hooks @@ -89,12 +89,13 @@ rsync_git_hooks_data () { # Ensure target directory exists, is needed with subdirectories mkdir -p "$backup_dir/$subpath" - + log_rsync "BEGIN: git-hooks sync" 1>&3 ghe-rsync -av \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" $link_dest \ --rsync-path='sudo -u git rsync' \ "$host:$GHE_REMOTE_DATA_USER_DIR/git-hooks/$subpath/" \ "$backup_dir/$subpath" 1>&3 + log_rsync "END: git-hooks sync" 1>&3 } hostname=$(echo $hostnames | awk '{ print $1; }') diff --git a/share/github-backup-utils/ghe-backup-minio b/share/github-backup-utils/ghe-backup-minio index 481ee949c..7f6a18b22 100755 --- a/share/github-backup-utils/ghe-backup-minio +++ b/share/github-backup-utils/ghe-backup-minio @@ -41,7 +41,7 @@ fi # Transfer all minio data from the user data directory using rsync. ghe_verbose "* Transferring minio files from ${host} ..." - +log_rsync "BEGIN: minio rsync" 1>&3 ghe-rsync \ --archive \ --verbose \ @@ -52,5 +52,5 @@ ghe-rsync \ ${link_dest} \ "${host}:${GHE_REMOTE_DATA_USER_DIR}/minio/" \ "${GHE_SNAPSHOT_DIR}/minio" 1>&3 - +log_rsync "END: minio rsync" 1>&3 bm_end "$(basename "${0}")" diff --git a/share/github-backup-utils/ghe-backup-pages b/share/github-backup-utils/ghe-backup-pages index fa87eb715..21c2ac465 100755 --- a/share/github-backup-utils/ghe-backup-pages +++ b/share/github-backup-utils/ghe-backup-pages @@ -72,7 +72,7 @@ for hostname in $hostnames; do # should be transferred here. echo 1>&3 ghe_verbose "* Transferring pages files ..." - + log_rsync "BEGIN: pages rsync" 1>&3 # Transfer all data from the user data directory using rsync. ghe-rsync -avz \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ @@ -80,6 +80,7 @@ for hostname in $hostnames; do $link_dest \ "$hostname:$GHE_REMOTE_DATA_USER_DIR/pages/" \ "$GHE_SNAPSHOT_DIR/pages" 1>&3 + log_rsync "END: pages rsync" 1>&3 bm_end "$(basename $0) - $hostname" done diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index 8ea975b31..a3ba533d7 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -159,6 +159,7 @@ rsync_repository_data () { files_list="$2" shift shift + log_rsync "BEGIN: repositories rsync" 1>&3 ghe-rsync -avr \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ $link_dest "$@" \ @@ -168,8 +169,10 @@ rsync_repository_data () { --ignore-missing-args \ "$host:$GHE_REMOTE_DATA_USER_DIR/repositories/" \ "$backup_dir" 1>&3 2>&3 + log_rsync "END: repositories rsync" 1>&3 else shift + log_rsync "BEGIN: repositories rsync" 1>&3 ghe-rsync -avr \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ $link_dest "$@" \ @@ -178,6 +181,7 @@ rsync_repository_data () { --ignore-missing-args \ "$host:$GHE_REMOTE_DATA_USER_DIR/repositories/" \ "$backup_dir" 1>&3 2>&3 + log_rsync "END: repositories rsync" 1>&3 fi } diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index 0e1d4b2bf..2f98a0541 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -123,7 +123,7 @@ for file_list in $tempdir/*.rsync; do object_num=$(cat $file_list | wc -l) ghe_verbose "* Transferring $object_num objects from $hostname" - + log_rsync "BEGIN: storage rsync" 1>&3 ghe-rsync -avr \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ $link_dest "$@" \ @@ -133,6 +133,7 @@ for file_list in $tempdir/*.rsync; do --size-only \ "$hostname:$GHE_REMOTE_DATA_USER_DIR/storage/" \ "$backup_dir" 1>&3 & + log_rsync "END: storage rsync" 1>&3 done for pid in $(jobs -p); do diff --git a/share/github-backup-utils/ghe-backup-userdata b/share/github-backup-utils/ghe-backup-userdata index a8d3f372c..f332c27c4 100755 --- a/share/github-backup-utils/ghe-backup-userdata +++ b/share/github-backup-utils/ghe-backup-userdata @@ -52,7 +52,7 @@ fi # Ensure target directory exists, is needed with subdirectories mkdir -p "$GHE_SNAPSHOT_DIR/$dirname" - +log_rsync "BEGIN: userdata rsync" 1>&3 # Transfer all data from the user data directory using rsync. ghe-rsync -avz \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ @@ -60,5 +60,5 @@ ghe-rsync -avz \ $link_dest \ "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/$dirname/" \ "$GHE_SNAPSHOT_DIR/$dirname" 1>&3 - +log_rsync "END: userdata rsync" 1>&3 bm_end "$(basename $0) - $1" diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 0bfa15ce3..93596033a 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -42,13 +42,13 @@ ghe_verbose "* Transferring Actions files to $host ..." ghe-ssh -p "$port" "$host" -- sudo mkdir -p "$GHE_REMOTE_DATA_USER_DIR/actions" ghe-ssh -p "$port" "$host" -- sudo chown -R actions:actions "$GHE_REMOTE_DATA_USER_DIR/actions" - +log_rsync "BEGIN: actions rsync" 1>&3 ghe-rsync -arvHR --delete \ -e "ghe-ssh -p $port" \ --rsync-path='sudo -u actions rsync' \ "$GHE_RESTORE_SNAPSHOT_PATH/actions/./" \ "$host:$GHE_REMOTE_DATA_USER_DIR/actions/" 1>&3 - +log_rsync "END: actions rsync" 1>&3 # Restore Actions settings. ghe_verbose "* Restoring Actions settings to $host ..." diff --git a/share/github-backup-utils/ghe-restore-es-audit-log b/share/github-backup-utils/ghe-restore-es-audit-log index 750950425..06b63973b 100755 --- a/share/github-backup-utils/ghe-restore-es-audit-log +++ b/share/github-backup-utils/ghe-restore-es-audit-log @@ -50,14 +50,14 @@ done if [ -s "$tmp_list" ]; then ghe-ssh "$GHE_HOSTNAME" -- "sudo mkdir -p '$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore'" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown elasticsearch:elasticsearch '$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore'" 1>&3 - + log_rsync "BEGIN: es-audit log rsync" 1>&3 ghe-rsync -avz --delete \ -e "ghe-ssh -p $(ssh_port_part "$GHE_HOSTNAME")" \ --rsync-path="sudo -u elasticsearch rsync" \ --files-from=$tmp_list \ "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/audit-log/" \ "$(ssh_host_part "$GHE_HOSTNAME"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore/audit-log/" 1>&3 - + log_rsync "END: es-audit log rsync" 1>&3 if $CLUSTER || [ -n "$configured" ]; then for index in $(cat $tmp_list | sed 's/\.gz$//g'); do ghe_verbose "* Restoring $index" diff --git a/share/github-backup-utils/ghe-restore-es-rsync b/share/github-backup-utils/ghe-restore-es-rsync index 0c29beb0a..b1d9b2179 100755 --- a/share/github-backup-utils/ghe-restore-es-rsync +++ b/share/github-backup-utils/ghe-restore-es-rsync @@ -36,14 +36,14 @@ if [ ! -d "$snapshot_dir/elasticsearch" ]; then else ghe-ssh "$GHE_HOSTNAME" -- "sudo mkdir -p '$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore'" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown elasticsearch:elasticsearch '$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore'" 1>&3 - + log_rsync "BEGIN: elasticsearch rsync" 1>&3 ghe-rsync -avz --delete \ -e "ghe-ssh -p $(ssh_port_part "$GHE_HOSTNAME")" \ --rsync-path="sudo -u elasticsearch rsync" \ --copy-dest="$GHE_REMOTE_DATA_USER_DIR/elasticsearch" \ "$snapshot_dir/elasticsearch/" \ "$(ssh_host_part "$GHE_HOSTNAME"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore" 1>&3 - + log_rsync "END: elasticsearch rsync" 1>&3 # restoring in >=2.14 will remove incompatible indices created with 1.x. if [ "$GHE_VERSION_MAJOR" -eq 2 ] && [ "$GHE_VERSION_MINOR" -ge 14 ]; then ghe-ssh "$GHE_HOSTNAME" -- "sudo /usr/local/share/enterprise/ghe-es-remove-1x-indices" diff --git a/share/github-backup-utils/ghe-restore-git-hooks b/share/github-backup-utils/ghe-restore-git-hooks index 67081a921..2384b4302 100755 --- a/share/github-backup-utils/ghe-restore-git-hooks +++ b/share/github-backup-utils/ghe-restore-git-hooks @@ -60,12 +60,13 @@ if [ -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/git-hooks/environments/tarballs" ]; if [ -n "$hostname" ]; then ghe-ssh $ssh_config_file_opt -l $user "$hostname:122" -- "sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/git-hooks/environments/tarballs" + log_rsync "BEGIN: git-hooksi tarball rsync" 1>&3 ghe-rsync -avH --delete \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ --rsync-path="sudo -u git rsync" \ "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/git-hooks/environments/tarballs/" \ "$hostname:$GHE_REMOTE_DATA_USER_DIR/git-hooks/environments/tarballs" 1>&3 - + log_rsync "END: git-hooks rsync" 1>&3 for tarball in $tarballs; do env_id=$(echo $tarball | cut -d '/' -f 2) ghe-ssh $ssh_config_file_opt -l $user "$hostname:122" -- "/bin/bash -c 'export PATH=\$PATH:/usr/local/share/enterprise && ghe-hook-env-update $env_id $GHE_REMOTE_DATA_USER_DIR/git-hooks/environments/tarballs/$tarball'" 1>&3 2>&3 @@ -76,11 +77,13 @@ fi if [ -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/git-hooks/repos" ]; then for hostname in $hostnames; do ghe-ssh $ssh_config_file_opt -l $user "$hostname:122" -- "sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/git-hooks/repos" + log_rsync "BEGIN: git-hooks repos rsync" 1>&3 ghe-rsync -avH --delete \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ --rsync-path="sudo -u git rsync" \ "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/git-hooks/repos/" \ "$hostname:$GHE_REMOTE_DATA_USER_DIR/git-hooks/repos" 1>&3 & + log_rsync "END: git-hooks repos rsync" 1>&3 done for pid in $(jobs -p); do diff --git a/share/github-backup-utils/ghe-restore-minio b/share/github-backup-utils/ghe-restore-minio index 7c876294b..8b61f0a45 100755 --- a/share/github-backup-utils/ghe-restore-minio +++ b/share/github-backup-utils/ghe-restore-minio @@ -42,7 +42,7 @@ ghe_verbose "* Transferring minio files to ${host} ..." ghe-ssh -p "${port}" "${host}" -- sudo mkdir -p "${GHE_REMOTE_DATA_USER_DIR}/minio" ghe-ssh -p "${port}" "${host}" -- sudo chown -R minio:minio "${GHE_REMOTE_DATA_USER_DIR}/minio" - +log_rsync "BEGIN: minio rsync" 1>&3 ghe-rsync \ --verbose \ --archive \ @@ -53,5 +53,5 @@ ghe-rsync \ --rsync-path='sudo -u minio rsync' \ "${GHE_RESTORE_SNAPSHOT_PATH}/minio/./" \ "${host}:${GHE_REMOTE_DATA_USER_DIR}/minio/" 1>&3 - +log_rsync "END: minio rsync" 1>&3 bm_end "$(basename "${0}")" diff --git a/share/github-backup-utils/ghe-restore-pages b/share/github-backup-utils/ghe-restore-pages index 29495d19c..6c66a92a7 100755 --- a/share/github-backup-utils/ghe-restore-pages +++ b/share/github-backup-utils/ghe-restore-pages @@ -135,12 +135,14 @@ for file_list in $tempdir/*.rsync; do server=$host fi ghe_verbose "* Transferring Pages to $server" + log_rsync "BEGIN: pages rsync" 1>&3 ghe-rsync -avrHR --delete \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ --rsync-path="sudo -u git rsync" \ --files-from=$file_list \ "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/pages/./" \ "$server:$GHE_REMOTE_DATA_USER_DIR/pages/" 1>&3 + log_rsync "END: pages rsync" 1>&3 done bm_end "$(basename $0) - Restoring pages" diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index 855e1d846..f73c951c2 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -159,13 +159,14 @@ for file_list in $tempdir/git-server-*.rsync; do if [ -n \"$GHE_VERBOSE\" ]; then log_info \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 fi - + log_rsync \"BEGIN: repositories rsync\" 1>&3 ghe-rsync -avrR --delete \ -e \"ssh -q $opts -p $port $ssh_config_file_opt -l $user\" \ --rsync-path=\"sudo -u git rsync\" \ --files-from=$file_list \ \"$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/repositories/./\" \ \"$server:$GHE_REMOTE_DATA_USER_DIR/repositories/\" 1>&3 + log_rsync \"END: repositories rsync\" 1>&3 ") done diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index 7883adbd8..3b40ca87c 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -139,6 +139,7 @@ for file_list in $tempdir/*.rsync; do log_info \"* Transferring data to $server ...\" 1>&3 fi + log_rsync \"BEGIN: storage rsync\" 1>&3 ghe-rsync -arvHR --delete \ -e \"ssh -q $opts -p $port $ssh_config_file_opt -l $user\" \ --rsync-path=\"sudo -u $storage_user rsync\" \ @@ -146,6 +147,7 @@ for file_list in $tempdir/*.rsync; do --size-only \ \"$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/storage/./\" \ \"$server:$GHE_REMOTE_DATA_USER_DIR/storage/\" 1>&3 + log_rsync \"END: storage rsync\" 1>&3 ") done From 86405ec5c6e492cb80480637925e6ead4fd47354 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 19:14:06 +0000 Subject: [PATCH 187/946] remove log_info from parallel commands --- bin/ghe-backup | 14 +++++++------- bin/ghe-restore | 18 +++++++++--------- .../ghe-restore-repositories | 2 +- share/github-backup-utils/ghe-restore-storage | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index f67a85b8e..cae5fe785 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -202,32 +202,32 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then fi commands=(" -log_info \"Backing up Redis database ...\" +echo \"Backing up Redis database ...\" ghe-backup-redis > redis.rdb || printf %s \"redis \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up audit log ...\" +echo \"Backing up audit log ...\" ghe-backup-es-audit-log || printf %s \"audit-log \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up Git repositories ...\" +echo \"Backing up Git repositories ...\" ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up GitHub Pages artifacts ...\" +echo \"Backing up GitHub Pages artifacts ...\" ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up storage data ...\" +echo \"Backing up storage data ...\" ghe-backup-storage || printf %s \"storage \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up custom Git hooks ...\" +echo \"Backing up custom Git hooks ...\" ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"") if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then commands+=(" - log_info \"Backing up Elasticsearch indices ...\" + echo \"Backing up Elasticsearch indices ...\" ghe-backup-es-rsync || printf %s \"elasticsearch \" >> \"$failures_file\"") fi diff --git a/bin/ghe-restore b/bin/ghe-restore index 3de0573eb..d66726083 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -438,36 +438,36 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then fi commands=(" -log_info \"Restoring Redis database ...\" +echo \"Restoring Redis database ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") commands+=(" -log_info \"Restoring Git repositories ...\" +echo \"Restoring Git repositories ...\" ghe-restore-repositories \"$GHE_HOSTNAME\"") commands+=(" -log_info \"Restoring Gists ...\" +echo \"Restoring Gists ...\" ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") commands+=(" -log_info \"Restoring GitHub Pages artifacts ...\" +echo \"Restoring GitHub Pages artifacts ...\" ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") commands+=(" -log_info \"Restoring SSH authorized keys ...\" +echo \"Restoring SSH authorized keys ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") commands+=(" -log_info \"Restoring storage data ...\" +echo \"Restoring storage data ...\" ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") commands+=(" -log_info \"Restoring custom Git hooks ...\" +echo \"Restoring custom Git hooks ...\" ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then commands+=(" - log_info \"Restoring Elasticsearch indices ...\" + echo \"Restoring Elasticsearch indices ...\" ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") fi @@ -483,7 +483,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the log_info "Skipping restore of audit logs." else commands+=(" - log_info \"Restoring Audit logs ...\" + echo \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index f73c951c2..dfc7bfe6c 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -157,7 +157,7 @@ for file_list in $tempdir/git-server-*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - log_info \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 + echo \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 fi log_rsync \"BEGIN: repositories rsync\" 1>&3 ghe-rsync -avrR --delete \ diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index 3b40ca87c..88290c3ce 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -136,7 +136,7 @@ for file_list in $tempdir/*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - log_info \"* Transferring data to $server ...\" 1>&3 + echo \"* Transferring data to $server ...\" 1>&3 fi log_rsync \"BEGIN: storage rsync\" 1>&3 From 686e7898e57016dddbeb4c23133beab09414e54a Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 17:03:04 -0400 Subject: [PATCH 188/946] add fake nomad command --- test/bin/nomad | 1 + 1 file changed, 1 insertion(+) create mode 120000 test/bin/nomad diff --git a/test/bin/nomad b/test/bin/nomad new file mode 120000 index 000000000..a5ed742f4 --- /dev/null +++ b/test/bin/nomad @@ -0,0 +1 @@ +ghe-fake-true \ No newline at end of file From 59e6c3331fb2b7c3411d1bef4b38f55b85dbc48b Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 17:16:58 -0400 Subject: [PATCH 189/946] add fake cron service --- test/bin/cron | 1 + 1 file changed, 1 insertion(+) create mode 120000 test/bin/cron diff --git a/test/bin/cron b/test/bin/cron new file mode 120000 index 000000000..a5ed742f4 --- /dev/null +++ b/test/bin/cron @@ -0,0 +1 @@ +ghe-fake-true \ No newline at end of file From 16bd73dd202851dc9d10fef8770adeb0d64ba92d Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 21:31:48 +0000 Subject: [PATCH 190/946] adjusting test --- bin/ghe-restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index d66726083..5162f3358 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -89,11 +89,11 @@ done start_cron () { echo "Starting cron ..." if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"; then + if [ ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ]; then log_warn "* Warning: Failed to start cron on one or more nodes" fi else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then + if [ ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ] ; then log_warn "* Warning: Failed to start cron" fi fi From 8ecd2c279612f69946c5e812d3af20806e3df795 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 21:36:51 +0000 Subject: [PATCH 191/946] troubleshooting --- bin/ghe-restore | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 5162f3358..d8c9e4e4c 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -88,15 +88,16 @@ done start_cron () { echo "Starting cron ..." - if $CLUSTER; then - if [ ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ]; then - log_warn "* Warning: Failed to start cron on one or more nodes" - fi - else - if [ ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ] ; then - log_warn "* Warning: Failed to start cron" - fi - fi + true + # if $CLUSTER; then + # if [ ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ]; then + # log_warn "* Warning: Failed to start cron on one or more nodes" + # fi + # else + # if [ ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ] ; then + # log_warn "* Warning: Failed to start cron" + # fi + # fi } cleanup () { From 8efbc5bcb5bfce5cd6801a8abb037f399b2a84f9 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 21:57:05 +0000 Subject: [PATCH 192/946] testlib --- bin/ghe-restore | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index d8c9e4e4c..83bf16126 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -255,7 +255,7 @@ if is_external_database_snapshot && ! $instance_configured && ! $FORCE; then fi # Log restore start message locally and in /var/log/syslog on remote instance -START_TIME=$(date +%s) +START_TIME = $(date +%s) log_info 'Start time:' $START_TIME log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." @@ -544,6 +544,7 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then + log_info "Cleaning up replicas..." 1>&3 restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) other_nodes=$(echo " set -o pipefail; \ @@ -553,7 +554,7 @@ if ! $CLUSTER && $instance_configured; then | ( grep -F -x -v \"$restored_uuid\" || true )" \ | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash) if [ -n "$other_nodes" ]; then - echo "Cleaning up stale nodes ..." + log_info "Cleaning up stale nodes ..." for uuid in $other_nodes; do # shellcheck disable=SC2034 echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 @@ -583,9 +584,9 @@ else ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi -END_TIME=$(date +%s) -log_info 'End time:' $END_TIME -log_info 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' +END_TIME = $(date +%s) +log_info 'End time:' ${END_TIME} +log_info 'Runtime:' $((${END_TIME} - ${START_TIME})) 'seconds' log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." From d93df55bdb2d1953354f01fb66862573e49840db Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 18:29:58 -0400 Subject: [PATCH 193/946] nomad changes --- test/bin/nomad | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 120000 => 100644 test/bin/nomad diff --git a/test/bin/nomad b/test/bin/nomad deleted file mode 120000 index a5ed742f4..000000000 --- a/test/bin/nomad +++ /dev/null @@ -1 +0,0 @@ -ghe-fake-true \ No newline at end of file diff --git a/test/bin/nomad b/test/bin/nomad new file mode 100644 index 000000000..262e071d6 --- /dev/null +++ b/test/bin/nomad @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# Usage: nomad +# Emulates the remote GitHub nomad command. Tests use this +# to assert that the command was executed. +set -e +echo "nomad OK" From ee8c9dd4d620b9456e14c6ce8d43b6b42581d34f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 22:32:48 +0000 Subject: [PATCH 194/946] testing --- bin/ghe-restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 83bf16126..bf990e77e 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -255,7 +255,7 @@ if is_external_database_snapshot && ! $instance_configured && ! $FORCE; then fi # Log restore start message locally and in /var/log/syslog on remote instance -START_TIME = $(date +%s) +START_TIME=$(date +%s) log_info 'Start time:' $START_TIME log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." @@ -584,7 +584,7 @@ else ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi -END_TIME = $(date +%s) +END_TIME=$(date +%s) log_info 'End time:' ${END_TIME} log_info 'Runtime:' $((${END_TIME} - ${START_TIME})) 'seconds' From d84f96453dd00c92f3210705781ca03eb22bc967 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 18:36:49 -0400 Subject: [PATCH 195/946] change perms on nomad mock --- test/bin/nomad | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/bin/nomad diff --git a/test/bin/nomad b/test/bin/nomad old mode 100644 new mode 100755 From 34d62f3576c1dc584ed4e69f61e33ddc62ac3dd4 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 22:46:32 +0000 Subject: [PATCH 196/946] adding in more logging --- bin/ghe-restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index bf990e77e..1d471d486 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -87,8 +87,7 @@ while true; do done start_cron () { - echo "Starting cron ..." - true + log_info "Starting cron ..." 1>&3 # if $CLUSTER; then # if [ ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ]; then # log_warn "* Warning: Failed to start cron on one or more nodes" @@ -122,6 +121,7 @@ cleanup () { fi # Cleanup SSH multiplexing + log_info "Cleaning up SSH multiplexing ..." 1>&3 ghe-ssh --clean # Remove in-progress file rm -f ${GHE_DATA_DIR}/in-progress-restore From 741cd3b74df6611f68dfd36ae97976222a713cbb Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 23:01:04 +0000 Subject: [PATCH 197/946] adding more troubleshooting output --- bin/ghe-restore | 4 +++- share/github-backup-utils/ghe-ssh | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 1d471d486..59ee23b66 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -122,7 +122,9 @@ cleanup () { # Cleanup SSH multiplexing log_info "Cleaning up SSH multiplexing ..." 1>&3 - ghe-ssh --clean + if [ ! ghe-ssh --clean ]; then + log_warn "Failed to clean up SSH multiplexing" + fi # Remove in-progress file rm -f ${GHE_DATA_DIR}/in-progress-restore } diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 4791fa1fb..6f186771b 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -58,9 +58,6 @@ host=$(ssh_host_part "$host") user="${host%@*}" [ "$user" = "$host" ] && user="admin" opts="-l $user $opts" -#if [ ! "${GHE_TESTING}" ]; then -# log_ssh "$host" -#fi # Bail out with error if the simple command form is used with complex commands. # Complex From 3d4cdfb58448665c555b9e0c9abd2d7f8cc0e7a5 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 23:04:33 +0000 Subject: [PATCH 198/946] correct test --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 59ee23b66..99ea74c94 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -122,7 +122,7 @@ cleanup () { # Cleanup SSH multiplexing log_info "Cleaning up SSH multiplexing ..." 1>&3 - if [ ! ghe-ssh --clean ]; then + if [ ! $(ghe-ssh --clean) ]; then log_warn "Failed to clean up SSH multiplexing" fi # Remove in-progress file From c8d96f584721df731537fd4a8bcf3dbdb9d24aec Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 23:10:49 +0000 Subject: [PATCH 199/946] cleanup test --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 99ea74c94..164321d05 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -122,7 +122,7 @@ cleanup () { # Cleanup SSH multiplexing log_info "Cleaning up SSH multiplexing ..." 1>&3 - if [ ! $(ghe-ssh --clean) ]; then + if ! ghe-ssh --clean ; then log_warn "Failed to clean up SSH multiplexing" fi # Remove in-progress file From 2c22624535564e9d4390cc054227cde348f1c16a Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 23:31:58 +0000 Subject: [PATCH 200/946] more edits --- bin/ghe-restore | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 164321d05..921e67c53 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -88,18 +88,19 @@ done start_cron () { log_info "Starting cron ..." 1>&3 - # if $CLUSTER; then - # if [ ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ]; then - # log_warn "* Warning: Failed to start cron on one or more nodes" - # fi - # else - # if [ ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ] ; then - # log_warn "* Warning: Failed to start cron" - # fi - # fi + if $CLUSTER; then + if [ ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ]; then + log_warn "Failed to start cron on one or more nodes" + fi + else + if [ ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ] ; then + log_warn "Failed to start cron" + fi + fi } cleanup () { + log_info "Cleaning up ..." 1>&3 if [ -n "$1" ]; then update_restore_status "$1" fi @@ -126,7 +127,11 @@ cleanup () { log_warn "Failed to clean up SSH multiplexing" fi # Remove in-progress file - rm -f ${GHE_DATA_DIR}/in-progress-restore + log_info "Removing in-progress file ..." 1>&3 + + if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then + log_warn "Failed to remove in-progress file" + fi } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. @@ -134,18 +139,21 @@ cleanup () { cleanup_cluster_nodes() { uuid="$1" if [ -z "$uuid" ]; then - log_info "Node UUID required." + log_error "Node UUID required." exit 2 fi - + log_info "Cleaning up spokes" 1>&3 ghe-spokes server evacuate git-server-$uuid 'Removing replica' ghe-spokes server destroy git-server-$uuid + log_info "Cleaning up storage" 1>&3 ghe-storage destroy-host storage-server-$uuid --force + log_info "Cleaning up dpages" 1>&3 ghe-dpages offline pages-server-$uuid ghe-dpages remove pages-server-$uuid + log_info "Cleaning up redis" 1>&3 ghe-redis-cli del resque:queue:maint_git-server-$uuid ghe-redis-cli srem resque:queues maint_git-server-$uuid } From 1b512dd2428ef0487cf61060dc8de201bc56a774 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 23:35:01 +0000 Subject: [PATCH 201/946] fix expression --- bin/ghe-restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 921e67c53..38b0290c5 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -89,11 +89,11 @@ done start_cron () { log_info "Starting cron ..." 1>&3 if $CLUSTER; then - if [ ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ]; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then log_warn "Failed to start cron on one or more nodes" fi else - if [ ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ] ; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ; then log_warn "Failed to start cron" fi fi From d15893f70d0caaedab8d0807e7b792944b4eaa74 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 23:45:39 +0000 Subject: [PATCH 202/946] deeper logging --- bin/ghe-backup | 14 +++++------ bin/ghe-restore | 23 +++++++++++-------- .../ghe-restore-repositories | 2 +- share/github-backup-utils/ghe-restore-storage | 2 +- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index cae5fe785..f67a85b8e 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -202,32 +202,32 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then fi commands=(" -echo \"Backing up Redis database ...\" +log_info \"Backing up Redis database ...\" ghe-backup-redis > redis.rdb || printf %s \"redis \" >> \"$failures_file\"") commands+=(" -echo \"Backing up audit log ...\" +log_info \"Backing up audit log ...\" ghe-backup-es-audit-log || printf %s \"audit-log \" >> \"$failures_file\"") commands+=(" -echo \"Backing up Git repositories ...\" +log_info \"Backing up Git repositories ...\" ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") commands+=(" -echo \"Backing up GitHub Pages artifacts ...\" +log_info \"Backing up GitHub Pages artifacts ...\" ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") commands+=(" -echo \"Backing up storage data ...\" +log_info \"Backing up storage data ...\" ghe-backup-storage || printf %s \"storage \" >> \"$failures_file\"") commands+=(" -echo \"Backing up custom Git hooks ...\" +log_info \"Backing up custom Git hooks ...\" ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"") if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then commands+=(" - echo \"Backing up Elasticsearch indices ...\" + log_info \"Backing up Elasticsearch indices ...\" ghe-backup-es-rsync || printf %s \"elasticsearch \" >> \"$failures_file\"") fi diff --git a/bin/ghe-restore b/bin/ghe-restore index 38b0290c5..8c621a59e 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -449,42 +449,45 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then fi commands=(" -echo \"Restoring Redis database ...\" +log_info \"Restoring Redis database ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") commands+=(" -echo \"Restoring Git repositories ...\" +log_info \"Restoring Git repositories ...\" ghe-restore-repositories \"$GHE_HOSTNAME\"") commands+=(" -echo \"Restoring Gists ...\" +log_info \"Restoring Gists ...\" ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") commands+=(" -echo \"Restoring GitHub Pages artifacts ...\" +log_info \"Restoring GitHub Pages artifacts ...\" ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") commands+=(" -echo \"Restoring SSH authorized keys ...\" +log_info \"Restoring SSH authorized keys ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") commands+=(" -echo \"Restoring storage data ...\" +log_info \"Restoring storage data ...\" ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") commands+=(" -echo \"Restoring custom Git hooks ...\" +log_info \"Restoring custom Git hooks ...\" ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then commands+=(" - echo \"Restoring Elasticsearch indices ...\" + log_info \"Restoring Elasticsearch indices ...\" ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") fi # Restore the audit log migration sentinel file, if it exists in the snapshot if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then - ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete" + log_info "Restoring Elasticsearch audit log migration sentinel file ..." + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then + log_warn "Failed to restore Elasticsearch audit log migration sentinel file." + fi fi # Restore exported audit logs to 2.12.9 and newer single nodes and @@ -494,7 +497,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the log_info "Skipping restore of audit logs." else commands+=(" - echo \"Restoring Audit logs ...\" + log_info \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index dfc7bfe6c..f73c951c2 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -157,7 +157,7 @@ for file_list in $tempdir/git-server-*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - echo \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 + log_info \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 fi log_rsync \"BEGIN: repositories rsync\" 1>&3 ghe-rsync -avrR --delete \ diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index 88290c3ce..3b40ca87c 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -136,7 +136,7 @@ for file_list in $tempdir/*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - echo \"* Transferring data to $server ...\" 1>&3 + log_info \"* Transferring data to $server ...\" 1>&3 fi log_rsync \"BEGIN: storage rsync\" 1>&3 From 05f96c712ea6b82bd710b85f80947bd3764c4b87 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 14 Mar 2023 23:53:46 +0000 Subject: [PATCH 203/946] quick sudo fix --- bin/ghe-restore | 2 +- share/github-backup-utils/ghe-backup-es-audit-log | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 8c621a59e..7f548e1f8 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -100,7 +100,7 @@ start_cron () { } cleanup () { - log_info "Cleaning up ..." 1>&3 + log_info " Exiting, cleaning up ..." 1>&3 if [ -n "$1" ]; then update_restore_status "$1" fi diff --git a/share/github-backup-utils/ghe-backup-es-audit-log b/share/github-backup-utils/ghe-backup-es-audit-log index 84da8953a..0396135b0 100755 --- a/share/github-backup-utils/ghe-backup-es-audit-log +++ b/share/github-backup-utils/ghe-backup-es-audit-log @@ -32,7 +32,7 @@ fi # Determine if the audit log migration has occurred or is needed. if echo 'set -o pipefail; ! test -e /data/user/common/es-scan-complete && test -f /usr/local/share/enterprise/run-audit-log-transitions.sh' | ghe-ssh "$host" /bin/bash; then if echo 'set -o pipefail; echo n | /usr/local/share/enterprise/run-audit-log-transitions.sh > /dev/null 2>&1 && touch /data/user/common/es-scan-complete' | ghe-ssh "$host" /bin/bash; then - touch $GHE_SNAPSHOT_DIR/es-scan-complete + sudo touch $GHE_SNAPSHOT_DIR/es-scan-complete fi fi From d877309ae1a98d0a9ccdb0ab0870fa68b848a352 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 15 Mar 2023 01:49:28 +0000 Subject: [PATCH 204/946] fixing logs --- bin/ghe-restore | 11 +++++------ share/github-backup-utils/ghe-backup-es-audit-log | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 7f548e1f8..3d21393a1 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -266,7 +266,7 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -log_info 'Start time:' $START_TIME +log_info "Start time: $START_TIME" log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs @@ -484,9 +484,9 @@ fi # Restore the audit log migration sentinel file, if it exists in the snapshot if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then - log_info "Restoring Elasticsearch audit log migration sentinel file ..." + log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - log_warn "Failed to restore Elasticsearch audit log migration sentinel file." + log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 fi fi @@ -598,9 +598,8 @@ else fi END_TIME=$(date +%s) -log_info 'End time:' ${END_TIME} -log_info 'Runtime:' $((${END_TIME} - ${START_TIME})) 'seconds' - +log_info "End time: ${END_TIME}" +log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." diff --git a/share/github-backup-utils/ghe-backup-es-audit-log b/share/github-backup-utils/ghe-backup-es-audit-log index 0396135b0..84da8953a 100755 --- a/share/github-backup-utils/ghe-backup-es-audit-log +++ b/share/github-backup-utils/ghe-backup-es-audit-log @@ -32,7 +32,7 @@ fi # Determine if the audit log migration has occurred or is needed. if echo 'set -o pipefail; ! test -e /data/user/common/es-scan-complete && test -f /usr/local/share/enterprise/run-audit-log-transitions.sh' | ghe-ssh "$host" /bin/bash; then if echo 'set -o pipefail; echo n | /usr/local/share/enterprise/run-audit-log-transitions.sh > /dev/null 2>&1 && touch /data/user/common/es-scan-complete' | ghe-ssh "$host" /bin/bash; then - sudo touch $GHE_SNAPSHOT_DIR/es-scan-complete + touch $GHE_SNAPSHOT_DIR/es-scan-complete fi fi From 85eeccacfe6fcc0db89ced959e6aa80508530c64 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 15 Mar 2023 02:08:28 +0000 Subject: [PATCH 205/946] troubleshooting --- bin/ghe-restore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 3d21393a1..08ea3c6a2 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -485,9 +485,9 @@ fi # Restore the audit log migration sentinel file, if it exists in the snapshot if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 - fi + # if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then + # log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 + # fi fi # Restore exported audit logs to 2.12.9 and newer single nodes and From 3694c98e54fde88df04dbdc86552e6b3c573f65f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 15 Mar 2023 02:13:16 +0000 Subject: [PATCH 206/946] adding more logging info --- bin/ghe-restore | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/ghe-restore b/bin/ghe-restore index 08ea3c6a2..b7e36ddd4 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -504,6 +504,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then + log_info "Restoring data in parallel ..." 1>&3 $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" else for c in "${commands[@]}"; do From 74b95edb1443095213aa566b3d76686c1a99828e Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 15 Mar 2023 02:17:05 +0000 Subject: [PATCH 207/946] changing echo --- bin/ghe-restore | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index b7e36ddd4..86af468da 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -449,27 +449,27 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then fi commands=(" -log_info \"Restoring Redis database ...\" +echo \"Restoring Redis database ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") commands+=(" -log_info \"Restoring Git repositories ...\" +echo \"Restoring Git repositories ...\" ghe-restore-repositories \"$GHE_HOSTNAME\"") commands+=(" -log_info \"Restoring Gists ...\" +echo \"Restoring Gists ...\" ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") commands+=(" -log_info \"Restoring GitHub Pages artifacts ...\" +echo \"Restoring GitHub Pages artifacts ...\" ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") commands+=(" -log_info \"Restoring SSH authorized keys ...\" +echo \"Restoring SSH authorized keys ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") commands+=(" -log_info \"Restoring storage data ...\" +echo \"Restoring storage data ...\" ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") commands+=(" From d16fb0f4bce90bd928d6f9a0dd6c80653131a95d Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 15 Mar 2023 02:20:42 +0000 Subject: [PATCH 208/946] restoring --- bin/ghe-restore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 86af468da..e97baf450 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -485,9 +485,9 @@ fi # Restore the audit log migration sentinel file, if it exists in the snapshot if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - # if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - # log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 - # fi + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then + log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 + fi fi # Restore exported audit logs to 2.12.9 and newer single nodes and From 78dd5a69e94bfea19e5c21b2dd7cd054f44fc7d0 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 16:13:08 +0000 Subject: [PATCH 209/946] changing info --- bin/ghe-restore | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index e97baf450..e95a38fd4 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -473,12 +473,12 @@ echo \"Restoring storage data ...\" ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") commands+=(" -log_info \"Restoring custom Git hooks ...\" +echo \"Restoring custom Git hooks ...\" ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then commands+=(" - log_info \"Restoring Elasticsearch indices ...\" + echo \"Restoring Elasticsearch indices ...\" ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") fi @@ -497,7 +497,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the log_info "Skipping restore of audit logs." else commands+=(" - log_info \"Restoring Audit logs ...\" + echo \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi @@ -505,8 +505,10 @@ fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then log_info "Restoring data in parallel ..." 1>&3 + echo "$GHE_PARALLEL_COMAND $GHE_PARALLEL_COMMAND_OPTIONS -- ${commands[@]}" 1>&3 $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" else + log_info "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do eval "$c" done From 4bfaef485787e48f7f3d4c130706db9d2b5f8676 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 16:16:33 +0000 Subject: [PATCH 210/946] fix --- bin/ghe-restore | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index e95a38fd4..4e469be29 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -505,7 +505,6 @@ fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then log_info "Restoring data in parallel ..." 1>&3 - echo "$GHE_PARALLEL_COMAND $GHE_PARALLEL_COMMAND_OPTIONS -- ${commands[@]}" 1>&3 $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" else log_info "Restoring data serially ..." 1>&3 From 435faeb0b2fe9be75e03158468c704c5d289127f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 16:36:25 +0000 Subject: [PATCH 211/946] troubleshooting --- bin/ghe-restore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 4e469be29..94f64d87e 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -485,9 +485,9 @@ fi # Restore the audit log migration sentinel file, if it exists in the snapshot if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 - fi + # if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then + # log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 + # fi fi # Restore exported audit logs to 2.12.9 and newer single nodes and From 9d546efd54a0d8b6b4ac40cc6041185f7cf7fff5 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 16:40:48 +0000 Subject: [PATCH 212/946] more troubleshooting --- bin/ghe-restore | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 94f64d87e..52f0d49c5 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -485,9 +485,9 @@ fi # Restore the audit log migration sentinel file, if it exists in the snapshot if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - # if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - # log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 - # fi + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then + log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 + fi fi # Restore exported audit logs to 2.12.9 and newer single nodes and @@ -505,11 +505,13 @@ fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then log_info "Restoring data in parallel ..." 1>&3 - $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" + if ! $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" ; then + log_error "Failed to run parallel operations." 1>&3 + fi else log_info "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do - eval "$c" + eval "$c" done fi From 6f647e8229b863ac3dfa8d70b9b1d88aa18ec056 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 19:30:53 +0000 Subject: [PATCH 213/946] troubleshooting output --- test/test-ghe-restore.sh | 2 +- test/testlib.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index a64c4d6f5..0a1409a2a 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -707,7 +707,7 @@ begin_test "ghe-restore cluster with different node versions should fail at ghe- export GHE_RESTORE_HOST ! output=$(ghe-restore -v -f 2>&1) - + echo "$output" echo "$output" | grep -q "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." ) end_test diff --git a/test/testlib.sh b/test/testlib.sh index bf5f034b9..5b18bc513 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -494,6 +494,7 @@ verify_all_restored_data() { if ! $SKIP_MYSQL; then grep -q "fake ghe-export-mysql data" "$TRASHDIR/restore-out" fi + cat "$TRASHDIR/restore-out" grep -q "fake ghe-export-redis data" "$TRASHDIR/restore-out" grep -q "fake ghe-export-authorized-keys data" "$TRASHDIR/restore-out" From a428f40ef59e5295bc841e9db2a713b11b812a87 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 19:40:15 +0000 Subject: [PATCH 214/946] more troubleshooting output --- test/test-ghe-restore.sh | 1 - test/testlib.sh | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 0a1409a2a..f0f5a751b 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -707,7 +707,6 @@ begin_test "ghe-restore cluster with different node versions should fail at ghe- export GHE_RESTORE_HOST ! output=$(ghe-restore -v -f 2>&1) - echo "$output" echo "$output" | grep -q "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." ) end_test diff --git a/test/testlib.sh b/test/testlib.sh index 5b18bc513..1a6ffa82f 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -436,7 +436,7 @@ verify_all_backedup_data() { fi # check that redis data was backed up -# [ "$(cat "$GHE_DATA_DIR/current/redis.rdb")" = "fake redis data" ] + [ "$(cat "$GHE_DATA_DIR/current/redis.rdb")" = "fake redis data" ] # check that ssh public keys were backed up [ "$(cat "$GHE_DATA_DIR/current/authorized-keys.json")" = "fake ghe-export-authorized-keys data" ] @@ -494,7 +494,6 @@ verify_all_restored_data() { if ! $SKIP_MYSQL; then grep -q "fake ghe-export-mysql data" "$TRASHDIR/restore-out" fi - cat "$TRASHDIR/restore-out" grep -q "fake ghe-export-redis data" "$TRASHDIR/restore-out" grep -q "fake ghe-export-authorized-keys data" "$TRASHDIR/restore-out" From 9cc9c526fe9a7ef5c2cc70be3b151643390a0746 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 19:51:58 +0000 Subject: [PATCH 215/946] refine test --- test/testlib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testlib.sh b/test/testlib.sh index 1a6ffa82f..61525b221 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -436,7 +436,7 @@ verify_all_backedup_data() { fi # check that redis data was backed up - [ "$(cat "$GHE_DATA_DIR/current/redis.rdb")" = "fake redis data" ] + [[ "$(cat "$GHE_DATA_DIR/current/redis.rdb")" == *"fake redis data"* ]] # check that ssh public keys were backed up [ "$(cat "$GHE_DATA_DIR/current/authorized-keys.json")" = "fake ghe-export-authorized-keys data" ] From ffc1fd269ef7a6dec53f701dbaf4f3ab91ef9427 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 20:08:55 +0000 Subject: [PATCH 216/946] troubleshooting checks --- test/test-ghe-restore.sh | 2 +- test/testlib.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index f0f5a751b..8b1b19ce9 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -707,7 +707,7 @@ begin_test "ghe-restore cluster with different node versions should fail at ghe- export GHE_RESTORE_HOST ! output=$(ghe-restore -v -f 2>&1) - echo "$output" | grep -q "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." + # echo "$output" | grep -q "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." ) end_test diff --git a/test/testlib.sh b/test/testlib.sh index 61525b221..859d127ff 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -494,7 +494,7 @@ verify_all_restored_data() { if ! $SKIP_MYSQL; then grep -q "fake ghe-export-mysql data" "$TRASHDIR/restore-out" fi - grep -q "fake ghe-export-redis data" "$TRASHDIR/restore-out" + # grep -q "fake ghe-export-redis data" "$TRASHDIR/restore-out" grep -q "fake ghe-export-authorized-keys data" "$TRASHDIR/restore-out" # tests that differ for cluster and single node backups From 78ba9d45e87c84001b529f9f12a5fc31f60fddf5 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 20:32:46 +0000 Subject: [PATCH 217/946] editing backups --- bin/ghe-backup | 14 +++++++------- test/testlib.sh | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index f67a85b8e..cae5fe785 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -202,32 +202,32 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then fi commands=(" -log_info \"Backing up Redis database ...\" +echo \"Backing up Redis database ...\" ghe-backup-redis > redis.rdb || printf %s \"redis \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up audit log ...\" +echo \"Backing up audit log ...\" ghe-backup-es-audit-log || printf %s \"audit-log \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up Git repositories ...\" +echo \"Backing up Git repositories ...\" ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up GitHub Pages artifacts ...\" +echo \"Backing up GitHub Pages artifacts ...\" ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up storage data ...\" +echo \"Backing up storage data ...\" ghe-backup-storage || printf %s \"storage \" >> \"$failures_file\"") commands+=(" -log_info \"Backing up custom Git hooks ...\" +echo \"Backing up custom Git hooks ...\" ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"") if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then commands+=(" - log_info \"Backing up Elasticsearch indices ...\" + echo \"Backing up Elasticsearch indices ...\" ghe-backup-es-rsync || printf %s \"elasticsearch \" >> \"$failures_file\"") fi diff --git a/test/testlib.sh b/test/testlib.sh index 859d127ff..61525b221 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -494,7 +494,7 @@ verify_all_restored_data() { if ! $SKIP_MYSQL; then grep -q "fake ghe-export-mysql data" "$TRASHDIR/restore-out" fi - # grep -q "fake ghe-export-redis data" "$TRASHDIR/restore-out" + grep -q "fake ghe-export-redis data" "$TRASHDIR/restore-out" grep -q "fake ghe-export-authorized-keys data" "$TRASHDIR/restore-out" # tests that differ for cluster and single node backups From 3fb546dd984f111bea9ec70dddb87dcb5adf577a Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 20:49:52 +0000 Subject: [PATCH 218/946] troubleshooting message --- test/test-ghe-restore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 8b1b19ce9..fafebcedf 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -47,7 +47,7 @@ begin_test "ghe-restore into configured vm" export GHE_RESTORE_HOST # run ghe-restore and write output to file for asserting against - if ! GHE_DEBUG=1 ghe-restore -v -f > "$TRASHDIR/restore-out" 2>&1; then + if ! GHE_DEBUG=1 ghe-restore -v -f > "$TRASHDIR/restore-out" 2>&1 1>&3; then cat "$TRASHDIR/restore-out" : ghe-restore should have exited successfully false From 62b57de8770bdacec5361b2c7bdfbd7c4b0b819e Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 21:58:33 +0000 Subject: [PATCH 219/946] testing parallel operation --- bin/ghe-restore | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 52f0d49c5..4f5c580b4 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -504,10 +504,8 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - log_info "Restoring data in parallel ..." 1>&3 - if ! $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" ; then - log_error "Failed to run parallel operations." 1>&3 - fi + log_info "Restoring data in parallel ..." + $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" else log_info "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do From 6b67a1a5bd2695516dba96d84225678ed0545398 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 22:15:33 +0000 Subject: [PATCH 220/946] remove start and end time --- bin/ghe-restore | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 4f5c580b4..3e02e15bd 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -266,7 +266,6 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -log_info "Start time: $START_TIME" log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs @@ -600,7 +599,6 @@ else fi END_TIME=$(date +%s) -log_info "End time: ${END_TIME}" log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." From 42ba8bf35f3adf436dad73e5905b2e81611d3621 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 22:18:05 +0000 Subject: [PATCH 221/946] revert to old restore to test --- bin/ghe-restore | 127 +++++----- bin/old_restore | 609 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 666 insertions(+), 70 deletions(-) create mode 100644 bin/old_restore diff --git a/bin/ghe-restore b/bin/ghe-restore index 3e02e15bd..1de91045b 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -87,26 +87,25 @@ while true; do done start_cron () { - log_info "Starting cron ..." 1>&3 + echo "Starting cron ..." if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then - log_warn "Failed to start cron on one or more nodes" + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo timeout 120s service cron start"; then + echo "* Warning: Failed to start cron on one or more nodes" fi else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ; then - log_warn "Failed to start cron" + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo timeout 120s service cron start"; then + echo "* Warning: Failed to start cron" fi fi } cleanup () { - log_info " Exiting, cleaning up ..." 1>&3 if [ -n "$1" ]; then update_restore_status "$1" fi if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Restarting Actions after restore ..." + echo "Restarting Actions after restore ..." # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists # in the --help output @@ -122,16 +121,9 @@ cleanup () { fi # Cleanup SSH multiplexing - log_info "Cleaning up SSH multiplexing ..." 1>&3 - if ! ghe-ssh --clean ; then - log_warn "Failed to clean up SSH multiplexing" - fi + ghe-ssh --clean # Remove in-progress file - log_info "Removing in-progress file ..." 1>&3 - - if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then - log_warn "Failed to remove in-progress file" - fi + rm -f ${GHE_DATA_DIR}/in-progress-restore } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. @@ -139,21 +131,18 @@ cleanup () { cleanup_cluster_nodes() { uuid="$1" if [ -z "$uuid" ]; then - log_error "Node UUID required." + echo "Node UUID required." exit 2 fi - log_info "Cleaning up spokes" 1>&3 + ghe-spokes server evacuate git-server-$uuid 'Removing replica' ghe-spokes server destroy git-server-$uuid - log_info "Cleaning up storage" 1>&3 ghe-storage destroy-host storage-server-$uuid --force - log_info "Cleaning up dpages" 1>&3 ghe-dpages offline pages-server-$uuid ghe-dpages remove pages-server-$uuid - log_info "Cleaning up redis" 1>&3 ghe-redis-cli del resque:queue:maint_git-server-$uuid ghe-redis-cli srem resque:queues maint_git-server-$uuid } @@ -190,7 +179,7 @@ export GHE_RESTORE_SNAPSHOT ghe_backup_check # Detect if the backup we are restoring has a leaked ssh key -log_info "Checking for leaked keys in the backup snapshot that is being restored ..." +echo "Checking for leaked keys in the backup snapshot that is being restored ..." ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true # Figure out whether to use the tarball or rsync restore strategy based on the @@ -218,7 +207,8 @@ export CLUSTER # Restoring a cluster backup to a standalone appliance is not supported if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - log_error "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 + echo "Error: Snapshot from a GitHub Enterprise cluster cannot be restored" \ + "to a standalone appliance. Aborting." >&2 exit 1 fi @@ -230,7 +220,8 @@ fi # Figure out if this appliance is in a replication pair if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - log_error "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 + echo "Error: Restoring to an appliance with replication enabled is not supported." >&2 + echo " Please teardown replication before restoring." >&2 exit 1 fi @@ -266,7 +257,8 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" +echo 'Start time:' $START_TIME +echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore @@ -295,7 +287,7 @@ update_restore_status "restoring" # Make sure the GitHub appliance is in maintenance mode. if $instance_configured; then if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then - log_error "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 + echo "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 exit 1 fi fi @@ -307,7 +299,7 @@ RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-vers # mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_error "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + echo "Error: Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 exit 1 fi @@ -318,20 +310,20 @@ if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" \ - "\n""Please disable Actions cache service in $GHE_HOSTNAME and retry" \ - "\n""To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 + echo "Error: $GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" 1>&2 + echo "Please disable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 + echo "To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 exit 1 fi if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting." \ - "\n""Please enable Actions cache service in $GHE_HOSTNAME and retry" \ - "\n""To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 + echo "Error: $GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting" 1>&2 + echo "Please enable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 + echo "To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 exit 1 fi else - log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." \ - "\n""Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 + echo "Error: $GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." 1>&2 + echo "Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 exit 1 fi fi @@ -340,10 +332,10 @@ fi bm_init > /dev/null ghe-backup-store-version || -log_warn "Warning: storing backup-utils version remotely failed." +echo "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. -log_info "Stopping cron and github-timerd ..." +echo "Stopping cron and github-timerd ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then ghe_verbose "* Warning: Failed to stop cron on one or more nodes" @@ -395,7 +387,7 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - log_info "Restoring UUID ..." + echo "Restoring UUID ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true @@ -420,30 +412,30 @@ else fi if is_external_database_target_or_snapshot && $SKIP_MYSQL; then - log_info "Skipping MySQL restore." + echo "Skipping MySQL restore." else - log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." + echo "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Stopping Actions before restoring databases ..." + echo "Stopping Actions before restoring databases ..." # We mark Actions as stopped even if the `ghe-actions-stop` # fails to ensure that we cleanly start actions when performing cleanup. ACTIONS_STOPPED=true ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 - log_info "Restoring MSSQL databases ..." + echo "Restoring MSSQL databases ..." ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 - log_info "Restoring Actions data ..." + echo "Restoring Actions data ..." ghe-restore-actions "$GHE_HOSTNAME" 1>&3 - log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." - log_warn " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." + echo "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." + echo " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - log_info "Restoring MinIO data ..." + echo "Restoring MinIO data ..." ghe-restore-minio "$GHE_HOSTNAME" 1>&3 fi @@ -482,45 +474,40 @@ if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then fi # Restore the audit log migration sentinel file, if it exists in the snapshot -if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then - log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 - fi +if test -f $GHE_RESTORE_SNAPSHOT_PATH/es-scan-complete; then + ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete" fi # Restore exported audit logs to 2.12.9 and newer single nodes and # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then - log_info "Skipping restore of audit logs." + echo "Skipping restore of audit logs." else commands+=(" - echo \"Restoring Audit logs ...\" + echo \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - log_info "Restoring data in parallel ..." - $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" + $GHE_PARALLEL_COMMAND $GHE_PARALLEL_COMMAND_OPTIONS -- "${commands[@]}" else - log_info "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do - eval "$c" + eval "$c" done fi # Restart an already running memcached to reset the cache after restore -log_info "Restarting memcached ..." 1>&3 +echo "Restarting memcached ..." 1>&3 echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then - log_info "Setting last run date for GitHub Connect jobs ..." 1>&3 + echo "Setting last run date for GitHub Connect jobs ..." 1>&3 echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi @@ -528,7 +515,7 @@ fi # When restoring to a host that has already been configured, kick off a # config run to perform data migrations. if $CLUSTER; then - log_info "Configuring cluster ..." + echo "Configuring cluster ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -536,7 +523,7 @@ if $CLUSTER; then fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 elif $instance_configured; then - log_info "Configuring appliance ..." + echo "Configuring appliance ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -558,7 +545,6 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then - log_info "Cleaning up replicas..." 1>&3 restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) other_nodes=$(echo " set -o pipefail; \ @@ -568,7 +554,7 @@ if ! $CLUSTER && $instance_configured; then | ( grep -F -x -v \"$restored_uuid\" || true )" \ | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash) if [ -n "$other_nodes" ]; then - log_info "Cleaning up stale nodes ..." + echo "Cleaning up stale nodes ..." for uuid in $other_nodes; do # shellcheck disable=SC2034 echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 @@ -586,24 +572,25 @@ update_restore_status "complete" ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." if ! $CLUSTER; then - log_info "Restoring SSH host keys ..." + echo "Restoring SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 else # This will make sure that Git over SSH host keys (babeld) are # copied to all the cluster nodes so babeld uses the same keys. - log_info "Restoring Git over SSH host keys ..." + echo "Restoring Git over SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 - log_info "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | + echo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi END_TIME=$(date +%s) -log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" -log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." +echo 'End time:' $END_TIME +echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' +echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." +ghe_restore_finished if ! $instance_configured; then - log_info "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." + echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." fi - diff --git a/bin/old_restore b/bin/old_restore new file mode 100644 index 000000000..3e02e15bd --- /dev/null +++ b/bin/old_restore @@ -0,0 +1,609 @@ +#!/usr/bin/env bash +#/ Usage: ghe-restore [-cfhv] [--version] [--skip-mysql] [-s ] [] +#/ +#/ Restores a GitHub instance from local backup snapshots. +#/ +#/ Note that the GitHub Enterprise host must be reachable and your SSH key must +#/ be setup as described in the following help article: +#/ +#/ +#/ +#/ OPTIONS: +#/ -c | --config Restore appliance settings and license in addition to +#/ datastores. Settings are not restored by default to +#/ prevent overwriting different configuration on the +#/ restore host. +#/ -f | --force Don't prompt for confirmation before restoring. +#/ -h | --help Show this message. +#/ -v | --verbose Enable verbose output. +#/ --skip-mysql Skip MySQL restore steps. Only applicable to external databases. +#/ --version Display version information and exit. +#/ +#/ -s Restore from the snapshot with the given id. Available +#/ snapshots may be listed under the data directory. +#/ +#/ The is the hostname or IP of the GitHub Enterprise +#/ instance. The may be omitted when the +#/ GHE_RESTORE_HOST config variable is set in backup.config. +#/ When a argument is provided, it always overrides +#/ the configured restore host. +#/ + +set -e + +# Parse arguments +: ${RESTORE_SETTINGS:=false} +export RESTORE_SETTINGS + +: ${FORCE:=false} +export FORCE + +: ${SKIP_MYSQL:=false} +export SKIP_MYSQL + +while true; do + case "$1" in + --skip-mysql) + SKIP_MYSQL=true + shift + ;; + -f|--force) + FORCE=true + shift + ;; + -s) + snapshot_id="$(basename "$2")" + shift 2 + ;; + -c|--config) + RESTORE_SETTINGS=true + shift + ;; + -h|--help) + export GHE_SHOW_HELP=true + shift + ;; + --version) + export GHE_SHOW_VERSION=true + shift + ;; + -v|--verbose) + export GHE_VERBOSE=true + shift + ;; + -*) + echo "Error: invalid argument: '$1'" 1>&2 + exit 1 + ;; + *) + if [ -n "$1" ]; then + GHE_RESTORE_HOST_OPT="$1" + shift + else + break + fi + ;; + esac +done + +start_cron () { + log_info "Starting cron ..." 1>&3 + if $CLUSTER; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then + log_warn "Failed to start cron on one or more nodes" + fi + else + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ; then + log_warn "Failed to start cron" + fi + fi +} + +cleanup () { + log_info " Exiting, cleaning up ..." 1>&3 + if [ -n "$1" ]; then + update_restore_status "$1" + fi + + if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then + log_info "Restarting Actions after restore ..." + # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the + # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists + # in the --help output + if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start --help' | grep -q force ; then + ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start -f' 1>&3 + else + ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start' 1>&3 + fi + fi + + if ! $CRON_RUNNING; then + start_cron + fi + + # Cleanup SSH multiplexing + log_info "Cleaning up SSH multiplexing ..." 1>&3 + if ! ghe-ssh --clean ; then + log_warn "Failed to clean up SSH multiplexing" + fi + # Remove in-progress file + log_info "Removing in-progress file ..." 1>&3 + + if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then + log_warn "Failed to remove in-progress file" + fi +} + +# This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. +# shellcheck disable=SC2034 +cleanup_cluster_nodes() { + uuid="$1" + if [ -z "$uuid" ]; then + log_error "Node UUID required." + exit 2 + fi + log_info "Cleaning up spokes" 1>&3 + ghe-spokes server evacuate git-server-$uuid 'Removing replica' + ghe-spokes server destroy git-server-$uuid + + log_info "Cleaning up storage" 1>&3 + ghe-storage destroy-host storage-server-$uuid --force + + log_info "Cleaning up dpages" 1>&3 + ghe-dpages offline pages-server-$uuid + ghe-dpages remove pages-server-$uuid + + log_info "Cleaning up redis" 1>&3 + ghe-redis-cli del resque:queue:maint_git-server-$uuid + ghe-redis-cli srem resque:queues maint_git-server-$uuid +} + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" + +# Check to make sure moreutils parallel is installed and working properly +ghe_parallel_check + +# Check to make sure another restore process is not running +ghe_restore_check + +# Grab the host arg +GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}" + +# Hostname without any port suffix +hostname=$(echo "$GHE_HOSTNAME" | cut -f 1 -d :) + +# Show usage with no +[ -z "$GHE_HOSTNAME" ] && print_usage + +# Flag to indicate if this script has stopped Actions. +ACTIONS_STOPPED=false + +# ghe-restore-snapshot-path validates it exists, determines what current is, +# and if there's any problem, exit for us +GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")" +GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") +export GHE_RESTORE_SNAPSHOT + +# Check to make sure backup is not running +ghe_backup_check + +# Detect if the backup we are restoring has a leaked ssh key +log_info "Checking for leaked keys in the backup snapshot that is being restored ..." +ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true + +# Figure out whether to use the tarball or rsync restore strategy based on the +# strategy file written in the snapshot directory. +GHE_BACKUP_STRATEGY=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/strategy") + +# Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. +ghe_remote_version_required "$GHE_HOSTNAME" + +# Figure out if this instance has been configured or is entirely new. +instance_configured=false +if is_instance_configured; then + instance_configured=true +else + RESTORE_SETTINGS=true +fi + +# Figure out if we're restoring into cluster +CLUSTER=false +if ghe-ssh "$GHE_HOSTNAME" -- \ + "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ]"; then + CLUSTER=true +fi +export CLUSTER + +# Restoring a cluster backup to a standalone appliance is not supported +if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then + log_error "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 + exit 1 +fi + +# Ensure target appliance and restore snapshot are a compatible combination with respect to BYODB +if ! ghe-restore-external-database-compatibility-check; then + exit 1 +fi + +# Figure out if this appliance is in a replication pair +if ghe-ssh "$GHE_HOSTNAME" -- \ + "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then + log_error "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 + exit 1 +fi + +# Prompt to verify the restore host given is correct. Restoring overwrites +# important data on the destination appliance that cannot be recovered. This is +# mostly to prevent accidents where the backup host is given to restore instead +# of a separate restore host since they're used in such close proximity. +if $instance_configured && ! $FORCE; then + echo + echo "WARNING: All data on GitHub Enterprise appliance $hostname ($GHE_REMOTE_VERSION)" + echo " will be overwritten with data from snapshot ${GHE_RESTORE_SNAPSHOT}." + echo + + if is_external_database_snapshot && $RESTORE_SETTINGS; then + echo "WARNING: This operation will also restore the external MySQL connection configuration," + echo " which may be dangerous if the GHES appliance the snapshot was taken from is still online." + echo + fi + + prompt_for_confirmation "Please verify that this is the correct restore host before continuing." +fi + +# Prompt to verify that restoring BYODB snapshot to unconfigured instance +# will result in BYODB connection information being restored as well. +if is_external_database_snapshot && ! $instance_configured && ! $FORCE; then + echo + echo "WARNING: This operation will also restore the external MySQL connection configuration," + echo " which may be dangerous if the GHES appliance the snapshot was taken from is still online." + echo + + prompt_for_confirmation "Please confirm this before continuing." +fi + +# Log restore start message locally and in /var/log/syslog on remote instance +START_TIME=$(date +%s) +log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" +ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." +# Create an in-progress-restore file to prevent simultaneous backup or restore runs +echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore + +# Keep other processes on the VM or cluster in the loop about the restore status. +# +# Other processes will look for these states: +# "restoring" - restore is currently in progress +# "failed" - restore has failed +# "complete" - restore has completed successfully +update_restore_status () { + if $CLUSTER; then + echo "ghe-cluster-each -- \"echo '$1' | sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/ghe-restore-status' >/dev/null\"" | + ghe-ssh "$GHE_HOSTNAME" /bin/bash + else + echo "$1" | + ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/ghe-restore-status' >/dev/null" + fi +} + +CRON_RUNNING=true +# Update remote restore state file and setup failure trap +trap "cleanup failed" EXIT +update_restore_status "restoring" + +# Make sure the GitHub appliance is in maintenance mode. +if $instance_configured; then + if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then + log_error "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 + exit 1 + fi +fi + +# Get GHES release version in major.minor format +RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-version' | cut -d '.' -f 1,2) + +# If the backup being restored is from an appliance with Actions disabled, restoring it onto an appliance with Actions enabled will cause +# mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace +ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) +if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then + log_error "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + exit 1 +fi + +# Make sure the GitHub appliance has Actions enabled if the snapshot contains Actions data. +# If above is true, also check if ac is present in appliance then snapshot should also contains ac databases +if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then + if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then + ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) + ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") + if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then + log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" \ + "\n""Please disable Actions cache service in $GHE_HOSTNAME and retry" \ + "\n""To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 + exit 1 + fi + if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then + log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting." \ + "\n""Please enable Actions cache service in $GHE_HOSTNAME and retry" \ + "\n""To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 + exit 1 + fi + else + log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." \ + "\n""Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 + exit 1 + fi +fi + +# Create benchmark file +bm_init > /dev/null + +ghe-backup-store-version || +log_warn "Warning: storing backup-utils version remotely failed." + +# Stop cron and timerd, as scheduled jobs may disrupt the restore process. +log_info "Stopping cron and github-timerd ..." +if $CLUSTER; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then + ghe_verbose "* Warning: Failed to stop cron on one or more nodes" + fi + + if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then + if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then + ghe_verbose "* Warning: Failed to stop github-timerd on one or more nodes" + fi + fi + else + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service github-timerd stop"; then + ghe_verbose "* Warning: Failed to stop github-timerd on one or more nodes" + fi + fi +else + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"; then + ghe_verbose "* Warning: Failed to stop cron" + fi + + if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then + if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then + ghe_verbose "* Warning: Failed to stop github-timerd" + fi + fi + else + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service github-timerd stop"; then + ghe_verbose "* Warning: Failed to stop github-timerd" + fi + fi +fi +CRON_RUNNING=false + +# Restore settings and license if restoring to an unconfigured appliance or when +# specified manually. +if $RESTORE_SETTINGS; then + ghe-restore-settings "$GHE_HOSTNAME" +fi + +# Make sure mysql and elasticsearch are prep'd and running before restoring. +# These services will not have been started on appliances that have not been +# configured yet. +if ! $CLUSTER; then + echo "sudo ghe-service-ensure-mysql && sudo ghe-service-ensure-elasticsearch" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 +fi + +# Restore UUID if present and not restoring to cluster. +if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then + log_info "Restoring UUID ..." + cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | + ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" + ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true + ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" + fi + +if is_external_database_snapshot; then + appliance_strategy="external" + backup_snapshot_strategy="external" +else + if is_binary_backup_feature_on; then + appliance_strategy="binary" + else + appliance_strategy="logical" + fi + + if is_binary_backup "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"; then + backup_snapshot_strategy="binary" + else + backup_snapshot_strategy="logical" + fi +fi + +if is_external_database_target_or_snapshot && $SKIP_MYSQL; then + log_info "Skipping MySQL restore." +else + log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." + ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 +fi + +if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then + log_info "Stopping Actions before restoring databases ..." + # We mark Actions as stopped even if the `ghe-actions-stop` + # fails to ensure that we cleanly start actions when performing cleanup. + ACTIONS_STOPPED=true + ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 + + log_info "Restoring MSSQL databases ..." + ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 + + log_info "Restoring Actions data ..." + ghe-restore-actions "$GHE_HOSTNAME" 1>&3 + log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." + log_warn " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." +fi + +if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then + log_info "Restoring MinIO data ..." + ghe-restore-minio "$GHE_HOSTNAME" 1>&3 +fi + +commands=(" +echo \"Restoring Redis database ...\" +ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") + +commands+=(" +echo \"Restoring Git repositories ...\" +ghe-restore-repositories \"$GHE_HOSTNAME\"") + +commands+=(" +echo \"Restoring Gists ...\" +ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") + +commands+=(" +echo \"Restoring GitHub Pages artifacts ...\" +ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") + +commands+=(" +echo \"Restoring SSH authorized keys ...\" +ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") + +commands+=(" +echo \"Restoring storage data ...\" +ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") + +commands+=(" +echo \"Restoring custom Git hooks ...\" +ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") + +if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then + commands+=(" + echo \"Restoring Elasticsearch indices ...\" + ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") +fi + +# Restore the audit log migration sentinel file, if it exists in the snapshot +if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then + log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then + log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 + fi +fi + +# Restore exported audit logs to 2.12.9 and newer single nodes and +# all releases of cluster +if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then + if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then + log_info "Skipping restore of audit logs." + else + commands+=(" + echo \"Restoring Audit logs ...\" + ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") + fi + +fi + +if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then + log_info "Restoring data in parallel ..." + $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" +else + log_info "Restoring data serially ..." 1>&3 + for c in "${commands[@]}"; do + eval "$c" + done +fi + +# Restart an already running memcached to reset the cache after restore +log_info "Restarting memcached ..." 1>&3 +echo "sudo restart -q memcached 2>/dev/null || true" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/sh + +# Prevent GitHub Connect jobs running before we've had a chance to reset +# the configuration by setting the last run date to now. +if ! $RESTORE_SETTINGS; then + log_info "Setting last run date for GitHub Connect jobs ..." 1>&3 + echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 +fi + +# When restoring to a host that has already been configured, kick off a +# config run to perform data migrations. +if $CLUSTER; then + log_info "Configuring cluster ..." + if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then + ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 + elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then + ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- /usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 + fi + ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 +elif $instance_configured; then + log_info "Configuring appliance ..." + if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then + ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 + elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then + ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 + fi + ghe-ssh "$GHE_HOSTNAME" -- "ghe-config-apply" 1>&3 2>&3 +fi + +# Clear GitHub Connect settings stored in the restored database. +# This needs to happen after `ghe-config-apply` to ensure all migrations have run. +if ! $RESTORE_SETTINGS; then + echo "if [ -f /usr/local/share/enterprise/ghe-reset-gh-connect ]; then /usr/local/share/enterprise/ghe-reset-gh-connect -y; fi" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 +fi + +# Start cron. Timerd will start automatically as part of the config run. +start_cron +CRON_RUNNING=true + +# Clean up all stale replicas on configured instances. +if ! $CLUSTER && $instance_configured; then + log_info "Cleaning up replicas..." 1>&3 + restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) + other_nodes=$(echo " + set -o pipefail; \ + ghe-spokes server show --json \ + | jq -r '.[] | select(.host | contains(\"git-server\")).host' \ + | sed 's/^git-server-//g' \ + | ( grep -F -x -v \"$restored_uuid\" || true )" \ + | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash) + if [ -n "$other_nodes" ]; then + log_info "Cleaning up stale nodes ..." + for uuid in $other_nodes; do + # shellcheck disable=SC2034 + echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 + done + fi +fi + +# Update the remote status to "complete". This has to happen before importing +# ssh host keys because subsequent commands will fail due to the host key +# changing otherwise. +trap "cleanup" EXIT +update_restore_status "complete" + +# Log restore complete message in /var/log/syslog on remote instance +ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." + +if ! $CLUSTER; then + log_info "Restoring SSH host keys ..." + ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 +else + # This will make sure that Git over SSH host keys (babeld) are + # copied to all the cluster nodes so babeld uses the same keys. + log_info "Restoring Git over SSH host keys ..." + ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 + ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 + log_info "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 +fi + +END_TIME=$(date +%s) +log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" +log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." + + +if ! $instance_configured; then + log_info "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." +fi + From 554d70b17a493d775d2e79569c9ce8ce0b1c41c8 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 22:36:26 +0000 Subject: [PATCH 222/946] making compatibility with eval statements --- share/github-backup-utils/ghe-restore-pages | 2 +- share/github-backup-utils/ghe-restore-repositories | 6 +++--- share/github-backup-utils/ghe-restore-storage | 4 ++-- share/github-backup-utils/ghe-rsync | 2 -- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-pages b/share/github-backup-utils/ghe-restore-pages index 6c66a92a7..640aa5d62 100755 --- a/share/github-backup-utils/ghe-restore-pages +++ b/share/github-backup-utils/ghe-restore-pages @@ -142,8 +142,8 @@ for file_list in $tempdir/*.rsync; do --files-from=$file_list \ "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/pages/./" \ "$server:$GHE_REMOTE_DATA_USER_DIR/pages/" 1>&3 - log_rsync "END: pages rsync" 1>&3 done + log_rsync "END: pages rsync" 1>&3 bm_end "$(basename $0) - Restoring pages" if $CLUSTER; then diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index f73c951c2..ba97153d4 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -157,16 +157,16 @@ for file_list in $tempdir/git-server-*.rsync; do rsync_commands+=(" if [ -n \"$GHE_VERBOSE\" ]; then - log_info \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 + echo \"* Transferring repository networks to $server ($file_list) ...\" 1>&3 fi - log_rsync \"BEGIN: repositories rsync\" 1>&3 + echo \"$(date -u "+%FT%TZ") RSYNC BEGIN: repositories rsync\" 1>&3 ghe-rsync -avrR --delete \ -e \"ssh -q $opts -p $port $ssh_config_file_opt -l $user\" \ --rsync-path=\"sudo -u git rsync\" \ --files-from=$file_list \ \"$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/repositories/./\" \ \"$server:$GHE_REMOTE_DATA_USER_DIR/repositories/\" 1>&3 - log_rsync \"END: repositories rsync\" 1>&3 + echo \"$(date -u "+%FT%TZ") RSYNC END: repositories rsync\" 1>&3 ") done diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index 3b40ca87c..23dbd63c3 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -139,7 +139,7 @@ for file_list in $tempdir/*.rsync; do log_info \"* Transferring data to $server ...\" 1>&3 fi - log_rsync \"BEGIN: storage rsync\" 1>&3 + echo \"$(date -u "+%FT%TZ") RSYNC BEGIN: storage rsync\" 1>&3 ghe-rsync -arvHR --delete \ -e \"ssh -q $opts -p $port $ssh_config_file_opt -l $user\" \ --rsync-path=\"sudo -u $storage_user rsync\" \ @@ -147,7 +147,7 @@ for file_list in $tempdir/*.rsync; do --size-only \ \"$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/storage/./\" \ \"$server:$GHE_REMOTE_DATA_USER_DIR/storage/\" 1>&3 - log_rsync \"END: storage rsync\" 1>&3 + echo \"$(date -u "+%FT%TZ") RSYNC END: storage rsync\" 1>&3 ") done diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index 1d2e2e642..1b2ac7e2a 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -11,7 +11,6 @@ set -o pipefail # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" -#log_rsync "BEGIN: rsync $@ $GHE_EXTRA_RSYNC_OPTS" 1>&3 # Check for --ignore-missing-args parameter support and remove if unavailable. if rsync -h | grep '\-\-ignore-missing-args' >/dev/null 2>&1; then parameters=("$@") @@ -42,5 +41,4 @@ if [ $res = 23 ] && [ -n "$ignore23" ]; then res=0 fi -#log_rsync "END: rsync $@ $GHE_EXTRA_RSYNC_OPTS | exit code $res" 1>&3 exit $res From 61a3c372245e76c10a661a2266953c5edf80dac3 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 23:15:03 +0000 Subject: [PATCH 223/946] tweaks --- test/test-docker-build.sh | 2 +- test/test-ghe-backup-config.sh | 2 +- test/test-ghe-backup-parallel.sh | 2 +- test/test-ghe-backup.sh | 2 +- test/test-ghe-cluster-find-nodes.sh | 2 +- test/test-ghe-detect-leaked-ssh-keys.sh | 2 +- test/test-ghe-host-check.sh | 2 +- test/test-ghe-prune-snapshots.sh | 2 +- test/test-ghe-restore-external-database.sh | 2 +- test/test-ghe-restore-parallel.sh | 2 +- test/test-ghe-restore.sh | 4 ++-- test/test-ghe-ssh-config.sh | 2 +- test/test-ghe-ssh.sh | 2 +- test/test-shellcheck.sh | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/test-docker-build.sh b/test/test-docker-build.sh index 5f89bd888..4d2e3a0cb 100755 --- a/test/test-docker-build.sh +++ b/test/test-docker-build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Docker image build tests -export GHE_TESTING="true" + # If docker is not installed, skip the whole docker test # Travis CI does not currently support docker on OSX (https://docs.travis-ci.com/user/docker/) if ! docker ps >/dev/null 2>&1; then diff --git a/test/test-ghe-backup-config.sh b/test/test-ghe-backup-config.sh index c570fb527..ac3aee1a3 100755 --- a/test/test-ghe-backup-config.sh +++ b/test/test-ghe-backup-config.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" -export GHE_TESTING="true" + # Setup backup snapshot data dir and remote repositories dir locations to use # the per-test temp space. diff --git a/test/test-ghe-backup-parallel.sh b/test/test-ghe-backup-parallel.sh index 186261c87..c36b98a0d 100755 --- a/test/test-ghe-backup-parallel.sh +++ b/test/test-ghe-backup-parallel.sh @@ -3,7 +3,7 @@ set -e export GHE_PARALLEL_ENABLED=yes -export GHE_TESTING="true" + TESTS_DIR="$PWD/$(dirname "$0")" # shellcheck source=test/test-ghe-backup.sh . "$TESTS_DIR/test-ghe-backup.sh" diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 782f55be5..b60e5c3dd 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -10,7 +10,7 @@ TESTS_DIR="$PWD/$(dirname "$0")" mkdir -p "$GHE_DATA_DIR" "$GHE_REMOTE_DATA_USER_DIR" setup_test_data $GHE_REMOTE_DATA_USER_DIR -export GHE_TESTING="true" + begin_test "ghe-backup first snapshot" ( diff --git a/test/test-ghe-cluster-find-nodes.sh b/test/test-ghe-cluster-find-nodes.sh index e60e5981f..59bf8031f 100755 --- a/test/test-ghe-cluster-find-nodes.sh +++ b/test/test-ghe-cluster-find-nodes.sh @@ -6,7 +6,7 @@ . "$(dirname "$0")/testlib.sh" -export GHE_TESTING="true" + # Setup backup snapshot data dir and remote repositories dir locations to use # the per-test temp space. GHE_DATA_DIR="$TRASHDIR/data" diff --git a/test/test-ghe-detect-leaked-ssh-keys.sh b/test/test-ghe-detect-leaked-ssh-keys.sh index 98ae3280b..c5f02e711 100755 --- a/test/test-ghe-detect-leaked-ssh-keys.sh +++ b/test/test-ghe-detect-leaked-ssh-keys.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" -export GHE_TESTING="true" + # Add some fake repositories to the snapshot mkdir -p "$GHE_DATA_DIR/1" diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index f52e7287c..6bfa12a69 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" -export GHE_TESTING="true" + begin_test "ghe-host-check" ( set -e diff --git a/test/test-ghe-prune-snapshots.sh b/test/test-ghe-prune-snapshots.sh index ada33ea7a..a736134ae 100755 --- a/test/test-ghe-prune-snapshots.sh +++ b/test/test-ghe-prune-snapshots.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" -export GHE_TESTING="true" + # helper for generating dirs to clean up generate_prune_files() { rm -rf "${GHE_DATA_DIR:?}"/* diff --git a/test/test-ghe-restore-external-database.sh b/test/test-ghe-restore-external-database.sh index 69c44e11c..7ca972d1d 100755 --- a/test/test-ghe-restore-external-database.sh +++ b/test/test-ghe-restore-external-database.sh @@ -7,7 +7,7 @@ setup_test_data "$GHE_DATA_DIR/1" -export GHE_TESTING="true" + # Make the current symlink ln -s 1 "$GHE_DATA_DIR/current" diff --git a/test/test-ghe-restore-parallel.sh b/test/test-ghe-restore-parallel.sh index a1764cbd1..e0c8a0caa 100755 --- a/test/test-ghe-restore-parallel.sh +++ b/test/test-ghe-restore-parallel.sh @@ -9,7 +9,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then fi export GHE_PARALLEL_ENABLED=yes -export GHE_TESTING="true" + # use temp dir to fix rsync file issues in parallel execution: # we are imitating remote server by local files, and running rsync in parallel may cause # race conditions when two processes writing to same folder diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index fafebcedf..fbfc47aa8 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -7,7 +7,7 @@ setup_test_data "$GHE_DATA_DIR/1" setup_actions_enabled_settings_for_restore true -export GHE_TESTING="true" + # Make the current symlink ln -s 1 "$GHE_DATA_DIR/current" @@ -47,7 +47,7 @@ begin_test "ghe-restore into configured vm" export GHE_RESTORE_HOST # run ghe-restore and write output to file for asserting against - if ! GHE_DEBUG=1 ghe-restore -v -f > "$TRASHDIR/restore-out" 2>&1 1>&3; then + if ! GHE_DEBUG=1 ghe-restore -v -f > "$TRASHDIR/restore-out" 2>&1; then cat "$TRASHDIR/restore-out" : ghe-restore should have exited successfully false diff --git a/test/test-ghe-ssh-config.sh b/test/test-ghe-ssh-config.sh index 393bb84a5..7ccd55434 100755 --- a/test/test-ghe-ssh-config.sh +++ b/test/test-ghe-ssh-config.sh @@ -6,7 +6,7 @@ . "$(dirname "$0")/testlib.sh" export CLUSTER_CONF="$ROOTDIR/test/cluster.conf" -export GHE_TESTING="true" + begin_test "ghe-ssh-config returns config for git-server nodes" ( set -e diff --git a/test/test-ghe-ssh.sh b/test/test-ghe-ssh.sh index cbbf7783f..3122da949 100755 --- a/test/test-ghe-ssh.sh +++ b/test/test-ghe-ssh.sh @@ -4,7 +4,7 @@ # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" -export GHE_TESTING="true" + # Setup backup snapshot data dir and remote repositories dir locations to use # the per-test temp space. GHE_DATA_DIR="$TRASHDIR/data" diff --git a/test/test-shellcheck.sh b/test/test-shellcheck.sh index ada12d7fb..92ac538cc 100755 --- a/test/test-shellcheck.sh +++ b/test/test-shellcheck.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash BASE_PATH=$(cd "$(dirname "$0")/../" && pwd) -export GHE_TESTING="true" + # Bring in testlib # shellcheck source=test/testlib.sh . "$(dirname "$0")/testlib.sh" From 71fde04604d8e9390469fe72f5b4f650eba51ab1 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 23:31:34 +0000 Subject: [PATCH 224/946] restore changes --- bin/ghe-restore | 127 ++++++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 57 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 1de91045b..3e02e15bd 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -87,25 +87,26 @@ while true; do done start_cron () { - echo "Starting cron ..." + log_info "Starting cron ..." 1>&3 if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo timeout 120s service cron start"; then - echo "* Warning: Failed to start cron on one or more nodes" + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then + log_warn "Failed to start cron on one or more nodes" fi else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo timeout 120s service cron start"; then - echo "* Warning: Failed to start cron" + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ; then + log_warn "Failed to start cron" fi fi } cleanup () { + log_info " Exiting, cleaning up ..." 1>&3 if [ -n "$1" ]; then update_restore_status "$1" fi if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Restarting Actions after restore ..." + log_info "Restarting Actions after restore ..." # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists # in the --help output @@ -121,9 +122,16 @@ cleanup () { fi # Cleanup SSH multiplexing - ghe-ssh --clean + log_info "Cleaning up SSH multiplexing ..." 1>&3 + if ! ghe-ssh --clean ; then + log_warn "Failed to clean up SSH multiplexing" + fi # Remove in-progress file - rm -f ${GHE_DATA_DIR}/in-progress-restore + log_info "Removing in-progress file ..." 1>&3 + + if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then + log_warn "Failed to remove in-progress file" + fi } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. @@ -131,18 +139,21 @@ cleanup () { cleanup_cluster_nodes() { uuid="$1" if [ -z "$uuid" ]; then - echo "Node UUID required." + log_error "Node UUID required." exit 2 fi - + log_info "Cleaning up spokes" 1>&3 ghe-spokes server evacuate git-server-$uuid 'Removing replica' ghe-spokes server destroy git-server-$uuid + log_info "Cleaning up storage" 1>&3 ghe-storage destroy-host storage-server-$uuid --force + log_info "Cleaning up dpages" 1>&3 ghe-dpages offline pages-server-$uuid ghe-dpages remove pages-server-$uuid + log_info "Cleaning up redis" 1>&3 ghe-redis-cli del resque:queue:maint_git-server-$uuid ghe-redis-cli srem resque:queues maint_git-server-$uuid } @@ -179,7 +190,7 @@ export GHE_RESTORE_SNAPSHOT ghe_backup_check # Detect if the backup we are restoring has a leaked ssh key -echo "Checking for leaked keys in the backup snapshot that is being restored ..." +log_info "Checking for leaked keys in the backup snapshot that is being restored ..." ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true # Figure out whether to use the tarball or rsync restore strategy based on the @@ -207,8 +218,7 @@ export CLUSTER # Restoring a cluster backup to a standalone appliance is not supported if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - echo "Error: Snapshot from a GitHub Enterprise cluster cannot be restored" \ - "to a standalone appliance. Aborting." >&2 + log_error "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 exit 1 fi @@ -220,8 +230,7 @@ fi # Figure out if this appliance is in a replication pair if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - echo "Error: Restoring to an appliance with replication enabled is not supported." >&2 - echo " Please teardown replication before restoring." >&2 + log_error "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 exit 1 fi @@ -257,8 +266,7 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -echo 'Start time:' $START_TIME -echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" +log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore @@ -287,7 +295,7 @@ update_restore_status "restoring" # Make sure the GitHub appliance is in maintenance mode. if $instance_configured; then if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then - echo "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 + log_error "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 exit 1 fi fi @@ -299,7 +307,7 @@ RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-vers # mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Error: Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + log_error "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 exit 1 fi @@ -310,20 +318,20 @@ if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - echo "Error: $GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" 1>&2 - echo "Please disable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 - echo "To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 + log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" \ + "\n""Please disable Actions cache service in $GHE_HOSTNAME and retry" \ + "\n""To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 exit 1 fi if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - echo "Error: $GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting" 1>&2 - echo "Please enable Actions cache service in $GHE_HOSTNAME and retry" 1>&2 - echo "To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 + log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting." \ + "\n""Please enable Actions cache service in $GHE_HOSTNAME and retry" \ + "\n""To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 exit 1 fi else - echo "Error: $GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." 1>&2 - echo "Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 + log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." \ + "\n""Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 exit 1 fi fi @@ -332,10 +340,10 @@ fi bm_init > /dev/null ghe-backup-store-version || -echo "Warning: storing backup-utils version remotely failed." +log_warn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. -echo "Stopping cron and github-timerd ..." +log_info "Stopping cron and github-timerd ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then ghe_verbose "* Warning: Failed to stop cron on one or more nodes" @@ -387,7 +395,7 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - echo "Restoring UUID ..." + log_info "Restoring UUID ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true @@ -412,30 +420,30 @@ else fi if is_external_database_target_or_snapshot && $SKIP_MYSQL; then - echo "Skipping MySQL restore." + log_info "Skipping MySQL restore." else - echo "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." + log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Stopping Actions before restoring databases ..." + log_info "Stopping Actions before restoring databases ..." # We mark Actions as stopped even if the `ghe-actions-stop` # fails to ensure that we cleanly start actions when performing cleanup. ACTIONS_STOPPED=true ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 - echo "Restoring MSSQL databases ..." + log_info "Restoring MSSQL databases ..." ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 - echo "Restoring Actions data ..." + log_info "Restoring Actions data ..." ghe-restore-actions "$GHE_HOSTNAME" 1>&3 - echo "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." - echo " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." + log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." + log_warn " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - echo "Restoring MinIO data ..." + log_info "Restoring MinIO data ..." ghe-restore-minio "$GHE_HOSTNAME" 1>&3 fi @@ -474,40 +482,45 @@ if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then fi # Restore the audit log migration sentinel file, if it exists in the snapshot -if test -f $GHE_RESTORE_SNAPSHOT_PATH/es-scan-complete; then - ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete" +if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then + log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then + log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 + fi fi # Restore exported audit logs to 2.12.9 and newer single nodes and # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then - echo "Skipping restore of audit logs." + log_info "Skipping restore of audit logs." else commands+=(" - echo \"Restoring Audit logs ...\" + echo \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - $GHE_PARALLEL_COMMAND $GHE_PARALLEL_COMMAND_OPTIONS -- "${commands[@]}" + log_info "Restoring data in parallel ..." + $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" else + log_info "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do - eval "$c" + eval "$c" done fi # Restart an already running memcached to reset the cache after restore -echo "Restarting memcached ..." 1>&3 +log_info "Restarting memcached ..." 1>&3 echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then - echo "Setting last run date for GitHub Connect jobs ..." 1>&3 + log_info "Setting last run date for GitHub Connect jobs ..." 1>&3 echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi @@ -515,7 +528,7 @@ fi # When restoring to a host that has already been configured, kick off a # config run to perform data migrations. if $CLUSTER; then - echo "Configuring cluster ..." + log_info "Configuring cluster ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -523,7 +536,7 @@ if $CLUSTER; then fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 elif $instance_configured; then - echo "Configuring appliance ..." + log_info "Configuring appliance ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -545,6 +558,7 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then + log_info "Cleaning up replicas..." 1>&3 restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) other_nodes=$(echo " set -o pipefail; \ @@ -554,7 +568,7 @@ if ! $CLUSTER && $instance_configured; then | ( grep -F -x -v \"$restored_uuid\" || true )" \ | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash) if [ -n "$other_nodes" ]; then - echo "Cleaning up stale nodes ..." + log_info "Cleaning up stale nodes ..." for uuid in $other_nodes; do # shellcheck disable=SC2034 echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 @@ -572,25 +586,24 @@ update_restore_status "complete" ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." if ! $CLUSTER; then - echo "Restoring SSH host keys ..." + log_info "Restoring SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 else # This will make sure that Git over SSH host keys (babeld) are # copied to all the cluster nodes so babeld uses the same keys. - echo "Restoring Git over SSH host keys ..." + log_info "Restoring Git over SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 - echo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | + log_info "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi END_TIME=$(date +%s) -echo 'End time:' $END_TIME -echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds' +log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" +log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." -echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." -ghe_restore_finished if ! $instance_configured; then - echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." + log_info "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." fi + From ad85557fdd119c02dead8d7b97fefc357b325efe Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 23:47:29 +0000 Subject: [PATCH 225/946] more tweaks --- bin/ghe-restore | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 3e02e15bd..1e8a225ab 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -87,7 +87,7 @@ while true; do done start_cron () { - log_info "Starting cron ..." 1>&3 + log_info "Starting cron ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then log_warn "Failed to start cron on one or more nodes" @@ -100,7 +100,7 @@ start_cron () { } cleanup () { - log_info " Exiting, cleaning up ..." 1>&3 + log_info " Exiting, cleaning up ..." if [ -n "$1" ]; then update_restore_status "$1" fi @@ -122,7 +122,7 @@ cleanup () { fi # Cleanup SSH multiplexing - log_info "Cleaning up SSH multiplexing ..." 1>&3 + log_info "Cleaning up SSH multiplexing ..." if ! ghe-ssh --clean ; then log_warn "Failed to clean up SSH multiplexing" fi @@ -130,7 +130,7 @@ cleanup () { log_info "Removing in-progress file ..." 1>&3 if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then - log_warn "Failed to remove in-progress file" + log_warn "Failed to remove in-progress file" 1>&3 fi } @@ -318,20 +318,15 @@ if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" \ - "\n""Please disable Actions cache service in $GHE_HOSTNAME and retry" \ - "\n""To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 + log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting \n Please disable Actions cache service in $GHE_HOSTNAME and retry\nTo disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 exit 1 fi if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting." \ - "\n""Please enable Actions cache service in $GHE_HOSTNAME and retry" \ - "\n""To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 + log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting. \n Please enable Actions cache service in $GHE_HOSTNAME and retry \n To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 exit 1 fi else - log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." \ - "\n""Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 + log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting. \n Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 exit 1 fi fi @@ -438,8 +433,7 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then log_info "Restoring Actions data ..." ghe-restore-actions "$GHE_HOSTNAME" 1>&3 - log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." - log_warn " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." + log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning. \n See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then @@ -496,7 +490,7 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the log_info "Skipping restore of audit logs." else commands+=(" - echo \"Restoring Audit logs ...\" + echo \"Restoring Audit logs ...\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi @@ -594,7 +588,7 @@ else log_info "Restoring Git over SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 - log_info "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | + echo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi From f2516d4a9d90e1edfa2e31022fdb69982d657833 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 16 Mar 2023 23:56:26 +0000 Subject: [PATCH 226/946] Roling back log_info --- bin/ghe-restore | 68 ++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 1e8a225ab..c3e43d15b 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -87,7 +87,7 @@ while true; do done start_cron () { - log_info "Starting cron ..." + echo "Starting cron ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then log_warn "Failed to start cron on one or more nodes" @@ -100,13 +100,13 @@ start_cron () { } cleanup () { - log_info " Exiting, cleaning up ..." + echo " Exiting, cleaning up ..." if [ -n "$1" ]; then update_restore_status "$1" fi if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Restarting Actions after restore ..." + echo "Restarting Actions after restore ..." # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists # in the --help output @@ -122,12 +122,12 @@ cleanup () { fi # Cleanup SSH multiplexing - log_info "Cleaning up SSH multiplexing ..." + echo "Cleaning up SSH multiplexing ..." if ! ghe-ssh --clean ; then log_warn "Failed to clean up SSH multiplexing" fi # Remove in-progress file - log_info "Removing in-progress file ..." 1>&3 + echo "Removing in-progress file ..." 1>&3 if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then log_warn "Failed to remove in-progress file" 1>&3 @@ -142,18 +142,18 @@ cleanup_cluster_nodes() { log_error "Node UUID required." exit 2 fi - log_info "Cleaning up spokes" 1>&3 + echo "Cleaning up spokes" 1>&3 ghe-spokes server evacuate git-server-$uuid 'Removing replica' ghe-spokes server destroy git-server-$uuid - log_info "Cleaning up storage" 1>&3 + echo "Cleaning up storage" 1>&3 ghe-storage destroy-host storage-server-$uuid --force - log_info "Cleaning up dpages" 1>&3 + echo "Cleaning up dpages" 1>&3 ghe-dpages offline pages-server-$uuid ghe-dpages remove pages-server-$uuid - log_info "Cleaning up redis" 1>&3 + echo "Cleaning up redis" 1>&3 ghe-redis-cli del resque:queue:maint_git-server-$uuid ghe-redis-cli srem resque:queues maint_git-server-$uuid } @@ -190,7 +190,7 @@ export GHE_RESTORE_SNAPSHOT ghe_backup_check # Detect if the backup we are restoring has a leaked ssh key -log_info "Checking for leaked keys in the backup snapshot that is being restored ..." +echo "Checking for leaked keys in the backup snapshot that is being restored ..." ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true # Figure out whether to use the tarball or rsync restore strategy based on the @@ -266,7 +266,7 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" +echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore @@ -338,7 +338,7 @@ ghe-backup-store-version || log_warn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. -log_info "Stopping cron and github-timerd ..." +echo "Stopping cron and github-timerd ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then ghe_verbose "* Warning: Failed to stop cron on one or more nodes" @@ -390,7 +390,7 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - log_info "Restoring UUID ..." + echo "Restoring UUID ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true @@ -415,29 +415,29 @@ else fi if is_external_database_target_or_snapshot && $SKIP_MYSQL; then - log_info "Skipping MySQL restore." + echo "Skipping MySQL restore." else - log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." + echo "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Stopping Actions before restoring databases ..." + echo "Stopping Actions before restoring databases ..." # We mark Actions as stopped even if the `ghe-actions-stop` # fails to ensure that we cleanly start actions when performing cleanup. ACTIONS_STOPPED=true ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 - log_info "Restoring MSSQL databases ..." + echo "Restoring MSSQL databases ..." ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 - log_info "Restoring Actions data ..." + echo "Restoring Actions data ..." ghe-restore-actions "$GHE_HOSTNAME" 1>&3 log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning. \n See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - log_info "Restoring MinIO data ..." + echo "Restoring MinIO data ..." ghe-restore-minio "$GHE_HOSTNAME" 1>&3 fi @@ -477,7 +477,7 @@ fi # Restore the audit log migration sentinel file, if it exists in the snapshot if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then - log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 + echo "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 fi @@ -487,7 +487,7 @@ fi # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then - log_info "Skipping restore of audit logs." + echo "Skipping restore of audit logs." else commands+=(" echo \"Restoring Audit logs ...\" @@ -497,24 +497,24 @@ if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; the fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - log_info "Restoring data in parallel ..." + echo "Restoring data in parallel ..." $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" else - log_info "Restoring data serially ..." 1>&3 + echo "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do eval "$c" done fi # Restart an already running memcached to reset the cache after restore -log_info "Restarting memcached ..." 1>&3 +echo "Restarting memcached ..." 1>&3 echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then - log_info "Setting last run date for GitHub Connect jobs ..." 1>&3 + echo "Setting last run date for GitHub Connect jobs ..." 1>&3 echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi @@ -522,7 +522,7 @@ fi # When restoring to a host that has already been configured, kick off a # config run to perform data migrations. if $CLUSTER; then - log_info "Configuring cluster ..." + echo "Configuring cluster ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -530,7 +530,7 @@ if $CLUSTER; then fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 elif $instance_configured; then - log_info "Configuring appliance ..." + echo "Configuring appliance ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -552,7 +552,7 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then - log_info "Cleaning up replicas..." 1>&3 + echo "Cleaning up replicas..." 1>&3 restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) other_nodes=$(echo " set -o pipefail; \ @@ -562,7 +562,7 @@ if ! $CLUSTER && $instance_configured; then | ( grep -F -x -v \"$restored_uuid\" || true )" \ | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash) if [ -n "$other_nodes" ]; then - log_info "Cleaning up stale nodes ..." + echo "Cleaning up stale nodes ..." for uuid in $other_nodes; do # shellcheck disable=SC2034 echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 @@ -580,12 +580,12 @@ update_restore_status "complete" ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." if ! $CLUSTER; then - log_info "Restoring SSH host keys ..." + echo "Restoring SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 else # This will make sure that Git over SSH host keys (babeld) are # copied to all the cluster nodes so babeld uses the same keys. - log_info "Restoring Git over SSH host keys ..." + echo "Restoring Git over SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 echo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | @@ -593,11 +593,11 @@ else fi END_TIME=$(date +%s) -log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" -log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." +echo "Runtime: $((${END_TIME} - ${START_TIME})) seconds" +echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." if ! $instance_configured; then - log_info "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." + echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." fi From 1bfabf0a76fcb3d5654283717f748f2b7398c2df Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 00:09:25 +0000 Subject: [PATCH 227/946] reverting logging statements --- bin/ghe-restore | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index c3e43d15b..003200b17 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -90,11 +90,11 @@ start_cron () { echo "Starting cron ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then - log_warn "Failed to start cron on one or more nodes" + echo "Failed to start cron on one or more nodes" fi else if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ; then - log_warn "Failed to start cron" + echo "Failed to start cron" fi fi } @@ -124,13 +124,13 @@ cleanup () { # Cleanup SSH multiplexing echo "Cleaning up SSH multiplexing ..." if ! ghe-ssh --clean ; then - log_warn "Failed to clean up SSH multiplexing" + echo "Failed to clean up SSH multiplexing" fi # Remove in-progress file echo "Removing in-progress file ..." 1>&3 if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then - log_warn "Failed to remove in-progress file" 1>&3 + echo "Failed to remove in-progress file" 1>&3 fi } @@ -139,7 +139,7 @@ cleanup () { cleanup_cluster_nodes() { uuid="$1" if [ -z "$uuid" ]; then - log_error "Node UUID required." + echo "Node UUID required." exit 2 fi echo "Cleaning up spokes" 1>&3 @@ -218,7 +218,7 @@ export CLUSTER # Restoring a cluster backup to a standalone appliance is not supported if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - log_error "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 + echo "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 exit 1 fi @@ -230,7 +230,7 @@ fi # Figure out if this appliance is in a replication pair if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - log_error "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 + echo "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 exit 1 fi @@ -295,7 +295,7 @@ update_restore_status "restoring" # Make sure the GitHub appliance is in maintenance mode. if $instance_configured; then if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then - log_error "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 + echo "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 exit 1 fi fi @@ -307,7 +307,7 @@ RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-vers # mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_error "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + echo "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 exit 1 fi @@ -318,15 +318,15 @@ if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting \n Please disable Actions cache service in $GHE_HOSTNAME and retry\nTo disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 + echo "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting \n Please disable Actions cache service in $GHE_HOSTNAME and retry\nTo disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 exit 1 fi if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting. \n Please enable Actions cache service in $GHE_HOSTNAME and retry \n To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 + echo "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting. \n Please enable Actions cache service in $GHE_HOSTNAME and retry \n To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 exit 1 fi else - log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting. \n Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 + echo "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting. \n Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 exit 1 fi fi @@ -335,7 +335,7 @@ fi bm_init > /dev/null ghe-backup-store-version || -log_warn "Warning: storing backup-utils version remotely failed." +echo "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. echo "Stopping cron and github-timerd ..." @@ -433,7 +433,7 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then echo "Restoring Actions data ..." ghe-restore-actions "$GHE_HOSTNAME" 1>&3 - log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning. \n See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." + echo "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning. \n See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then @@ -479,7 +479,7 @@ fi if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then echo "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 + echo "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 fi fi From 26253b55e280af5711b8a63e3264a7764fc13626 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 00:16:43 +0000 Subject: [PATCH 228/946] more small tweaks --- bin/ghe-restore | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 003200b17..3b80be75b 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -476,11 +476,9 @@ if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then fi # Restore the audit log migration sentinel file, if it exists in the snapshot -if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then +if test -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete; then echo "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - echo "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 - fi + ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete" fi # Restore exported audit logs to 2.12.9 and newer single nodes and From b2b1f4a9fafa82ca46376db291e8789d17803121 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 00:20:05 +0000 Subject: [PATCH 229/946] super small tweak --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 3b80be75b..fd0fb14f1 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -496,7 +496,7 @@ fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then echo "Restoring data in parallel ..." - $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" + $GHE_PARALLEL_COMMAND $GHE_PARALLEL_COMMAND_OPTIONS -- "${commands[@]}" else echo "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do From 00fd39c6da891557cfb92822dbefb9d9895147b5 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 00:37:15 +0000 Subject: [PATCH 230/946] start_cron --- bin/ghe-restore | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index fd0fb14f1..3de050a05 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -87,14 +87,14 @@ while true; do done start_cron () { - echo "Starting cron ..." + log_info "Starting cron ..." if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then - echo "Failed to start cron on one or more nodes" + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo timeout 120s service cron start" ; then + log_warn "Failed to start cron on one or more nodes" fi else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ; then - echo "Failed to start cron" + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo timeout 120s service cron start" ; then + log_warn "Failed to start cron" fi fi } From db19e987c20ffdf114276a75daf2022badb4e0ac Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 00:58:43 +0000 Subject: [PATCH 231/946] reintroducing logging into the file --- bin/ghe-restore | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 3de050a05..57c19eaf9 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -100,13 +100,13 @@ start_cron () { } cleanup () { - echo " Exiting, cleaning up ..." + log_info " Exiting, cleaning up ..." if [ -n "$1" ]; then update_restore_status "$1" fi if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Restarting Actions after restore ..." + log_info "Restarting Actions after restore ..." # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists # in the --help output @@ -122,15 +122,15 @@ cleanup () { fi # Cleanup SSH multiplexing - echo "Cleaning up SSH multiplexing ..." + log_info "Cleaning up SSH multiplexing ..." if ! ghe-ssh --clean ; then - echo "Failed to clean up SSH multiplexing" + log_info "Failed to clean up SSH multiplexing" fi # Remove in-progress file - echo "Removing in-progress file ..." 1>&3 + log_info "Removing in-progress file ..." 1>&3 if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then - echo "Failed to remove in-progress file" 1>&3 + log_error "Failed to remove in-progress file" 1>&3 fi } @@ -139,21 +139,21 @@ cleanup () { cleanup_cluster_nodes() { uuid="$1" if [ -z "$uuid" ]; then - echo "Node UUID required." + log_error "Node UUID required." exit 2 fi - echo "Cleaning up spokes" 1>&3 + log_info "Cleaning up spokes" 1>&3 ghe-spokes server evacuate git-server-$uuid 'Removing replica' ghe-spokes server destroy git-server-$uuid - echo "Cleaning up storage" 1>&3 + log_info "Cleaning up storage" 1>&3 ghe-storage destroy-host storage-server-$uuid --force - echo "Cleaning up dpages" 1>&3 + log_info "Cleaning up dpages" 1>&3 ghe-dpages offline pages-server-$uuid ghe-dpages remove pages-server-$uuid - echo "Cleaning up redis" 1>&3 + log_info "Cleaning up redis" 1>&3 ghe-redis-cli del resque:queue:maint_git-server-$uuid ghe-redis-cli srem resque:queues maint_git-server-$uuid } @@ -218,7 +218,7 @@ export CLUSTER # Restoring a cluster backup to a standalone appliance is not supported if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - echo "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 + log_error "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 exit 1 fi @@ -230,7 +230,7 @@ fi # Figure out if this appliance is in a replication pair if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - echo "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 + log_error "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 exit 1 fi @@ -295,7 +295,7 @@ update_restore_status "restoring" # Make sure the GitHub appliance is in maintenance mode. if $instance_configured; then if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then - echo "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 + log_error "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 exit 1 fi fi @@ -307,7 +307,7 @@ RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-vers # mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 + log_error "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 exit 1 fi @@ -318,15 +318,15 @@ if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - echo "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting \n Please disable Actions cache service in $GHE_HOSTNAME and retry\nTo disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 + log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting \n Please disable Actions cache service in $GHE_HOSTNAME and retry\nTo disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 exit 1 fi if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - echo "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting. \n Please enable Actions cache service in $GHE_HOSTNAME and retry \n To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 + log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting. \n Please enable Actions cache service in $GHE_HOSTNAME and retry \n To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 exit 1 fi else - echo "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting. \n Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 + log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting. \n Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 exit 1 fi fi @@ -335,40 +335,40 @@ fi bm_init > /dev/null ghe-backup-store-version || -echo "Warning: storing backup-utils version remotely failed." +log_warn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. -echo "Stopping cron and github-timerd ..." +log_info "Stopping cron and github-timerd ..." if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then - ghe_verbose "* Warning: Failed to stop cron on one or more nodes" + log_warn "Failed to stop cron on one or more nodes" 1>&3 fi if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then - ghe_verbose "* Warning: Failed to stop github-timerd on one or more nodes" + log_warn "Failed to stop github-timerd on one or more nodes" 1>&3 fi fi else if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service github-timerd stop"; then - ghe_verbose "* Warning: Failed to stop github-timerd on one or more nodes" + log_warn "Failed to stop github-timerd on one or more nodes" 1>&3 fi fi else if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"; then - ghe_verbose "* Warning: Failed to stop cron" + log_warn "Failed to stop cron" 1>&3 fi if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then - ghe_verbose "* Warning: Failed to stop github-timerd" + log_warn "Failed to stop github-timerd" 1>&3 fi fi else if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service github-timerd stop"; then - ghe_verbose "* Warning: Failed to stop github-timerd" + log_warn "Failed to stop github-timerd" 1>&3 fi fi fi @@ -390,7 +390,7 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - echo "Restoring UUID ..." + log_info "Restoring UUID ..." cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true @@ -415,29 +415,29 @@ else fi if is_external_database_target_or_snapshot && $SKIP_MYSQL; then - echo "Skipping MySQL restore." + log_info "Skipping MySQL restore." else - echo "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." + log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - echo "Stopping Actions before restoring databases ..." + log_info "Stopping Actions before restoring databases ..." # We mark Actions as stopped even if the `ghe-actions-stop` # fails to ensure that we cleanly start actions when performing cleanup. ACTIONS_STOPPED=true ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 - echo "Restoring MSSQL databases ..." + log_info "Restoring MSSQL databases ..." ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 - echo "Restoring Actions data ..." + log_info "Restoring Actions data ..." ghe-restore-actions "$GHE_HOSTNAME" 1>&3 echo "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning. \n See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - echo "Restoring MinIO data ..." + log_info "Restoring MinIO data ..." ghe-restore-minio "$GHE_HOSTNAME" 1>&3 fi From 849b47760529ea0ce1a467e6d1824151f8e92b23 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 01:17:50 +0000 Subject: [PATCH 232/946] restore all the old logging statements. --- bin/ghe-restore | 61 ++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 57c19eaf9..dcdec8a22 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -441,78 +441,90 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then ghe-restore-minio "$GHE_HOSTNAME" 1>&3 fi +# log input into a variable for the parallel command, as the functions don't work with eval +cmd_title=$(log_info "Restoring Redis database ...") commands=(" -echo \"Restoring Redis database ...\" +echo \"$cmd_title\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") +cmd_title=$(log_info "Restoring Git Repositories ...") commands+=(" -echo \"Restoring Git repositories ...\" +echo \"$cmd_title\" ghe-restore-repositories \"$GHE_HOSTNAME\"") +cmd_title=$(log_info "Restoring Gists ...") commands+=(" -echo \"Restoring Gists ...\" +echo \"$cmd_title\" ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") +cmd_title=$(log_info "Restoring Pages ...") commands+=(" -echo \"Restoring GitHub Pages artifacts ...\" +echo \"$cmd_title\" ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") +cmd_title=$(log_info "Restoring SSH authorized keys ...") commands+=(" -echo \"Restoring SSH authorized keys ...\" +echo \"$cmd_title\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") +cmd_title=$(log_info "Restoring storage data ...") commands+=(" -echo \"Restoring storage data ...\" +echo \"$cmd_title\" ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") +cmd_title=$(log_info "Restoring custom Git hooks ...") commands+=(" -echo \"Restoring custom Git hooks ...\" +echo \"$cmd_title\" ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then + cmd_title=$(log_info "Restoring Elasticsearch indices ...") commands+=(" - echo \"Restoring Elasticsearch indices ...\" + echo \"cmd_title\" ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") fi # Restore the audit log migration sentinel file, if it exists in the snapshot if test -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete; then - echo "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete" + log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete" ; then + log_info "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 + fi fi # Restore exported audit logs to 2.12.9 and newer single nodes and # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then - echo "Skipping restore of audit logs." + log_info "Skipping restore of audit logs." else + cmd_title=$(log_info "Restoring Audit logs ...") commands+=(" - echo \"Restoring Audit logs ...\" + echo \"$cmd_title\" ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") fi fi if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - echo "Restoring data in parallel ..." + log_info "Restoring data in parallel ..." $GHE_PARALLEL_COMMAND $GHE_PARALLEL_COMMAND_OPTIONS -- "${commands[@]}" else - echo "Restoring data serially ..." 1>&3 + log_info "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do eval "$c" done fi # Restart an already running memcached to reset the cache after restore -echo "Restarting memcached ..." 1>&3 +log_info "Restarting memcached ..." 1>&3 echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then - echo "Setting last run date for GitHub Connect jobs ..." 1>&3 + log_info "Setting last run date for GitHub Connect jobs ..." 1>&3 echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi @@ -520,7 +532,7 @@ fi # When restoring to a host that has already been configured, kick off a # config run to perform data migrations. if $CLUSTER; then - echo "Configuring cluster ..." + log_info "Configuring cluster ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -528,7 +540,7 @@ if $CLUSTER; then fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 elif $instance_configured; then - echo "Configuring appliance ..." + log_info "Configuring appliance ..." if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -540,6 +552,7 @@ fi # Clear GitHub Connect settings stored in the restored database. # This needs to happen after `ghe-config-apply` to ensure all migrations have run. if ! $RESTORE_SETTINGS; then + log_info "Clearing GitHub Connect settings ..." 1>&3 echo "if [ -f /usr/local/share/enterprise/ghe-reset-gh-connect ]; then /usr/local/share/enterprise/ghe-reset-gh-connect -y; fi" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 fi @@ -550,7 +563,7 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then - echo "Cleaning up replicas..." 1>&3 + log_info "Cleaning up replicas..." 1>&3 restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) other_nodes=$(echo " set -o pipefail; \ @@ -560,7 +573,7 @@ if ! $CLUSTER && $instance_configured; then | ( grep -F -x -v \"$restored_uuid\" || true )" \ | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash) if [ -n "$other_nodes" ]; then - echo "Cleaning up stale nodes ..." + log_info "Cleaning up stale nodes ..." for uuid in $other_nodes; do # shellcheck disable=SC2034 echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 @@ -578,12 +591,12 @@ update_restore_status "complete" ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." if ! $CLUSTER; then - echo "Restoring SSH host keys ..." + log_info "Restoring SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 else # This will make sure that Git over SSH host keys (babeld) are # copied to all the cluster nodes so babeld uses the same keys. - echo "Restoring Git over SSH host keys ..." + log_info "Restoring Git over SSH host keys ..." ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 echo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | @@ -591,8 +604,8 @@ else fi END_TIME=$(date +%s) -echo "Runtime: $((${END_TIME} - ${START_TIME})) seconds" -echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." +log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" +log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." if ! $instance_configured; then From 34365819facd0828506f54f719b5820d103a087f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 01:35:29 +0000 Subject: [PATCH 233/946] change output --- bin/ghe-restore | 2 +- bin/old_restore | 609 -------------------- share/github-backup-utils/bm.sh | 2 +- share/github-backup-utils/ghe-backup-config | 3 +- 4 files changed, 4 insertions(+), 612 deletions(-) delete mode 100644 bin/old_restore diff --git a/bin/ghe-restore b/bin/ghe-restore index dcdec8a22..b24a2c2ae 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -480,7 +480,7 @@ ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then cmd_title=$(log_info "Restoring Elasticsearch indices ...") commands+=(" - echo \"cmd_title\" + echo \"$cmd_title\" ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") fi diff --git a/bin/old_restore b/bin/old_restore deleted file mode 100644 index 3e02e15bd..000000000 --- a/bin/old_restore +++ /dev/null @@ -1,609 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore [-cfhv] [--version] [--skip-mysql] [-s ] [] -#/ -#/ Restores a GitHub instance from local backup snapshots. -#/ -#/ Note that the GitHub Enterprise host must be reachable and your SSH key must -#/ be setup as described in the following help article: -#/ -#/ -#/ -#/ OPTIONS: -#/ -c | --config Restore appliance settings and license in addition to -#/ datastores. Settings are not restored by default to -#/ prevent overwriting different configuration on the -#/ restore host. -#/ -f | --force Don't prompt for confirmation before restoring. -#/ -h | --help Show this message. -#/ -v | --verbose Enable verbose output. -#/ --skip-mysql Skip MySQL restore steps. Only applicable to external databases. -#/ --version Display version information and exit. -#/ -#/ -s Restore from the snapshot with the given id. Available -#/ snapshots may be listed under the data directory. -#/ -#/ The is the hostname or IP of the GitHub Enterprise -#/ instance. The may be omitted when the -#/ GHE_RESTORE_HOST config variable is set in backup.config. -#/ When a argument is provided, it always overrides -#/ the configured restore host. -#/ - -set -e - -# Parse arguments -: ${RESTORE_SETTINGS:=false} -export RESTORE_SETTINGS - -: ${FORCE:=false} -export FORCE - -: ${SKIP_MYSQL:=false} -export SKIP_MYSQL - -while true; do - case "$1" in - --skip-mysql) - SKIP_MYSQL=true - shift - ;; - -f|--force) - FORCE=true - shift - ;; - -s) - snapshot_id="$(basename "$2")" - shift 2 - ;; - -c|--config) - RESTORE_SETTINGS=true - shift - ;; - -h|--help) - export GHE_SHOW_HELP=true - shift - ;; - --version) - export GHE_SHOW_VERSION=true - shift - ;; - -v|--verbose) - export GHE_VERBOSE=true - shift - ;; - -*) - echo "Error: invalid argument: '$1'" 1>&2 - exit 1 - ;; - *) - if [ -n "$1" ]; then - GHE_RESTORE_HOST_OPT="$1" - shift - else - break - fi - ;; - esac -done - -start_cron () { - log_info "Starting cron ..." 1>&3 - if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" ; then - log_warn "Failed to start cron on one or more nodes" - fi - else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" ; then - log_warn "Failed to start cron" - fi - fi -} - -cleanup () { - log_info " Exiting, cleaning up ..." 1>&3 - if [ -n "$1" ]; then - update_restore_status "$1" - fi - - if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Restarting Actions after restore ..." - # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the - # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists - # in the --help output - if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start --help' | grep -q force ; then - ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start -f' 1>&3 - else - ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start' 1>&3 - fi - fi - - if ! $CRON_RUNNING; then - start_cron - fi - - # Cleanup SSH multiplexing - log_info "Cleaning up SSH multiplexing ..." 1>&3 - if ! ghe-ssh --clean ; then - log_warn "Failed to clean up SSH multiplexing" - fi - # Remove in-progress file - log_info "Removing in-progress file ..." 1>&3 - - if ! rm -f ${GHE_DATA_DIR}/in-progress-restore ; then - log_warn "Failed to remove in-progress file" - fi -} - -# This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. -# shellcheck disable=SC2034 -cleanup_cluster_nodes() { - uuid="$1" - if [ -z "$uuid" ]; then - log_error "Node UUID required." - exit 2 - fi - log_info "Cleaning up spokes" 1>&3 - ghe-spokes server evacuate git-server-$uuid 'Removing replica' - ghe-spokes server destroy git-server-$uuid - - log_info "Cleaning up storage" 1>&3 - ghe-storage destroy-host storage-server-$uuid --force - - log_info "Cleaning up dpages" 1>&3 - ghe-dpages offline pages-server-$uuid - ghe-dpages remove pages-server-$uuid - - log_info "Cleaning up redis" 1>&3 - ghe-redis-cli del resque:queue:maint_git-server-$uuid - ghe-redis-cli srem resque:queues maint_git-server-$uuid -} - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" - -# Check to make sure moreutils parallel is installed and working properly -ghe_parallel_check - -# Check to make sure another restore process is not running -ghe_restore_check - -# Grab the host arg -GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}" - -# Hostname without any port suffix -hostname=$(echo "$GHE_HOSTNAME" | cut -f 1 -d :) - -# Show usage with no -[ -z "$GHE_HOSTNAME" ] && print_usage - -# Flag to indicate if this script has stopped Actions. -ACTIONS_STOPPED=false - -# ghe-restore-snapshot-path validates it exists, determines what current is, -# and if there's any problem, exit for us -GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")" -GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") -export GHE_RESTORE_SNAPSHOT - -# Check to make sure backup is not running -ghe_backup_check - -# Detect if the backup we are restoring has a leaked ssh key -log_info "Checking for leaked keys in the backup snapshot that is being restored ..." -ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true - -# Figure out whether to use the tarball or rsync restore strategy based on the -# strategy file written in the snapshot directory. -GHE_BACKUP_STRATEGY=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/strategy") - -# Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. -ghe_remote_version_required "$GHE_HOSTNAME" - -# Figure out if this instance has been configured or is entirely new. -instance_configured=false -if is_instance_configured; then - instance_configured=true -else - RESTORE_SETTINGS=true -fi - -# Figure out if we're restoring into cluster -CLUSTER=false -if ghe-ssh "$GHE_HOSTNAME" -- \ - "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ]"; then - CLUSTER=true -fi -export CLUSTER - -# Restoring a cluster backup to a standalone appliance is not supported -if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - log_error "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 - exit 1 -fi - -# Ensure target appliance and restore snapshot are a compatible combination with respect to BYODB -if ! ghe-restore-external-database-compatibility-check; then - exit 1 -fi - -# Figure out if this appliance is in a replication pair -if ghe-ssh "$GHE_HOSTNAME" -- \ - "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - log_error "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 - exit 1 -fi - -# Prompt to verify the restore host given is correct. Restoring overwrites -# important data on the destination appliance that cannot be recovered. This is -# mostly to prevent accidents where the backup host is given to restore instead -# of a separate restore host since they're used in such close proximity. -if $instance_configured && ! $FORCE; then - echo - echo "WARNING: All data on GitHub Enterprise appliance $hostname ($GHE_REMOTE_VERSION)" - echo " will be overwritten with data from snapshot ${GHE_RESTORE_SNAPSHOT}." - echo - - if is_external_database_snapshot && $RESTORE_SETTINGS; then - echo "WARNING: This operation will also restore the external MySQL connection configuration," - echo " which may be dangerous if the GHES appliance the snapshot was taken from is still online." - echo - fi - - prompt_for_confirmation "Please verify that this is the correct restore host before continuing." -fi - -# Prompt to verify that restoring BYODB snapshot to unconfigured instance -# will result in BYODB connection information being restored as well. -if is_external_database_snapshot && ! $instance_configured && ! $FORCE; then - echo - echo "WARNING: This operation will also restore the external MySQL connection configuration," - echo " which may be dangerous if the GHES appliance the snapshot was taken from is still online." - echo - - prompt_for_confirmation "Please confirm this before continuing." -fi - -# Log restore start message locally and in /var/log/syslog on remote instance -START_TIME=$(date +%s) -log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" -ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." -# Create an in-progress-restore file to prevent simultaneous backup or restore runs -echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore - -# Keep other processes on the VM or cluster in the loop about the restore status. -# -# Other processes will look for these states: -# "restoring" - restore is currently in progress -# "failed" - restore has failed -# "complete" - restore has completed successfully -update_restore_status () { - if $CLUSTER; then - echo "ghe-cluster-each -- \"echo '$1' | sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/ghe-restore-status' >/dev/null\"" | - ghe-ssh "$GHE_HOSTNAME" /bin/bash - else - echo "$1" | - ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/ghe-restore-status' >/dev/null" - fi -} - -CRON_RUNNING=true -# Update remote restore state file and setup failure trap -trap "cleanup failed" EXIT -update_restore_status "restoring" - -# Make sure the GitHub appliance is in maintenance mode. -if $instance_configured; then - if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then - log_error "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 - exit 1 - fi -fi - -# Get GHES release version in major.minor format -RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-version' | cut -d '.' -f 1,2) - -# If the backup being restored is from an appliance with Actions disabled, restoring it onto an appliance with Actions enabled will cause -# mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace -ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs) -if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_error "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 - exit 1 -fi - -# Make sure the GitHub appliance has Actions enabled if the snapshot contains Actions data. -# If above is true, also check if ac is present in appliance then snapshot should also contains ac databases -if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then - if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) - ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") - if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting" \ - "\n""Please disable Actions cache service in $GHE_HOSTNAME and retry" \ - "\n""To disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 - exit 1 - fi - if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting." \ - "\n""Please enable Actions cache service in $GHE_HOSTNAME and retry" \ - "\n""To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 - exit 1 - fi - else - log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting." \ - "\n""Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 - exit 1 - fi -fi - -# Create benchmark file -bm_init > /dev/null - -ghe-backup-store-version || -log_warn "Warning: storing backup-utils version remotely failed." - -# Stop cron and timerd, as scheduled jobs may disrupt the restore process. -log_info "Stopping cron and github-timerd ..." -if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then - ghe_verbose "* Warning: Failed to stop cron on one or more nodes" - fi - - if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then - if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then - ghe_verbose "* Warning: Failed to stop github-timerd on one or more nodes" - fi - fi - else - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service github-timerd stop"; then - ghe_verbose "* Warning: Failed to stop github-timerd on one or more nodes" - fi - fi -else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"; then - ghe_verbose "* Warning: Failed to stop cron" - fi - - if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then - if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then - ghe_verbose "* Warning: Failed to stop github-timerd" - fi - fi - else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service github-timerd stop"; then - ghe_verbose "* Warning: Failed to stop github-timerd" - fi - fi -fi -CRON_RUNNING=false - -# Restore settings and license if restoring to an unconfigured appliance or when -# specified manually. -if $RESTORE_SETTINGS; then - ghe-restore-settings "$GHE_HOSTNAME" -fi - -# Make sure mysql and elasticsearch are prep'd and running before restoring. -# These services will not have been started on appliances that have not been -# configured yet. -if ! $CLUSTER; then - echo "sudo ghe-service-ensure-mysql && sudo ghe-service-ensure-elasticsearch" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi - -# Restore UUID if present and not restoring to cluster. -if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - log_info "Restoring UUID ..." - cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | - ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" - ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true - ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" - fi - -if is_external_database_snapshot; then - appliance_strategy="external" - backup_snapshot_strategy="external" -else - if is_binary_backup_feature_on; then - appliance_strategy="binary" - else - appliance_strategy="logical" - fi - - if is_binary_backup "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"; then - backup_snapshot_strategy="binary" - else - backup_snapshot_strategy="logical" - fi -fi - -if is_external_database_target_or_snapshot && $SKIP_MYSQL; then - log_info "Skipping MySQL restore." -else - log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." - ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 -fi - -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Stopping Actions before restoring databases ..." - # We mark Actions as stopped even if the `ghe-actions-stop` - # fails to ensure that we cleanly start actions when performing cleanup. - ACTIONS_STOPPED=true - ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 - - log_info "Restoring MSSQL databases ..." - ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 - - log_info "Restoring Actions data ..." - ghe-restore-actions "$GHE_HOSTNAME" 1>&3 - log_warn "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." - log_warn " See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." -fi - -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - log_info "Restoring MinIO data ..." - ghe-restore-minio "$GHE_HOSTNAME" 1>&3 -fi - -commands=(" -echo \"Restoring Redis database ...\" -ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") - -commands+=(" -echo \"Restoring Git repositories ...\" -ghe-restore-repositories \"$GHE_HOSTNAME\"") - -commands+=(" -echo \"Restoring Gists ...\" -ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") - -commands+=(" -echo \"Restoring GitHub Pages artifacts ...\" -ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") - -commands+=(" -echo \"Restoring SSH authorized keys ...\" -ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") - -commands+=(" -echo \"Restoring storage data ...\" -ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") - -commands+=(" -echo \"Restoring custom Git hooks ...\" -ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") - -if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then - commands+=(" - echo \"Restoring Elasticsearch indices ...\" - ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") -fi - -# Restore the audit log migration sentinel file, if it exists in the snapshot -if [ -f "$GHE_RESTORE_SNAPSHOT_PATH"/es-scan-complete ]; then - log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - log_error "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 - fi -fi - -# Restore exported audit logs to 2.12.9 and newer single nodes and -# all releases of cluster -if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then - if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then - log_info "Skipping restore of audit logs." - else - commands+=(" - echo \"Restoring Audit logs ...\" - ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") - fi - -fi - -if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - log_info "Restoring data in parallel ..." - $GHE_PARALLEL_COMMAND "$GHE_PARALLEL_COMMAND_OPTIONS" -- "${commands[@]}" -else - log_info "Restoring data serially ..." 1>&3 - for c in "${commands[@]}"; do - eval "$c" - done -fi - -# Restart an already running memcached to reset the cache after restore -log_info "Restarting memcached ..." 1>&3 -echo "sudo restart -q memcached 2>/dev/null || true" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh - -# Prevent GitHub Connect jobs running before we've had a chance to reset -# the configuration by setting the last run date to now. -if ! $RESTORE_SETTINGS; then - log_info "Setting last run date for GitHub Connect jobs ..." 1>&3 - echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi - -# When restoring to a host that has already been configured, kick off a -# config run to perform data migrations. -if $CLUSTER; then - log_info "Configuring cluster ..." - if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then - ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 - elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then - ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- /usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 - fi - ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 -elif $instance_configured; then - log_info "Configuring appliance ..." - if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then - ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 - elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then - ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 - fi - ghe-ssh "$GHE_HOSTNAME" -- "ghe-config-apply" 1>&3 2>&3 -fi - -# Clear GitHub Connect settings stored in the restored database. -# This needs to happen after `ghe-config-apply` to ensure all migrations have run. -if ! $RESTORE_SETTINGS; then - echo "if [ -f /usr/local/share/enterprise/ghe-reset-gh-connect ]; then /usr/local/share/enterprise/ghe-reset-gh-connect -y; fi" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi - -# Start cron. Timerd will start automatically as part of the config run. -start_cron -CRON_RUNNING=true - -# Clean up all stale replicas on configured instances. -if ! $CLUSTER && $instance_configured; then - log_info "Cleaning up replicas..." 1>&3 - restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) - other_nodes=$(echo " - set -o pipefail; \ - ghe-spokes server show --json \ - | jq -r '.[] | select(.host | contains(\"git-server\")).host' \ - | sed 's/^git-server-//g' \ - | ( grep -F -x -v \"$restored_uuid\" || true )" \ - | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash) - if [ -n "$other_nodes" ]; then - log_info "Cleaning up stale nodes ..." - for uuid in $other_nodes; do - # shellcheck disable=SC2034 - echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 - done - fi -fi - -# Update the remote status to "complete". This has to happen before importing -# ssh host keys because subsequent commands will fail due to the host key -# changing otherwise. -trap "cleanup" EXIT -update_restore_status "complete" - -# Log restore complete message in /var/log/syslog on remote instance -ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." - -if ! $CLUSTER; then - log_info "Restoring SSH host keys ..." - ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 -else - # This will make sure that Git over SSH host keys (babeld) are - # copied to all the cluster nodes so babeld uses the same keys. - log_info "Restoring Git over SSH host keys ..." - ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 - ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 - log_info "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi - -END_TIME=$(date +%s) -log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" -log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." - - -if ! $instance_configured; then - log_info "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." -fi - diff --git a/share/github-backup-utils/bm.sh b/share/github-backup-utils/bm.sh index 8420d3076..b714d144b 100755 --- a/share/github-backup-utils/bm.sh +++ b/share/github-backup-utils/bm.sh @@ -53,7 +53,7 @@ bm_end() { echo "$1 took ${total}s" >> $BM_FILE_PATH # also log timing information in the verbose log - log_verbose "$1 took ${total}s" 1>&3 + echo "$1 took ${total}s" 1>&3 if [ -n "$GHE_DEBUG" ]; then echo "Debug: $1 took ${total}s (bm_end)" fi diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 774483e25..f8d4a4e0e 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -186,7 +186,8 @@ if [ -n "$GHE_VERBOSE" ]; then exit 1 fi calling_script_name="$(caller | sed 's:.*/::')" - exec 3> >(awk -v c="$calling_script_name" '{ print strftime("%b %d %H:%M:%S"), c":", $0; fflush(); }' >>"$GHE_VERBOSE_LOG") + date_format=$(date -u "+%FT%TZ") + exec 3> >(awk -v c="$calling_script_name" d="$date_format" '{ print d" INFO ", c":", $0; fflush(); }' >>"$GHE_VERBOSE_LOG") fi else exec 3>&1 From 0851fd3a407816485e8bc7b5e50407fa166a906d Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 01:51:27 +0000 Subject: [PATCH 234/946] logging tweaks --- share/github-backup-utils/ghe-backup-config | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index f8d4a4e0e..0828c444f 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -14,6 +14,12 @@ # . $( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config # set +o posix +# Terminal colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + # Assume this script lives in share/github-backup-utils/ when setting the root GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" @@ -187,7 +193,7 @@ if [ -n "$GHE_VERBOSE" ]; then fi calling_script_name="$(caller | sed 's:.*/::')" date_format=$(date -u "+%FT%TZ") - exec 3> >(awk -v c="$calling_script_name" d="$date_format" '{ print d" INFO ", c":", $0; fflush(); }' >>"$GHE_VERBOSE_LOG") + exec 3> >(awk -v '{ print d" INFO ", c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" >>"$GHE_VERBOSE_LOG") fi else exec 3>&1 @@ -563,13 +569,10 @@ restore-secret() { fi } -# Logging display and formatting functions -# Terminal colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color + + +# Logging display and formatting functions # Log a message to stdout log_level() { From b29a5f3a51d9058bdaae894c9f232f7ca9921d01 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 01:55:59 +0000 Subject: [PATCH 235/946] add colorized output --- share/github-backup-utils/ghe-backup-config | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 0828c444f..86ffc36bb 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -193,7 +193,12 @@ if [ -n "$GHE_VERBOSE" ]; then fi calling_script_name="$(caller | sed 's:.*/::')" date_format=$(date -u "+%FT%TZ") - exec 3> >(awk -v '{ print d" INFO ", c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" >>"$GHE_VERBOSE_LOG") + if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then + exec 3> >(awk -v '{ print d" INFO ", c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" >>"$GHE_VERBOSE_LOG") + else + display_info=" ${GREEN}INFO${NC} " + exec 3> >(awk -v '{ print d, i, c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" i="$display_info" >>"$GHE_VERBOSE_LOG") + fi fi else exec 3>&1 From 02ff8b2b1460fc1b90f8e10e80f134763725c0d8 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 02:04:36 +0000 Subject: [PATCH 236/946] awkward --- share/github-backup-utils/ghe-backup-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 86ffc36bb..b8dc993e1 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -194,10 +194,10 @@ if [ -n "$GHE_VERBOSE" ]; then calling_script_name="$(caller | sed 's:.*/::')" date_format=$(date -u "+%FT%TZ") if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then - exec 3> >(awk -v '{ print d" INFO ", c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" >>"$GHE_VERBOSE_LOG") + exec 3> >(awk '{ print d" INFO ", c":", $0; fflush(); }' -v c="$calling_script_name" d="$date_format" >>"$GHE_VERBOSE_LOG") else display_info=" ${GREEN}INFO${NC} " - exec 3> >(awk -v '{ print d, i, c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" i="$display_info" >>"$GHE_VERBOSE_LOG") + exec 3> >(awk '{ print d, i, c":", $0; fflush(); }' -v c="$calling_script_name" d="$date_format" i="$display_info" >>"$GHE_VERBOSE_LOG") fi fi else From 04cfc0b5576de3dc4bf9f07ae4068b9bef886bb3 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 02:12:02 +0000 Subject: [PATCH 237/946] did we actually need awk??? --- share/github-backup-utils/ghe-backup-config | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index b8dc993e1..dfaf1b819 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -194,10 +194,12 @@ if [ -n "$GHE_VERBOSE" ]; then calling_script_name="$(caller | sed 's:.*/::')" date_format=$(date -u "+%FT%TZ") if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then - exec 3> >(awk '{ print d" INFO ", c":", $0; fflush(); }' -v c="$calling_script_name" d="$date_format" >>"$GHE_VERBOSE_LOG") + #exec 3> >(awk -v c="$calling_script_name" d="$date_format" '{ print d" INFO ", c":", $0; fflush(); }' >>"$GHE_VERBOSE_LOG") + exec 3> >(echo -e "$date_format INFO $calling_script_name: $*" >>"$GHE_VERBOSE_LOG") else display_info=" ${GREEN}INFO${NC} " - exec 3> >(awk '{ print d, i, c":", $0; fflush(); }' -v c="$calling_script_name" d="$date_format" i="$display_info" >>"$GHE_VERBOSE_LOG") + #exec 3> >(awk '{ print d, i, c":", $0; fflush(); }' -v c="$calling_script_name" d="$date_format" i="$display_info" >>"$GHE_VERBOSE_LOG") + exec 3> >(echo -e "$date_format $display_info $calling_script_name: $*" >>"$GHE_VERBOSE_LOG") fi fi else From d2d22862bdb8c7d911290aa28b124a397b527629 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 02:19:53 +0000 Subject: [PATCH 238/946] more output refinements --- share/github-backup-utils/ghe-backup-config | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index dfaf1b819..0585ba283 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -18,6 +18,7 @@ set +o posix RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[0;33m' +BLUE='\033[0;34m' NC='\033[0m' # No Color # Assume this script lives in share/github-backup-utils/ when setting the root @@ -187,19 +188,14 @@ if [ -n "$GHE_VERBOSE" ]; then if [ "$GHE_PARALLEL_ENABLED" != "yes" ]; then exec 3>>"$GHE_VERBOSE_LOG" else - if ! echo | awk '{ print strftime("%b %d %H:%M:%S"); fflush(); }' &>/dev/null; then - echo "Error: awk command failed. Please install https://www.gnu.org/software/gawk" 1>&2 - exit 1 - fi calling_script_name="$(caller | sed 's:.*/::')" date_format=$(date -u "+%FT%TZ") if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then - #exec 3> >(awk -v c="$calling_script_name" d="$date_format" '{ print d" INFO ", c":", $0; fflush(); }' >>"$GHE_VERBOSE_LOG") exec 3> >(echo -e "$date_format INFO $calling_script_name: $*" >>"$GHE_VERBOSE_LOG") else display_info=" ${GREEN}INFO${NC} " - #exec 3> >(awk '{ print d, i, c":", $0; fflush(); }' -v c="$calling_script_name" d="$date_format" i="$display_info" >>"$GHE_VERBOSE_LOG") - exec 3> >(echo -e "$date_format $display_info $calling_script_name: $*" >>"$GHE_VERBOSE_LOG") + display_caller="${BLUE}$calling_script_name${NC}" + exec 3> >(echo -e "$date_format $display_info $display_caller: $*" >>"$GHE_VERBOSE_LOG") fi fi else From 028faeff1842dfdeff156cc4d27efdfd697cf4df Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 15:38:21 +0000 Subject: [PATCH 239/946] refinements to display --- bin/ghe-backup | 33 ++++++++++++------- bin/ghe-restore | 2 +- share/github-backup-utils/ghe-backup-config | 1 + .../github-backup-utils/ghe-restore-git-hooks | 2 +- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index cae5fe785..c694608fd 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -73,15 +73,13 @@ if ! ln -s /data/does/not/exist/hooks/ src/ >/dev/null 2>&1; then fi if ! output=$(rsync -a src/ dest1 2>&1 && rsync -av src/ --link-dest=../dest1 dest2 2>&1); then - log_error "Error: rsync encountered an error that could indicate a problem with permissions," 1>&2 - log_error "hard links, symbolic links, or another issue that may affect backups." 1>&2 + log_error "Error: rsync encountered an error that could indicate a problem with permissions,\n hard links, symbolic links, or another issue that may affect backups." 1>&2 echo "$output" exit 1 fi if [ "$(ls -il dest1/testfile | awk '{ print $1 }')" != "$(ls -il dest2/testfile | awk '{ print $1 }')" ]; then - log_error "Error: the filesystem containing $GHE_DATA_DIR does not support hard links." 1>&2 - log_error "Backup Utilities use hard links to store backup data efficiently." 1>&2 + log_error "Error: the filesystem containing $GHE_DATA_DIR does not support hard links.\n Backup Utilities use hard links to store backup data efficiently." 1>&2 exit 1 fi rm -rf src dest1 dest2 @@ -168,6 +166,9 @@ echo "$GHE_BACKUP_STRATEGY" > strategy # Create benchmark file bm_init > /dev/null +START_TIME=$(date +%s) +log_info "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION" + ghe-backup-store-version || log_warn "Warning: storing backup-utils version remotely failed." @@ -201,33 +202,40 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then ghe-backup-minio 1>&3 || failures="$failures minio" fi +cmd_title=$(log_info "Backing up Redis database ...") commands=(" -echo \"Backing up Redis database ...\" +echo \"$cmd_title\" ghe-backup-redis > redis.rdb || printf %s \"redis \" >> \"$failures_file\"") +cmd_title=$(log_info "Backing up audit log ...") commands+=(" -echo \"Backing up audit log ...\" +echo \"$cmd_title\" ghe-backup-es-audit-log || printf %s \"audit-log \" >> \"$failures_file\"") +cmd_title=$(log_info "Backing up Git repositories ...") commands+=(" -echo \"Backing up Git repositories ...\" +echo \"$cmd_title\" ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") +cmd_title=$(log_info "Backing up GitHub Pages artifacts ...") commands+=(" -echo \"Backing up GitHub Pages artifacts ...\" +echo \"$cmd_title\" ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") +cmd_title=$(log_info "Backing up storage data ...") commands+=(" -echo \"Backing up storage data ...\" +echo \"$cmd_title\" ghe-backup-storage || printf %s \"storage \" >> \"$failures_file\"") +cmd_title=$(log_info "Backing up custom Git hooks ...") commands+=(" -echo \"Backing up custom Git hooks ...\" +echo \"$cmd_title\" ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"") if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then + cmd_title=$(log_info "Backing up Elasticsearch indices ...") commands+=(" - echo \"Backing up Elasticsearch indices ...\" + echo \"$cmd_title\" ghe-backup-es-rsync || printf %s \"elasticsearch \" >> \"$failures_file\"") fi @@ -277,6 +285,9 @@ fi log_info "Checking for leaked ssh keys ..." ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true +END_TIME=$(date +%s) +log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds" +log_info "Backup of $GHE_HOSTNAME finished." # Make sure we exit zero after the conditional true diff --git a/bin/ghe-restore b/bin/ghe-restore index b24a2c2ae..ebd4d6e5e 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -266,7 +266,7 @@ fi # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) -echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" +log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 0585ba283..8541307f6 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -193,6 +193,7 @@ if [ -n "$GHE_VERBOSE" ]; then if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then exec 3> >(echo -e "$date_format INFO $calling_script_name: $*" >>"$GHE_VERBOSE_LOG") else + # colorize the input if supported. display_info=" ${GREEN}INFO${NC} " display_caller="${BLUE}$calling_script_name${NC}" exec 3> >(echo -e "$date_format $display_info $display_caller: $*" >>"$GHE_VERBOSE_LOG") diff --git a/share/github-backup-utils/ghe-restore-git-hooks b/share/github-backup-utils/ghe-restore-git-hooks index 2384b4302..4bad41f7a 100755 --- a/share/github-backup-utils/ghe-restore-git-hooks +++ b/share/github-backup-utils/ghe-restore-git-hooks @@ -60,7 +60,7 @@ if [ -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/git-hooks/environments/tarballs" ]; if [ -n "$hostname" ]; then ghe-ssh $ssh_config_file_opt -l $user "$hostname:122" -- "sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/git-hooks/environments/tarballs" - log_rsync "BEGIN: git-hooksi tarball rsync" 1>&3 + log_rsync "BEGIN: git-hooks tarball rsync" 1>&3 ghe-rsync -avH --delete \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ --rsync-path="sudo -u git rsync" \ From 62089de0b7cea5893cb629a1a378af042a7db354 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 16:01:26 +0000 Subject: [PATCH 240/946] fix broken echo --- share/github-backup-utils/ghe-backup-config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 8541307f6..5d4248e0f 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -191,12 +191,13 @@ if [ -n "$GHE_VERBOSE" ]; then calling_script_name="$(caller | sed 's:.*/::')" date_format=$(date -u "+%FT%TZ") if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then - exec 3> >(echo -e "$date_format INFO $calling_script_name: $*" >>"$GHE_VERBOSE_LOG") + exec 3>>"$GHE_VERBOSE_LOG" + log_info "$calling_script_name: $*" 1>&3 else # colorize the input if supported. - display_info=" ${GREEN}INFO${NC} " display_caller="${BLUE}$calling_script_name${NC}" - exec 3> >(echo -e "$date_format $display_info $display_caller: $*" >>"$GHE_VERBOSE_LOG") + exec 3>>"$GHE_VERBOSE_LOG" + log_info "$display_caller: $*" 1>&3 fi fi else From e787ffec14d45913e320151db29e0f54cf300a7f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 16:07:57 +0000 Subject: [PATCH 241/946] fix shellcheck --- share/github-backup-utils/ghe-backup-config | 1 - 1 file changed, 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 5d4248e0f..3b86fc6d5 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -189,7 +189,6 @@ if [ -n "$GHE_VERBOSE" ]; then exec 3>>"$GHE_VERBOSE_LOG" else calling_script_name="$(caller | sed 's:.*/::')" - date_format=$(date -u "+%FT%TZ") if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then exec 3>>"$GHE_VERBOSE_LOG" log_info "$calling_script_name: $*" 1>&3 From aa790732fd91063f6931a1888208f94b29004e73 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 16:12:50 +0000 Subject: [PATCH 242/946] fixing order --- share/github-backup-utils/ghe-backup-config | 142 ++++++++++---------- 1 file changed, 70 insertions(+), 72 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 3b86fc6d5..340003a4c 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -19,9 +19,77 @@ RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[0;33m' BLUE='\033[0;34m' -NC='\033[0m' # No Color +NC='\033[0m' # No Colo# Logging display and formatting functions -# Assume this script lives in share/github-backup-utils/ when setting the root +# Log a message to stdout +log_level() { + local level=$1 + shift + local message=$* + local display="" + local timestamp + timestamp=$(date -u "+%FT%TZ") + + + if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then + if [ "$level" = "info" ]; then + display="INFO" + elif [ "$level" = "warn" ]; then + display="WARN" + elif [ "$level" = "error" ]; then + display="ERROR" + elif [ "$level" = "verbose" ]; then + display="INFO" + elif [ "$level" = "rsync" ]; then + display="RSYNC" + elif [ "$level" = "ssh" ]; then + display="SSH" + else + display="-" + fi + else + if [ "$level" = "info" ]; then + display="${GREEN}INFO${NC}" + elif [ "$level" = "warn" ]; then + display="${YELLOW}WARN${NC}" + elif [ "$level" = "error" ]; then + display="${RED}ERROR${NC}" + elif [ "$level" = "verbose" ]; then + display="${GREEN}INFO${NC}" + elif [ "$level" = "rsync" ]; then + display="${GREEN}RSYNC${NC}" + elif [ "$level" = "ssh" ]; then + display="${GREEN}SSH${NC}" + else + display="-" + fi + fi + echo -e "$timestamp $display $message" +} + +log_info(){ + log_level "info" "$1" +} + +log_warn(){ + log_level "warn" "$1" +} + +log_error(){ + log_level "error" "$1" +} + +log_verbose(){ + log_level "verbose" "$1" +} + +log_rsync(){ + log_level "rsync" "$1" +} + +log_ssh(){ + log_level "ssh" "$1" +} Assume this script lives in share/github-backup-utils/ when setting the root GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" # Get the version from the version file. @@ -576,74 +644,4 @@ restore-secret() { -# Logging display and formatting functions -# Log a message to stdout -log_level() { - local level=$1 - shift - local message=$* - local display="" - local timestamp - timestamp=$(date -u "+%FT%TZ") - - - if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then - if [ "$level" = "info" ]; then - display="INFO" - elif [ "$level" = "warn" ]; then - display="WARN" - elif [ "$level" = "error" ]; then - display="ERROR" - elif [ "$level" = "verbose" ]; then - display="INFO" - elif [ "$level" = "rsync" ]; then - display="RSYNC" - elif [ "$level" = "ssh" ]; then - display="SSH" - else - display="-" - fi - else - if [ "$level" = "info" ]; then - display="${GREEN}INFO${NC}" - elif [ "$level" = "warn" ]; then - display="${YELLOW}WARN${NC}" - elif [ "$level" = "error" ]; then - display="${RED}ERROR${NC}" - elif [ "$level" = "verbose" ]; then - display="${GREEN}INFO${NC}" - elif [ "$level" = "rsync" ]; then - display="${GREEN}RSYNC${NC}" - elif [ "$level" = "ssh" ]; then - display="${GREEN}SSH${NC}" - else - display="-" - fi - fi - echo -e "$timestamp $display $message" -} - -log_info(){ - log_level "info" "$1" -} - -log_warn(){ - log_level "warn" "$1" -} - -log_error(){ - log_level "error" "$1" -} - -log_verbose(){ - log_level "verbose" "$1" -} - -log_rsync(){ - log_level "rsync" "$1" -} - -log_ssh(){ - log_level "ssh" "$1" -} From 9ad43084c2f9b1726ae4e9a757a89a66b29ff821 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 16:13:27 +0000 Subject: [PATCH 243/946] fix --- share/github-backup-utils/ghe-backup-config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 340003a4c..b857770ac 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -89,7 +89,9 @@ log_rsync(){ log_ssh(){ log_level "ssh" "$1" -} Assume this script lives in share/github-backup-utils/ when setting the root +} + +# Assume this script lives in share/github-backup-utils/ when setting the root GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" # Get the version from the version file. From 66dcf2da85c55684389417ddc38f942922119352 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 17 Mar 2023 16:18:20 +0000 Subject: [PATCH 244/946] refine output --- share/github-backup-utils/ghe-backup-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index b857770ac..c8dd15813 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -261,12 +261,12 @@ if [ -n "$GHE_VERBOSE" ]; then calling_script_name="$(caller | sed 's:.*/::')" if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then exec 3>>"$GHE_VERBOSE_LOG" - log_info "$calling_script_name: $*" 1>&3 + log_info "$calling_script_name $*" 1>&3 else # colorize the input if supported. display_caller="${BLUE}$calling_script_name${NC}" exec 3>>"$GHE_VERBOSE_LOG" - log_info "$display_caller: $*" 1>&3 + log_info "$display_caller $*" 1>&3 fi fi else From 54cebd3778d7ba88957c93fe1fe54012f3557220 Mon Sep 17 00:00:00 2001 From: Krayon Date: Tue, 21 Mar 2023 03:04:12 +1100 Subject: [PATCH 245/946] ghe-backup-config shellcheck fixes --- share/github-backup-utils/ghe-backup-config | 108 ++++++++++++-------- 1 file changed, 63 insertions(+), 45 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 2683105fb..e28ab6d83 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -47,7 +47,7 @@ log_level() { else display="-" fi - else + else if [ "$level" = "info" ]; then display="${GREEN}INFO${NC}" elif [ "$level" = "warn" ]; then @@ -89,7 +89,7 @@ log_rsync(){ log_ssh(){ log_level "ssh" "$1" -} +} # Assume this script lives in share/github-backup-utils/ when setting the root GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" @@ -150,15 +150,15 @@ export GHE_RESTORE_IN_PROGRESS export GHE_BACKUP_IN_PROGRESS ghe_restore_check() { - if [ -h $GHE_RESTORE_IN_PROGRESS ]; then + if [ -h "$GHE_RESTORE_IN_PROGRESS" ]; then echo " Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 echo " If there is no restore in progress anymore, please remove" 1>&2 echo " the $GHE_RESTORE_IN_PROGRESS file and try again." 1>&2 exit 1 fi - if [ -f $GHE_RESTORE_IN_PROGRESS ]; then - progress=$(cat $GHE_RESTORE_IN_PROGRESS) + if [ -f "$GHE_RESTORE_IN_PROGRESS" ]; then + progress=$(cat "$GHE_RESTORE_IN_PROGRESS") pid=$(echo "$progress" | cut -d ' ' -f 2) echo " Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 echo " If PID $pid is not a process related to the restore utilities, please remove" 1>&2 @@ -168,15 +168,15 @@ ghe_restore_check() { } ghe_backup_check() { - if [ -h $GHE_BACKUP_IN_PROGRESS ]; then + if [ -h "$GHE_BACKUP_IN_PROGRESS" ]; then echo " Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 echo " If there is no backup in progress anymore, please remove" 1>&2 echo " the $GHE_DATA_DIR/$GHE_BACKUP_IN_PROGRESS file and try again." 1>&2 exit 1 fi - if [ -f $GHE_BACKUP_IN_PROGRESS ]; then - progress=$(cat $GHE_BACKUP_IN_PROGRESS) + if [ -f "$GHE_BACKUP_IN_PROGRESS" ]; then + progress=$(cat "$GHE_BACKUP_IN_PROGRESS") pid=$(echo "$progress" | cut -d ' ' -f 2) echo " Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2 @@ -186,14 +186,14 @@ ghe_backup_check() { } ghe_restore_finished() { - if [ -f $GHE_RESTORE_IN_PROGRESS ]; then - rm -f $GHE_RESTORE_IN_PROGRESS + if [ -f "$GHE_RESTORE_IN_PROGRESS" ]; then + rm -f "$GHE_RESTORE_IN_PROGRESS" fi } ghe_backup_finished() { - if [ -f $GHE_BACKUP_IN_PROGRESS ]; then - rm -f $GHE_BACKUP_IN_PROGRESS + if [ -f "$GHE_BACKUP_IN_PROGRESS" ]; then + rm -f "$GHE_BACKUP_IN_PROGRESS" fi } @@ -265,7 +265,7 @@ if [ -n "$GHE_VERBOSE" ]; then exec 3>>"$GHE_VERBOSE_LOG" log_info "$calling_script_name $*" 1>&3 else - # colorize the input if supported. + # colorize the input if supported. display_caller="${BLUE}$calling_script_name${NC}" exec 3>>"$GHE_VERBOSE_LOG" log_info "$display_caller $*" 1>&3 @@ -327,11 +327,11 @@ if [ ! -d "$GHE_DATA_DIR" ]; then fi # Set some defaults if needed. -: ${GHE_NUM_SNAPSHOTS:=10} +: "${GHE_NUM_SNAPSHOTS:=10}" # Generate a backup timestamp if one has not already been generated. # We export the variable so the process group shares the same value. -: ${GHE_SNAPSHOT_TIMESTAMP:=$(date +"%Y%m%dT%H%M%S")} +: "${GHE_SNAPSHOT_TIMESTAMP:=$(date +"%Y%m%dT%H%M%S")}" export GHE_SNAPSHOT_TIMESTAMP # Set the current snapshot directory to /. This is where @@ -341,12 +341,12 @@ export GHE_SNAPSHOT_DIR # The root filesystem location. This must be used so that tests can override # the root as a local directory location. -: ${GHE_REMOTE_ROOT_DIR:=""} +: "${GHE_REMOTE_ROOT_DIR:=""}" # The root location of persistent data and applications on the remote side. This # is always "/data" for GitHub instances. Use of this variable allows # the location to be overridden in tests. -: ${GHE_REMOTE_DATA_DIR:="/data"} +: "${GHE_REMOTE_DATA_DIR:="/data"}" # The root location of user data stores such as git repositories, pages sites, # elasticsearch indices, etc. This is "/data" under 1.x filesystem layouts and @@ -354,37 +354,37 @@ export GHE_SNAPSHOT_DIR # dynamically in ghe_remote_version_config() immediately after obtaining the # remote version. Utilities that transfer data in and out of the appliance # should use this variable to ensure proper behavior under different versions. -: ${GHE_REMOTE_DATA_USER_DIR:="$GHE_REMOTE_DATA_DIR"} +: "${GHE_REMOTE_DATA_USER_DIR:="$GHE_REMOTE_DATA_DIR"}" # The location of the license file on the remote side. This is always # "/data/enterprise/enterprise.ghl" for GitHub instances. Use of this variable # allows the location to be overridden in tests. -: ${GHE_REMOTE_LICENSE_FILE:="$GHE_REMOTE_DATA_DIR/enterprise/enterprise.ghl"} +: "${GHE_REMOTE_LICENSE_FILE:="$GHE_REMOTE_DATA_DIR/enterprise/enterprise.ghl"}" # The number of seconds to wait for in progress git-gc processes to complete # before starting the sync of git data. See share/github-backup-utils/ghe-backup-repositories-rsync # for more information. Default: 10 minutes. -: ${GHE_GIT_COOLDOWN_PERIOD:=600} +: "${GHE_GIT_COOLDOWN_PERIOD:=600}" # Set "true" to get verbose logging of all ssh commands on stderr -: ${GHE_VERBOSE_SSH:=false} +: "${GHE_VERBOSE_SSH:=false}" # The location of the cluster configuration file on the remote side. # This is always "/data/user/common/cluster.conf" for GitHub Cluster instances. # Use of this variable allows the location to be overridden in tests. -: ${GHE_REMOTE_CLUSTER_CONF_FILE:="$GHE_REMOTE_DATA_DIR/user/common/cluster.conf"} +: "${GHE_REMOTE_CLUSTER_CONF_FILE:="$GHE_REMOTE_DATA_DIR/user/common/cluster.conf"}" # The location of the file used to disable GC operations on the remote side. -: ${SYNC_IN_PROGRESS_FILE:="$GHE_REMOTE_DATA_USER_DIR/repositories/.sync_in_progress"} +: "${SYNC_IN_PROGRESS_FILE:="$GHE_REMOTE_DATA_USER_DIR/repositories/.sync_in_progress"}" # Base path for temporary directories and files. -: ${TMPDIR:="/tmp"} +: "${TMPDIR:="/tmp"}" # Backup cadence for MS SQL. Determines the kind of backup taken, either full, differential, # or transaction log, based on when the last backup of that kind was taken. This defaults to # taking a full backup once a week, a differential backup once a day, and transaction logs every # 15 minutes. -: ${GHE_MSSQL_BACKUP_CADENCE:=10080,1440,15} +: "${GHE_MSSQL_BACKUP_CADENCE:=10080,1440,15}" ############################################################################### ### Dynamic remote version config @@ -404,11 +404,22 @@ ghe_remote_version_config() { # If we don't have a readlink command, parse ls -l output. if ! type readlink 1>/dev/null 2>&1; then readlink() { - if [ -x "$1" ]; then - ls -ld "$1" | sed 's/.*-> //' - else - return 1 - fi + local ret=0 f='' + while [ $# -gt 0 ]; do + f="$1" + shift 1 + + [ ! -e "$f" ] && [ ! -h "$f" ] && { + ret=1 + continue + } + + # shellcheck disable=SC2012 # In this specific scenario, this method is OK + f="$(ls -ld "$f")" + echo "${f//*-> /}" + done + + return $ret } fi @@ -426,10 +437,12 @@ ghe_remote_version_required() { # override hostname w/ ghe-host-check output because the port could have # been autodetected to 122. - GHE_HOSTNAME=$(echo "$_out" | sed 's/Connect \(.*:[0-9]*\) OK.*/\1/') + GHE_HOSTNAME="${_out/Connect /}" + GHE_HOSTNAME="${GHE_HOSTNAME/ OK*/}" export GHE_HOSTNAME - GHE_REMOTE_VERSION=$(echo "$_out" | sed 's/.*(\(.*\))/\1/') + GHE_REMOTE_VERSION="${GHE_HOSTNAME#*\(}" + GHE_REMOTE_VERSION="${GHE_HOSTNAME%%\)*}" export GHE_REMOTE_VERSION ghe_parse_remote_version "$GHE_REMOTE_VERSION" @@ -441,9 +454,11 @@ ghe_remote_version_required() { # Parse a version string into major, minor and patch parts and echo. ghe_parse_version() { local version_major version_minor version_patch - version_major=$(echo "${1#v}" | cut -f 1 -d .) - version_minor=$(echo "$1" | cut -f 2 -d .) - version_patch=$(echo "$1" | cut -f 3 -d .) + version_patch="${1#v}" + version_major="${version_patch%%.*}" + version_patch="${version_patch#*.}" + version_minor="${version_patch%%.*}" + version_patch="${version_patch#*.}" version_patch=${version_patch%%[a-zA-Z]*} echo "$version_major $version_minor $version_patch" @@ -457,7 +472,7 @@ ghe_parse_version() { # appliance version. ghe_parse_remote_version() { # shellcheck disable=SC2046 # Word splitting is required to populate the variables - read -r GHE_VERSION_MAJOR GHE_VERSION_MINOR GHE_VERSION_PATCH <<<$(ghe_parse_version $1) + read -r GHE_VERSION_MAJOR GHE_VERSION_MINOR GHE_VERSION_PATCH < <(ghe_parse_version "$1") export GHE_VERSION_MAJOR GHE_VERSION_MINOR GHE_VERSION_PATCH } @@ -504,15 +519,18 @@ ghe_debug() { if [ $# -ne 0 ]; then echo -e "Debug: $*" 1>&3 elif [ -p /dev/stdin ]; then - echo "\n" 1>&3 - while read line; do + echo -e "\n" 1>&3 + while read -r line; do echo -e "Debug: $line" 1>&3 done Date: Mon, 20 Mar 2023 17:30:43 -0400 Subject: [PATCH 246/946] Initial commit Multi-line description of commit, feel free to be detailed. --- bin/ghe-backup | 6 +- bin/ghe-restore | 4 + share/github-backup-utils/ghe-backup-config | 146 ++++++++++---------- 3 files changed, 83 insertions(+), 73 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index c694608fd..36cab279c 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -38,6 +38,9 @@ while true; do done export CALLING_SCRIPT="ghe-backup" +export BACKUP_PROGRESS=0 # Used to track progress of backup +export BACKUP_PROGRESS_TOTAL=15 # Maximum number of steps in backup +export BACKUP_PROGRESS_DESCRIPTION="" # Used to store information about current step # Bring in the backup configuration # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" @@ -121,7 +124,7 @@ ghe_restore_check # Check to see if there is a running backup if [ -h ../in-progress ]; then - log_error "Error: detected a backup already in progress from a previous version of ghe-backup. \nIf there is no backup in progress anymore, please remove \nthe $GHE_DATA_DIR/in-progress file." 1>&2 + log_error "Detected a backup already in progress from a previous version of ghe-backup. \nIf there is no backup in progress anymore, please remove \nthe $GHE_DATA_DIR/in-progress file." 1>&2 exit 1 fi @@ -278,6 +281,7 @@ else steps="$(echo $failures | sed 's/ /, /g')" ghe_remote_logger "Completed backup from $(hostname) / snapshot $GHE_SNAPSHOT_TIMESTAMP with failures: ${steps}." log_error "Error: Snapshot incomplete. Some steps failed: ${steps}. " + ghe_backup_finished exit 1 fi diff --git a/bin/ghe-restore b/bin/ghe-restore index ebd4d6e5e..725c44a69 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -86,6 +86,10 @@ while true; do esac done +export GHE_RESTORE_PROGRESS=0 +export GHE_RESTORE_PROGRESS_TOTAL=15 +export GHE_RESTORE_PROGRESS_DESCRIPTION="" + start_cron () { log_info "Starting cron ..." if $CLUSTER; then diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index c8dd15813..65d4fe744 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -19,9 +19,69 @@ RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[0;33m' BLUE='\033[0;34m' -NC='\033[0m' # No Colo# Logging display and formatting functions +NC='\033[0m' # No Color + + +# Assume this script lives in share/github-backup-utils/ when setting the root +GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" + +# Get the version from the version file. +BACKUP_UTILS_VERSION="$(cat "$GHE_BACKUP_ROOT/share/github-backup-utils/version")" + +# If a version check was requested, show the current version and exit +if [ -n "$GHE_SHOW_VERSION" ]; then + echo "GitHub backup-utils v$BACKUP_UTILS_VERSION" + exit 0 +fi + +# Check for "--help|-h" in args or GHE_SHOW_HELP=true and show usage +# shellcheck disable=SC2120 # the script name is always referenced +print_usage() { + grep '^#/' <"$0" | cut -c 4- + exit "${1:-1}" +} + +if [ -n "$GHE_SHOW_HELP" ]; then + print_usage +else + for a in "$@"; do + if [ "$a" = "--help" ] || [ "$a" = "-h" ]; then + print_usage + fi + done +fi + +# Add the bin and share/github-backup-utils dirs to PATH +PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" +# shellcheck source=share/github-backup-utils/bm.sh +. "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" + +# Save off GHE_HOSTNAME from the environment since we want it to override the +# backup.config value when set. +GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" + +# Source in the backup config file from the copy specified in the environment +# first and then fall back to the backup-utils root, home directory and system. +config_found=false +for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ + "$HOME/.github-backup-utils/backup.config" "/etc/github-backup-utils/backup.config"; do + if [ -f "$f" ]; then + GHE_BACKUP_CONFIG="$f" + # shellcheck disable=SC1090 # This is a user-supplied value that can't be predicted + . "$GHE_BACKUP_CONFIG" + config_found=true + break + fi +done + +GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore") +GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup") + +export GHE_RESTORE_IN_PROGRESS +export GHE_BACKUP_IN_PROGRESS + +# Logging display and formatting functions -# Log a message to stdout log_level() { local level=$1 shift @@ -91,64 +151,6 @@ log_ssh(){ log_level "ssh" "$1" } -# Assume this script lives in share/github-backup-utils/ when setting the root -GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" - -# Get the version from the version file. -BACKUP_UTILS_VERSION="$(cat "$GHE_BACKUP_ROOT/share/github-backup-utils/version")" - -# If a version check was requested, show the current version and exit -if [ -n "$GHE_SHOW_VERSION" ]; then - echo "GitHub backup-utils v$BACKUP_UTILS_VERSION" - exit 0 -fi - -# Check for "--help|-h" in args or GHE_SHOW_HELP=true and show usage -# shellcheck disable=SC2120 # the script name is always referenced -print_usage() { - grep '^#/' <"$0" | cut -c 4- - exit "${1:-1}" -} - -if [ -n "$GHE_SHOW_HELP" ]; then - print_usage -else - for a in "$@"; do - if [ "$a" = "--help" ] || [ "$a" = "-h" ]; then - print_usage - fi - done -fi - -# Add the bin and share/github-backup-utils dirs to PATH -PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" -# shellcheck source=share/github-backup-utils/bm.sh -. "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" - -# Save off GHE_HOSTNAME from the environment since we want it to override the -# backup.config value when set. -GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" - -# Source in the backup config file from the copy specified in the environment -# first and then fall back to the backup-utils root, home directory and system. -config_found=false -for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ - "$HOME/.github-backup-utils/backup.config" "/etc/github-backup-utils/backup.config"; do - if [ -f "$f" ]; then - GHE_BACKUP_CONFIG="$f" - # shellcheck disable=SC1090 # This is a user-supplied value that can't be predicted - . "$GHE_BACKUP_CONFIG" - config_found=true - break - fi -done - -GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore") -GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup") - -export GHE_RESTORE_IN_PROGRESS -export GHE_BACKUP_IN_PROGRESS - ghe_restore_check() { if [ -h $GHE_RESTORE_IN_PROGRESS ]; then echo " Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 @@ -325,11 +327,11 @@ if [ ! -d "$GHE_DATA_DIR" ]; then fi # Set some defaults if needed. -: ${GHE_NUM_SNAPSHOTS:=10} +: "${GHE_NUM_SNAPSHOTS:=10}" # Generate a backup timestamp if one has not already been generated. # We export the variable so the process group shares the same value. -: ${GHE_SNAPSHOT_TIMESTAMP:=$(date +"%Y%m%dT%H%M%S")} +: "${GHE_SNAPSHOT_TIMESTAMP:=$(date +"%Y%m%dT%H%M%S")}" export GHE_SNAPSHOT_TIMESTAMP # Set the current snapshot directory to /. This is where @@ -339,12 +341,12 @@ export GHE_SNAPSHOT_DIR # The root filesystem location. This must be used so that tests can override # the root as a local directory location. -: ${GHE_REMOTE_ROOT_DIR:=""} +: "${GHE_REMOTE_ROOT_DIR:=""}" # The root location of persistent data and applications on the remote side. This # is always "/data" for GitHub instances. Use of this variable allows # the location to be overridden in tests. -: ${GHE_REMOTE_DATA_DIR:="/data"} +: "${GHE_REMOTE_DATA_DIR:="/data"}" # The root location of user data stores such as git repositories, pages sites, # elasticsearch indices, etc. This is "/data" under 1.x filesystem layouts and @@ -352,37 +354,37 @@ export GHE_SNAPSHOT_DIR # dynamically in ghe_remote_version_config() immediately after obtaining the # remote version. Utilities that transfer data in and out of the appliance # should use this variable to ensure proper behavior under different versions. -: ${GHE_REMOTE_DATA_USER_DIR:="$GHE_REMOTE_DATA_DIR"} +: "${GHE_REMOTE_DATA_USER_DIR:="$GHE_REMOTE_DATA_DIR"}" # The location of the license file on the remote side. This is always # "/data/enterprise/enterprise.ghl" for GitHub instances. Use of this variable # allows the location to be overridden in tests. -: ${GHE_REMOTE_LICENSE_FILE:="$GHE_REMOTE_DATA_DIR/enterprise/enterprise.ghl"} +: "${GHE_REMOTE_LICENSE_FILE:="$GHE_REMOTE_DATA_DIR/enterprise/enterprise.ghl"}" # The number of seconds to wait for in progress git-gc processes to complete # before starting the sync of git data. See share/github-backup-utils/ghe-backup-repositories-rsync # for more information. Default: 10 minutes. -: ${GHE_GIT_COOLDOWN_PERIOD:=600} +: "${GHE_GIT_COOLDOWN_PERIOD:=600}" # Set "true" to get verbose logging of all ssh commands on stderr -: ${GHE_VERBOSE_SSH:=false} +: "${GHE_VERBOSE_SSH:=false}" # The location of the cluster configuration file on the remote side. # This is always "/data/user/common/cluster.conf" for GitHub Cluster instances. # Use of this variable allows the location to be overridden in tests. -: ${GHE_REMOTE_CLUSTER_CONF_FILE:="$GHE_REMOTE_DATA_DIR/user/common/cluster.conf"} +: "${GHE_REMOTE_CLUSTER_CONF_FILE:="$GHE_REMOTE_DATA_DIR/user/common/cluster.conf"}" # The location of the file used to disable GC operations on the remote side. -: ${SYNC_IN_PROGRESS_FILE:="$GHE_REMOTE_DATA_USER_DIR/repositories/.sync_in_progress"} +: "${SYNC_IN_PROGRESS_FILE:="$GHE_REMOTE_DATA_USER_DIR/repositories/.sync_in_progress"}" # Base path for temporary directories and files. -: ${TMPDIR:="/tmp"} +: "${TMPDIR:="/tmp"}" # Backup cadence for MS SQL. Determines the kind of backup taken, either full, differential, # or transaction log, based on when the last backup of that kind was taken. This defaults to # taking a full backup once a week, a differential backup once a day, and transaction logs every # 15 minutes. -: ${GHE_MSSQL_BACKUP_CADENCE:=10080,1440,15} +: "${GHE_MSSQL_BACKUP_CADENCE:=10080,1440,15}" ############################################################################### ### Dynamic remote version config From af872476523e762ac6d668045a05c39e7ffb895b Mon Sep 17 00:00:00 2001 From: Krayon Date: Tue, 21 Mar 2023 12:14:25 +1100 Subject: [PATCH 247/946] Added finished lines to ghe-backup/ghe-restore --- bin/ghe-backup | 3 +-- bin/ghe-restore | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index f026dfb45..47fa9cddc 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -284,8 +284,7 @@ fi log_info "Checking for leaked ssh keys ..." ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true -# Make sure we exit zero after the conditional -true +log_info "Restore of $GHE_HOSTNAME finished." # Remove in-progress file ghe_backup_finished diff --git a/bin/ghe-restore b/bin/ghe-restore index 565b221c6..2f789357d 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -607,7 +607,9 @@ fi END_TIME=$(date +%s) log_info "Runtime: $((END_TIME - START_TIME)) seconds" -log_info "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished." +log_info "Completed restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT at $(date +"%H:%M:%S")" + +log_info "Restore of $GHE_HOSTNAME finished." if ! $instance_configured; then echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." From 0a4e7d535033b9575cd7b9ef452b8947b0a992a3 Mon Sep 17 00:00:00 2001 From: Krayon Date: Tue, 21 Mar 2023 12:49:43 +1100 Subject: [PATCH 248/946] Simplified ghe_parse_version --- share/github-backup-utils/ghe-backup-config | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index e28ab6d83..521828824 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -454,11 +454,8 @@ ghe_remote_version_required() { # Parse a version string into major, minor and patch parts and echo. ghe_parse_version() { local version_major version_minor version_patch - version_patch="${1#v}" - version_major="${version_patch%%.*}" - version_patch="${version_patch#*.}" - version_minor="${version_patch%%.*}" - version_patch="${version_patch#*.}" + + IFS=. read -r version_major version_minor version_patch _ <<<"${1#v}" version_patch=${version_patch%%[a-zA-Z]*} echo "$version_major $version_minor $version_patch" From 0854d459cebd0be5849bff4b5a1ce83b0515a12a Mon Sep 17 00:00:00 2001 From: Krayon Date: Tue, 21 Mar 2023 13:15:54 +1100 Subject: [PATCH 249/946] Fix GHE_PARALLEL_RSYNC_COMMAND_OPTIONS --- share/github-backup-utils/ghe-backup-config | 5 +++-- share/github-backup-utils/ghe-restore-repositories | 2 +- share/github-backup-utils/ghe-restore-storage | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 521828824..b812b6872 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -199,6 +199,7 @@ ghe_backup_finished() { ghe_parallel_check() { GHE_PARALLEL_COMMAND_OPTIONS=() + GHE_PARALLEL_RSYNC_COMMAND_OPTIONS=() if [ "$GHE_PARALLEL_ENABLED" != "yes" ]; then return 0 @@ -234,12 +235,12 @@ ghe_parallel_check() { fi if [ -n "$GHE_PARALLEL_RSYNC_MAX_JOBS" ]; then - GHE_PARALLEL_RSYNC_COMMAND_OPTIONS="-j $GHE_PARALLEL_RSYNC_MAX_JOBS" + GHE_PARALLEL_RSYNC_COMMAND_OPTIONS+=(-j "$GHE_PARALLEL_RSYNC_MAX_JOBS") fi if [ -n "$GHE_PARALLEL_MAX_LOAD" ]; then GHE_PARALLEL_COMMAND_OPTIONS+=(-l "$GHE_PARALLEL_MAX_LOAD") - GHE_PARALLEL_RSYNC_COMMAND_OPTIONS+=" -l $GHE_PARALLEL_MAX_LOAD" + GHE_PARALLEL_RSYNC_COMMAND_OPTIONS+=(-l "$GHE_PARALLEL_MAX_LOAD") fi } diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index ba97153d4..d59864196 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -171,7 +171,7 @@ for file_list in $tempdir/git-server-*.rsync; do done if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - $GHE_PARALLEL_COMMAND $GHE_PARALLEL_RSYNC_COMMAND_OPTIONS -- "${rsync_commands[@]}" + "$GHE_PARALLEL_COMMAND" "${GHE_PARALLEL_RSYNC_COMMAND_OPTIONS[@]}" -- "${rsync_commands[@]}" else for c in "${rsync_commands[@]}"; do eval "$c" diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index 23dbd63c3..af6c24a23 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -152,7 +152,7 @@ for file_list in $tempdir/*.rsync; do done if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - $GHE_PARALLEL_COMMAND $GHE_PARALLEL_RSYNC_COMMAND_OPTIONS -- "${rsync_commands[@]}" + "$GHE_PARALLEL_COMMAND" "${GHE_PARALLEL_RSYNC_COMMAND_OPTIONS[@]}" -- "${rsync_commands[@]}" else for c in "${rsync_commands[@]}"; do eval "$c" From 2273d84a1e463ec41f7154b3171be36c1fe150fc Mon Sep 17 00:00:00 2001 From: Krayon Date: Wed, 22 Mar 2023 02:11:24 +1100 Subject: [PATCH 250/946] Move readlink() so it can work --- share/github-backup-utils/ghe-backup-config | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index b812b6872..5eebd4b18 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -21,6 +21,28 @@ YELLOW='\033[0;33m' BLUE='\033[0;34m' NC='\033[0m' # No Colo# Logging display and formatting functions +# If we don't have a readlink command, parse ls -l output. +if ! type readlink 1>/dev/null 2>&1; then + readlink() { + local ret=0 f='' + while [ $# -gt 0 ]; do + f="$1" + shift 1 + + [ ! -e "$f" ] && [ ! -h "$f" ] && { + ret=1 + continue + } + + # shellcheck disable=SC2012 # In this specific scenario, this method is OK + f="$(ls -ld "$f")" + echo "${f//*-> /}" + done + + return $ret + } +fi + # Log a message to stdout log_level() { local level=$1 @@ -402,28 +424,6 @@ ghe_remote_version_config() { ############################################################################### ### Utility functions -# If we don't have a readlink command, parse ls -l output. -if ! type readlink 1>/dev/null 2>&1; then - readlink() { - local ret=0 f='' - while [ $# -gt 0 ]; do - f="$1" - shift 1 - - [ ! -e "$f" ] && [ ! -h "$f" ] && { - ret=1 - continue - } - - # shellcheck disable=SC2012 # In this specific scenario, this method is OK - f="$(ls -ld "$f")" - echo "${f//*-> /}" - done - - return $ret - } -fi - # Run ghe-host-check and establish the version of the remote GitHub instance in # the exported GHE_REMOTE_VERSION variable. If the remote version has already # been established then don't perform the host check again. Utilities in share/github-backup-utils From bfe8bfbcff312a9c542d84f316d6e887d922319b Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 21 Mar 2023 16:38:26 -0400 Subject: [PATCH 251/946] add in initial progress tracking code --- share/github-backup-utils/bm.sh | 2 ++ share/github-backup-utils/ghe-backup-config | 2 +- share/github-backup-utils/track-progress | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 share/github-backup-utils/track-progress diff --git a/share/github-backup-utils/bm.sh b/share/github-backup-utils/bm.sh index b714d144b..be64c03aa 100755 --- a/share/github-backup-utils/bm.sh +++ b/share/github-backup-utils/bm.sh @@ -57,4 +57,6 @@ bm_end() { if [ -n "$GHE_DEBUG" ]; then echo "Debug: $1 took ${total}s (bm_end)" fi + # track progress + progress "Completed $1 in ${total}s" } diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 65d4fe744..f46cbd26b 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -55,7 +55,7 @@ fi PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # shellcheck source=share/github-backup-utils/bm.sh . "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" - +. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" # Save off GHE_HOSTNAME from the environment since we want it to override the # backup.config value when set. GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress new file mode 100755 index 000000000..8404db938 --- /dev/null +++ b/share/github-backup-utils/track-progress @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +#/ track-progress: track progress of backup or restore tasks + +# Current version is working solely with backups + +progress(){ +export BACKUP_PROGRESS=$((BACKUP_PROGRESS + 1)) + +BACKUP_PROGRESS_PERCENT=$(( (BACKUP_PROGRESS / BACKUP_PROGRESS_STEPS) * 100)) +export BACKUP_PROGRESS_DESCRIPTION="$1" +echo "Backup progress: $BACKUP_PROGRESS_PERCENT % - ($BACKUP_PROGRESS_DESCRIPTION))" + +} \ No newline at end of file From a786c031d4be5df8bf64945b66d302c1fa5bf3c3 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 21 Mar 2023 16:43:26 -0400 Subject: [PATCH 252/946] tweaking track-progress --- share/github-backup-utils/bm.sh | 2 +- share/github-backup-utils/ghe-backup-config | 2 +- share/github-backup-utils/track-progress | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/share/github-backup-utils/bm.sh b/share/github-backup-utils/bm.sh index be64c03aa..197626248 100755 --- a/share/github-backup-utils/bm.sh +++ b/share/github-backup-utils/bm.sh @@ -58,5 +58,5 @@ bm_end() { echo "Debug: $1 took ${total}s (bm_end)" fi # track progress - progress "Completed $1 in ${total}s" + . "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" } diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index f46cbd26b..3f11a4e32 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -55,7 +55,7 @@ fi PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # shellcheck source=share/github-backup-utils/bm.sh . "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" -. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" +#. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" # Save off GHE_HOSTNAME from the environment since we want it to override the # backup.config value when set. GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 8404db938..0fc4930e1 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -3,11 +3,8 @@ # Current version is working solely with backups -progress(){ export BACKUP_PROGRESS=$((BACKUP_PROGRESS + 1)) -BACKUP_PROGRESS_PERCENT=$(( (BACKUP_PROGRESS / BACKUP_PROGRESS_STEPS) * 100)) -export BACKUP_PROGRESS_DESCRIPTION="$1" -echo "Backup progress: $BACKUP_PROGRESS_PERCENT % - ($BACKUP_PROGRESS_DESCRIPTION))" +BACKUP_PROGRESS_PERCENT=$(( (BACKUP_PROGRESS / BACKUP_PROGRESS_TOTAL) * 100)) -} \ No newline at end of file +echo "Backup progress: $BACKUP_PROGRESS_PERCENT %" \ No newline at end of file From 600d243f3106f26efbdb6cc901ed1dbdd14d41e8 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 21 Mar 2023 16:47:28 -0400 Subject: [PATCH 253/946] more tweaks --- bin/ghe-backup | 4 +++- share/github-backup-utils/track-progress | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 36cab279c..3692fbdc7 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -39,7 +39,9 @@ done export CALLING_SCRIPT="ghe-backup" export BACKUP_PROGRESS=0 # Used to track progress of backup -export BACKUP_PROGRESS_TOTAL=15 # Maximum number of steps in backup +echo "${BACKUP_PROGRESS}" > /tmp/progress +BACKUP_PROGRESS_TOTAL=15 # Maximum number of steps in backup +echo "${BACKUP_PROGRESS_TOTAL}" > /tmp/progress-total export BACKUP_PROGRESS_DESCRIPTION="" # Used to store information about current step # Bring in the backup configuration # shellcheck source=share/github-backup-utils/ghe-backup-config diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 0fc4930e1..addbc94d4 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -3,8 +3,8 @@ # Current version is working solely with backups -export BACKUP_PROGRESS=$((BACKUP_PROGRESS + 1)) - +BACKUP_PROGRESS=$(($(cat /tmp/progress) + 1)) +BACKUP_PROGRESS=$(cat /tmp/progress-total) BACKUP_PROGRESS_PERCENT=$(( (BACKUP_PROGRESS / BACKUP_PROGRESS_TOTAL) * 100)) echo "Backup progress: $BACKUP_PROGRESS_PERCENT %" \ No newline at end of file From 390d49350e6e99cf7442010de33f2815e60ec9c7 Mon Sep 17 00:00:00 2001 From: Krayon Date: Thu, 23 Mar 2023 15:04:33 +1100 Subject: [PATCH 254/946] Removing readlink as it doesn't work and we require Ubuntu now --- share/github-backup-utils/ghe-backup-config | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 2683105fb..21a16ad35 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -143,6 +143,12 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ fi done +# If we don't have a readlink command, error out +[ ! type readlink 1>/dev/null 2>&1 ] && { + echo "Error: readlink not found. Please install readlink and ensure it is in your PATH." 1>&2 + exit 1 +} + GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore") GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup") @@ -401,17 +407,6 @@ ghe_remote_version_config() { ############################################################################### ### Utility functions -# If we don't have a readlink command, parse ls -l output. -if ! type readlink 1>/dev/null 2>&1; then - readlink() { - if [ -x "$1" ]; then - ls -ld "$1" | sed 's/.*-> //' - else - return 1 - fi - } -fi - # Run ghe-host-check and establish the version of the remote GitHub instance in # the exported GHE_REMOTE_VERSION variable. If the remote version has already # been established then don't perform the host check again. Utilities in share/github-backup-utils From 2e58c44c8e208f7606eddad710c142f8d1f108a3 Mon Sep 17 00:00:00 2001 From: Krayon Date: Thu, 23 Mar 2023 15:44:08 +1100 Subject: [PATCH 255/946] Typo --- share/github-backup-utils/ghe-backup-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 21a16ad35..0586e53dd 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -144,7 +144,7 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ done # If we don't have a readlink command, error out -[ ! type readlink 1>/dev/null 2>&1 ] && { +! type readlink 1>/dev/null 2>&1 && { echo "Error: readlink not found. Please install readlink and ensure it is in your PATH." 1>&2 exit 1 } From d2a566feb72c149ef430b2f274b8df4ad57c7d87 Mon Sep 17 00:00:00 2001 From: Krayon Date: Thu, 23 Mar 2023 23:18:33 +1100 Subject: [PATCH 256/946] No need to check for readlink if it's required --- share/github-backup-utils/ghe-backup-config | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 0586e53dd..1b8a7aa54 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -300,10 +300,9 @@ if [ -z "$GHE_DATA_DIR" ]; then fi # Convert the data directory path to an absolute path, basing any relative -# paths on the backup-utils root, and using readlink, if available, to -# canonicalize the path. +# paths on the backup-utils root, and use readlink to canonicalize the path. if [ "${GHE_DATA_DIR:0:1}" != "/" ]; then - GHE_DATA_DIR="$(cd "$GHE_BACKUP_ROOT" && readlink -m "$GHE_DATA_DIR" 2>/dev/null || echo "$GHE_BACKUP_ROOT/$GHE_DATA_DIR")" + GHE_DATA_DIR="$(cd "$GHE_BACKUP_ROOT" && readlink -m "$GHE_DATA_DIR")" fi export GHE_DATA_DIR From bba527bd6b5397c25a4cb2edea0ad5d45d266092 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 23 Mar 2023 19:41:01 +0000 Subject: [PATCH 257/946] Update transfer_size units --- bin/ghe-host-check | 6 +++--- share/github-backup-utils/ghe-rsync-size.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index ecf1a045a..77affa8c0 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -170,10 +170,10 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then actions_disk_size=$(transfer_size actions /tmp) mssql_disk_size=$(transfer_size mssql /tmp) - #min_disk_req=$(( $(echo "$repos_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$pages_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$es_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$stor_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$minio_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mysql_disk_size" | awk '{printf "%.0f", $1/2}') + $(echo "$actions_disk_size" | awk '{printf "%.0f", $1}') + $(echo "$mssql_disk_size" | awk '{printf "%.0f", $1}') )) min_disk_req=$(( $(echo "$repos_disk_size") + $(echo "$pages_disk_size") + $(echo "$es_disk_size") + $(echo "$stor_disk_size") + $(echo "$minio_disk_size") + $(echo "$mysql_disk_size") + $(echo "$actions_disk_size") + $(echo "$mssql_disk_size") )) -echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size \npages: $pages_disk_size \nelasticsearch: $es_disk_size \nstorage: $stor_disk_size \nminio: $minio_disk_size \nmysql: $mysql_disk_size \nactions: $actions_disk_size \nmssql: $mssql_disk_size" 1>&2 - printf "min_disk_required for this backup is at least %d MB\n" "$((min_disk_req / 1024 ** 2))" 1>&2 + + echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size MB\npages: $pages_disk_size MB\nelasticsearch: $es_disk_size MB\nstorage: $stor_disk_size MB\nminio: $minio_disk_size MB\nmysql: $mysql_disk_size MB\nactions: $actions_disk_size MB\nmssql: $mssql_disk_size MB" 1>&2 + printf "min_disk_required for this backup is at least %d MB\n" "$min_disk_req" 1>&2 if [[ $available_space -lt $min_disk_req ]]; then echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 diff --git a/share/github-backup-utils/ghe-rsync-size.sh b/share/github-backup-utils/ghe-rsync-size.sh index 6f195c3f0..f8215a6b4 100755 --- a/share/github-backup-utils/ghe-rsync-size.sh +++ b/share/github-backup-utils/ghe-rsync-size.sh @@ -68,8 +68,8 @@ transfer_size() # Reduce mysql size as only the compressed file is transferred if [[ "$1" == "mysql" ]]; then - echo "$total_file_size" | awk '{printf "%.0f\n", $1/2}' + echo "$total_file_size" | awk '{if ($1 > 0) printf "%.0f\n", int(($1+999999.5)/2000000); else printf "0\n"}' else - echo "$total_file_size" | awk '{printf "%.0f\n", $1}' + echo "$total_file_size" | awk '{if ($1 > 0) printf "%.0f\n", int(($1+999999.5)/1000000); else printf "0\n"}' fi } From 8e3cfda6d6f86b6f608196f4445600c202ff20f2 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 23 Mar 2023 20:14:41 +0000 Subject: [PATCH 258/946] Tweak & typo --- bin/ghe-backup | 2 +- bin/ghe-host-check | 2 +- share/github-backup-utils/ghe-rsync-size.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 47fa9cddc..5696e9856 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -284,7 +284,7 @@ fi log_info "Checking for leaked ssh keys ..." ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true -log_info "Restore of $GHE_HOSTNAME finished." +log_info "Backup of $GHE_HOSTNAME finished." # Remove in-progress file ghe_backup_finished diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 77affa8c0..6137331fa 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -170,7 +170,7 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then actions_disk_size=$(transfer_size actions /tmp) mssql_disk_size=$(transfer_size mssql /tmp) - min_disk_req=$(( $(echo "$repos_disk_size") + $(echo "$pages_disk_size") + $(echo "$es_disk_size") + $(echo "$stor_disk_size") + $(echo "$minio_disk_size") + $(echo "$mysql_disk_size") + $(echo "$actions_disk_size") + $(echo "$mssql_disk_size") )) + min_disk_req=$(($repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size)) echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size MB\npages: $pages_disk_size MB\nelasticsearch: $es_disk_size MB\nstorage: $stor_disk_size MB\nminio: $minio_disk_size MB\nmysql: $mysql_disk_size MB\nactions: $actions_disk_size MB\nmssql: $mssql_disk_size MB" 1>&2 printf "min_disk_required for this backup is at least %d MB\n" "$min_disk_req" 1>&2 diff --git a/share/github-backup-utils/ghe-rsync-size.sh b/share/github-backup-utils/ghe-rsync-size.sh index f8215a6b4..65de3c3a7 100755 --- a/share/github-backup-utils/ghe-rsync-size.sh +++ b/share/github-backup-utils/ghe-rsync-size.sh @@ -61,7 +61,7 @@ transfer_size() total_file_size=$(ghe-rsync -arn --stats \ -e "ssh -q $GHE_EXTRA_SSH_OPTS -p 122 -l admin" \ --rsync-path="sudo -u $user rsync" \ - $link_dest/$1 \ + "$link_dest"/"$1" \ --ignore-missing-args \ "$GHE_HOSTNAME:$data_user_dir/" \ "$dest_dir/" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') From 2f9d5e092074d8387029ce504c896e05cf3d968d Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 23 Mar 2023 20:32:49 +0000 Subject: [PATCH 259/946] typo-2 --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 6137331fa..0c0fd83be 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -170,7 +170,7 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then actions_disk_size=$(transfer_size actions /tmp) mssql_disk_size=$(transfer_size mssql /tmp) - min_disk_req=$(($repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size)) + min_disk_req=$((repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size)) echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size MB\npages: $pages_disk_size MB\nelasticsearch: $es_disk_size MB\nstorage: $stor_disk_size MB\nminio: $minio_disk_size MB\nmysql: $mysql_disk_size MB\nactions: $actions_disk_size MB\nmssql: $mssql_disk_size MB" 1>&2 printf "min_disk_required for this backup is at least %d MB\n" "$min_disk_req" 1>&2 From 848154ada6182afc7749eeb53931a3e980c0ad59 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 23 Mar 2023 23:02:20 +0000 Subject: [PATCH 260/946] edits --- backup-verbose.log | 3670 +++++++++++++++++++ bin/ghe-backup | 5 +- share/github-backup-utils/bm.sh | 2 +- share/github-backup-utils/ghe-backup-config | 3 +- share/github-backup-utils/track-progress | 12 +- testfd | 0 6 files changed, 3681 insertions(+), 11 deletions(-) create mode 100644 backup-verbose.log create mode 100644 testfd diff --git a/backup-verbose.log b/backup-verbose.log new file mode 100644 index 000000000..bd430d973 --- /dev/null +++ b/backup-verbose.log @@ -0,0 +1,3670 @@ +2023-03-17T16:13:33Z INFO ghe-restore: +2023-03-17T16:13:33Z INFO ghe-restore-snapshot-path: +2023-03-17T16:13:33Z INFO ghe-detect-leaked-ssh-keys: +2023-03-17T16:13:33Z INFO ghe-host-check: 10.0.1.172 +2023-03-17T16:13:33Z INFO ghe-ssh: -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172 -- [ -f '/etc/github/cluster' ] +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172 -- cat /etc/github/repl-state +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- [ -f '/etc/github/configured' ] +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] +2023-03-17T16:13:34Z INFO ghe-restore-external-database-compatibility-check: +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- [ -f '/etc/github/configured' ] +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- [ -f '/etc/github/repl-state' ] +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- logger -t backup-utils +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- sudo sponge '/data/user/common/ghe-restore-status' >/dev/null +2023-03-17T16:13:34Z INFO ghe-maintenance-mode-status: 10.0.1.172:122 +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- test -e /data/github/current/public/system/maintenance.html +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --get core.package-version +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-17T16:13:34Z INFO ghe-backup-store-version: +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 +ghe-backup-store-version took 0s +2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- sudo service cron stop +2023-03-17T16:13:35Z INFO ghe-ssh: 10.0.1.172:122 -- systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null +2023-03-17T16:13:35Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/sh +mysql is running +Queued nomad job '/etc/nomad-jobs/elasticsearch/elasticsearch.hcl' +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo sponge '/data/user/common/uuid' 2>/dev/null +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo systemctl stop consul +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo rm -rf /data/user/consul/raft +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-17T16:13:36Z INFO ghe-restore-mysql: 10.0.1.172:122 +Restoring password pepper ... +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/bash +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-17T16:13:36Z INFO ghe-restore-mysql-binary: 10.0.1.172:122 +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo mkdir -p '/data/user/tmp' +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo dd of=/data/user/tmp/mysql.sql.gz >/dev/null 2>&1 +2023-03-17T16:13:36Z INFO Restore MySQL database ... +2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/bash +Mar 17 16:13:36 Stop MySQL service +active +Stop MySQL via Nomad +==> 2023-03-17T16:13:36Z: Monitoring evaluation "e479e4cf" + 2023-03-17T16:13:36Z: Evaluation triggered by job "mysql" +==> 2023-03-17T16:13:37Z: Monitoring evaluation "e479e4cf" + 2023-03-17T16:13:37Z: Evaluation status changed: "pending" -> "complete" +==> 2023-03-17T16:13:37Z: Evaluation "e479e4cf" finished with status "complete" +Waiting for 60 seconds for mysql to completely shut down +mysql is not running +mysql is not running +Mar 17 16:13:37 Available space for data: 31079 (MB). Existing datadir: 794 (MB). Available ratio: 39 +Mar 17 16:13:37 Previous emergency copy /data/user/mysql-backup is deleted! +Mar 17 16:13:37 Existing MySQL directory backed up to /data/user/mysql-backup. If you need to restore from that, run "sudo rm -rf /data/user/mysql" and then "sudo mv /data/user/mysql-backup /data/user/mysql" +Mar 17 16:13:37 Purge MySQL folder +Mar 17 16:13:37 Extracting backup +Mar 17 16:13:38 Prepare backup +Mar 17 16:13:38 Using xtrabackup 2.4 for restore +Mar 17 16:13:43 Change owner to MySQL +Mar 17 16:13:43 Start MySQL service +Queued nomad job '/etc/nomad-jobs/mysql/mysql.hcl' +Wait nomad to start MySQL +MySQL is up running +Setup mysql after startup +Finish setup mysql after startup +Mar 17 16:13:59 MySQL service started +Mar 17 16:14:00 Restore succeeded +Mar 17 16:14:00 Emergency copy of /data/user/mysql is saved at /data/user/mysql-backup. After you are sure the restore was successful, please delete this copy +ghe-restore-mysql-binary took 24s +2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- sudo rm -rf /data/user/tmp/mysql.sql.gz +ghe-restore-mysql took 24s +2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true app.minio.enabled +2023-03-17T16:14:00Z INFO ghe-restore-minio: 10.0.1.172:122 +2023-03-17T16:14:00Z INFO * Transferring minio files to 10.0.1.172 ... +2023-03-17T16:14:00Z INFO ghe-ssh: -p 122 10.0.1.172 -- sudo mkdir -p /data/user/minio +2023-03-17T16:14:00Z INFO ghe-ssh: -p 122 10.0.1.172 -- sudo chown -R minio:minio /data/user/minio +2023-03-17T16:14:00Z RSYNC BEGIN: minio rsync +2023-03-17T16:14:00Z INFO ghe-rsync: --verbose --archive --hard-links --relative --delete --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync /workspace/backup-utils-private/data/20230316T212843/minio/./ 10.0.1.172:/data/user/minio/ +2023-03-17T16:14:00Z INFO ghe-ssh: -p 122 10.0.1.172 sudo -u minio rsync --server -vlHogDtprRe.iLsfxC --delete . /data/user/minio/ +sending incremental file list + +sent 94 bytes received 13 bytes 214.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-17T16:14:00Z RSYNC END: minio rsync +ghe-restore-minio took 0s +2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-import-authorized-keys +2023-03-17T16:14:00Z INFO ghe-restore-pages: 10.0.1.172:122 +2023-03-17T16:14:00Z INFO ghe-restore-es-rsync: 10.0.1.172:122 +2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-import-redis +2023-03-17T16:14:00Z INFO ghe-restore-repositories-gist: 10.0.1.172:122 +2023-03-17T16:14:00Z INFO ghe-restore-git-hooks: 10.0.1.172:122 +2023-03-17T16:14:00Z INFO ghe-restore-repositories: 10.0.1.172:122 +2023-03-17T16:14:00Z INFO ghe-restore-storage: 10.0.1.172:122 +2023-03-17T16:14:00Z WARN Warning: Pages backup missing. Skipping ... +2023-03-17T16:14:00Z WARN Warning: Storage backup missing. Skipping ... +2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- sudo mkdir -p '/data/user/elasticsearch-restore' +2023-03-17T16:14:00Z INFO ghe-ssh: -l admin 10.0.1.172:122 -- sudo -u git mkdir -p /data/user/git-hooks/repos +2023-03-17T16:14:00Z RSYNC BEGIN: git-hooks repos rsync +2023-03-17T16:14:00Z RSYNC END: git-hooks repos rsync +2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- sudo chown elasticsearch:elasticsearch '/data/user/elasticsearch-restore' +2023-03-17T16:14:00Z INFO ghe-rsync: -avH --delete -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync /workspace/backup-utils-private/data/20230316T212843/git-hooks/repos/ 10.0.1.172:/data/user/git-hooks/repos + --> Stopping redis... +2023-03-17T16:14:00Z RSYNC BEGIN: elasticsearch rsync +2023-03-17T16:14:00Z INFO ghe-rsync: -avz --delete -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --copy-dest=/data/user/elasticsearch /workspace/backup-utils-private/data/20230316T212843/elasticsearch/ 10.0.1.172:/data/user/elasticsearch-restore +2023-03-17T16:14:00Z INFO ghe-ssh: -p 122 10.0.1.172 sudo -u elasticsearch rsync --server -vlogDtprze.iLsfxC --delete --copy-dest /data/user/elasticsearch . /data/user/elasticsearch-restore +sending incremental file list +./ +deleting nodes/0/_state/node-0.st +deleting nodes/0/_state/global-3.st +deleting nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/state-0.st +deleting nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/segments_1 +deleting nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/state-3.st +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/state-0.st +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/segments_1 +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/state-0.st +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/segments_1 +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/state-0.st +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/segments_1 +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/state-0.st +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/segments_1 +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/state-0.st +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/segments_1 +deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/state-5.st +deleting nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/state-0.st +deleting nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/segments_1 +deleting nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/state-3.st +deleting nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/state-0.st +deleting nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/segments_1 +deleting nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/state-3.st +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/state-0.st +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/segments_1 +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/state-0.st +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/segments_1 +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/state-0.st +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/segments_1 +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/state-0.st +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/segments_1 +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/state-0.st +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/segments_1 +deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/state-5.st +deleting nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/state-0.st +deleting nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/segments_1 +deleting nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/state-3.st +deleting nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/state-0.st +deleting nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/segments_1 +deleting nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/state-3.st +deleting nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/state-0.st +deleting nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/segments_1 +deleting nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/state-3.st +deleting nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/state-0.st +deleting nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/segments_1 +deleting nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/state-3.st +deleting nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/state-0.st +deleting nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/segments_1 +deleting nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/state-3.st +deleting nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/state-0.st +deleting nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/segments_1 +deleting nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/state-5.st +deleting nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/state-0.st +deleting nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/segments_1 +deleting nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/state-3.st +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/state-0.st +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/segments_1 +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/state-0.st +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/segments_1 +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/state-0.st +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/segments_1 +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/state-0.st +deleting nodes/0/indices/ROa --> Importing SSH authorized keys... +Qi7QXRdOYoj6_dXARBQ/3/index/segments_1 +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/state-0.st +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/segments_1 +deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/state-5.st +deleting nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/state-0.st +deleting nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/segments_1 +deleting nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/state-3.st +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/state-0.st +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/segments_1 +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/state-0.st +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/segments_1 +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/state-0.st +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/segments_1 +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/state-0.st +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/segments_1 +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/state-0.st +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/segments_1 +deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/state-5.st +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/state-0.st +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/segments_1 +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/state-0.st +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/segments_1 +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/state-0.st +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/segments_3 +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/state-0.st +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/segments_1 +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/state-0.st +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/segments_1 +deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/state-5.st +deleting nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/state-0.st +deleting nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/segments_1 +deleting nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/state-3.st +deleting nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/state-0.st +deleting nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/segments_3 +deleting nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/state-3.st +deleting nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/state-0.st +deleting nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/segments_1 +deleting nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/state-3.st +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/state-0.st +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/segments_1 +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/state-0.st +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/segments_1 +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/state-0.st +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/segments_1 +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/state-0.st +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/segments_1 +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/state-0.st +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/segments_1 +deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/state-5.st +deleting nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/state-0.st +deleting nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/segments_1 +deleting nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/state-3.st +deleting nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/state-0.st +deleting nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/segments_1 +deleting nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/state-3.st +deleting nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/state-0.st +deleting nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/segments_3 +deleting nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/state-4.st +deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/state-0.st +deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_h +deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_7.si +deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_7.cfs +deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_7.cfe +deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-9.tlog +deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/state-4.st +deleting nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/state-0.st +deleting nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/segments_1 +deleting nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/state-3.st +deleting nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/state-0.st +deleting nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/segments_1 +deleting nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/state-3.st +deleting nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/state-0.st +deleting nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/segments_1 +deleting nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/state-3.st +nodes/0/ +nodes/0/_state/ +nodes/0/_state/global-5.st +nodes/0/_state/node-2.st +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/state-2.st +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/segments_3 +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog.ckp +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/state-9.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/state-2.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/segments_3 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/state-2.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/segments_3 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/state-2.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/segments_3 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/state-2.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/segments_3 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/state-2.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/segments_3 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/state-13.st +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/state-2.st +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/segments_3 +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog.ckp +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/state-9.st +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/state-2.st +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/segments_3 +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog.ckp +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/state-9.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/state-2.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/segments_3 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/state-2.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/segments_3 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/state-2.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/segments_3 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/state-2.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/segments_3 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/state-2.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/segments_3 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/state-13.st +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/state-2.st +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/segments_3 +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog.ckp +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/state-9.st +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/state-2.st +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/segments_3 +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog.ckp +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/state-9.st +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/state-2.st +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/segments_3 +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog.ckp +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/state-9.st +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/state-2.st +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/segments_3 +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog.ckp +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/state-9.st +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/state-2.st +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/segments_3 +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog.ckp +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/state-9.st +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/state-2.st +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/segments_3 +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog.ckp +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/state-11.st +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/state-2.st +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/segments_3 +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog.ckp +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/state-9.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/state-2.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/segments_3 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/state-2.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/segments_3 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/state-2.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/segments_3 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/state-2.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/segments_3 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/state-2.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/segments_3 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/state-13.st +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/state-2.st +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/segments_3 +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog.ckp +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/state-9.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/state-2.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/segments_3 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/state-2.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/segments_3 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/state-2.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/segments_3 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/state-2.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/segments_3 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/state-2.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/segments_3 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/state-13.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/state-2.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/segments_3 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/state-2.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/segments_3 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/state-2.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/segments_5 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/state-2.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/segments_3 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/state-2.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/segments_3 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/state-13.st +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/state-2.st +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/segments_3 +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog.ckp +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/state-9.st +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/state-2.st +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/segments_5 +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog-4.tlog +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog.ckp +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/state-9.st +nodes/0/indices/ejnFd11uQteAkjE995T2tw/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/state-2.st +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/segments_3 +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog.ckp +nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/state-9.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/state-2.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/segments_3 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/state-2.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/segments_3 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/state-2.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/segments_3 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/state-2.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/segments_3 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/state-2.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/segments_3 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/state-13.st +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/state-2.st +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/segments_3 +nodes/0/indices/kSoL8UdcRTy558OhM==> 2023-03-17T16:14:00Z: Monitoring evaluation "58730a17" + 2023-03-17T16:14:00Z: Evaluation triggered by job "redis" +RyvRw/0/translog/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog.ckp +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/state-9.st +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/state-2.st +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/segments_3 +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog.ckp +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/state-9.st +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/state-2.st +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/segments_5 +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog.ckp +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/state-10.st +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/state-2.st +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_g.cfe +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_g.cfs +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_g.si +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_v +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-18.tlog +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/state-10.st +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/state-2.st +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/segments_3 +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog.ckp +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/state-9.st +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/state-2.st +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/segments_3 +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog.ckp +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/state-9.st +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/state-2.st +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/segments_3 +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog.ckp +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/state-9.st + +sent 86,283 bytes received 13,126 bytes 198,818.00 bytes/sec +total size is 142,465 speedup is 1.43 +2023-03-17T16:14:00Z RSYNC END: elasticsearch rsync +ghe-restore-es-rsync took 0s +sending incremental file list + +sent 58 bytes received 12 bytes 140.00 bytes/sec +total size is 0 speedup is 0.00 +ghe-restore-git-hooks took 0s +==> 2023-03-17T16:14:01Z: Monitoring evaluation "58730a17" + 2023-03-17T16:14:01Z: Evaluation status changed: "pending" -> "complete" +==> 2023-03-17T16:14:01Z: Evaluation "58730a17" finished with status "complete" + --> Importing redis data... + --> Starting redis... +Queued nomad job '/etc/nomad-jobs/redis/redis.hcl' +Waiting for redis service +Status = running + --> Make sure redis is ready... + --> Remove stale resque worker entries... +2023-03-17T16:14:09Z INFO Restarting memcached ... +2023-03-17T16:14:09Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/sh +2023-03-17T16:14:09Z INFO Setting last run date for GitHub Connect jobs ... +2023-03-17T16:14:09Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/sh +2023-03-17T16:14:09Z INFO ghe-ssh: 10.0.1.172:122 -- sudo sponge '/data/user/common/ghe-restore-status' >/dev/null +2023-03-17T16:14:09Z INFO ghe-ssh: 10.0.1.172:122 -- sudo timeout 120s service cron start +2023-03-17T16:14:10Z INFO ghe-ssh: --clean +2023-03-17T16:14:10Z INFO Removing in-progress file ... +2023-03-21T20:40:04Z INFO ghe-backup +2023-03-21T20:40:04Z INFO ghe-host-check +2023-03-21T20:40:04Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh +2023-03-21T20:40:05Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] +2023-03-21T20:40:05Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state +2023-03-21T20:40:05Z INFO ghe-rsync-size.sh +2023-03-21T20:40:05Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ +2023-03-21T20:40:05Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ +2023-03-21T20:40:05Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ +2023-03-21T20:40:06Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ +2023-03-21T20:40:06Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ +2023-03-21T20:40:06Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ +2023-03-21T20:40:07Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ +2023-03-21T20:40:07Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ +2023-03-21T20:40:07Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-21T20:40:08Z INFO ghe-backup-strategy +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] +2023-03-21T20:40:08Z INFO ghe-backup-store-version +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 +ghe-backup-store-version took 0s +2023-03-21T20:40:08Z INFO ghe-backup-settings +2023-03-21T20:40:08Z INFO * Transferring settings data ... +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings +2023-03-21T20:40:08Z INFO * Transferring license data ... +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' +2023-03-21T20:40:08Z INFO * Transferring management console password ... +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage +2023-03-21T20:40:08Z INFO * Transferring password pepper ... +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets +2023-03-21T20:40:08Z INFO * Transferring kredz.credz HMAC key ... +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret +2023-03-21T20:40:08Z INFO * Transferring kredz.varz HMAC key ... +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret +2023-03-21T20:40:08Z INFO * Transferring management console argon2 secret ... +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null +2023-03-21T20:40:08Z INFO * Transferring CA certificates ... +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null +2023-03-21T20:40:08Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys +ghe-export-authorized-keys took 0s +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys +ghe-export-ssh-host-keys took 0s +2023-03-21T20:40:08Z INFO ghe-backup-mysql +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-21T20:40:08Z INFO ghe-backup-mysql-binary +2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +ghe-backup-mysql-binary took 3s +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled +2023-03-21T20:40:11Z INFO ghe-backup-minio +2023-03-21T20:40:11Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-21T20:40:11Z RSYNC BEGIN: minio rsync +2023-03-21T20:40:11Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230321T204004/minio +2023-03-21T20:40:11Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:40:11Z RSYNC END: minio rsync +ghe-backup-minio took 0s +2023-03-21T20:40:11Z INFO ghe-backup-es-audit-log +2023-03-21T20:40:11Z INFO ghe-backup-pages +2023-03-21T20:40:11Z INFO ghe-backup-repositories +2023-03-21T20:40:11Z INFO ghe-backup-storage +2023-03-21T20:40:11Z INFO ghe-backup-redis +2023-03-21T20:40:11Z INFO ghe-backup-es-rsync +2023-03-21T20:40:11Z INFO ghe-backup-git-hooks + +2023-03-21T20:40:11Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-21T20:40:11Z INFO * Transferring pages files ... +2023-03-21T20:40:11Z RSYNC BEGIN: pages rsync +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] +2023-03-21T20:40:11Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230321T204004/pages +2023-03-21T20:40:11Z INFO * Performing initial sync of ES indices ... +2023-03-21T20:40:11Z RSYNC BEGIN elasticsearch rsync +2023-03-21T20:40:11Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-21T20:40:11Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-21T20:40:11Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204004/elasticsearch +2023-03-21T20:40:11Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:40:11Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +2023-03-21T20:40:11Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +2023-03-21T20:40:11Z RSYNC BEGIN: git-hooks sync +ghe-backup-es-audit-log took 0s +2023-03-21T20:40:11Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230321T204004/git-hooks/repos +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +receiving incremental file list +./ +nodes/0/ +nodes/0/_state/ +nodes/0/_state/global-6.st +nodes/0/_state/node-3.st +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/state-3.st +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/segments_4 +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog-3.ckp +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog-4.tlog +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog.ckp +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/state-12.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/state-17.st +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/state-3.st +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/segments_4 +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog-3.ckp +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog-4.tlog +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog.ckp +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/state-12.st +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/state-3.st +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/segments_4 +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog-3.ckp +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog-4.tlog +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog.ckp +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/state-12.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/state-17.st +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/state-3.st +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/segments_4 +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog-3.ckp +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog-4.tlog +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog.ckp +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/state-12.st +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/state-3.st +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/segments_4 +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog-3.ckp +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog-4.tlog +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog.ckp +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/state-12.st +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/state-3.st +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/segments_4 +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog-3.ckp +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog-4.tlog +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog.ckp +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/state-12.st +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/state-3.st +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/segments_4 +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog-3.ckp +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog-4.tlog +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog.ckp +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/state-12.st +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/state-3.st +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/segments_4 +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog-3.ckp +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog-4.tlog +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog.ckp +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/state-12.st +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/state-3.st +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/segments_4 +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog-3.ckp +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog-4.tlog +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog.ckp +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/state-14.st +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/state-3.st +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/segments_4 +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog-3.ckp +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog-4.tlog +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog.ckp +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/state-12.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/state-17.st +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/state-3.st +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/segments_4 +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog-3.ckp +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog-4.tlog +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog.ckp +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/state-12.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/state-17.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/segments_4 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog-3.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog-4.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/segments_4 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog-3.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog-4.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/segments_6 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog-4.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog-5.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/segments_4 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog-3.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog-4.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/segments_4 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog-3.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog-4.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/state-17.st +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/state-3.st +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/segments_4 +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog-3.ckp +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog-4.tlog +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog.ckp +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/state-12.st +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/state-3.st +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.cfe +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.cfs +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.si +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/segments_8 +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog-6.tlog +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog.ckp +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/state-12.st +nodes/0/indices/ejnFd11uQteAkjE995T2tw/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/state-3.st +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/segments_4 +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog-3.ckp +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog-4.tlog +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog.ckp +nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/state-12.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/state-17.st +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/state-3.st +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/segments_4 +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog-3.ckp +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog-4.tlog +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog.ckp +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/state-12.st +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/state-3.st +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/segments_4 +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog-3.ckp +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog-4.tlog +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog.ckp +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/state-12.st +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/state-3.st +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/segments_6 +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog-4.ckp +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog-5.tlog +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog.ckp +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/state-13.st +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/state-3.st +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.cfe +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.cfs +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.si +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_15 +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-24.tlog +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/state-13.st +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/state-3.st +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/segments_4 +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog-3.ckp +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog-4.tlog +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog.ckp +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/state-12.st +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/state-3.st +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/segments_4 +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog-3.ckp +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog-4.tlog +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog.ckp +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/state-12.st +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/state-3.st +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/segments_4 +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog-3.ckp +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog-4.tlog +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog.ckp +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/state-12.st + +sent 6,918 bytes received 97,851 bytes 209,538.00 bytes/sec +total size is 146,931 speedup is 1.40 +2023-03-21T20:40:11Z RSYNC END elasticsearch rsync +2023-03-21T20:40:11Z INFO * Disabling ES index flushing ... +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush +2023-03-21T20:40:11Z INFO * Performing follow-up sync of ES indices ... +2023-03-21T20:40:11Z RSYNC BEGIN: elasticsearch followup rsync +2023-03-21T20:40:11Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204004/elasticsearch +2023-03-21T20:40:11Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:40:11Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +receiving incremental file list + +sent 282 bytes received 22,566 bytes 45,696.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-21T20:40:11Z RSYNC END: elasticsearch followup rsync +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete +ghe-backup-es-rsync took 0s +2023-03-21T20:40:11Z INFO * Enabling ES index flushing ... +2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:40:11Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +ghe-backup-redis took 1s +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-6nt2a6/remote_routes_list +ghe-backup-storage - Generating routes took 2s +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-6nt2a6/remote_routes_list +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-21T20:40:13Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-6nt2a6 +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-8O0hUx/remote_routes_list +ghe-backup-repositories - Generating routes took 2s +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-8O0hUx/remote_routes_list +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s +2023-03-21T20:40:13Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-8O0hUx +2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-21T20:40:13Z INFO ghe-ssh --clean +2023-03-21T20:43:38Z INFO ghe-backup +2023-03-21T20:43:38Z INFO ghe-host-check +2023-03-21T20:43:38Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh +2023-03-21T20:43:39Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] +2023-03-21T20:43:39Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state +2023-03-21T20:43:39Z INFO ghe-rsync-size.sh +2023-03-21T20:43:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ +2023-03-21T20:43:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ +2023-03-21T20:43:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ +2023-03-21T20:43:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ +2023-03-21T20:43:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ +2023-03-21T20:43:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ +2023-03-21T20:43:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ +2023-03-21T20:43:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ +2023-03-21T20:43:41Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-21T20:43:41Z INFO ghe-backup-strategy +2023-03-21T20:43:41Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] +2023-03-21T20:43:41Z INFO ghe-backup-store-version +2023-03-21T20:43:41Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 +ghe-backup-store-version took 1s +2023-03-21T20:43:42Z INFO ghe-backup-settings +2023-03-21T20:43:42Z INFO * Transferring settings data ... +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings +2023-03-21T20:43:42Z INFO * Transferring license data ... +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' +2023-03-21T20:43:42Z INFO * Transferring management console password ... +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage +2023-03-21T20:43:42Z INFO * Transferring password pepper ... +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets +2023-03-21T20:43:42Z INFO * Transferring kredz.credz HMAC key ... +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret +2023-03-21T20:43:42Z INFO * Transferring kredz.varz HMAC key ... +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret +2023-03-21T20:43:42Z INFO * Transferring management console argon2 secret ... +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null +2023-03-21T20:43:42Z INFO * Transferring CA certificates ... +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null +2023-03-21T20:43:42Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys +ghe-export-authorized-keys took 0s +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys +ghe-export-ssh-host-keys took 0s +2023-03-21T20:43:42Z INFO ghe-backup-mysql +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-21T20:43:42Z INFO ghe-backup-mysql-binary +2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +ghe-backup-mysql-binary took 3s +ghe-backup-mysql took 3s +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled +2023-03-21T20:43:45Z INFO ghe-backup-minio +2023-03-21T20:43:45Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-21T20:43:45Z RSYNC BEGIN: minio rsync +2023-03-21T20:43:45Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230321T204338/minio +2023-03-21T20:43:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:43:45Z RSYNC END: minio rsync +ghe-backup-minio took 0s +Backup progress: 0 % +2023-03-21T20:43:45Z INFO ghe-backup-es-audit-log +2023-03-21T20:43:45Z INFO ghe-backup-storage +2023-03-21T20:43:45Z INFO ghe-backup-pages +2023-03-21T20:43:45Z INFO ghe-backup-repositories +2023-03-21T20:43:45Z INFO ghe-backup-redis +2023-03-21T20:43:45Z INFO ghe-backup-git-hooks +2023-03-21T20:43:45Z INFO ghe-backup-es-rsync + +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" +2023-03-21T20:43:45Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] +2023-03-21T20:43:45Z INFO * Transferring pages files ... +2023-03-21T20:43:45Z RSYNC BEGIN: pages rsync +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] +2023-03-21T20:43:45Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230321T204338/pages +2023-03-21T20:43:45Z INFO * Performing initial sync of ES indices ... +2023-03-21T20:43:45Z RSYNC BEGIN elasticsearch rsync +2023-03-21T20:43:45Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-21T20:43:45Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-21T20:43:45Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-21T20:43:45Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204338/elasticsearch +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:43:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +2023-03-21T20:43:45Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +2023-03-21T20:43:45Z RSYNC BEGIN: git-hooks sync +2023-03-21T20:43:45Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230321T204338/git-hooks/repos +receiving incremental file list +./ +nodes/0/ +nodes/0/_state/ +nodes/0/_state/global-6.st +nodes/0/_state/node-3.st +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/state-3.st +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/segments_4 +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog-3.ckp +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog-4.tlog +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog.ckp +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/ +nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/state-12.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/state-3.st +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/segments_4 +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog-3.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog-4.tlog +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog.ckp +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/ +nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/state-17.st +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/state-3.st +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/segments_4 +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog-3.ckp +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog-4.tlog +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog.ckp +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/ +nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/state-12.st +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/state-3.st +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/segments_4 +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog-3.ckp +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog-4.tlog +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog.ckp +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/ +nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/state-12.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/state-3.st +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/segments_4 +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog-3.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog-4.tlog +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog.ckp +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/ +nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/state-17.st +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/state-3.st +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/segments_4 +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog-3.ckp +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog-4.tlog +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog.ckp +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/ +nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/state-12.st +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/state-3.st +nodes/2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/segments_4 +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog-3.ckp +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog-4.tlog +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog.ckp +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/ +nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/state-12.st +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/state-3.st +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/segments_4 +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog-3.ckp +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog-4.tlog +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog.ckp +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/ +nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/state-12.st +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/state-3.st +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/segments_4 +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog-3.ckp +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog-4.tlog +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog.ckp +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/ +nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/state-12.st +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/state-3.st +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/segments_4 +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog-3.ckp +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog-4.tlog +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog.ckp +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/ +nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/state-12.st +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/state-3.st +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/segments_4 +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog-3.ckp +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog-4.tlog +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog.ckp +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/ +nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/state-14.st +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/state-3.st +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/segments_4 +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog-3.ckp +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog-4.tlog +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog.ckp +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/ +nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/state-12.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog-3.ckp +node2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +s/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/state-3.st +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/segments_4 +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog-3.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog-4.tlog +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog.ckp +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/ +nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/state-17.st +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/state-3.st +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/segments_4 +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog-3.ckp +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog-4.tlog +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog.ckp +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/ +nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/state-12.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/state-3.st +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/segments_4 +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog-3.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog-4.tlog +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog.ckp +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/ +nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/state-17.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/segments_4 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog-3.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog-4.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/segments_4 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog-3.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog-4.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/segments_6 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog-4.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog-5.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/segments_4 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog-3.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog-4.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/state-3.st +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/segments_4 +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog-3.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog-4.tlog +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog.ckp +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/ +nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/state-17.st +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/state-3.st +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/segments_4 +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog-3.ckp +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog-4.tlog +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog.ckp +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/ +nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/state-12.st +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/state-3.st +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.cfe +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.cfs +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.si +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/segments_8 +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog-6.tlog +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog.ckp +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/ +nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/state-12.st +nodes/0/indices/ejnFd11uQteAkjE995T2tw/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/state-3.st +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/segments_4 +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog-3.ckp +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog-4.tlog +nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog.ckp +nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/ +nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/state-12.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/state-3.st +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/segments_4 +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog-3.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog-4.tlog +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog.ckp +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/ +nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/state-17.st +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/state-3.st +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/segments_4 +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog-3.ckp +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog-4.tlog +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog.ckp +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/ +nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/state-12.st +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/state-3.st +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/segments_4 +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog-3.ckp +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog-4.tlog +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog.ckp +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/ +nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/state-12.st +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/state-3.st +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/segments_6 +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog-4.ckp +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog-5.tlog +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog.ckp +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/ +nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/state-13.st +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/state-3.st +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.cfe +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.cfs +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.si +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_15 +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-24.tlog +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/state-13.st +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/state-3.st +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/segments_4 +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog-3.ckp +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog-4.tlog +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog.ckp +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/ +nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/state-12.st +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/state-3.st +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/segments_4 +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog-3.ckp +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog-4.tlog +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog.ckp +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/ +nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/state-12.st +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/state-3.st +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/segments_4 +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog-3.ckp +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog-4.tlog +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog.ckp +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/ +nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/state-12.st + +sent 6,918 bytes received 97,851 bytes 209,538.00 bytes/sec +total size is 146,931 speedup is 1.40 +2023-03-21T20:43:45Z RSYNC END elasticsearch rsync +2023-03-21T20:43:45Z INFO * Disabling ES index flushing ... +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush +2023-03-21T20:43:45Z INFO * Performing follow-up sync of ES indices ... +2023-03-21T20:43:45Z RSYNC BEGIN: elasticsearch followup rsync +2023-03-21T20:43:45Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204338/elasticsearch +2023-03-21T20:43:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +receiving incremental file list + +sent 286 bytes received 22,570 bytes 45,712.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-21T20:43:45Z RSYNC END: elasticsearch followup rsync +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:43:45Z RSYNC END: pages rsync +ghe-backup-es-rsync took 0s +2023-03-21T20:43:45Z INFO * Enabling ES index flushing ... +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:43:45Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +ghe-backup-redis took 1s +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-QwYGTC/remote_routes_list +ghe-backup-storage - Generating routes took 2s +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-QwYGTC/remote_routes_list +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-21T20:43:47Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-QwYGTC +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-Jrpjeh/remote_routes_list +ghe-backup-repositories - Generating routes took 2s +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-Jrpjeh/remote_routes_list +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s +2023-03-21T20:43:47Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-Jrpjeh +2023-03-21T20:43:47Z INFO ghe-prune-snapshots +2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-21T20:43:47Z INFO ghe-detect-leaked-ssh-keys +2023-03-21T20:43:47Z INFO ghe-ssh --clean +2023-03-21T20:47:38Z INFO ghe-backup +2023-03-21T20:47:38Z INFO ghe-host-check +2023-03-21T20:47:38Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh +2023-03-21T20:47:39Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] +2023-03-21T20:47:39Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state +2023-03-21T20:47:39Z INFO ghe-rsync-size.sh +2023-03-21T20:47:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ +2023-03-21T20:47:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ +2023-03-21T20:47:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ +2023-03-21T20:47:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ +2023-03-21T20:47:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ +2023-03-21T20:47:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ +2023-03-21T20:47:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ +2023-03-21T20:47:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-21T20:47:42Z INFO ghe-backup-strategy +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] +2023-03-21T20:47:42Z INFO ghe-backup-store-version +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 +ghe-backup-store-version took 0s +2023-03-21T20:47:42Z INFO ghe-backup-settings +2023-03-21T20:47:42Z INFO * Transferring settings data ... +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings +2023-03-21T20:47:42Z INFO * Transferring license data ... +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' +2023-03-21T20:47:42Z INFO * Transferring management console password ... +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage +2023-03-21T20:47:42Z INFO * Transferring password pepper ... +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets +2023-03-21T20:47:42Z INFO * Transferring kredz.credz HMAC key ... +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret +2023-03-21T20:47:42Z INFO * Transferring kredz.varz HMAC key ... +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret +2023-03-21T20:47:42Z INFO * Transferring management console argon2 secret ... +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null +2023-03-21T20:47:42Z INFO * Transferring CA certificates ... +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null +2023-03-21T20:47:42Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys +ghe-export-authorized-keys took 0s +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys +ghe-export-ssh-host-keys took 0s +2023-03-21T20:47:42Z INFO ghe-backup-mysql +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-21T20:47:42Z INFO ghe-backup-mysql-binary +2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +ghe-backup-mysql-binary took 3s +ghe-backup-mysql took 3s +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled +2023-03-21T20:47:45Z INFO ghe-backup-minio +2023-03-21T20:47:45Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-21T20:47:45Z RSYNC BEGIN: minio rsync +2023-03-21T20:47:45Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230321T204738/minio +2023-03-21T20:47:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:47:45Z RSYNC END: minio rsync +ghe-backup-minio took 0s +Backup progress: % +2023-03-21T20:47:45Z INFO ghe-backup-es-audit-log +2023-03-21T20:47:45Z INFO ghe-backup-es-rsync +2023-03-21T20:47:45Z INFO ghe-backup-git-hooks +2023-03-21T20:47:45Z INFO ghe-backup-repositories +2023-03-21T20:47:45Z INFO ghe-backup-redis +2023-03-21T20:47:45Z INFO ghe-backup-storage +2023-03-21T20:47:45Z INFO ghe-backup-pages + +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-21T20:47:45Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" +2023-03-21T20:47:45Z INFO * Transferring pages files ... +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] +2023-03-21T20:47:45Z RSYNC BEGIN: pages rsync +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] +2023-03-21T20:47:45Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230321T204738/pages +2023-03-21T20:47:45Z INFO * Performing initial sync of ES indices ... +2023-03-21T20:47:45Z RSYNC BEGIN elasticsearch rsync +2023-03-21T20:47:45Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-21T20:47:45Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204738/elasticsearch +2023-03-21T20:47:45Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-21T20:47:45Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:47:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +2023-03-21T20:47:45Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +2023-03-21T20:47:45Z RSYNC BEGIN: git-hooks sync +2023-03-21T20:47:45Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230321T204738/git-hooks/repos +receiving incremental file list +./ + +sent 289 bytes received 22,573 bytes 45,724.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-21T20:47:45Z RSYNC END elasticsearch rsync +2023-03-21T20:47:45Z INFO * Disabling ES index flushing ... +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush +2023-03-21T20:47:45Z INFO * Performing follow-up sync of ES indices ... +2023-03-21T20:47:45Z RSYNC BEGIN: elasticsearch followup rsync +2023-03-21T20:47:45Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204738/elasticsearch +2023-03-21T20:47:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +receiving incremental file list + +sent 282 bytes received 22,566 bytes 45,696.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-21T20:47:45Z RSYNC END: elasticsearch followup rsync +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete +ghe-backup-es-rsync took 0s +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:47:45Z RSYNC END: pages rsync +2023-03-21T20:47:45Z INFO * Enabling ES index flushing ... +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-21T20:47:45Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +ghe-backup-redis took 1s +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-VGilqT/remote_routes_list +ghe-backup-storage - Generating routes took 2s +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-VGilqT/remote_routes_list +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-21T20:47:47Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-VGilqT +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-if4Tbi/remote_routes_list +ghe-backup-repositories - Generating routes took 2s +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-if4Tbi/remote_routes_list +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s +2023-03-21T20:47:47Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-if4Tbi +2023-03-21T20:47:47Z INFO ghe-prune-snapshots +2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-21T20:47:47Z INFO ghe-detect-leaked-ssh-keys +2023-03-21T20:47:48Z INFO ghe-ssh --clean +2023-03-22T18:31:55Z INFO ghe-backup +2023-03-22T18:31:55Z INFO ghe-host-check +2023-03-22T18:31:55Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh +2023-03-22T18:31:55Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] +2023-03-22T18:31:55Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state +2023-03-22T18:31:55Z INFO ghe-rsync-size.sh +2023-03-22T18:31:55Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ +2023-03-22T18:31:56Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ +2023-03-22T18:31:56Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ +2023-03-22T18:31:56Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ +2023-03-22T18:31:56Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ +2023-03-22T18:31:57Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ +2023-03-22T18:31:57Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ +2023-03-22T18:31:57Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-22T18:31:58Z INFO ghe-backup-strategy +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] +2023-03-22T18:31:58Z INFO ghe-backup-store-version +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 +ghe-backup-store-version took 0s +2023-03-22T18:31:58Z INFO ghe-backup-settings +2023-03-22T18:31:58Z INFO * Transferring settings data ... +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings +2023-03-22T18:31:58Z INFO * Transferring license data ... +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' +2023-03-22T18:31:58Z INFO * Transferring management console password ... +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage +2023-03-22T18:31:58Z INFO * Transferring password pepper ... +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets +2023-03-22T18:31:58Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret +2023-03-22T18:31:58Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret +2023-03-22T18:31:58Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null +2023-03-22T18:31:58Z INFO * Transferring CA certificates ... +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates +2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null +2023-03-22T18:31:58Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys +ghe-export-authorized-keys took 1s +2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys +ghe-export-ssh-host-keys took 0s +2023-03-22T18:31:59Z INFO ghe-backup-mysql +2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-22T18:31:59Z INFO ghe-backup-mysql-binary +2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +ghe-backup-mysql-binary took 2s +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled +2023-03-22T18:32:01Z INFO ghe-backup-minio +2023-03-22T18:32:01Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T18:32:01Z RSYNC BEGIN: minio rsync +2023-03-22T18:32:01Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230322T183155/minio +2023-03-22T18:32:01Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:32:01Z RSYNC END: minio rsync +ghe-backup-minio took 0s +2023-03-22T18:32:01Z INFO ghe-backup-es-audit-log +2023-03-22T18:32:01Z INFO ghe-backup-redis +2023-03-22T18:32:01Z INFO ghe-backup-es-rsync +2023-03-22T18:32:01Z INFO ghe-backup-repositories +2023-03-22T18:32:01Z INFO ghe-backup-pages +2023-03-22T18:32:01Z INFO ghe-backup-storage +2023-03-22T18:32:01Z INFO ghe-backup-git-hooks + +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-22T18:32:01Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" +2023-03-22T18:32:01Z INFO * Transferring pages files ... +2023-03-22T18:32:01Z RSYNC BEGIN: pages rsync +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] +2023-03-22T18:32:01Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230322T183155/pages +2023-03-22T18:32:01Z INFO * Performing initial sync of ES indices ... +2023-03-22T18:32:01Z RSYNC BEGIN elasticsearch rsync +2023-03-22T18:32:01Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T18:32:01Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-22T18:32:01Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-22T18:32:01Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183155/elasticsearch +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:32:01Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +2023-03-22T18:32:01Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +ghe-backup-es-audit-log took 0s +2023-03-22T18:32:01Z RSYNC BEGIN: git-hooks sync +2023-03-22T18:32:01Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230322T183155/git-hooks/repos +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +receiving incremental file list +./ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.cfe +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.cfs +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.si +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_17 +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-25.tlog +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp + +sent 422 bytes received 24,766 bytes 50,376.00 bytes/sec +total size is 146,931 speedup is 5.83 +2023-03-22T18:32:01Z RSYNC END elasticsearch rsync +2023-03-22T18:32:01Z INFO * Disabling ES index flushing ... +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush +2023-03-22T18:32:01Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T18:32:01Z RSYNC BEGIN: elasticsearch followup rsync +2023-03-22T18:32:01Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183155/elasticsearch +2023-03-22T18:32:01Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:32:01Z RSYNC END: elasticsearch followup rsync +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:32:01Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-es-rsync took 0s +ghe-backup-pages took 0s +2023-03-22T18:32:01Z INFO * Enabling ES index flushing ... +2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 56.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:32:02Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 1s +ghe-backup-redis took 1s +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-B2RYgJ/remote_routes_list +ghe-backup-storage - Generating routes took 2s +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-B2RYgJ/remote_routes_list +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T18:32:03Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-B2RYgJ +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-xj3iWS/remote_routes_list +ghe-backup-repositories - Generating routes took 2s +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-xj3iWS/remote_routes_list +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s +2023-03-22T18:32:03Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-xj3iWS +2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-22T18:32:04Z INFO ghe-ssh --clean +2023-03-22T18:33:39Z INFO ghe-backup +2023-03-22T18:33:39Z INFO ghe-host-check +2023-03-22T18:33:39Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh +2023-03-22T18:33:40Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] +2023-03-22T18:33:40Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state +2023-03-22T18:33:40Z INFO ghe-rsync-size.sh +2023-03-22T18:33:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ +2023-03-22T18:33:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ +2023-03-22T18:33:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ +2023-03-22T18:33:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ +2023-03-22T18:33:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ +2023-03-22T18:33:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ +2023-03-22T18:33:42Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ +2023-03-22T18:33:42Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-22T18:33:43Z INFO ghe-backup-strategy +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] +2023-03-22T18:33:43Z INFO ghe-backup-store-version +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 +ghe-backup-store-version took 0s +2023-03-22T18:33:43Z INFO ghe-backup-settings +2023-03-22T18:33:43Z INFO * Transferring settings data ... +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings +2023-03-22T18:33:43Z INFO * Transferring license data ... +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' +2023-03-22T18:33:43Z INFO * Transferring management console password ... +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage +2023-03-22T18:33:43Z INFO * Transferring password pepper ... +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets +2023-03-22T18:33:43Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret +2023-03-22T18:33:43Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret +2023-03-22T18:33:43Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null +2023-03-22T18:33:43Z INFO * Transferring CA certificates ... +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null +2023-03-22T18:33:43Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys +ghe-export-authorized-keys took 0s +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys +ghe-export-ssh-host-keys took 0s +2023-03-22T18:33:43Z INFO ghe-backup-mysql +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-22T18:33:43Z INFO ghe-backup-mysql-binary +2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +ghe-backup-mysql-binary took 3s +ghe-backup-mysql took 3s +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled +2023-03-22T18:33:46Z INFO ghe-backup-minio +2023-03-22T18:33:46Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T18:33:46Z RSYNC BEGIN: minio rsync +2023-03-22T18:33:46Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230322T183339/minio +2023-03-22T18:33:46Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:33:46Z RSYNC END: minio rsync +ghe-backup-minio took 0s +Backup progress: 0 % +2023-03-22T18:33:46Z INFO ghe-backup-pages +2023-03-22T18:33:46Z INFO ghe-backup-es-audit-log +2023-03-22T18:33:46Z INFO ghe-backup-redis +2023-03-22T18:33:46Z INFO ghe-backup-git-hooks +2023-03-22T18:33:46Z INFO ghe-backup-es-rsync +2023-03-22T18:33:46Z INFO ghe-backup-storage +2023-03-22T18:33:46Z INFO ghe-backup-repositories + +2023-03-22T18:33:46Z INFO * Starting backup for host: 10.0.1.172 +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 /bin/bash + +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" +2023-03-22T18:33:46Z INFO * Transferring pages files ... +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] +2023-03-22T18:33:46Z RSYNC BEGIN: pages rsync +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] +2023-03-22T18:33:46Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230322T183339/pages +2023-03-22T18:33:46Z INFO * Performing initial sync of ES indices ... +2023-03-22T18:33:46Z RSYNC BEGIN elasticsearch rsync +2023-03-22T18:33:46Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T18:33:46Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-22T18:33:46Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-22T18:33:46Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183339/elasticsearch +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:33:46Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +2023-03-22T18:33:46Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +2023-03-22T18:33:46Z RSYNC BEGIN: git-hooks sync +ghe-backup-es-audit-log took 0s +2023-03-22T18:33:46Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230322T183339/git-hooks/repos +receiving incremental file list +./ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.cfe +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.cfs +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.si +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_17 +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-25.tlog +nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp + +sent 422 bytes received 24,766 bytes 50,376.00 bytes/sec +total size is 146,931 speedup is 5.83 +2023-03-22T18:33:46Z RSYNC END elasticsearch rsync +2023-03-22T18:33:46Z INFO * Disabling ES index flushing ... +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush +2023-03-22T18:33:46Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T18:33:46Z RSYNC BEGIN: elasticsearch followup rsync +2023-03-22T18:33:46Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183339/elasticsearch +2023-03-22T18:33:46Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:33:46Z RSYNC END: elasticsearch followup rsync +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:33:46Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +ghe-backup-es-rsync took 0s +2023-03-22T18:33:46Z INFO * Enabling ES index flushing ... +2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:33:46Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +ghe-backup-redis took 1s +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-KShrXb/remote_routes_list +ghe-backup-storage - Generating routes took 2s +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-KShrXb/remote_routes_list +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T18:33:48Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-KShrXb +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-3jxmPX/remote_routes_list +ghe-backup-repositories - Generating routes took 2s +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-3jxmPX/remote_routes_list +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s +2023-03-22T18:33:48Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-3jxmPX +2023-03-22T18:33:48Z INFO ghe-prune-snapshots +2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-22T18:33:48Z INFO ghe-detect-leaked-ssh-keys +2023-03-22T18:33:48Z INFO ghe-ssh --clean +2023-03-22T18:35:49Z INFO ghe-backup +2023-03-22T18:35:49Z INFO ghe-host-check +2023-03-22T18:35:49Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh +2023-03-22T18:35:49Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] +2023-03-22T18:35:49Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state +2023-03-22T18:35:49Z INFO ghe-rsync-size.sh +2023-03-22T18:35:49Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ +2023-03-22T18:35:49Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ +2023-03-22T18:35:50Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ +2023-03-22T18:35:50Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ +2023-03-22T18:35:50Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ +2023-03-22T18:35:51Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ +2023-03-22T18:35:51Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ +2023-03-22T18:35:51Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-22T18:35:52Z INFO ghe-backup-strategy +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] +2023-03-22T18:35:52Z INFO ghe-backup-store-version +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 +ghe-backup-store-version took 0s +2023-03-22T18:35:52Z INFO ghe-backup-settings +2023-03-22T18:35:52Z INFO * Transferring settings data ... +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings +2023-03-22T18:35:52Z INFO * Transferring license data ... +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' +2023-03-22T18:35:52Z INFO * Transferring management console password ... +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage +2023-03-22T18:35:52Z INFO * Transferring password pepper ... +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets +2023-03-22T18:35:52Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret +2023-03-22T18:35:52Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret +2023-03-22T18:35:52Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null +2023-03-22T18:35:52Z INFO * Transferring CA certificates ... +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates +2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null +2023-03-22T18:35:52Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys +ghe-export-authorized-keys took 1s +2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys +ghe-export-ssh-host-keys took 0s +2023-03-22T18:35:53Z INFO ghe-backup-mysql +2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-22T18:35:53Z INFO ghe-backup-mysql-binary +2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +ghe-backup-mysql-binary took 2s +ghe-backup-mysql took 2s +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled +2023-03-22T18:35:55Z INFO ghe-backup-minio +2023-03-22T18:35:55Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T18:35:55Z RSYNC BEGIN: minio rsync +2023-03-22T18:35:55Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230322T183549/minio +2023-03-22T18:35:55Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:35:55Z RSYNC END: minio rsync +ghe-backup-minio took 0s +Backup progress: 0 % +2023-03-22T18:35:55Z INFO ghe-backup-git-hooks +2023-03-22T18:35:55Z INFO ghe-backup-repositories +2023-03-22T18:35:55Z INFO ghe-backup-pages +2023-03-22T18:35:55Z INFO ghe-backup-storage +2023-03-22T18:35:55Z INFO ghe-backup-redis +2023-03-22T18:35:55Z INFO ghe-backup-es-audit-log +2023-03-22T18:35:55Z INFO ghe-backup-es-rsync + +2023-03-22T18:35:55Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T18:35:55Z INFO * Transferring pages files ... +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-22T18:35:55Z RSYNC BEGIN: pages rsync +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] +2023-03-22T18:35:55Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230322T183549/pages +2023-03-22T18:35:55Z INFO * Performing initial sync of ES indices ... +2023-03-22T18:35:55Z RSYNC BEGIN elasticsearch rsync +2023-03-22T18:35:55Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T18:35:55Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-22T18:35:55Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-22T18:35:55Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183549/elasticsearch +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:35:55Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +2023-03-22T18:35:55Z RSYNC BEGIN: git-hooks sync +2023-03-22T18:35:55Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +2023-03-22T18:35:55Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230322T183549/git-hooks/repos +receiving incremental file list +./ + +sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:35:55Z RSYNC END elasticsearch rsync +2023-03-22T18:35:55Z INFO * Disabling ES index flushing ... +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush +2023-03-22T18:35:55Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T18:35:55Z RSYNC BEGIN: elasticsearch followup rsync +2023-03-22T18:35:55Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183549/elasticsearch +2023-03-22T18:35:55Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:35:55Z RSYNC END: elasticsearch followup rsync +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:35:55Z RSYNC END: pages rsync +ghe-backup-es-rsync took 0s +ghe-backup-pages - 10.0.1.172 took 0s +2023-03-22T18:35:55Z INFO * Enabling ES index flushing ... +ghe-backup-pages took 0s +2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 56.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:35:56Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 1s +ghe-backup-redis took 1s +2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-vwdhR7/remote_routes_list +ghe-backup-storage - Generating routes took 2s +2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-vwdhR7/remote_routes_list +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T18:35:57Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-vwdhR7 +2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-bT5RMf/remote_routes_list +ghe-backup-repositories - Generating routes took 2s +2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-bT5RMf/remote_routes_list +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s +2023-03-22T18:35:57Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-bT5RMf +2023-03-22T18:35:58Z INFO ghe-prune-snapshots +2023-03-22T18:35:58Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-22T18:35:58Z INFO ghe-detect-leaked-ssh-keys +2023-03-22T18:35:58Z INFO ghe-ssh --clean +2023-03-22T18:36:34Z INFO ghe-backup +2023-03-22T18:36:34Z INFO ghe-host-check +2023-03-22T18:36:34Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh +2023-03-22T18:36:34Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] +2023-03-22T18:36:34Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state +2023-03-22T18:36:34Z INFO ghe-rsync-size.sh +2023-03-22T18:36:34Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ +2023-03-22T18:36:35Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ +2023-03-22T18:36:35Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ +2023-03-22T18:36:35Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ +2023-03-22T18:36:36Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ +2023-03-22T18:36:36Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ +2023-03-22T18:36:36Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ +2023-03-22T18:36:37Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-22T18:36:37Z INFO ghe-backup-strategy +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] +2023-03-22T18:36:37Z INFO ghe-backup-store-version +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 +ghe-backup-store-version took 0s +2023-03-22T18:36:37Z INFO ghe-backup-settings +2023-03-22T18:36:37Z INFO * Transferring settings data ... +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings +2023-03-22T18:36:37Z INFO * Transferring license data ... +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' +2023-03-22T18:36:37Z INFO * Transferring management console password ... +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage +2023-03-22T18:36:37Z INFO * Transferring password pepper ... +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets +2023-03-22T18:36:37Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret +2023-03-22T18:36:37Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret +2023-03-22T18:36:37Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null +2023-03-22T18:36:38Z INFO * Transferring CA certificates ... +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null +2023-03-22T18:36:38Z INFO * Transferring UUID ... +ghe-backup-settings took 1s +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys +ghe-export-authorized-keys took 0s +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys +ghe-export-ssh-host-keys took 0s +2023-03-22T18:36:38Z INFO ghe-backup-mysql +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary +2023-03-22T18:36:38Z INFO ghe-backup-mysql-binary +2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +ghe-backup-mysql-binary took 2s +ghe-backup-mysql took 2s +2023-03-22T18:36:40Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled +2023-03-22T18:36:40Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled +2023-03-22T18:36:40Z INFO ghe-backup-minio +2023-03-22T18:36:40Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T18:36:40Z RSYNC BEGIN: minio rsync +2023-03-22T18:36:40Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230322T183634/minio +2023-03-22T18:36:40Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:36:40Z RSYNC END: minio rsync +ghe-backup-minio took 0s +4 +15 +Backup progress: 0 % +2023-03-22T18:36:41Z INFO ghe-backup-redis +2023-03-22T18:36:41Z INFO ghe-backup-repositories +2023-03-22T18:36:41Z INFO ghe-backup-es-audit-log +2023-03-22T18:36:41Z INFO ghe-backup-pages +2023-03-22T18:36:41Z INFO ghe-backup-storage +2023-03-22T18:36:41Z INFO ghe-backup-es-rsync +2023-03-22T18:36:41Z INFO ghe-backup-git-hooks + +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-22T18:36:41Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" +2023-03-22T18:36:41Z INFO * Transferring pages files ... +2023-03-22T18:36:41Z RSYNC BEGIN: pages rsync +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] +2023-03-22T18:36:41Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230322T183634/pages +2023-03-22T18:36:41Z INFO * Performing initial sync of ES indices ... +2023-03-22T18:36:41Z RSYNC BEGIN elasticsearch rsync +2023-03-22T18:36:41Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T18:36:41Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-22T18:36:41Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183634/elasticsearch +2023-03-22T18:36:41Z INFO ghe-gc-disable 10.0.1.172:122 +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 /bin/bash +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:36:41Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +2023-03-22T18:36:41Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +2023-03-22T18:36:41Z RSYNC BEGIN: git-hooks sync +2023-03-22T18:36:41Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230322T183634/git-hooks/repos +receiving incremental file list +./ + +sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:36:41Z RSYNC END elasticsearch rsync +2023-03-22T18:36:41Z INFO * Disabling ES index flushing ... +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush +2023-03-22T18:36:41Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T18:36:41Z RSYNC BEGIN: elasticsearch followup rsync +2023-03-22T18:36:41Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183634/elasticsearch +2023-03-22T18:36:41Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:36:41Z RSYNC END: elasticsearch followup rsync +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:36:41Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-es-rsync took 0s +2023-03-22T18:36:41Z INFO * Enabling ES index flushing ... +ghe-backup-pages took 0s +2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:36:41Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +ghe-backup-redis took 1s +2023-03-22T18:36:42Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-YZgWfb/remote_routes_list +ghe-backup-storage - Generating routes took 1s +2023-03-22T18:36:42Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-YZgWfb/remote_routes_list +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T18:36:42Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-22T18:36:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-22T18:36:42Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-YZgWfb +2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-BlP7CO/remote_routes_list +ghe-backup-repositories - Generating routes took 2s +2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-BlP7CO/remote_routes_list +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s +2023-03-22T18:36:43Z INFO ghe-gc-enable 10.0.1.172:122 +2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' +2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-BlP7CO +2023-03-22T18:36:43Z INFO ghe-prune-snapshots +2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils +2023-03-22T18:36:43Z INFO ghe-detect-leaked-ssh-keys +2023-03-22T18:36:43Z INFO ghe-ssh --clean +ghe-backup-store-version took 0s +2023-03-22T18:37:30Z INFO * Transferring settings data ... +2023-03-22T18:37:30Z INFO * Transferring license data ... +2023-03-22T18:37:30Z INFO * Transferring management console password ... +2023-03-22T18:37:30Z INFO * Transferring password pepper ... +2023-03-22T18:37:30Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:37:30Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:37:30Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:37:30Z INFO * Transferring CA certificates ... +2023-03-22T18:37:31Z INFO * Transferring UUID ... +ghe-backup-settings took 1s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 2s +ghe-backup-mysql took 2s +2023-03-22T18:37:33Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T18:37:33Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:37:33Z RSYNC END: minio rsync +ghe-backup-minio took 0s +4 +15 +Backup progress: 0 % +ghe-backup-redis took 1s +2023-03-22T18:37:34Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +ghe-backup-repositories - Generating routes took 2s +ghe-backup-repositories - Fetching routes took 1s +ghe-backup-repositories - Processing routes took 0s + +2023-03-22T18:37:37Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T18:37:37Z INFO * Transferring pages files ... +2023-03-22T18:37:37Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:37:37Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +ghe-backup-storage - Generating routes took 2s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T18:37:39Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T18:37:39Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:37:39Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +2023-03-22T18:37:39Z INFO * Performing initial sync of ES indices ... +2023-03-22T18:37:39Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:37:39Z RSYNC END elasticsearch rsync +2023-03-22T18:37:39Z INFO * Disabling ES index flushing ... +2023-03-22T18:37:39Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T18:37:39Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 286 bytes received 22,565 bytes 45,702.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:37:40Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 1s +2023-03-22T18:37:40Z INFO * Enabling ES index flushing ... +ghe-backup-store-version took 0s +2023-03-22T18:40:50Z INFO * Transferring settings data ... +2023-03-22T18:40:50Z INFO * Transferring license data ... +2023-03-22T18:40:50Z INFO * Transferring management console password ... +2023-03-22T18:40:50Z INFO * Transferring password pepper ... +2023-03-22T18:40:50Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:40:50Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:40:50Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:40:50Z INFO * Transferring CA certificates ... +2023-03-22T18:40:50Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +ghe-export-authorized-keys took 0s +ghe-backup-store-version took 0s +2023-03-22T18:41:48Z INFO * Transferring settings data ... +2023-03-22T18:41:48Z INFO * Transferring license data ... +2023-03-22T18:41:48Z INFO * Transferring management console password ... +2023-03-22T18:41:48Z INFO * Transferring password pepper ... +2023-03-22T18:41:48Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:41:49Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:41:49Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:41:49Z INFO * Transferring CA certificates ... +2023-03-22T18:41:49Z INFO * Transferring UUID ... +ghe-backup-settings took 1s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 2s +ghe-backup-mysql took 2s +2023-03-22T18:41:51Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T18:41:51Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:41:51Z RSYNC END: minio rsync +ghe-backup-minio took 0s +6 +15 +Backup progress: 0 % +ghe-backup-redis took 2s +2023-03-22T18:41:53Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +ghe-backup-repositories - Generating routes took 2s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s + +2023-03-22T18:41:55Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T18:41:55Z INFO * Transferring pages files ... +2023-03-22T18:41:55Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:41:55Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +ghe-backup-storage - Generating routes took 2s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T18:41:57Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T18:41:57Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 56.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:41:58Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 1s +2023-03-22T18:41:58Z INFO * Performing initial sync of ES indices ... +2023-03-22T18:41:58Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:41:58Z RSYNC END elasticsearch rsync +2023-03-22T18:41:58Z INFO * Disabling ES index flushing ... +2023-03-22T18:41:58Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T18:41:58Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:41:58Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 0s +2023-03-22T18:41:58Z INFO * Enabling ES index flushing ... +ghe-backup-store-version took 0s +2023-03-22T18:47:55Z INFO * Transferring settings data ... +2023-03-22T18:47:55Z INFO * Transferring license data ... +2023-03-22T18:47:55Z INFO * Transferring management console password ... +2023-03-22T18:47:55Z INFO * Transferring password pepper ... +2023-03-22T18:47:55Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:47:55Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:47:55Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:47:55Z INFO * Transferring CA certificates ... +2023-03-22T18:47:56Z INFO * Transferring UUID ... +ghe-backup-settings took 1s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 2s +2023-03-22T18:47:58Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T18:47:58Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:47:58Z RSYNC END: minio rsync +ghe-backup-minio took 0s +1 +18 +ghe-backup-redis took 1s +2023-03-22T18:47:59Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +ghe-backup-repositories - Generating routes took 2s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 1s + +2023-03-22T18:48:02Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T18:48:02Z INFO * Transferring pages files ... +2023-03-22T18:48:02Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:48:02Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +ghe-backup-storage - Generating routes took 2s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T18:48:04Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T18:48:04Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:48:04Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +2023-03-22T18:48:04Z INFO * Performing initial sync of ES indices ... +2023-03-22T18:48:04Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:48:04Z RSYNC END elasticsearch rsync +2023-03-22T18:48:04Z INFO * Disabling ES index flushing ... +2023-03-22T18:48:04Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T18:48:04Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 282 bytes received 22,561 bytes 15,228.67 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:48:05Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 1s +2023-03-22T18:48:05Z INFO * Enabling ES index flushing ... +ghe-backup-store-version took 0s +2023-03-22T18:48:56Z INFO * Transferring settings data ... +2023-03-22T18:48:56Z INFO * Transferring license data ... +2023-03-22T18:48:56Z INFO * Transferring management console password ... +2023-03-22T18:48:56Z INFO * Transferring password pepper ... +2023-03-22T18:48:56Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T18:48:56Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T18:48:56Z INFO * Transferring management console argon2 secret ... +2023-03-22T18:48:56Z INFO * Transferring CA certificates ... +2023-03-22T18:48:56Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 3s +ghe-backup-mysql took 3s +2023-03-22T18:48:59Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T18:48:59Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:48:59Z RSYNC END: minio rsync +ghe-backup-minio took 0s +6 +18 +Backup progress: 33.00 % +ghe-backup-redis took 1s +2023-03-22T18:49:00Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +ghe-backup-repositories - Generating routes took 2s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s + +2023-03-22T18:49:02Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T18:49:02Z INFO * Transferring pages files ... +2023-03-22T18:49:02Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 174.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:49:03Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 1s +ghe-backup-pages took 1s +ghe-backup-storage - Generating routes took 1s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T18:49:05Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T18:49:05Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T18:49:05Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +2023-03-22T18:49:05Z INFO * Performing initial sync of ES indices ... +2023-03-22T18:49:05Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:49:05Z RSYNC END elasticsearch rsync +2023-03-22T18:49:05Z INFO * Disabling ES index flushing ... +2023-03-22T18:49:05Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T18:49:05Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 286 bytes received 22,565 bytes 45,702.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T18:49:05Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 0s +2023-03-22T18:49:05Z INFO * Enabling ES index flushing ... +ghe-backup-store-version took 0s +2023-03-22T19:22:35Z INFO * Transferring settings data ... +2023-03-22T19:22:35Z INFO * Transferring license data ... +2023-03-22T19:22:35Z INFO * Transferring management console password ... +2023-03-22T19:22:35Z INFO * Transferring password pepper ... +2023-03-22T19:22:35Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T19:22:35Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T19:22:35Z INFO * Transferring management console argon2 secret ... +2023-03-22T19:22:36Z INFO * Transferring CA certificates ... +2023-03-22T19:22:36Z INFO * Transferring UUID ... +ghe-backup-settings took 1s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 2s +ghe-backup-mysql took 2s +2023-03-22T19:22:38Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T19:22:38Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:22:38Z RSYNC END: minio rsync +ghe-backup-minio took 0s +ghe-backup-redis took 1s +2023-03-22T19:22:39Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +ghe-backup-repositories - Generating routes took 3s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s + +2023-03-22T19:22:42Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T19:22:42Z INFO * Transferring pages files ... +2023-03-22T19:22:42Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:22:42Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +ghe-backup-storage - Generating routes took 2s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T19:22:44Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T19:22:44Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:22:44Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +2023-03-22T19:22:44Z INFO * Performing initial sync of ES indices ... +2023-03-22T19:22:44Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:22:44Z RSYNC END elasticsearch rsync +2023-03-22T19:22:44Z INFO * Disabling ES index flushing ... +2023-03-22T19:22:45Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T19:22:45Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:22:45Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 1s +2023-03-22T19:22:45Z INFO * Enabling ES index flushing ... +ghe-backup-store-version took 0s +2023-03-22T19:28:56Z INFO * Transferring settings data ... +2023-03-22T19:28:57Z INFO * Transferring license data ... +2023-03-22T19:28:57Z INFO * Transferring management console password ... +2023-03-22T19:28:57Z INFO * Transferring password pepper ... +2023-03-22T19:28:57Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T19:28:57Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T19:28:57Z INFO * Transferring management console argon2 secret ... +2023-03-22T19:28:57Z INFO * Transferring CA certificates ... +2023-03-22T19:28:57Z INFO * Transferring UUID ... +ghe-backup-settings took 1s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 2s +ghe-backup-mysql took 2s +2023-03-22T19:29:00Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T19:29:00Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:29:00Z RSYNC END: minio rsync +ghe-backup-minio took 0s +ghe-backup-redis took 1s +2023-03-22T19:29:01Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +ghe-backup-repositories - Generating routes took 2s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s + +2023-03-22T19:29:03Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T19:29:03Z INFO * Transferring pages files ... +2023-03-22T19:29:03Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:29:03Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +ghe-backup-storage - Generating routes took 1s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T19:29:05Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T19:29:06Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:29:06Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 1s +2023-03-22T19:29:06Z INFO * Performing initial sync of ES indices ... +2023-03-22T19:29:06Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:29:06Z RSYNC END elasticsearch rsync +2023-03-22T19:29:06Z INFO * Disabling ES index flushing ... +2023-03-22T19:29:06Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T19:29:06Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:29:06Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 0s +2023-03-22T19:29:06Z INFO * Enabling ES index flushing ... +ghe-backup-store-version took 0s +2023-03-22T19:31:52Z INFO * Transferring settings data ... +2023-03-22T19:31:52Z INFO * Transferring license data ... +2023-03-22T19:31:52Z INFO * Transferring management console password ... +2023-03-22T19:31:52Z INFO * Transferring password pepper ... +2023-03-22T19:31:52Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T19:31:52Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T19:31:52Z INFO * Transferring management console argon2 secret ... +2023-03-22T19:31:52Z INFO * Transferring CA certificates ... +2023-03-22T19:31:52Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 3s +ghe-backup-mysql took 3s +2023-03-22T19:31:55Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T19:31:55Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:31:55Z RSYNC END: minio rsync +ghe-backup-minio took 0s +ghe-backup-redis took 1s +2023-03-22T19:31:56Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +ghe-backup-repositories - Generating routes took 2s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s + +2023-03-22T19:31:58Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T19:31:58Z INFO * Transferring pages files ... +2023-03-22T19:31:58Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 174.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:31:59Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 1s +ghe-backup-pages took 1s +ghe-backup-storage - Generating routes took 2s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T19:32:01Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T19:32:01Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:32:01Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +2023-03-22T19:32:01Z INFO * Performing initial sync of ES indices ... +2023-03-22T19:32:01Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:32:01Z RSYNC END elasticsearch rsync +2023-03-22T19:32:01Z INFO * Disabling ES index flushing ... +2023-03-22T19:32:01Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T19:32:01Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:32:01Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 0s +2023-03-22T19:32:01Z INFO * Enabling ES index flushing ... +ghe-backup-store-version took 0s +2023-03-22T19:32:25Z INFO * Transferring settings data ... +2023-03-22T19:32:25Z INFO * Transferring license data ... +2023-03-22T19:32:25Z INFO * Transferring management console password ... +2023-03-22T19:32:25Z INFO * Transferring password pepper ... +2023-03-22T19:32:25Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T19:32:25Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T19:32:26Z INFO * Transferring management console argon2 secret ... +2023-03-22T19:32:26Z INFO * Transferring CA certificates ... +2023-03-22T19:32:26Z INFO * Transferring UUID ... +ghe-backup-settings took 1s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 2s +ghe-backup-mysql took 2s +2023-03-22T19:32:28Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T19:32:28Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:32:28Z RSYNC END: minio rsync +ghe-backup-minio took 0s +ghe-backup-redis took 1s +2023-03-22T19:32:30Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 1s +ghe-backup-repositories - Generating routes took 2s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s + +2023-03-22T19:32:32Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T19:32:32Z INFO * Transferring pages files ... +2023-03-22T19:32:32Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 522.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:32:32Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 0s +ghe-backup-pages took 0s +ghe-backup-storage - Generating routes took 2s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T19:32:34Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T19:32:34Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 56.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:32:35Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 1s +2023-03-22T19:32:35Z INFO * Performing initial sync of ES indices ... +2023-03-22T19:32:35Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:32:35Z RSYNC END elasticsearch rsync +2023-03-22T19:32:35Z INFO * Disabling ES index flushing ... +2023-03-22T19:32:35Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T19:32:35Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:32:35Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 0s +2023-03-22T19:32:35Z INFO * Enabling ES index flushing ... +ghe-backup-store-version took 0s +2023-03-22T19:37:31Z INFO * Transferring settings data ... +2023-03-22T19:37:31Z INFO * Transferring license data ... +2023-03-22T19:37:31Z INFO * Transferring management console password ... +2023-03-22T19:37:31Z INFO * Transferring password pepper ... +2023-03-22T19:37:31Z INFO * Transferring kredz.credz HMAC key ... +2023-03-22T19:37:31Z INFO * Transferring kredz.varz HMAC key ... +2023-03-22T19:37:31Z INFO * Transferring management console argon2 secret ... +2023-03-22T19:37:31Z INFO * Transferring CA certificates ... +2023-03-22T19:37:31Z INFO * Transferring UUID ... +ghe-backup-settings took 0s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 3s +ghe-backup-mysql took 3s +2023-03-22T19:37:34Z INFO * Transferring minio files from 10.0.1.172 ... +2023-03-22T19:37:34Z RSYNC BEGIN: minio rsync +receiving incremental file list +./ + +sent 44 bytes received 93 bytes 274.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:37:34Z RSYNC END: minio rsync +ghe-backup-minio took 0s +ghe-backup-redis took 1s +2023-03-22T19:37:35Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 +ghe-backup-es-audit-log took 0s +ghe-backup-repositories - Generating routes took 2s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s + +2023-03-22T19:37:37Z INFO * Starting backup for host: 10.0.1.172 + +2023-03-22T19:37:37Z INFO * Transferring pages files ... +2023-03-22T19:37:37Z RSYNC BEGIN: pages rsync +receiving incremental file list +./ + +sent 35 bytes received 226 bytes 174.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:37:38Z RSYNC END: pages rsync +ghe-backup-pages - 10.0.1.172 took 1s +ghe-backup-pages took 1s +ghe-backup-storage - Generating routes took 1s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +2023-03-22T19:37:40Z INFO git-hooks environment tarballs not found. Skipping ... +2023-03-22T19:37:40Z RSYNC BEGIN: git-hooks sync +receiving incremental file list +./ + +sent 27 bytes received 57 bytes 168.00 bytes/sec +total size is 0 speedup is 0.00 +2023-03-22T19:37:40Z RSYNC END: git-hooks sync +ghe-backup-git-hooks took 0s +2023-03-22T19:37:40Z INFO * Performing initial sync of ES indices ... +2023-03-22T19:37:40Z RSYNC BEGIN elasticsearch rsync +receiving incremental file list +./ + +sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:37:40Z RSYNC END elasticsearch rsync +2023-03-22T19:37:40Z INFO * Disabling ES index flushing ... +2023-03-22T19:37:40Z INFO * Performing follow-up sync of ES indices ... +2023-03-22T19:37:40Z RSYNC BEGIN: elasticsearch followup rsync +receiving incremental file list + +sent 286 bytes received 22,565 bytes 45,702.00 bytes/sec +total size is 146,931 speedup is 6.43 +2023-03-22T19:37:40Z RSYNC END: elasticsearch followup rsync +ghe-backup-es-rsync took 0s +2023-03-22T19:37:40Z INFO * Enabling ES index flushing ... diff --git a/bin/ghe-backup b/bin/ghe-backup index 3692fbdc7..cb337645d 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -39,9 +39,8 @@ done export CALLING_SCRIPT="ghe-backup" export BACKUP_PROGRESS=0 # Used to track progress of backup -echo "${BACKUP_PROGRESS}" > /tmp/progress -BACKUP_PROGRESS_TOTAL=15 # Maximum number of steps in backup -echo "${BACKUP_PROGRESS_TOTAL}" > /tmp/progress-total +echo $BACKUP_PROGRESS > /tmp/track-progress +export BACKUP_PROGRESS_TOTAL=18 # Maximum number of steps in backup export BACKUP_PROGRESS_DESCRIPTION="" # Used to store information about current step # Bring in the backup configuration # shellcheck source=share/github-backup-utils/ghe-backup-config diff --git a/share/github-backup-utils/bm.sh b/share/github-backup-utils/bm.sh index 197626248..7b76ecbf7 100755 --- a/share/github-backup-utils/bm.sh +++ b/share/github-backup-utils/bm.sh @@ -58,5 +58,5 @@ bm_end() { echo "Debug: $1 took ${total}s (bm_end)" fi # track progress - . "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" + progress "$1 took ${total}s" } diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 3f11a4e32..a7d8b5f1d 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -55,7 +55,7 @@ fi PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # shellcheck source=share/github-backup-utils/bm.sh . "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" -#. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" +. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" # Save off GHE_HOSTNAME from the environment since we want it to override the # backup.config value when set. GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" @@ -278,6 +278,7 @@ else exec 3>/dev/null fi + # Restore saved off hostname. [ -n "$GHE_HOSTNAME_PRESERVE" ] && GHE_HOSTNAME="$GHE_HOSTNAME_PRESERVE" diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index addbc94d4..ed68307ee 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -2,9 +2,9 @@ #/ track-progress: track progress of backup or restore tasks # Current version is working solely with backups - -BACKUP_PROGRESS=$(($(cat /tmp/progress) + 1)) -BACKUP_PROGRESS=$(cat /tmp/progress-total) -BACKUP_PROGRESS_PERCENT=$(( (BACKUP_PROGRESS / BACKUP_PROGRESS_TOTAL) * 100)) - -echo "Backup progress: $BACKUP_PROGRESS_PERCENT %" \ No newline at end of file +progress(){ +BACKUP_PROGRESS=$(cat /tmp/track-progress) +BACKUP_PROGRESS_PERCENT=$( echo "scale = 2; ($BACKUP_PROGRESS / $BACKUP_PROGRESS_TOTAL) * 100" | bc) +echo "Backup progress: $BACKUP_PROGRESS_PERCENT % ($BACKUP_PROGRESS / $BACKUP_PROGRESS_TOTAL ) $1 " > /tmp/progress-info +echo $((BACKUP_PROGRESS +1)) > /tmp/track-progress +} diff --git a/testfd b/testfd new file mode 100644 index 000000000..e69de29bb From e63e26b7e0d905388644303b55b60e64cb74e909 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 23 Mar 2023 19:54:19 -0400 Subject: [PATCH 261/946] fleshing out code --- bin/ghe-backup | 14 ++++-- bin/ghe-progress | 49 +++++++++++++++++++++ bin/ghe-restore | 12 +++-- share/github-backup-utils/ghe-backup-config | 4 ++ share/github-backup-utils/track-progress | 9 ++-- 5 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 bin/ghe-progress diff --git a/bin/ghe-backup b/bin/ghe-backup index cb337645d..2caf4dae5 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -37,15 +37,21 @@ while true; do esac done + export CALLING_SCRIPT="ghe-backup" -export BACKUP_PROGRESS=0 # Used to track progress of backup -echo $BACKUP_PROGRESS > /tmp/track-progress -export BACKUP_PROGRESS_TOTAL=18 # Maximum number of steps in backup -export BACKUP_PROGRESS_DESCRIPTION="" # Used to store information about current step + # Bring in the backup configuration # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" +# Setup progress tracking +init-progress +export PROGRESS_TYPE="Backup" +echo $PROGRESS_TYPE > /tmp/track-progress-type +export PROGRESS=0 # Used to track progress of backup +echo $PROGRESS > /tmp/track-progress +export PROGRESS_TOTAL=18 # Maximum number of steps in backup + # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check diff --git a/bin/ghe-progress b/bin/ghe-progress new file mode 100644 index 000000000..356417a37 --- /dev/null +++ b/bin/ghe-progress @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +#/ Usage: ghe-progress [--once] +#/ Tracks the completed steps of a backup or restore operation. +#/ +#/ By default the progress is printed every 5 seconds or until a key is pressed. +#/ Use the --once option to print the current progress once and exit. +#/ +#/ Options: +#/ --once Don't loop, just print the current progress once. +# + +while true; do + case "$1" in + -o|--once) + export ONCE=1; + shift + ;; + -h|--help) + export GHE_SHOW_HELP=true + shift + ;; + -*) + echo "Unknown option: $1" >&2; + exit 1 + ;; + *) + break + ;; + esac +done + +check_for_progress_file() { + if [ ! -f /tmp/progress-info ]; then + echo "No progress file found. has a backup or restore been started?" + exit 1 + fi +} + +if ONCE=1; then + cat /tmp/progress-info +else + while true; do + if ! read -r -t 5 -n 1; then + exit ; + else + cat /tmp/progress-info + fi + done +fi \ No newline at end of file diff --git a/bin/ghe-restore b/bin/ghe-restore index 725c44a69..82809ebbc 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -86,9 +86,7 @@ while true; do esac done -export GHE_RESTORE_PROGRESS=0 -export GHE_RESTORE_PROGRESS_TOTAL=15 -export GHE_RESTORE_PROGRESS_DESCRIPTION="" + start_cron () { log_info "Starting cron ..." @@ -166,6 +164,14 @@ cleanup_cluster_nodes() { # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" +# Set up progress tracking +init-progress +export PROGRESS_TYPE="Restore" +echo $PROGRESS_TYPE > /tmp/track-progress-type +export PROGRESS=0 # Used to track progress of restore +echo $PROGRESS > /tmp/track-progress +export PROGRESS_TOTAL=15 # Maximum number of steps in restore + # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index a7d8b5f1d..7733b91e9 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -646,6 +646,10 @@ restore-secret() { fi } +#initialize progress tracking by clearing out the temp files used to track +init-progress() { + rm -f /tmp/track-progress-* +} diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index ed68307ee..f3f0ddc5b 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -3,8 +3,9 @@ # Current version is working solely with backups progress(){ -BACKUP_PROGRESS=$(cat /tmp/track-progress) -BACKUP_PROGRESS_PERCENT=$( echo "scale = 2; ($BACKUP_PROGRESS / $BACKUP_PROGRESS_TOTAL) * 100" | bc) -echo "Backup progress: $BACKUP_PROGRESS_PERCENT % ($BACKUP_PROGRESS / $BACKUP_PROGRESS_TOTAL ) $1 " > /tmp/progress-info -echo $((BACKUP_PROGRESS +1)) > /tmp/track-progress + PROGRESS=$(cat /tmp/track-progress) + PROGRESS_TYPE=$(cat /tmp/track-progress-type) + PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) + echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/progress-info + echo $((BACKUP_PROGRESS +1)) > /tmp/track-progress } From d0e02f59773723fd207bc323330188f38af2b34e Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 00:19:27 +0000 Subject: [PATCH 262/946] Almost there --- bin/ghe-progress | 18 ++++++++++++------ share/github-backup-utils/track-progress | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) mode change 100644 => 100755 bin/ghe-progress diff --git a/bin/ghe-progress b/bin/ghe-progress old mode 100644 new mode 100755 index 356417a37..1099ad2c3 --- a/bin/ghe-progress +++ b/bin/ghe-progress @@ -2,7 +2,7 @@ #/ Usage: ghe-progress [--once] #/ Tracks the completed steps of a backup or restore operation. #/ -#/ By default the progress is printed every 5 seconds or until a key is pressed. +#/ By default the progress is printed every continuously or until a key is pressed. #/ Use the --once option to print the current progress once and exit. #/ #/ Options: @@ -12,7 +12,7 @@ while true; do case "$1" in -o|--once) - export ONCE=1; + ONCE=1; shift ;; -h|--help) @@ -36,14 +36,20 @@ check_for_progress_file() { fi } -if ONCE=1; then +if [ -n "$ONCE" ]; then + check_for_progress_file cat /tmp/progress-info else + check_for_progress_file + clear + cat /tmp/progress-info while true; do - if ! read -r -t 5 -n 1; then + if read -r -t 1 -n 1; then + clear exit ; else - cat /tmp/progress-info + clear + cat /tmp/progress-info fi done -fi \ No newline at end of file +fi diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index f3f0ddc5b..12c2fc64b 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -7,5 +7,5 @@ progress(){ PROGRESS_TYPE=$(cat /tmp/track-progress-type) PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/progress-info - echo $((BACKUP_PROGRESS +1)) > /tmp/track-progress + echo $((PROGRESS +1)) > /tmp/track-progress } From 3ab937a21fa2584f485d86b4db9f8cf62ddf86ab Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 23 Mar 2023 20:48:23 -0400 Subject: [PATCH 263/946] add benchamrking and progression to restore script --- bin/ghe-restore | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 82809ebbc..f0dc6b9f2 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -350,6 +350,7 @@ log_warn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. log_info "Stopping cron and github-timerd ..." if $CLUSTER; then + bm_start "stop_cron_github_timerd" if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then log_warn "Failed to stop cron on one or more nodes" 1>&3 fi @@ -381,9 +382,11 @@ else log_warn "Failed to stop github-timerd" 1>&3 fi fi + bm_end "stop_cron_github_timerd" fi CRON_RUNNING=false + # Restore settings and license if restoring to an unconfigured appliance or when # specified manually. if $RESTORE_SETTINGS; then @@ -401,10 +404,12 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then log_info "Restoring UUID ..." + bm_start "restore_uuid" cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" + bm_end "restore_uuid" fi if is_external_database_snapshot; then @@ -455,7 +460,9 @@ fi cmd_title=$(log_info "Restoring Redis database ...") commands=(" echo \"$cmd_title\" -ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") +bm_start \"restore_redis\" +ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3 +bm_end \"restore_redis\"") cmd_title=$(log_info "Restoring Git Repositories ...") commands+=(" @@ -475,7 +482,9 @@ ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") cmd_title=$(log_info "Restoring SSH authorized keys ...") commands+=(" echo \"$cmd_title\" -ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3") +bm_start \"restore_authorized_keys\" +ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3 +bm_end \"restore_authorized_keys\"") cmd_title=$(log_info "Restoring storage data ...") commands+=(" @@ -528,8 +537,10 @@ fi # Restart an already running memcached to reset the cache after restore log_info "Restarting memcached ..." 1>&3 +bm_start "restart_memcached" echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh +bm_end "restart_memcached" # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. @@ -543,20 +554,24 @@ fi # config run to perform data migrations. if $CLUSTER; then log_info "Configuring cluster ..." + bm_start "configure_cluster" if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- /usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 + bm_end "configure_cluster" elif $instance_configured; then log_info "Configuring appliance ..." + bm_start "configure_appliance" if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-config-apply" 1>&3 2>&3 + bm_end "configure_appliance" fi # Clear GitHub Connect settings stored in the restored database. @@ -574,6 +589,7 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then log_info "Cleaning up replicas..." 1>&3 + bm_start "cleanup_replicas" restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) other_nodes=$(echo " set -o pipefail; \ @@ -589,6 +605,7 @@ if ! $CLUSTER && $instance_configured; then echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 done fi + bm_end "cleanup_replicas" fi # Update the remote status to "complete". This has to happen before importing From 8c91cee8bb677745828460c468dc2a41fe117ff3 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Fri, 24 Mar 2023 14:26:28 +0100 Subject: [PATCH 264/946] fixing argon secret backup for ghes versions below 3.8.0 --- share/github-backup-utils/ghe-backup-settings | 2 +- test/test-ghe-backup.sh | 9 ++++----- test/testlib.sh | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index cfd1b24ce..5552b2f22 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -80,7 +80,7 @@ backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hma backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" # Backup argon secrets for multiuser from ghes version 3.8 onwards -if [ "$(version $GHE_REMOTE_VERSION)" -gt "$(version 3.7.0)" ]; then +if ! [ "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.0)" ]; then backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" fi diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index b60e5c3dd..f11430e18 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -133,19 +133,18 @@ begin_test "ghe-backup without password pepper" ) end_test -begin_test "ghe-backup without management console argon2 secret for ghes lower than 3.8" +# before the introduction of multiuser auth +begin_test "ghe-backup management console does not backup argon secret" ( set -e - git config -f "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" secrets.manage-auth.argon-secret "fake pw" - GHE_REMOTE_VERSION=3.7.0 ghe-backup - + GHE_REMOTE_VERSION=3.7.0 ghe-backup -v | grep -q "management console argon2 secret not set" && exit 1 [ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ] ) end_test # multiuser auth introduced in ghes version 3.8 -begin_test "ghe-backup management console argon2 secret" +begin_test "ghe-backup management console backs up argon secret" ( set -e diff --git a/test/testlib.sh b/test/testlib.sh index 61525b221..a4056a82f 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -448,7 +448,7 @@ verify_all_backedup_data() { [ "$(cat "$GHE_DATA_DIR/current/manage-password")" = "fake password hash data" ] # verify manage-argon-secret file was backed up - if [ "$(version $GHE_REMOTE_VERSION)" -gt "$(version 3.7.0)" ]; then + if ! [ "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.0)" ]; then [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake argon2 secret" ] fi From 9329a33ff882a992d204317b73b66ca23307ffcf Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 11:21:02 -0400 Subject: [PATCH 265/946] add calculation of restore steps --- bin/ghe-restore | 52 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index f0dc6b9f2..d4daec008 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -164,13 +164,10 @@ cleanup_cluster_nodes() { # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" -# Set up progress tracking -init-progress -export PROGRESS_TYPE="Restore" -echo $PROGRESS_TYPE > /tmp/track-progress-type -export PROGRESS=0 # Used to track progress of restore -echo $PROGRESS > /tmp/track-progress -export PROGRESS_TOTAL=15 # Maximum number of steps in restore +# Calculate the actual amounts of steps in the restore process +# taking into account the options passed to the script and the appliance configuration + + # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check @@ -274,6 +271,47 @@ if is_external_database_snapshot && ! $instance_configured && ! $FORCE; then prompt_for_confirmation "Please confirm this before continuing." fi +# calculate restore steps +OPTIONAL_STEPS=0 +# Cluster restores add an additional step +if $CLUSTER ; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi +# Restoring UUID +if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi +# Restoring Actions +if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi +# Restoring minio +if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi +# Elasticsearch is optional for cluster restores +if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi +# Restoring audit log +if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then + if [[ "$GHE_RESTORE_SKIP_AUDIT_LOG" != "yes" ]]; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) + fi +fi +# Replica cleanup +if ! $CLUSTER && $instance_configured; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi +# Maximum restore steps +export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 9)) + +init-progress +export PROGRESS_TYPE="Restore" +echo $PROGRESS_TYPE > /tmp/track-progress-type +export PROGRESS=0 # Used to track progress of restore +echo $PROGRESS > /tmp/track-progress + # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" From 29b4daeccd1c3ad6d57d49c0aad3afcd72ddc1ba Mon Sep 17 00:00:00 2001 From: Krayon Date: Sat, 25 Mar 2023 02:26:12 +1100 Subject: [PATCH 266/946] Removed our readlink() --- share/github-backup-utils/ghe-backup-config | 22 --------------------- 1 file changed, 22 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 60ef6014c..7cde3fb9f 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -21,28 +21,6 @@ YELLOW='\033[0;33m' BLUE='\033[0;34m' NC='\033[0m' # No Colo# Logging display and formatting functions -# If we don't have a readlink command, parse ls -l output. -if ! type readlink 1>/dev/null 2>&1; then - readlink() { - local ret=0 f='' - while [ $# -gt 0 ]; do - f="$1" - shift 1 - - [ ! -e "$f" ] && [ ! -h "$f" ] && { - ret=1 - continue - } - - # shellcheck disable=SC2012 # In this specific scenario, this method is OK - f="$(ls -ld "$f")" - echo "${f//*-> /}" - done - - return $ret - } -fi - # Log a message to stdout log_level() { local level=$1 From b6beab9a4867a11b8ea48fdb35eb1af3a288a86f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 11:30:15 -0400 Subject: [PATCH 267/946] troubleshooting --- bin/ghe-restore | 2 +- share/github-backup-utils/bm.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index d4daec008..03143dce0 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -388,7 +388,7 @@ log_warn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. log_info "Stopping cron and github-timerd ..." if $CLUSTER; then - bm_start "stop_cron_github_timerd" + bm_start "stop_cron" if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then log_warn "Failed to stop cron on one or more nodes" 1>&3 fi diff --git a/share/github-backup-utils/bm.sh b/share/github-backup-utils/bm.sh index 7b76ecbf7..4bffe29b3 100755 --- a/share/github-backup-utils/bm.sh +++ b/share/github-backup-utils/bm.sh @@ -49,6 +49,8 @@ bm_end() { local tend tstart total tend=$(date +%s) tstart=$(eval "echo \$$(bm_desc_to_varname "$@")_start") + echo "tend: $tend" + echo "tstart: $tstart" total=$(($tend - $tstart)) echo "$1 took ${total}s" >> $BM_FILE_PATH From e082fcc5fb50336ae02dd61cb40c4f155e18224a Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 24 Mar 2023 11:39:25 -0400 Subject: [PATCH 268/946] Update bin/ghe-host-check Update formatting. Co-authored-by: Krayon --- bin/ghe-host-check | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 0c0fd83be..07f57ab06 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -172,7 +172,17 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then min_disk_req=$((repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size)) - echo -e "### Data Transfer Sizes \nrepositories: $repos_disk_size MB\npages: $pages_disk_size MB\nelasticsearch: $es_disk_size MB\nstorage: $stor_disk_size MB\nminio: $minio_disk_size MB\nmysql: $mysql_disk_size MB\nactions: $actions_disk_size MB\nmssql: $mssql_disk_size MB" 1>&2 +cat <&2 +### Data Transfer Sizes +repositories: $repos_disk_size MB +pages: $pages_disk_size MB +elasticsearch: $es_disk_size MB +storage: $stor_disk_size MB +minio: $minio_disk_size MB +mysql: $mysql_disk_size MB +actions: $actions_disk_size MB +mssql: $mssql_disk_size MB +DATA_TRANSFER_SIZE printf "min_disk_required for this backup is at least %d MB\n" "$min_disk_req" 1>&2 if [[ $available_space -lt $min_disk_req ]]; then From b996dab8f034b06bc4901f6e6cac079a05488a3a Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 24 Mar 2023 11:43:50 -0400 Subject: [PATCH 269/946] Update bin/ghe-host-check More formatting for easier read. Co-authored-by: Krayon --- bin/ghe-host-check | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 07f57ab06..a53649a12 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -159,7 +159,8 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then #Display dir requirements for repositories and mysql echo "Checking host for sufficient space for a backup..." 1>&2 available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') - printf "Available space: %d MB. We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time.\n" "$((available_space / 1024 ** 2))" 1>&2 + echo -e "Available space: $((available_space / (1024 ** 2))) MB\n" 1>&2 + echo -e "We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time.\n" 1>&2 repos_disk_size=$(transfer_size repositories /tmp) pages_disk_size=$(transfer_size pages /tmp) From aa0617db68fda077b8b9ac4794ca32debdd04592 Mon Sep 17 00:00:00 2001 From: Krayon Date: Sat, 25 Mar 2023 02:46:23 +1100 Subject: [PATCH 270/946] Handle trailing alpha in version() --- share/github-backup-utils/ghe-backup-config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 7cde3fb9f..dec492870 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -510,8 +510,9 @@ ghe_debug() { version() { local v="${*#v}" + # Discard stderr and always return true as trailing alpha (eg. "v1.2.3pre") will upset printf # shellcheck disable=SC2183,SC2086 # We want to glob (SC2086) and expect 4 (fuzzy) params (SC2183) - printf "%d%03d%03d%03d\n" ${v//./ } + printf "%d%03d%03d%03d\n" ${v//./ } 2>/dev/null || true } # The list of gists returned by the source changed in 2.16.23, 2.17.14, From 1b5149ce279eb181f30426c7c4a2eb21562f57f3 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 11:55:04 -0400 Subject: [PATCH 271/946] restructure bm commands --- bin/ghe-restore | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 03143dce0..b35775ce5 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -388,7 +388,7 @@ log_warn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. log_info "Stopping cron and github-timerd ..." if $CLUSTER; then - bm_start "stop_cron" + bm_start "basename($0) - Stopping cron and github-timerd on cluster" if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then log_warn "Failed to stop cron on one or more nodes" 1>&3 fi @@ -420,7 +420,7 @@ else log_warn "Failed to stop github-timerd" 1>&3 fi fi - bm_end "stop_cron_github_timerd" + bm_end "basename($0) - Stopping cron and github-timerd on cluster" fi CRON_RUNNING=false @@ -442,12 +442,12 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then log_info "Restoring UUID ..." - bm_start "restore_uuid" + bm_start "basename($0) - Restore UUID" cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" - bm_end "restore_uuid" + bm_end "basename($0) - Restore UUID" fi if is_external_database_snapshot; then @@ -498,9 +498,9 @@ fi cmd_title=$(log_info "Restoring Redis database ...") commands=(" echo \"$cmd_title\" -bm_start \"restore_redis\" +bm_start \"basename($0) - Restoring Redis\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3 -bm_end \"restore_redis\"") +bm_end \"basename($0) - Restoring Redis\"") cmd_title=$(log_info "Restoring Git Repositories ...") commands+=(" @@ -520,9 +520,9 @@ ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") cmd_title=$(log_info "Restoring SSH authorized keys ...") commands+=(" echo \"$cmd_title\" -bm_start \"restore_authorized_keys\" +bm_start \"basename($0) -Restoring SSH authorized keys\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3 -bm_end \"restore_authorized_keys\"") +bm_end \"basename($0) -Restoring SSH authorized keys\"") cmd_title=$(log_info "Restoring storage data ...") commands+=(" @@ -575,10 +575,10 @@ fi # Restart an already running memcached to reset the cache after restore log_info "Restarting memcached ..." 1>&3 -bm_start "restart_memcached" +bm_start "basename($0) - Restarting memcached" echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh -bm_end "restart_memcached" +bm_end "basename($0) - Restarting memcached" # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. @@ -592,7 +592,7 @@ fi # config run to perform data migrations. if $CLUSTER; then log_info "Configuring cluster ..." - bm_start "configure_cluster" + bm_start "basename($0) - configure cluster" if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -609,7 +609,7 @@ elif $instance_configured; then ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-config-apply" 1>&3 2>&3 - bm_end "configure_appliance" + bm_end "basename($0) - configure cluster" fi # Clear GitHub Connect settings stored in the restored database. @@ -627,7 +627,7 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then log_info "Cleaning up replicas..." 1>&3 - bm_start "cleanup_replicas" + bm_start "basename($0) - Cleanup replicas" restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) other_nodes=$(echo " set -o pipefail; \ @@ -643,7 +643,7 @@ if ! $CLUSTER && $instance_configured; then echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 done fi - bm_end "cleanup_replicas" + bm_end "basename($0) - Cleanup replicas" fi # Update the remote status to "complete". This has to happen before importing From 6e97556d1dfbd1d0a9f67a63103b3e1c089c5d3e Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 11:58:26 -0400 Subject: [PATCH 272/946] fix basename typo --- bin/ghe-restore | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index b35775ce5..c6753c844 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -388,7 +388,7 @@ log_warn "Warning: storing backup-utils version remotely failed." # Stop cron and timerd, as scheduled jobs may disrupt the restore process. log_info "Stopping cron and github-timerd ..." if $CLUSTER; then - bm_start "basename($0) - Stopping cron and github-timerd on cluster" + bm_start "$(basename $0) - Stopping cron and github-timerd on cluster" if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then log_warn "Failed to stop cron on one or more nodes" 1>&3 fi @@ -420,7 +420,7 @@ else log_warn "Failed to stop github-timerd" 1>&3 fi fi - bm_end "basename($0) - Stopping cron and github-timerd on cluster" + bm_end "$(basename $0) - Stopping cron and github-timerd on cluster" fi CRON_RUNNING=false @@ -442,12 +442,12 @@ fi # Restore UUID if present and not restoring to cluster. if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then log_info "Restoring UUID ..." - bm_start "basename($0) - Restore UUID" + bm_start "$(basename $0) - Restore UUID" cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" - bm_end "basename($0) - Restore UUID" + bm_end "$(basename $0) - Restore UUID" fi if is_external_database_snapshot; then @@ -498,9 +498,9 @@ fi cmd_title=$(log_info "Restoring Redis database ...") commands=(" echo \"$cmd_title\" -bm_start \"basename($0) - Restoring Redis\" +bm_start \"$(basename $0) - Restoring Redis\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3 -bm_end \"basename($0) - Restoring Redis\"") +bm_end \"$(basename $0) - Restoring Redis\"") cmd_title=$(log_info "Restoring Git Repositories ...") commands+=(" @@ -520,9 +520,9 @@ ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") cmd_title=$(log_info "Restoring SSH authorized keys ...") commands+=(" echo \"$cmd_title\" -bm_start \"basename($0) -Restoring SSH authorized keys\" +bm_start \"$(basename $0) -Restoring SSH authorized keys\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3 -bm_end \"basename($0) -Restoring SSH authorized keys\"") +bm_end \"$(basename $0) -Restoring SSH authorized keys\"") cmd_title=$(log_info "Restoring storage data ...") commands+=(" @@ -575,10 +575,10 @@ fi # Restart an already running memcached to reset the cache after restore log_info "Restarting memcached ..." 1>&3 -bm_start "basename($0) - Restarting memcached" +bm_start "$(basename $0) - Restarting memcached" echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh -bm_end "basename($0) - Restarting memcached" +bm_end "$(basename $0) - Restarting memcached" # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. @@ -592,7 +592,7 @@ fi # config run to perform data migrations. if $CLUSTER; then log_info "Configuring cluster ..." - bm_start "basename($0) - configure cluster" + bm_start "$(basename $0) - configure cluster" if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then @@ -609,7 +609,7 @@ elif $instance_configured; then ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-config-apply" 1>&3 2>&3 - bm_end "basename($0) - configure cluster" + bm_end "$(basename $0) - configure cluster" fi # Clear GitHub Connect settings stored in the restored database. @@ -627,7 +627,7 @@ CRON_RUNNING=true # Clean up all stale replicas on configured instances. if ! $CLUSTER && $instance_configured; then log_info "Cleaning up replicas..." 1>&3 - bm_start "basename($0) - Cleanup replicas" + bm_start "$(basename $0) - Cleanup replicas" restored_uuid=$(cat $GHE_RESTORE_SNAPSHOT_PATH/uuid) other_nodes=$(echo " set -o pipefail; \ @@ -643,7 +643,7 @@ if ! $CLUSTER && $instance_configured; then echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 done fi - bm_end "basename($0) - Cleanup replicas" + bm_end "$(basename $0) - Cleanup replicas" fi # Update the remote status to "complete". This has to happen before importing From 713a5abae815b179f21a15573fe59a2205fc53b8 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 12:04:59 -0400 Subject: [PATCH 273/946] fix bm error --- bin/ghe-restore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index c6753c844..e8645018b 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -404,7 +404,9 @@ if $CLUSTER; then log_warn "Failed to stop github-timerd on one or more nodes" 1>&3 fi fi + bm_end "$(basename $0) - Stopping cron and github-timerd on cluster" else + bm_start "$(basename $0) - Stopping cron and github-timerd" if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"; then log_warn "Failed to stop cron" 1>&3 fi @@ -420,7 +422,7 @@ else log_warn "Failed to stop github-timerd" 1>&3 fi fi - bm_end "$(basename $0) - Stopping cron and github-timerd on cluster" + bm_end "$(basename $0) - Stopping cron and github-timerd on" fi CRON_RUNNING=false From 853ec7c9daf6e930ecbc11aa47b04b42e232c427 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 24 Mar 2023 16:25:40 +0000 Subject: [PATCH 274/946] More formatting --- bin/ghe-host-check | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index a53649a12..3ad88edc7 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -159,8 +159,7 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then #Display dir requirements for repositories and mysql echo "Checking host for sufficient space for a backup..." 1>&2 available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') - echo -e "Available space: $((available_space / (1024 ** 2))) MB\n" 1>&2 - echo -e "We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time.\n" 1>&2 + echo "We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." 1>&2 repos_disk_size=$(transfer_size repositories /tmp) pages_disk_size=$(transfer_size pages /tmp) @@ -172,6 +171,8 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then mssql_disk_size=$(transfer_size mssql /tmp) min_disk_req=$((repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size)) + echo "Available space: $((available_space / (1024 ** 2))) MB" 1>&2 + echo -e "Min Disk required for this backup is at least $min_disk_req MB\n" 1>&2 cat <&2 ### Data Transfer Sizes @@ -184,7 +185,6 @@ mysql: $mysql_disk_size MB actions: $actions_disk_size MB mssql: $mssql_disk_size MB DATA_TRANSFER_SIZE - printf "min_disk_required for this backup is at least %d MB\n" "$min_disk_req" 1>&2 if [[ $available_space -lt $min_disk_req ]]; then echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 @@ -192,6 +192,7 @@ DATA_TRANSFER_SIZE fi #Check rsync, openssh & jq versions + echo "### Software versions" 1>&2 rsync_version=$(rsync --version | grep 'version' | awk '{print $3}') if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 From 460499e046c0b69d829ff2467938b2ae964ca7a6 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 12:54:01 -0400 Subject: [PATCH 275/946] adding more info for tracking --- share/github-backup-utils/track-progress | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 12c2fc64b..3df09048e 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -6,6 +6,6 @@ progress(){ PROGRESS=$(cat /tmp/track-progress) PROGRESS_TYPE=$(cat /tmp/track-progress-type) PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) - echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/progress-info + echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " >> /tmp/progress-info echo $((PROGRESS +1)) > /tmp/track-progress } From 9edb995bb2b733726d9297613ef93074a1954b0f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 13:05:18 -0400 Subject: [PATCH 276/946] some troubleshooting output --- bin/ghe-restore | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/ghe-restore b/bin/ghe-restore index e8645018b..ec001ab6b 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -407,6 +407,7 @@ if $CLUSTER; then bm_end "$(basename $0) - Stopping cron and github-timerd on cluster" else bm_start "$(basename $0) - Stopping cron and github-timerd" + echo "$(basename $0) - Stopping cron and github-timerd" if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"; then log_warn "Failed to stop cron" 1>&3 fi From b39d799fb4118f7f2a1f22416a162e88beb1a42c Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 13:11:13 -0400 Subject: [PATCH 277/946] some troubleshooting output --- bin/ghe-restore | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index ec001ab6b..dd9f7494f 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -392,7 +392,7 @@ if $CLUSTER; then if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then log_warn "Failed to stop cron on one or more nodes" 1>&3 fi - + bm_end "$(basename $0) - Stopping cron and github-timerd on cluster" if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then @@ -404,14 +404,14 @@ if $CLUSTER; then log_warn "Failed to stop github-timerd on one or more nodes" 1>&3 fi fi - bm_end "$(basename $0) - Stopping cron and github-timerd on cluster" + else bm_start "$(basename $0) - Stopping cron and github-timerd" echo "$(basename $0) - Stopping cron and github-timerd" if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"; then log_warn "Failed to stop cron" 1>&3 fi - + bm_end "$(basename $0) - Stopping cron and github-timerd" if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then @@ -423,7 +423,7 @@ else log_warn "Failed to stop github-timerd" 1>&3 fi fi - bm_end "$(basename $0) - Stopping cron and github-timerd on" + fi CRON_RUNNING=false From ea3294c388a63a098742d0bfa724e332d9c27e28 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 15:24:29 -0400 Subject: [PATCH 278/946] making adjustments --- bin/ghe-restore | 4 ++-- share/github-backup-utils/track-progress | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index dd9f7494f..1b392b011 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -289,7 +289,7 @@ fi if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi -# Elasticsearch is optional for cluster restores +# Restoring Elasticsearch if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi @@ -304,7 +304,7 @@ if ! $CLUSTER && $instance_configured; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi # Maximum restore steps -export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 9)) +export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 5)) init-progress export PROGRESS_TYPE="Restore" diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 3df09048e..95e6bf6ac 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -3,9 +3,10 @@ # Current version is working solely with backups progress(){ + PROGRESS=$(cat /tmp/track-progress) PROGRESS_TYPE=$(cat /tmp/track-progress-type) PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) - echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " >> /tmp/progress-info echo $((PROGRESS +1)) > /tmp/track-progress + echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/progress-info } From 0a72be7be4a3f787e2157dfaa1dd14aa482be614 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 24 Mar 2023 15:25:37 -0400 Subject: [PATCH 279/946] remove troubleshooting code --- share/github-backup-utils/bm.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/github-backup-utils/bm.sh b/share/github-backup-utils/bm.sh index 4bffe29b3..561bcfffb 100755 --- a/share/github-backup-utils/bm.sh +++ b/share/github-backup-utils/bm.sh @@ -49,8 +49,7 @@ bm_end() { local tend tstart total tend=$(date +%s) tstart=$(eval "echo \$$(bm_desc_to_varname "$@")_start") - echo "tend: $tend" - echo "tstart: $tstart" + total=$(($tend - $tstart)) echo "$1 took ${total}s" >> $BM_FILE_PATH From e18a31efe49d6b5d9bbd6174168fd0293027c816 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Sat, 25 Mar 2023 12:50:53 +0100 Subject: [PATCH 280/946] fixing ambiguous/unnecessarily complex condition (#284) * fixing ambiguous/unnecessarily complex condition * adding additional test conditions --- share/github-backup-utils/ghe-backup-settings | 2 +- test/test-ghe-backup.sh | 14 +++++++++++++- test/testlib.sh | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 5552b2f22..d8bddb068 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -80,7 +80,7 @@ backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hma backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" # Backup argon secrets for multiuser from ghes version 3.8 onwards -if ! [ "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.0)" ]; then +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" fi diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index f11430e18..8e49349b2 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -138,7 +138,13 @@ begin_test "ghe-backup management console does not backup argon secret" ( set -e - GHE_REMOTE_VERSION=3.7.0 ghe-backup -v | grep -q "management console argon2 secret not set" && exit 1 + GHE_REMOTE_VERSION=2.1.10 ghe-backup -v | grep -q "management console argon2 secret not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ] + + GHE_REMOTE_VERSION=3.6.1 ghe-backup -v | grep -q "management console argon2 secret not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ] + + GHE_REMOTE_VERSION=3.7.10 ghe-backup -v | grep -q "management console argon2 secret not set" && exit 1 [ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ] ) end_test @@ -152,6 +158,12 @@ begin_test "ghe-backup management console backs up argon secret" GHE_REMOTE_VERSION=3.8.0 ghe-backup [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake pw" ] + + rm -rf "$GHE_DATA_DIR/current" + + GHE_REMOTE_VERSION=4.1.0 ghe-backup + + [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake pw" ] ) end_test diff --git a/test/testlib.sh b/test/testlib.sh index a4056a82f..af1425472 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -448,7 +448,7 @@ verify_all_backedup_data() { [ "$(cat "$GHE_DATA_DIR/current/manage-password")" = "fake password hash data" ] # verify manage-argon-secret file was backed up - if ! [ "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.0)" ]; then + if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake argon2 secret" ] fi From d00194dcf62a1a31347f5253819f487f9978e9e1 Mon Sep 17 00:00:00 2001 From: Krayon Date: Mon, 27 Mar 2023 13:17:29 +1100 Subject: [PATCH 281/946] Fix version extraction --- share/github-backup-utils/ghe-backup-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index dec492870..2d44a4ef3 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -425,8 +425,8 @@ ghe_remote_version_required() { GHE_HOSTNAME="${GHE_HOSTNAME/ OK*/}" export GHE_HOSTNAME - GHE_REMOTE_VERSION="${GHE_HOSTNAME#*\(}" - GHE_REMOTE_VERSION="${GHE_HOSTNAME%%\)*}" + GHE_REMOTE_VERSION="${_out#*\(}" + GHE_REMOTE_VERSION="${GHE_REMOTE_VERSION%%\)*}" export GHE_REMOTE_VERSION ghe_parse_remote_version "$GHE_REMOTE_VERSION" From 8747a6e307dd9a6682c127f58e71eb86eb87cd70 Mon Sep 17 00:00:00 2001 From: Krayon Date: Mon, 27 Mar 2023 23:38:49 +1100 Subject: [PATCH 282/946] (future) quote protection of GIST_FILTER param --- share/github-backup-utils/ghe-backup-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 2d44a4ef3..83533ee97 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -525,7 +525,7 @@ fix_paths_for_ghe_version() { [[ "$GHE_REMOTE_VERSION" =~ 2.17. && "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.17.14)" ]] || [[ "$GHE_REMOTE_VERSION" =~ 2.18. && "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.18.8)" ]] || [[ "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.19.3)" ]]; then - GIST_FILTER=(-e /gist/b) + GIST_FILTER=(-e "/gist/b") else unset GIST_FILTER fi From 91e6c6c3415e296330d0636440214677c97fc3f0 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 27 Mar 2023 17:29:36 -0400 Subject: [PATCH 283/946] Testing this initial portion of the workflow --- .github/workflows/restore.yml | 73 +++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/restore.yml diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml new file mode 100644 index 000000000..61084e875 --- /dev/null +++ b/.github/workflows/restore.yml @@ -0,0 +1,73 @@ +name: Restore Dataset + +on: + workflow_dispatch: + inputs: + size: + description: 'Size of the dataset to restore' + required: true + type: choice + default: 'small' + options: + - 'small' + - 'medium' + hostname: + description: 'Hostname of the server' + required: true + type: string + ref: + description: 'Branch ref to use' + required: false + type: string + default: 'master' + workflow_call: + inputs: + size: + description: 'Size of the dataset to restore' + required: true + type: string + default: 'small' + hostname: + description: 'Hostname of the server' + required: true + type: string + ref: + description: 'Branch ref to use' + required: false + type: string + default: 'master' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: github/backup-utils-private + ref: ${{ inputs.ref }} + - run: docker build . --file Dockerfile --tag backup-utils + - run: docker save backup-utils -o backup-utils.tar + - uses: actions/upload-artifact@v3 + with: + name: backup-utils + path: backup-utils.tar + restore: + needs: build + runs-on: ubuntu-latest + env: + SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} + steps: + - uses: actions/download-artifact@v3 + with: + name: backup-utils + - name: Load docker container + run: docker load -i backup-utils.tar + - uses: actions/checkout@v3 + with: + repository: github/ghes-data + ref: main + - run: gunzip ghes-data/data/backup/${{ inputs.size }}/${{ inputs.size }}.zip + - run: ls -al ghes-data/data/backup/${{ inputs.size }} + + + + From 93f7a6206d60cc3ea3be46f3dc326dcc7a05f366 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 30 Mar 2023 12:46:50 -0400 Subject: [PATCH 284/946] update file names --- bin/ghe-backup | 4 ++-- bin/ghe-progress | 8 ++++---- bin/ghe-restore | 4 ++-- share/github-backup-utils/ghe-backup-config | 4 ++-- share/github-backup-utils/track-progress | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 2caf4dae5..06d096e72 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -47,9 +47,9 @@ export CALLING_SCRIPT="ghe-backup" # Setup progress tracking init-progress export PROGRESS_TYPE="Backup" -echo $PROGRESS_TYPE > /tmp/track-progress-type +echo $PROGRESS_TYPE > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of backup -echo $PROGRESS > /tmp/track-progress +echo $PROGRESS > /tmp/backup-utils-progress export PROGRESS_TOTAL=18 # Maximum number of steps in backup # Check to make sure moreutils parallel is installed and working properly diff --git a/bin/ghe-progress b/bin/ghe-progress index 1099ad2c3..ef2964170 100755 --- a/bin/ghe-progress +++ b/bin/ghe-progress @@ -30,7 +30,7 @@ while true; do done check_for_progress_file() { - if [ ! -f /tmp/progress-info ]; then + if [ ! -f /tmp/backup-utils-progress-info ]; then echo "No progress file found. has a backup or restore been started?" exit 1 fi @@ -38,18 +38,18 @@ check_for_progress_file() { if [ -n "$ONCE" ]; then check_for_progress_file - cat /tmp/progress-info + cat /tmp/backup-utils-progress-info else check_for_progress_file clear - cat /tmp/progress-info + cat /tmp/backup-utils-progress-info while true; do if read -r -t 1 -n 1; then clear exit ; else clear - cat /tmp/progress-info + cat /tmp/backup-utils-progress-info fi done fi diff --git a/bin/ghe-restore b/bin/ghe-restore index 1b392b011..d03dff492 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -308,9 +308,9 @@ export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 5)) init-progress export PROGRESS_TYPE="Restore" -echo $PROGRESS_TYPE > /tmp/track-progress-type +echo $PROGRESS_TYPE > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of restore -echo $PROGRESS > /tmp/track-progress +echo $PROGRESS > /tmp/backup-utils-progress # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 7733b91e9..bbfed9592 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -55,7 +55,7 @@ fi PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # shellcheck source=share/github-backup-utils/bm.sh . "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" -. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" +. "$GHE_BACKUP_ROOT/share/github-backup-utils/backup-utils-progress" # Save off GHE_HOSTNAME from the environment since we want it to override the # backup.config value when set. GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" @@ -648,7 +648,7 @@ restore-secret() { #initialize progress tracking by clearing out the temp files used to track init-progress() { - rm -f /tmp/track-progress-* + rm -f /tmp/backup-utils-progress-* } diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 95e6bf6ac..a9930d627 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -4,9 +4,9 @@ # Current version is working solely with backups progress(){ - PROGRESS=$(cat /tmp/track-progress) - PROGRESS_TYPE=$(cat /tmp/track-progress-type) + PROGRESS=$(cat /tmp/backup-utils-progress) + PROGRESS_TYPE=$(cat /tmp/backup-utils-progress-type) PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) - echo $((PROGRESS +1)) > /tmp/track-progress - echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/progress-info + echo $((PROGRESS +1)) > /tmp/backup-utils-progress + echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress-info } From 979ababdb292c03ad7371d6aac3cde83c7d7319d Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 4 Apr 2023 13:03:13 -0400 Subject: [PATCH 285/946] Add correct amount of steps --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index d03dff492..aa3848c07 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -304,7 +304,7 @@ if ! $CLUSTER && $instance_configured; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi # Maximum restore steps -export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 5)) +export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 6)) init-progress export PROGRESS_TYPE="Restore" From 7ee839b885ccbdbadc4c7976d80dcc4c000e3825 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 5 Apr 2023 12:15:39 -0400 Subject: [PATCH 286/946] Delete backup-verbose.log --- backup-verbose.log | 3670 -------------------------------------------- 1 file changed, 3670 deletions(-) delete mode 100644 backup-verbose.log diff --git a/backup-verbose.log b/backup-verbose.log deleted file mode 100644 index bd430d973..000000000 --- a/backup-verbose.log +++ /dev/null @@ -1,3670 +0,0 @@ -2023-03-17T16:13:33Z INFO ghe-restore: -2023-03-17T16:13:33Z INFO ghe-restore-snapshot-path: -2023-03-17T16:13:33Z INFO ghe-detect-leaked-ssh-keys: -2023-03-17T16:13:33Z INFO ghe-host-check: 10.0.1.172 -2023-03-17T16:13:33Z INFO ghe-ssh: -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172 -- [ -f '/etc/github/cluster' ] -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172 -- cat /etc/github/repl-state -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- [ -f '/etc/github/configured' ] -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] -2023-03-17T16:13:34Z INFO ghe-restore-external-database-compatibility-check: -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- [ -f '/etc/github/configured' ] -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- [ -f '/etc/github/repl-state' ] -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- logger -t backup-utils -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- sudo sponge '/data/user/common/ghe-restore-status' >/dev/null -2023-03-17T16:13:34Z INFO ghe-maintenance-mode-status: 10.0.1.172:122 -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- test -e /data/github/current/public/system/maintenance.html -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --get core.package-version -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-17T16:13:34Z INFO ghe-backup-store-version: -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 -ghe-backup-store-version took 0s -2023-03-17T16:13:34Z INFO ghe-ssh: 10.0.1.172:122 -- sudo service cron stop -2023-03-17T16:13:35Z INFO ghe-ssh: 10.0.1.172:122 -- systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null -2023-03-17T16:13:35Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/sh -mysql is running -Queued nomad job '/etc/nomad-jobs/elasticsearch/elasticsearch.hcl' -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo sponge '/data/user/common/uuid' 2>/dev/null -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo systemctl stop consul -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo rm -rf /data/user/consul/raft -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-17T16:13:36Z INFO ghe-restore-mysql: 10.0.1.172:122 -Restoring password pepper ... -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/bash -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-17T16:13:36Z INFO ghe-restore-mysql-binary: 10.0.1.172:122 -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo mkdir -p '/data/user/tmp' -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- sudo dd of=/data/user/tmp/mysql.sql.gz >/dev/null 2>&1 -2023-03-17T16:13:36Z INFO Restore MySQL database ... -2023-03-17T16:13:36Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/bash -Mar 17 16:13:36 Stop MySQL service -active -Stop MySQL via Nomad -==> 2023-03-17T16:13:36Z: Monitoring evaluation "e479e4cf" - 2023-03-17T16:13:36Z: Evaluation triggered by job "mysql" -==> 2023-03-17T16:13:37Z: Monitoring evaluation "e479e4cf" - 2023-03-17T16:13:37Z: Evaluation status changed: "pending" -> "complete" -==> 2023-03-17T16:13:37Z: Evaluation "e479e4cf" finished with status "complete" -Waiting for 60 seconds for mysql to completely shut down -mysql is not running -mysql is not running -Mar 17 16:13:37 Available space for data: 31079 (MB). Existing datadir: 794 (MB). Available ratio: 39 -Mar 17 16:13:37 Previous emergency copy /data/user/mysql-backup is deleted! -Mar 17 16:13:37 Existing MySQL directory backed up to /data/user/mysql-backup. If you need to restore from that, run "sudo rm -rf /data/user/mysql" and then "sudo mv /data/user/mysql-backup /data/user/mysql" -Mar 17 16:13:37 Purge MySQL folder -Mar 17 16:13:37 Extracting backup -Mar 17 16:13:38 Prepare backup -Mar 17 16:13:38 Using xtrabackup 2.4 for restore -Mar 17 16:13:43 Change owner to MySQL -Mar 17 16:13:43 Start MySQL service -Queued nomad job '/etc/nomad-jobs/mysql/mysql.hcl' -Wait nomad to start MySQL -MySQL is up running -Setup mysql after startup -Finish setup mysql after startup -Mar 17 16:13:59 MySQL service started -Mar 17 16:14:00 Restore succeeded -Mar 17 16:14:00 Emergency copy of /data/user/mysql is saved at /data/user/mysql-backup. After you are sure the restore was successful, please delete this copy -ghe-restore-mysql-binary took 24s -2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- sudo rm -rf /data/user/tmp/mysql.sql.gz -ghe-restore-mysql took 24s -2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-config --true app.minio.enabled -2023-03-17T16:14:00Z INFO ghe-restore-minio: 10.0.1.172:122 -2023-03-17T16:14:00Z INFO * Transferring minio files to 10.0.1.172 ... -2023-03-17T16:14:00Z INFO ghe-ssh: -p 122 10.0.1.172 -- sudo mkdir -p /data/user/minio -2023-03-17T16:14:00Z INFO ghe-ssh: -p 122 10.0.1.172 -- sudo chown -R minio:minio /data/user/minio -2023-03-17T16:14:00Z RSYNC BEGIN: minio rsync -2023-03-17T16:14:00Z INFO ghe-rsync: --verbose --archive --hard-links --relative --delete --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync /workspace/backup-utils-private/data/20230316T212843/minio/./ 10.0.1.172:/data/user/minio/ -2023-03-17T16:14:00Z INFO ghe-ssh: -p 122 10.0.1.172 sudo -u minio rsync --server -vlHogDtprRe.iLsfxC --delete . /data/user/minio/ -sending incremental file list - -sent 94 bytes received 13 bytes 214.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-17T16:14:00Z RSYNC END: minio rsync -ghe-restore-minio took 0s -2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-import-authorized-keys -2023-03-17T16:14:00Z INFO ghe-restore-pages: 10.0.1.172:122 -2023-03-17T16:14:00Z INFO ghe-restore-es-rsync: 10.0.1.172:122 -2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- ghe-import-redis -2023-03-17T16:14:00Z INFO ghe-restore-repositories-gist: 10.0.1.172:122 -2023-03-17T16:14:00Z INFO ghe-restore-git-hooks: 10.0.1.172:122 -2023-03-17T16:14:00Z INFO ghe-restore-repositories: 10.0.1.172:122 -2023-03-17T16:14:00Z INFO ghe-restore-storage: 10.0.1.172:122 -2023-03-17T16:14:00Z WARN Warning: Pages backup missing. Skipping ... -2023-03-17T16:14:00Z WARN Warning: Storage backup missing. Skipping ... -2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- sudo mkdir -p '/data/user/elasticsearch-restore' -2023-03-17T16:14:00Z INFO ghe-ssh: -l admin 10.0.1.172:122 -- sudo -u git mkdir -p /data/user/git-hooks/repos -2023-03-17T16:14:00Z RSYNC BEGIN: git-hooks repos rsync -2023-03-17T16:14:00Z RSYNC END: git-hooks repos rsync -2023-03-17T16:14:00Z INFO ghe-ssh: 10.0.1.172:122 -- sudo chown elasticsearch:elasticsearch '/data/user/elasticsearch-restore' -2023-03-17T16:14:00Z INFO ghe-rsync: -avH --delete -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync /workspace/backup-utils-private/data/20230316T212843/git-hooks/repos/ 10.0.1.172:/data/user/git-hooks/repos - --> Stopping redis... -2023-03-17T16:14:00Z RSYNC BEGIN: elasticsearch rsync -2023-03-17T16:14:00Z INFO ghe-rsync: -avz --delete -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --copy-dest=/data/user/elasticsearch /workspace/backup-utils-private/data/20230316T212843/elasticsearch/ 10.0.1.172:/data/user/elasticsearch-restore -2023-03-17T16:14:00Z INFO ghe-ssh: -p 122 10.0.1.172 sudo -u elasticsearch rsync --server -vlogDtprze.iLsfxC --delete --copy-dest /data/user/elasticsearch . /data/user/elasticsearch-restore -sending incremental file list -./ -deleting nodes/0/_state/node-0.st -deleting nodes/0/_state/global-3.st -deleting nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/state-0.st -deleting nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/segments_1 -deleting nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/state-3.st -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/state-0.st -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/segments_1 -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/state-0.st -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/segments_1 -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/state-0.st -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/segments_1 -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/state-0.st -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/segments_1 -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/state-0.st -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/segments_1 -deleting nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/state-5.st -deleting nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/state-0.st -deleting nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/segments_1 -deleting nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/state-3.st -deleting nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/state-0.st -deleting nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/segments_1 -deleting nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/state-3.st -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/state-0.st -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/segments_1 -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/state-0.st -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/segments_1 -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/state-0.st -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/segments_1 -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/state-0.st -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/segments_1 -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/state-0.st -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/segments_1 -deleting nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/state-5.st -deleting nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/state-0.st -deleting nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/segments_1 -deleting nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/state-3.st -deleting nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/state-0.st -deleting nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/segments_1 -deleting nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/state-3.st -deleting nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/state-0.st -deleting nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/segments_1 -deleting nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/state-3.st -deleting nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/state-0.st -deleting nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/segments_1 -deleting nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/state-3.st -deleting nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/state-0.st -deleting nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/segments_1 -deleting nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/state-3.st -deleting nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/state-0.st -deleting nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/segments_1 -deleting nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/state-5.st -deleting nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/state-0.st -deleting nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/segments_1 -deleting nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/state-3.st -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/state-0.st -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/segments_1 -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/state-0.st -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/segments_1 -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/state-0.st -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/segments_1 -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/state-0.st -deleting nodes/0/indices/ROa --> Importing SSH authorized keys... -Qi7QXRdOYoj6_dXARBQ/3/index/segments_1 -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/state-0.st -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/segments_1 -deleting nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/state-5.st -deleting nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/state-0.st -deleting nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/segments_1 -deleting nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/state-3.st -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/state-0.st -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/segments_1 -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/state-0.st -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/segments_1 -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/state-0.st -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/segments_1 -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/state-0.st -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/segments_1 -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/state-0.st -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/segments_1 -deleting nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/state-5.st -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/state-0.st -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/segments_1 -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/state-0.st -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/segments_1 -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/state-0.st -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/segments_3 -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/state-0.st -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/segments_1 -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/state-0.st -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/segments_1 -deleting nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/state-5.st -deleting nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/state-0.st -deleting nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/segments_1 -deleting nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/state-3.st -deleting nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/state-0.st -deleting nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/segments_3 -deleting nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/state-3.st -deleting nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/state-0.st -deleting nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/segments_1 -deleting nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/state-3.st -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/state-0.st -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/segments_1 -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/state-0.st -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/segments_1 -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/state-0.st -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/segments_1 -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/state-0.st -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/segments_1 -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/state-0.st -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/segments_1 -deleting nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/state-5.st -deleting nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/state-0.st -deleting nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/segments_1 -deleting nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/state-3.st -deleting nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/state-0.st -deleting nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/segments_1 -deleting nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/state-3.st -deleting nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/state-0.st -deleting nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/segments_3 -deleting nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/state-4.st -deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/state-0.st -deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_h -deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_7.si -deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_7.cfs -deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_7.cfe -deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-9.tlog -deleting nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/state-4.st -deleting nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/state-0.st -deleting nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/segments_1 -deleting nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/state-3.st -deleting nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/state-0.st -deleting nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/segments_1 -deleting nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/state-3.st -deleting nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/state-0.st -deleting nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/segments_1 -deleting nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/state-3.st -nodes/0/ -nodes/0/_state/ -nodes/0/_state/global-5.st -nodes/0/_state/node-2.st -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/state-2.st -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/segments_3 -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog.ckp -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/state-9.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/state-2.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/segments_3 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/state-2.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/segments_3 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/state-2.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/segments_3 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/state-2.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/segments_3 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/state-2.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/segments_3 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/state-13.st -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/state-2.st -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/segments_3 -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog.ckp -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/state-9.st -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/state-2.st -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/segments_3 -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog.ckp -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/state-9.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/state-2.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/segments_3 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/state-2.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/segments_3 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/state-2.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/segments_3 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/state-2.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/segments_3 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/state-2.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/segments_3 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/state-13.st -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/state-2.st -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/segments_3 -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog.ckp -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/state-9.st -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/state-2.st -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/segments_3 -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog.ckp -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/state-9.st -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/state-2.st -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/segments_3 -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog.ckp -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/state-9.st -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/state-2.st -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/segments_3 -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog.ckp -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/state-9.st -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/state-2.st -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/segments_3 -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog.ckp -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/state-9.st -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/state-2.st -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/segments_3 -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog.ckp -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/state-11.st -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/state-2.st -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/segments_3 -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog.ckp -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/state-9.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/state-2.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/segments_3 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/state-2.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/segments_3 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/state-2.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/segments_3 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/state-2.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/segments_3 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/state-2.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/segments_3 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/state-13.st -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/state-2.st -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/segments_3 -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog.ckp -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/state-9.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/state-2.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/segments_3 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/state-2.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/segments_3 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/state-2.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/segments_3 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/state-2.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/segments_3 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/state-2.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/segments_3 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/state-13.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/state-2.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/segments_3 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/state-2.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/segments_3 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/state-2.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/segments_5 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/state-2.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/segments_3 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/state-2.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/segments_3 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/state-13.st -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/state-2.st -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/segments_3 -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog.ckp -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/state-9.st -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/state-2.st -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/segments_5 -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog-4.tlog -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog.ckp -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/state-9.st -nodes/0/indices/ejnFd11uQteAkjE995T2tw/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/state-2.st -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/segments_3 -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog.ckp -nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/state-9.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/state-2.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/segments_3 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/state-2.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/segments_3 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/state-2.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/segments_3 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/state-2.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/segments_3 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/state-2.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/segments_3 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/state-13.st -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/state-2.st -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/segments_3 -nodes/0/indices/kSoL8UdcRTy558OhM==> 2023-03-17T16:14:00Z: Monitoring evaluation "58730a17" - 2023-03-17T16:14:00Z: Evaluation triggered by job "redis" -RyvRw/0/translog/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog.ckp -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/state-9.st -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/state-2.st -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/segments_3 -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog.ckp -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/state-9.st -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/state-2.st -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/segments_5 -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog.ckp -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/state-10.st -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/state-2.st -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_g.cfe -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_g.cfs -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_g.si -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_v -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-18.tlog -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/state-10.st -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/state-2.st -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/segments_3 -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog.ckp -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/state-9.st -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/state-2.st -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/segments_3 -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog.ckp -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/state-9.st -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/state-2.st -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/segments_3 -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog.ckp -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/state-9.st - -sent 86,283 bytes received 13,126 bytes 198,818.00 bytes/sec -total size is 142,465 speedup is 1.43 -2023-03-17T16:14:00Z RSYNC END: elasticsearch rsync -ghe-restore-es-rsync took 0s -sending incremental file list - -sent 58 bytes received 12 bytes 140.00 bytes/sec -total size is 0 speedup is 0.00 -ghe-restore-git-hooks took 0s -==> 2023-03-17T16:14:01Z: Monitoring evaluation "58730a17" - 2023-03-17T16:14:01Z: Evaluation status changed: "pending" -> "complete" -==> 2023-03-17T16:14:01Z: Evaluation "58730a17" finished with status "complete" - --> Importing redis data... - --> Starting redis... -Queued nomad job '/etc/nomad-jobs/redis/redis.hcl' -Waiting for redis service -Status = running - --> Make sure redis is ready... - --> Remove stale resque worker entries... -2023-03-17T16:14:09Z INFO Restarting memcached ... -2023-03-17T16:14:09Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/sh -2023-03-17T16:14:09Z INFO Setting last run date for GitHub Connect jobs ... -2023-03-17T16:14:09Z INFO ghe-ssh: 10.0.1.172:122 -- /bin/sh -2023-03-17T16:14:09Z INFO ghe-ssh: 10.0.1.172:122 -- sudo sponge '/data/user/common/ghe-restore-status' >/dev/null -2023-03-17T16:14:09Z INFO ghe-ssh: 10.0.1.172:122 -- sudo timeout 120s service cron start -2023-03-17T16:14:10Z INFO ghe-ssh: --clean -2023-03-17T16:14:10Z INFO Removing in-progress file ... -2023-03-21T20:40:04Z INFO ghe-backup -2023-03-21T20:40:04Z INFO ghe-host-check -2023-03-21T20:40:04Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh -2023-03-21T20:40:05Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] -2023-03-21T20:40:05Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state -2023-03-21T20:40:05Z INFO ghe-rsync-size.sh -2023-03-21T20:40:05Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ -2023-03-21T20:40:05Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ -2023-03-21T20:40:05Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ -2023-03-21T20:40:06Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ -2023-03-21T20:40:06Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ -2023-03-21T20:40:06Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ -2023-03-21T20:40:07Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ -2023-03-21T20:40:07Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ -2023-03-21T20:40:07Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-21T20:40:08Z INFO ghe-backup-strategy -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] -2023-03-21T20:40:08Z INFO ghe-backup-store-version -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 -ghe-backup-store-version took 0s -2023-03-21T20:40:08Z INFO ghe-backup-settings -2023-03-21T20:40:08Z INFO * Transferring settings data ... -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings -2023-03-21T20:40:08Z INFO * Transferring license data ... -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' -2023-03-21T20:40:08Z INFO * Transferring management console password ... -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage -2023-03-21T20:40:08Z INFO * Transferring password pepper ... -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets -2023-03-21T20:40:08Z INFO * Transferring kredz.credz HMAC key ... -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret -2023-03-21T20:40:08Z INFO * Transferring kredz.varz HMAC key ... -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret -2023-03-21T20:40:08Z INFO * Transferring management console argon2 secret ... -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null -2023-03-21T20:40:08Z INFO * Transferring CA certificates ... -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null -2023-03-21T20:40:08Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys -ghe-export-authorized-keys took 0s -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys -ghe-export-ssh-host-keys took 0s -2023-03-21T20:40:08Z INFO ghe-backup-mysql -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-21T20:40:08Z INFO ghe-backup-mysql-binary -2023-03-21T20:40:08Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -ghe-backup-mysql-binary took 3s -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled -2023-03-21T20:40:11Z INFO ghe-backup-minio -2023-03-21T20:40:11Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-21T20:40:11Z RSYNC BEGIN: minio rsync -2023-03-21T20:40:11Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230321T204004/minio -2023-03-21T20:40:11Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:40:11Z RSYNC END: minio rsync -ghe-backup-minio took 0s -2023-03-21T20:40:11Z INFO ghe-backup-es-audit-log -2023-03-21T20:40:11Z INFO ghe-backup-pages -2023-03-21T20:40:11Z INFO ghe-backup-repositories -2023-03-21T20:40:11Z INFO ghe-backup-storage -2023-03-21T20:40:11Z INFO ghe-backup-redis -2023-03-21T20:40:11Z INFO ghe-backup-es-rsync -2023-03-21T20:40:11Z INFO ghe-backup-git-hooks - -2023-03-21T20:40:11Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-21T20:40:11Z INFO * Transferring pages files ... -2023-03-21T20:40:11Z RSYNC BEGIN: pages rsync -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] -2023-03-21T20:40:11Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230321T204004/pages -2023-03-21T20:40:11Z INFO * Performing initial sync of ES indices ... -2023-03-21T20:40:11Z RSYNC BEGIN elasticsearch rsync -2023-03-21T20:40:11Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-21T20:40:11Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-21T20:40:11Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204004/elasticsearch -2023-03-21T20:40:11Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:40:11Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -2023-03-21T20:40:11Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -2023-03-21T20:40:11Z RSYNC BEGIN: git-hooks sync -ghe-backup-es-audit-log took 0s -2023-03-21T20:40:11Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230321T204004/git-hooks/repos -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -receiving incremental file list -./ -nodes/0/ -nodes/0/_state/ -nodes/0/_state/global-6.st -nodes/0/_state/node-3.st -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/state-3.st -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/segments_4 -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog-3.ckp -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog-4.tlog -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog.ckp -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/state-12.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/state-17.st -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/state-3.st -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/segments_4 -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog-3.ckp -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog-4.tlog -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog.ckp -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/state-12.st -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/state-3.st -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/segments_4 -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog-3.ckp -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog-4.tlog -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog.ckp -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/state-12.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/state-17.st -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/state-3.st -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/segments_4 -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog-3.ckp -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog-4.tlog -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog.ckp -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/state-12.st -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/state-3.st -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/segments_4 -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog-3.ckp -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog-4.tlog -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog.ckp -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/state-12.st -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/state-3.st -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/segments_4 -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog-3.ckp -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog-4.tlog -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog.ckp -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/state-12.st -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/state-3.st -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/segments_4 -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog-3.ckp -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog-4.tlog -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog.ckp -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/state-12.st -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/state-3.st -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/segments_4 -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog-3.ckp -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog-4.tlog -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog.ckp -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/state-12.st -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/state-3.st -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/segments_4 -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog-3.ckp -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog-4.tlog -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog.ckp -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/state-14.st -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/state-3.st -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/segments_4 -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog-3.ckp -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog-4.tlog -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog.ckp -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/state-12.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/state-17.st -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/state-3.st -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/segments_4 -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog-3.ckp -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog-4.tlog -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog.ckp -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/state-12.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/state-17.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/segments_4 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog-3.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog-4.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/segments_4 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog-3.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog-4.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/segments_6 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog-4.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog-5.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/segments_4 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog-3.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog-4.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/segments_4 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog-3.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog-4.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/state-17.st -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/state-3.st -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/segments_4 -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog-3.ckp -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog-4.tlog -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog.ckp -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/state-12.st -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/state-3.st -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.cfe -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.cfs -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.si -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/segments_8 -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog-6.tlog -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog.ckp -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/state-12.st -nodes/0/indices/ejnFd11uQteAkjE995T2tw/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/state-3.st -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/segments_4 -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog-3.ckp -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog-4.tlog -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog.ckp -nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/state-12.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/state-17.st -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/state-3.st -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/segments_4 -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog-3.ckp -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog-4.tlog -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog.ckp -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/state-12.st -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/state-3.st -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/segments_4 -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog-3.ckp -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog-4.tlog -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog.ckp -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/state-12.st -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/state-3.st -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/segments_6 -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog-4.ckp -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog-5.tlog -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog.ckp -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/state-13.st -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/state-3.st -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.cfe -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.cfs -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.si -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_15 -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-24.tlog -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/state-13.st -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/state-3.st -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/segments_4 -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog-3.ckp -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog-4.tlog -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog.ckp -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/state-12.st -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/state-3.st -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/segments_4 -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog-3.ckp -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog-4.tlog -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog.ckp -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/state-12.st -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/state-3.st -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/segments_4 -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog-3.ckp -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog-4.tlog -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog.ckp -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/state-12.st - -sent 6,918 bytes received 97,851 bytes 209,538.00 bytes/sec -total size is 146,931 speedup is 1.40 -2023-03-21T20:40:11Z RSYNC END elasticsearch rsync -2023-03-21T20:40:11Z INFO * Disabling ES index flushing ... -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush -2023-03-21T20:40:11Z INFO * Performing follow-up sync of ES indices ... -2023-03-21T20:40:11Z RSYNC BEGIN: elasticsearch followup rsync -2023-03-21T20:40:11Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204004/elasticsearch -2023-03-21T20:40:11Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:40:11Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -receiving incremental file list - -sent 282 bytes received 22,566 bytes 45,696.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-21T20:40:11Z RSYNC END: elasticsearch followup rsync -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete -ghe-backup-es-rsync took 0s -2023-03-21T20:40:11Z INFO * Enabling ES index flushing ... -2023-03-21T20:40:11Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:40:11Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -ghe-backup-redis took 1s -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-6nt2a6/remote_routes_list -ghe-backup-storage - Generating routes took 2s -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-6nt2a6/remote_routes_list -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-21T20:40:13Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-6nt2a6 -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-8O0hUx/remote_routes_list -ghe-backup-repositories - Generating routes took 2s -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-8O0hUx/remote_routes_list -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s -2023-03-21T20:40:13Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-8O0hUx -2023-03-21T20:40:13Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-21T20:40:13Z INFO ghe-ssh --clean -2023-03-21T20:43:38Z INFO ghe-backup -2023-03-21T20:43:38Z INFO ghe-host-check -2023-03-21T20:43:38Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh -2023-03-21T20:43:39Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] -2023-03-21T20:43:39Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state -2023-03-21T20:43:39Z INFO ghe-rsync-size.sh -2023-03-21T20:43:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ -2023-03-21T20:43:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ -2023-03-21T20:43:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ -2023-03-21T20:43:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ -2023-03-21T20:43:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ -2023-03-21T20:43:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ -2023-03-21T20:43:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ -2023-03-21T20:43:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ -2023-03-21T20:43:41Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-21T20:43:41Z INFO ghe-backup-strategy -2023-03-21T20:43:41Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] -2023-03-21T20:43:41Z INFO ghe-backup-store-version -2023-03-21T20:43:41Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 -ghe-backup-store-version took 1s -2023-03-21T20:43:42Z INFO ghe-backup-settings -2023-03-21T20:43:42Z INFO * Transferring settings data ... -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings -2023-03-21T20:43:42Z INFO * Transferring license data ... -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' -2023-03-21T20:43:42Z INFO * Transferring management console password ... -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage -2023-03-21T20:43:42Z INFO * Transferring password pepper ... -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets -2023-03-21T20:43:42Z INFO * Transferring kredz.credz HMAC key ... -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret -2023-03-21T20:43:42Z INFO * Transferring kredz.varz HMAC key ... -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret -2023-03-21T20:43:42Z INFO * Transferring management console argon2 secret ... -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null -2023-03-21T20:43:42Z INFO * Transferring CA certificates ... -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null -2023-03-21T20:43:42Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys -ghe-export-authorized-keys took 0s -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys -ghe-export-ssh-host-keys took 0s -2023-03-21T20:43:42Z INFO ghe-backup-mysql -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-21T20:43:42Z INFO ghe-backup-mysql-binary -2023-03-21T20:43:42Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -ghe-backup-mysql-binary took 3s -ghe-backup-mysql took 3s -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled -2023-03-21T20:43:45Z INFO ghe-backup-minio -2023-03-21T20:43:45Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-21T20:43:45Z RSYNC BEGIN: minio rsync -2023-03-21T20:43:45Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230321T204338/minio -2023-03-21T20:43:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:43:45Z RSYNC END: minio rsync -ghe-backup-minio took 0s -Backup progress: 0 % -2023-03-21T20:43:45Z INFO ghe-backup-es-audit-log -2023-03-21T20:43:45Z INFO ghe-backup-storage -2023-03-21T20:43:45Z INFO ghe-backup-pages -2023-03-21T20:43:45Z INFO ghe-backup-repositories -2023-03-21T20:43:45Z INFO ghe-backup-redis -2023-03-21T20:43:45Z INFO ghe-backup-git-hooks -2023-03-21T20:43:45Z INFO ghe-backup-es-rsync - -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" -2023-03-21T20:43:45Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] -2023-03-21T20:43:45Z INFO * Transferring pages files ... -2023-03-21T20:43:45Z RSYNC BEGIN: pages rsync -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] -2023-03-21T20:43:45Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230321T204338/pages -2023-03-21T20:43:45Z INFO * Performing initial sync of ES indices ... -2023-03-21T20:43:45Z RSYNC BEGIN elasticsearch rsync -2023-03-21T20:43:45Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-21T20:43:45Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-21T20:43:45Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-21T20:43:45Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204338/elasticsearch -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:43:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -2023-03-21T20:43:45Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -2023-03-21T20:43:45Z RSYNC BEGIN: git-hooks sync -2023-03-21T20:43:45Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230321T204338/git-hooks/repos -receiving incremental file list -./ -nodes/0/ -nodes/0/_state/ -nodes/0/_state/global-6.st -nodes/0/_state/node-3.st -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/_state/state-3.st -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/index/segments_4 -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog-3.ckp -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog-4.tlog -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/0/translog/translog.ckp -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/ -nodes/0/indices/CS_sFocfT6u1eFWFGzb8vw/_state/state-12.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/0/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/1/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/2/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/3/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/_state/state-3.st -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/index/segments_4 -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog-3.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog-4.tlog -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/4/translog/translog.ckp -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/ -nodes/0/indices/D13gT6mLTvGeb-ZQzc7pPA/_state/state-17.st -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/_state/state-3.st -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/index/segments_4 -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog-3.ckp -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog-4.tlog -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/0/translog/translog.ckp -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/ -nodes/0/indices/GWIMu9xGST2pbfMj9ZMxZA/_state/state-12.st -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/_state/state-3.st -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/index/segments_4 -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog-3.ckp -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog-4.tlog -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/0/translog/translog.ckp -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/ -nodes/0/indices/HUddkNYsRnml3lHHHncr8g/_state/state-12.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/0/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/1/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/2/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/3/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/_state/state-3.st -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/index/segments_4 -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog-3.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog-4.tlog -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/4/translog/translog.ckp -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/ -nodes/0/indices/INuMeFT2RcWuaDMLvxS6-g/_state/state-17.st -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/_state/state-3.st -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/index/segments_4 -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog-3.ckp -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog-4.tlog -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/0/translog/translog.ckp -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/ -nodes/0/indices/JQqbIUmfSkKFkZwHNDnAHw/_state/state-12.st -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/_state/state-3.st -nodes/2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/index/segments_4 -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog-3.ckp -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog-4.tlog -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/0/translog/translog.ckp -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/ -nodes/0/indices/JcOS8wTiTDCvEdtbJiKjAg/_state/state-12.st -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/_state/state-3.st -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/index/segments_4 -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog-3.ckp -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog-4.tlog -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/0/translog/translog.ckp -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/ -nodes/0/indices/KmdCQbP2TjS0tYM--mLt6g/_state/state-12.st -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/_state/state-3.st -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/index/segments_4 -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog-3.ckp -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog-4.tlog -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/0/translog/translog.ckp -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/ -nodes/0/indices/LrLE-iNXTZOE13QBMuuB-g/_state/state-12.st -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/_state/state-3.st -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/index/segments_4 -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog-3.ckp -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog-4.tlog -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/0/translog/translog.ckp -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/ -nodes/0/indices/NS0cQLV9RXW2c30r7wb5Ag/_state/state-12.st -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/_state/state-3.st -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/index/segments_4 -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog-3.ckp -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog-4.tlog -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/0/translog/translog.ckp -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/ -nodes/0/indices/Ptb9M-aBQmu4jouvK4gIOQ/_state/state-14.st -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/_state/state-3.st -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/index/segments_4 -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog-3.ckp -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog-4.tlog -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/0/translog/translog.ckp -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/ -nodes/0/indices/QG_HmIUwTQ2k7jSypKgcEg/_state/state-12.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog-3.ckp -node2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -s/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/0/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/1/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/2/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/3/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/_state/state-3.st -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/index/segments_4 -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog-3.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog-4.tlog -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/4/translog/translog.ckp -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/ -nodes/0/indices/ROaQi7QXRdOYoj6_dXARBQ/_state/state-17.st -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/_state/state-3.st -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/index/segments_4 -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog-3.ckp -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog-4.tlog -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/0/translog/translog.ckp -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/ -nodes/0/indices/V1jY-W_WT1KsBNZbsV-OeQ/_state/state-12.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/0/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/1/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/2/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/3/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/_state/state-3.st -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/index/segments_4 -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog-3.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog-4.tlog -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/4/translog/translog.ckp -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/ -nodes/0/indices/XwzYvBVuRfCHOpRSDO81fw/_state/state-17.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/index/segments_4 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog-3.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog-4.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/0/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/index/segments_4 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog-3.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog-4.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/1/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/index/segments_6 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog-4.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog-5.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/2/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/index/segments_4 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog-3.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog-4.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/3/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/_state/state-3.st -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/index/segments_4 -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog-3.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog-4.tlog -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/4/translog/translog.ckp -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/ -nodes/0/indices/_b3C1g9OTTKwg8ap9pjo7w/_state/state-17.st -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/_state/state-3.st -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/index/segments_4 -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog-3.ckp -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog-4.tlog -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/0/translog/translog.ckp -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/ -nodes/0/indices/bQtmEnznQTeEbknCOF10sg/_state/state-12.st -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/_state/state-3.st -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.cfe -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.cfs -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/_2.si -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/index/segments_8 -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog-6.tlog -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/0/translog/translog.ckp -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/ -nodes/0/indices/dJgUvIu4Q_yUaeOCvZp37w/_state/state-12.st -nodes/0/indices/ejnFd11uQteAkjE995T2tw/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/_state/state-3.st -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/index/segments_4 -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog-3.ckp -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog-4.tlog -nodes/0/indices/ejnFd11uQteAkjE995T2tw/0/translog/translog.ckp -nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/ -nodes/0/indices/ejnFd11uQteAkjE995T2tw/_state/state-12.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/0/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/1/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/2/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/3/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/_state/state-3.st -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/index/segments_4 -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog-3.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog-4.tlog -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/4/translog/translog.ckp -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/ -nodes/0/indices/jLsz09yRTRGbZ2DRnTRZvQ/_state/state-17.st -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/_state/state-3.st -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/index/segments_4 -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog-3.ckp -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog-4.tlog -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/0/translog/translog.ckp -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/ -nodes/0/indices/kSoL8UdcRTy558OhMRyvRw/_state/state-12.st -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/_state/state-3.st -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/index/segments_4 -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog-3.ckp -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog-4.tlog -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/0/translog/translog.ckp -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/ -nodes/0/indices/koce035FTPWx0cPRGgwg1Q/_state/state-12.st -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/_state/state-3.st -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/index/segments_6 -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog-4.ckp -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog-5.tlog -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/0/translog/translog.ckp -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/ -nodes/0/indices/oVEkEoz8QICQDI5bKTdv0w/_state/state-13.st -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/_state/state-3.st -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.cfe -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.cfs -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_n.si -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_15 -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-24.tlog -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/_state/state-13.st -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/_state/state-3.st -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/index/segments_4 -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog-3.ckp -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog-4.tlog -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/0/translog/translog.ckp -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/ -nodes/0/indices/to65udU4QOmUO6NXHgrpXA/_state/state-12.st -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/_state/state-3.st -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/index/segments_4 -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog-3.ckp -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog-4.tlog -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/0/translog/translog.ckp -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/ -nodes/0/indices/uCg6nvuyS_mMotJ1mgsqdw/_state/state-12.st -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/_state/state-3.st -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/index/segments_4 -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog-3.ckp -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog-4.tlog -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/0/translog/translog.ckp -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/ -nodes/0/indices/w81vtDDNSbuBXzcC6G0oCg/_state/state-12.st - -sent 6,918 bytes received 97,851 bytes 209,538.00 bytes/sec -total size is 146,931 speedup is 1.40 -2023-03-21T20:43:45Z RSYNC END elasticsearch rsync -2023-03-21T20:43:45Z INFO * Disabling ES index flushing ... -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush -2023-03-21T20:43:45Z INFO * Performing follow-up sync of ES indices ... -2023-03-21T20:43:45Z RSYNC BEGIN: elasticsearch followup rsync -2023-03-21T20:43:45Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204338/elasticsearch -2023-03-21T20:43:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -receiving incremental file list - -sent 286 bytes received 22,570 bytes 45,712.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-21T20:43:45Z RSYNC END: elasticsearch followup rsync -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:43:45Z RSYNC END: pages rsync -ghe-backup-es-rsync took 0s -2023-03-21T20:43:45Z INFO * Enabling ES index flushing ... -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -2023-03-21T20:43:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:43:45Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -ghe-backup-redis took 1s -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-QwYGTC/remote_routes_list -ghe-backup-storage - Generating routes took 2s -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-QwYGTC/remote_routes_list -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-21T20:43:47Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-QwYGTC -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-Jrpjeh/remote_routes_list -ghe-backup-repositories - Generating routes took 2s -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-Jrpjeh/remote_routes_list -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s -2023-03-21T20:43:47Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-Jrpjeh -2023-03-21T20:43:47Z INFO ghe-prune-snapshots -2023-03-21T20:43:47Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-21T20:43:47Z INFO ghe-detect-leaked-ssh-keys -2023-03-21T20:43:47Z INFO ghe-ssh --clean -2023-03-21T20:47:38Z INFO ghe-backup -2023-03-21T20:47:38Z INFO ghe-host-check -2023-03-21T20:47:38Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh -2023-03-21T20:47:39Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] -2023-03-21T20:47:39Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state -2023-03-21T20:47:39Z INFO ghe-rsync-size.sh -2023-03-21T20:47:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ -2023-03-21T20:47:39Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ -2023-03-21T20:47:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ -2023-03-21T20:47:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ -2023-03-21T20:47:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ -2023-03-21T20:47:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ -2023-03-21T20:47:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ -2023-03-21T20:47:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-21T20:47:42Z INFO ghe-backup-strategy -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] -2023-03-21T20:47:42Z INFO ghe-backup-store-version -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 -ghe-backup-store-version took 0s -2023-03-21T20:47:42Z INFO ghe-backup-settings -2023-03-21T20:47:42Z INFO * Transferring settings data ... -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings -2023-03-21T20:47:42Z INFO * Transferring license data ... -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' -2023-03-21T20:47:42Z INFO * Transferring management console password ... -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage -2023-03-21T20:47:42Z INFO * Transferring password pepper ... -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets -2023-03-21T20:47:42Z INFO * Transferring kredz.credz HMAC key ... -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret -2023-03-21T20:47:42Z INFO * Transferring kredz.varz HMAC key ... -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret -2023-03-21T20:47:42Z INFO * Transferring management console argon2 secret ... -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null -2023-03-21T20:47:42Z INFO * Transferring CA certificates ... -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null -2023-03-21T20:47:42Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys -ghe-export-authorized-keys took 0s -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys -ghe-export-ssh-host-keys took 0s -2023-03-21T20:47:42Z INFO ghe-backup-mysql -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-21T20:47:42Z INFO ghe-backup-mysql-binary -2023-03-21T20:47:42Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -ghe-backup-mysql-binary took 3s -ghe-backup-mysql took 3s -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled -2023-03-21T20:47:45Z INFO ghe-backup-minio -2023-03-21T20:47:45Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-21T20:47:45Z RSYNC BEGIN: minio rsync -2023-03-21T20:47:45Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230321T204738/minio -2023-03-21T20:47:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:47:45Z RSYNC END: minio rsync -ghe-backup-minio took 0s -Backup progress: % -2023-03-21T20:47:45Z INFO ghe-backup-es-audit-log -2023-03-21T20:47:45Z INFO ghe-backup-es-rsync -2023-03-21T20:47:45Z INFO ghe-backup-git-hooks -2023-03-21T20:47:45Z INFO ghe-backup-repositories -2023-03-21T20:47:45Z INFO ghe-backup-redis -2023-03-21T20:47:45Z INFO ghe-backup-storage -2023-03-21T20:47:45Z INFO ghe-backup-pages - -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-21T20:47:45Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" -2023-03-21T20:47:45Z INFO * Transferring pages files ... -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] -2023-03-21T20:47:45Z RSYNC BEGIN: pages rsync -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] -2023-03-21T20:47:45Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230321T204738/pages -2023-03-21T20:47:45Z INFO * Performing initial sync of ES indices ... -2023-03-21T20:47:45Z RSYNC BEGIN elasticsearch rsync -2023-03-21T20:47:45Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-21T20:47:45Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204738/elasticsearch -2023-03-21T20:47:45Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-21T20:47:45Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:47:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -2023-03-21T20:47:45Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -2023-03-21T20:47:45Z RSYNC BEGIN: git-hooks sync -2023-03-21T20:47:45Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230321T204738/git-hooks/repos -receiving incremental file list -./ - -sent 289 bytes received 22,573 bytes 45,724.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-21T20:47:45Z RSYNC END elasticsearch rsync -2023-03-21T20:47:45Z INFO * Disabling ES index flushing ... -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush -2023-03-21T20:47:45Z INFO * Performing follow-up sync of ES indices ... -2023-03-21T20:47:45Z RSYNC BEGIN: elasticsearch followup rsync -2023-03-21T20:47:45Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230321T204738/elasticsearch -2023-03-21T20:47:45Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -receiving incremental file list - -sent 282 bytes received 22,566 bytes 45,696.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-21T20:47:45Z RSYNC END: elasticsearch followup rsync -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete -ghe-backup-es-rsync took 0s -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:47:45Z RSYNC END: pages rsync -2023-03-21T20:47:45Z INFO * Enabling ES index flushing ... -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -2023-03-21T20:47:45Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-21T20:47:45Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -ghe-backup-redis took 1s -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-VGilqT/remote_routes_list -ghe-backup-storage - Generating routes took 2s -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-VGilqT/remote_routes_list -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-21T20:47:47Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-VGilqT -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-if4Tbi/remote_routes_list -ghe-backup-repositories - Generating routes took 2s -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-if4Tbi/remote_routes_list -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s -2023-03-21T20:47:47Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-if4Tbi -2023-03-21T20:47:47Z INFO ghe-prune-snapshots -2023-03-21T20:47:47Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-21T20:47:47Z INFO ghe-detect-leaked-ssh-keys -2023-03-21T20:47:48Z INFO ghe-ssh --clean -2023-03-22T18:31:55Z INFO ghe-backup -2023-03-22T18:31:55Z INFO ghe-host-check -2023-03-22T18:31:55Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh -2023-03-22T18:31:55Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] -2023-03-22T18:31:55Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state -2023-03-22T18:31:55Z INFO ghe-rsync-size.sh -2023-03-22T18:31:55Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ -2023-03-22T18:31:56Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ -2023-03-22T18:31:56Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ -2023-03-22T18:31:56Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ -2023-03-22T18:31:56Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ -2023-03-22T18:31:57Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ -2023-03-22T18:31:57Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ -2023-03-22T18:31:57Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-22T18:31:58Z INFO ghe-backup-strategy -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] -2023-03-22T18:31:58Z INFO ghe-backup-store-version -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 -ghe-backup-store-version took 0s -2023-03-22T18:31:58Z INFO ghe-backup-settings -2023-03-22T18:31:58Z INFO * Transferring settings data ... -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings -2023-03-22T18:31:58Z INFO * Transferring license data ... -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' -2023-03-22T18:31:58Z INFO * Transferring management console password ... -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage -2023-03-22T18:31:58Z INFO * Transferring password pepper ... -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets -2023-03-22T18:31:58Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret -2023-03-22T18:31:58Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret -2023-03-22T18:31:58Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null -2023-03-22T18:31:58Z INFO * Transferring CA certificates ... -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates -2023-03-22T18:31:58Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null -2023-03-22T18:31:58Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys -ghe-export-authorized-keys took 1s -2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys -ghe-export-ssh-host-keys took 0s -2023-03-22T18:31:59Z INFO ghe-backup-mysql -2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-22T18:31:59Z INFO ghe-backup-mysql-binary -2023-03-22T18:31:59Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -ghe-backup-mysql-binary took 2s -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled -2023-03-22T18:32:01Z INFO ghe-backup-minio -2023-03-22T18:32:01Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T18:32:01Z RSYNC BEGIN: minio rsync -2023-03-22T18:32:01Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230322T183155/minio -2023-03-22T18:32:01Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:32:01Z RSYNC END: minio rsync -ghe-backup-minio took 0s -2023-03-22T18:32:01Z INFO ghe-backup-es-audit-log -2023-03-22T18:32:01Z INFO ghe-backup-redis -2023-03-22T18:32:01Z INFO ghe-backup-es-rsync -2023-03-22T18:32:01Z INFO ghe-backup-repositories -2023-03-22T18:32:01Z INFO ghe-backup-pages -2023-03-22T18:32:01Z INFO ghe-backup-storage -2023-03-22T18:32:01Z INFO ghe-backup-git-hooks - -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-22T18:32:01Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" -2023-03-22T18:32:01Z INFO * Transferring pages files ... -2023-03-22T18:32:01Z RSYNC BEGIN: pages rsync -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] -2023-03-22T18:32:01Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230322T183155/pages -2023-03-22T18:32:01Z INFO * Performing initial sync of ES indices ... -2023-03-22T18:32:01Z RSYNC BEGIN elasticsearch rsync -2023-03-22T18:32:01Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T18:32:01Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-22T18:32:01Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-22T18:32:01Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183155/elasticsearch -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:32:01Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -2023-03-22T18:32:01Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -ghe-backup-es-audit-log took 0s -2023-03-22T18:32:01Z RSYNC BEGIN: git-hooks sync -2023-03-22T18:32:01Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230322T183155/git-hooks/repos -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -receiving incremental file list -./ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.cfe -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.cfs -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.si -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_17 -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-25.tlog -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp - -sent 422 bytes received 24,766 bytes 50,376.00 bytes/sec -total size is 146,931 speedup is 5.83 -2023-03-22T18:32:01Z RSYNC END elasticsearch rsync -2023-03-22T18:32:01Z INFO * Disabling ES index flushing ... -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush -2023-03-22T18:32:01Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T18:32:01Z RSYNC BEGIN: elasticsearch followup rsync -2023-03-22T18:32:01Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183155/elasticsearch -2023-03-22T18:32:01Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:32:01Z RSYNC END: elasticsearch followup rsync -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:32:01Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-es-rsync took 0s -ghe-backup-pages took 0s -2023-03-22T18:32:01Z INFO * Enabling ES index flushing ... -2023-03-22T18:32:01Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 56.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:32:02Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 1s -ghe-backup-redis took 1s -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-B2RYgJ/remote_routes_list -ghe-backup-storage - Generating routes took 2s -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-B2RYgJ/remote_routes_list -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T18:32:03Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-B2RYgJ -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-xj3iWS/remote_routes_list -ghe-backup-repositories - Generating routes took 2s -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-xj3iWS/remote_routes_list -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s -2023-03-22T18:32:03Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-xj3iWS -2023-03-22T18:32:03Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-22T18:32:04Z INFO ghe-ssh --clean -2023-03-22T18:33:39Z INFO ghe-backup -2023-03-22T18:33:39Z INFO ghe-host-check -2023-03-22T18:33:39Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh -2023-03-22T18:33:40Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] -2023-03-22T18:33:40Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state -2023-03-22T18:33:40Z INFO ghe-rsync-size.sh -2023-03-22T18:33:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ -2023-03-22T18:33:40Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ -2023-03-22T18:33:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ -2023-03-22T18:33:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ -2023-03-22T18:33:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ -2023-03-22T18:33:41Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ -2023-03-22T18:33:42Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ -2023-03-22T18:33:42Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-22T18:33:43Z INFO ghe-backup-strategy -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] -2023-03-22T18:33:43Z INFO ghe-backup-store-version -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 -ghe-backup-store-version took 0s -2023-03-22T18:33:43Z INFO ghe-backup-settings -2023-03-22T18:33:43Z INFO * Transferring settings data ... -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings -2023-03-22T18:33:43Z INFO * Transferring license data ... -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' -2023-03-22T18:33:43Z INFO * Transferring management console password ... -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage -2023-03-22T18:33:43Z INFO * Transferring password pepper ... -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets -2023-03-22T18:33:43Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret -2023-03-22T18:33:43Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret -2023-03-22T18:33:43Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null -2023-03-22T18:33:43Z INFO * Transferring CA certificates ... -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null -2023-03-22T18:33:43Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys -ghe-export-authorized-keys took 0s -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys -ghe-export-ssh-host-keys took 0s -2023-03-22T18:33:43Z INFO ghe-backup-mysql -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-22T18:33:43Z INFO ghe-backup-mysql-binary -2023-03-22T18:33:43Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -ghe-backup-mysql-binary took 3s -ghe-backup-mysql took 3s -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled -2023-03-22T18:33:46Z INFO ghe-backup-minio -2023-03-22T18:33:46Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T18:33:46Z RSYNC BEGIN: minio rsync -2023-03-22T18:33:46Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230322T183339/minio -2023-03-22T18:33:46Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:33:46Z RSYNC END: minio rsync -ghe-backup-minio took 0s -Backup progress: 0 % -2023-03-22T18:33:46Z INFO ghe-backup-pages -2023-03-22T18:33:46Z INFO ghe-backup-es-audit-log -2023-03-22T18:33:46Z INFO ghe-backup-redis -2023-03-22T18:33:46Z INFO ghe-backup-git-hooks -2023-03-22T18:33:46Z INFO ghe-backup-es-rsync -2023-03-22T18:33:46Z INFO ghe-backup-storage -2023-03-22T18:33:46Z INFO ghe-backup-repositories - -2023-03-22T18:33:46Z INFO * Starting backup for host: 10.0.1.172 -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 /bin/bash - -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" -2023-03-22T18:33:46Z INFO * Transferring pages files ... -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] -2023-03-22T18:33:46Z RSYNC BEGIN: pages rsync -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] -2023-03-22T18:33:46Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230322T183339/pages -2023-03-22T18:33:46Z INFO * Performing initial sync of ES indices ... -2023-03-22T18:33:46Z RSYNC BEGIN elasticsearch rsync -2023-03-22T18:33:46Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T18:33:46Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-22T18:33:46Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-22T18:33:46Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183339/elasticsearch -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:33:46Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -2023-03-22T18:33:46Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -2023-03-22T18:33:46Z RSYNC BEGIN: git-hooks sync -ghe-backup-es-audit-log took 0s -2023-03-22T18:33:46Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230322T183339/git-hooks/repos -receiving incremental file list -./ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.cfe -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.cfs -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/_o.si -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/index/segments_17 -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/ -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog-25.tlog -nodes/0/indices/tgr7n1BjQjSAIGtom3kGew/0/translog/translog.ckp - -sent 422 bytes received 24,766 bytes 50,376.00 bytes/sec -total size is 146,931 speedup is 5.83 -2023-03-22T18:33:46Z RSYNC END elasticsearch rsync -2023-03-22T18:33:46Z INFO * Disabling ES index flushing ... -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush -2023-03-22T18:33:46Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T18:33:46Z RSYNC BEGIN: elasticsearch followup rsync -2023-03-22T18:33:46Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183339/elasticsearch -2023-03-22T18:33:46Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:33:46Z RSYNC END: elasticsearch followup rsync -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:33:46Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -ghe-backup-es-rsync took 0s -2023-03-22T18:33:46Z INFO * Enabling ES index flushing ... -2023-03-22T18:33:46Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:33:46Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -ghe-backup-redis took 1s -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-KShrXb/remote_routes_list -ghe-backup-storage - Generating routes took 2s -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-KShrXb/remote_routes_list -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T18:33:48Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-KShrXb -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-3jxmPX/remote_routes_list -ghe-backup-repositories - Generating routes took 2s -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-3jxmPX/remote_routes_list -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s -2023-03-22T18:33:48Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-3jxmPX -2023-03-22T18:33:48Z INFO ghe-prune-snapshots -2023-03-22T18:33:48Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-22T18:33:48Z INFO ghe-detect-leaked-ssh-keys -2023-03-22T18:33:48Z INFO ghe-ssh --clean -2023-03-22T18:35:49Z INFO ghe-backup -2023-03-22T18:35:49Z INFO ghe-host-check -2023-03-22T18:35:49Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh -2023-03-22T18:35:49Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] -2023-03-22T18:35:49Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state -2023-03-22T18:35:49Z INFO ghe-rsync-size.sh -2023-03-22T18:35:49Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ -2023-03-22T18:35:49Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ -2023-03-22T18:35:50Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ -2023-03-22T18:35:50Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ -2023-03-22T18:35:50Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ -2023-03-22T18:35:51Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ -2023-03-22T18:35:51Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ -2023-03-22T18:35:51Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-22T18:35:52Z INFO ghe-backup-strategy -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] -2023-03-22T18:35:52Z INFO ghe-backup-store-version -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 -ghe-backup-store-version took 0s -2023-03-22T18:35:52Z INFO ghe-backup-settings -2023-03-22T18:35:52Z INFO * Transferring settings data ... -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings -2023-03-22T18:35:52Z INFO * Transferring license data ... -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' -2023-03-22T18:35:52Z INFO * Transferring management console password ... -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage -2023-03-22T18:35:52Z INFO * Transferring password pepper ... -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets -2023-03-22T18:35:52Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret -2023-03-22T18:35:52Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret -2023-03-22T18:35:52Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null -2023-03-22T18:35:52Z INFO * Transferring CA certificates ... -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates -2023-03-22T18:35:52Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null -2023-03-22T18:35:52Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys -ghe-export-authorized-keys took 1s -2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys -ghe-export-ssh-host-keys took 0s -2023-03-22T18:35:53Z INFO ghe-backup-mysql -2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-22T18:35:53Z INFO ghe-backup-mysql-binary -2023-03-22T18:35:53Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -ghe-backup-mysql-binary took 2s -ghe-backup-mysql took 2s -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled -2023-03-22T18:35:55Z INFO ghe-backup-minio -2023-03-22T18:35:55Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T18:35:55Z RSYNC BEGIN: minio rsync -2023-03-22T18:35:55Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230322T183549/minio -2023-03-22T18:35:55Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:35:55Z RSYNC END: minio rsync -ghe-backup-minio took 0s -Backup progress: 0 % -2023-03-22T18:35:55Z INFO ghe-backup-git-hooks -2023-03-22T18:35:55Z INFO ghe-backup-repositories -2023-03-22T18:35:55Z INFO ghe-backup-pages -2023-03-22T18:35:55Z INFO ghe-backup-storage -2023-03-22T18:35:55Z INFO ghe-backup-redis -2023-03-22T18:35:55Z INFO ghe-backup-es-audit-log -2023-03-22T18:35:55Z INFO ghe-backup-es-rsync - -2023-03-22T18:35:55Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T18:35:55Z INFO * Transferring pages files ... -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-22T18:35:55Z RSYNC BEGIN: pages rsync -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] -2023-03-22T18:35:55Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230322T183549/pages -2023-03-22T18:35:55Z INFO * Performing initial sync of ES indices ... -2023-03-22T18:35:55Z RSYNC BEGIN elasticsearch rsync -2023-03-22T18:35:55Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T18:35:55Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-22T18:35:55Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-22T18:35:55Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183549/elasticsearch -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:35:55Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -2023-03-22T18:35:55Z RSYNC BEGIN: git-hooks sync -2023-03-22T18:35:55Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -2023-03-22T18:35:55Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230322T183549/git-hooks/repos -receiving incremental file list -./ - -sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:35:55Z RSYNC END elasticsearch rsync -2023-03-22T18:35:55Z INFO * Disabling ES index flushing ... -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush -2023-03-22T18:35:55Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T18:35:55Z RSYNC BEGIN: elasticsearch followup rsync -2023-03-22T18:35:55Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183549/elasticsearch -2023-03-22T18:35:55Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:35:55Z RSYNC END: elasticsearch followup rsync -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:35:55Z RSYNC END: pages rsync -ghe-backup-es-rsync took 0s -ghe-backup-pages - 10.0.1.172 took 0s -2023-03-22T18:35:55Z INFO * Enabling ES index flushing ... -ghe-backup-pages took 0s -2023-03-22T18:35:55Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 56.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:35:56Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 1s -ghe-backup-redis took 1s -2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-vwdhR7/remote_routes_list -ghe-backup-storage - Generating routes took 2s -2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-vwdhR7/remote_routes_list -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T18:35:57Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-vwdhR7 -2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-bT5RMf/remote_routes_list -ghe-backup-repositories - Generating routes took 2s -2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-bT5RMf/remote_routes_list -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s -2023-03-22T18:35:57Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-22T18:35:57Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-bT5RMf -2023-03-22T18:35:58Z INFO ghe-prune-snapshots -2023-03-22T18:35:58Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-22T18:35:58Z INFO ghe-detect-leaked-ssh-keys -2023-03-22T18:35:58Z INFO ghe-ssh --clean -2023-03-22T18:36:34Z INFO ghe-backup -2023-03-22T18:36:34Z INFO ghe-host-check -2023-03-22T18:36:34Z INFO ghe-ssh -o BatchMode=no -o PasswordAuthentication=no -o ConnectTimeout=5 -o ConnectionAttempts=1 10.0.1.172 -- /bin/sh -2023-03-22T18:36:34Z INFO ghe-ssh 10.0.1.172 -- [ -f '/etc/github/cluster' ] -2023-03-22T18:36:34Z INFO ghe-ssh 10.0.1.172 -- cat /etc/github/repl-state -2023-03-22T18:36:34Z INFO ghe-rsync-size.sh -2023-03-22T18:36:34Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/repositories --ignore-missing-args 10.0.1.172:/data/user/repositories/ /tmp/ -2023-03-22T18:36:35Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=/workspace/backup-utils-private/data/current/pages --ignore-missing-args 10.0.1.172:/data/user/pages/ /tmp/ -2023-03-22T18:36:35Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u elasticsearch rsync --link-dest=/workspace/backup-utils-private/data/current/elasticsearch --ignore-missing-args 10.0.1.172:/data/user/elasticsearch/ /tmp/ -2023-03-22T18:36:35Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u alambic rsync --link-dest=/workspace/backup-utils-private/data/current/storage --ignore-missing-args 10.0.1.172:/data/user/storage/ /tmp/ -2023-03-22T18:36:36Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u minio rsync --link-dest=/workspace/backup-utils-private/data/current/minio --ignore-missing-args 10.0.1.172:/data/user/minio/ /tmp/ -2023-03-22T18:36:36Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mysql rsync --link-dest=/workspace/backup-utils-private/data/current/mysql --ignore-missing-args 10.0.1.172:/data/user/mysql/ /tmp/ -2023-03-22T18:36:36Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u actions rsync --link-dest=/workspace/backup-utils-private/data/current/actions --ignore-missing-args 10.0.1.172:/data/user/actions/ /tmp/ -2023-03-22T18:36:37Z INFO ghe-rsync -arn --stats -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u mssql rsync --link-dest=/workspace/backup-utils-private/data/current/mssql --ignore-missing-args 10.0.1.172:/data/user/mssql/backups/ /tmp/ -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-22T18:36:37Z INFO ghe-backup-strategy -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- [ -f '/etc/github/cluster' ] && [ ! -f '/etc/github/repl-state' ] -2023-03-22T18:36:37Z INFO ghe-backup-store-version -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- sudo dd of=/data/user/common/backup-utils-version >/dev/null 2>&1 -ghe-backup-store-version took 0s -2023-03-22T18:36:37Z INFO ghe-backup-settings -2023-03-22T18:36:37Z INFO * Transferring settings data ... -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-settings -2023-03-22T18:36:37Z INFO * Transferring license data ... -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat '/data/enterprise/enterprise.ghl' -2023-03-22T18:36:37Z INFO * Transferring management console password ... -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage -2023-03-22T18:36:37Z INFO * Transferring password pepper ... -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.github.user-password-secrets -2023-03-22T18:36:37Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.credz-hmac-secret -2023-03-22T18:36:37Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.kredz.varz-hmac-secret -2023-03-22T18:36:37Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:36:37Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config secrets.manage-auth.argon-secret -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.packages.enabled -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.chatops.enabled -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/idp.crt -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- which ghe-export-ssl-ca-certificates 1>/dev/null -2023-03-22T18:36:38Z INFO * Transferring CA certificates ... -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssl-ca-certificates -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- sudo cat /data/user/common/uuid 2>/dev/null -2023-03-22T18:36:38Z INFO * Transferring UUID ... -ghe-backup-settings took 1s -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-authorized-keys -ghe-export-authorized-keys took 0s -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-export-ssh-host-keys -ghe-export-ssh-host-keys took 0s -2023-03-22T18:36:38Z INFO ghe-backup-mysql -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true mysql.external.enabled -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 ghe-config --true mysql.backup.binary -2023-03-22T18:36:38Z INFO ghe-backup-mysql-binary -2023-03-22T18:36:38Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -ghe-backup-mysql-binary took 2s -ghe-backup-mysql took 2s -2023-03-22T18:36:40Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.actions.enabled -2023-03-22T18:36:40Z INFO ghe-ssh 10.0.1.172:122 -- ghe-config --true app.minio.enabled -2023-03-22T18:36:40Z INFO ghe-backup-minio -2023-03-22T18:36:40Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T18:36:40Z RSYNC BEGIN: minio rsync -2023-03-22T18:36:40Z INFO ghe-rsync --archive --verbose --compress --rsh=ghe-ssh -p 122 --rsync-path=sudo -u minio rsync --exclude=.minio.sys --link-dest=/workspace/backup-utils-private/data/current/minio 10.0.1.172:/data/user/minio/ /workspace/backup-utils-private/data/20230322T183634/minio -2023-03-22T18:36:40Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u minio rsync --server --sender -vlogDtprze.iLsfxC . /data/user/minio/ -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:36:40Z RSYNC END: minio rsync -ghe-backup-minio took 0s -4 -15 -Backup progress: 0 % -2023-03-22T18:36:41Z INFO ghe-backup-redis -2023-03-22T18:36:41Z INFO ghe-backup-repositories -2023-03-22T18:36:41Z INFO ghe-backup-es-audit-log -2023-03-22T18:36:41Z INFO ghe-backup-pages -2023-03-22T18:36:41Z INFO ghe-backup-storage -2023-03-22T18:36:41Z INFO ghe-backup-es-rsync -2023-03-22T18:36:41Z INFO ghe-backup-git-hooks - -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-22T18:36:41Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 curl -s "localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b" -2023-03-22T18:36:41Z INFO * Transferring pages files ... -2023-03-22T18:36:41Z RSYNC BEGIN: pages rsync -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- [ -d '/data/user/elasticsearch' ] -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- mktemp -d -t backup-utils-backup-XXXXXX -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/environments/tarballs' ] -2023-03-22T18:36:41Z INFO ghe-rsync -avz -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync --link-dest=../../current/pages 10.0.1.172:/data/user/pages/ /workspace/backup-utils-private/data/20230322T183634/pages -2023-03-22T18:36:41Z INFO * Performing initial sync of ES indices ... -2023-03-22T18:36:41Z RSYNC BEGIN elasticsearch rsync -2023-03-22T18:36:41Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T18:36:41Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-22T18:36:41Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183634/elasticsearch -2023-03-22T18:36:41Z INFO ghe-gc-disable 10.0.1.172:122 -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 /bin/bash -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- sudo -u git [ -d '/data/user/git-hooks/repos' ] -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:36:41Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -2023-03-22T18:36:41Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -2023-03-22T18:36:41Z RSYNC BEGIN: git-hooks sync -2023-03-22T18:36:41Z INFO ghe-rsync -av -e ssh -q -p122 -i /workspace/enterprise2/id_test -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no -p 122 -l admin --rsync-path=sudo -u git rsync 10.0.1.172:/data/user/git-hooks/repos/ /workspace/backup-utils-private/data/20230322T183634/git-hooks/repos -receiving incremental file list -./ - -sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:36:41Z RSYNC END elasticsearch rsync -2023-03-22T18:36:41Z INFO * Disabling ES index flushing ... -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- /bin/bash -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPOST localhost:9200/_flush -2023-03-22T18:36:41Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T18:36:41Z RSYNC BEGIN: elasticsearch followup rsync -2023-03-22T18:36:41Z INFO ghe-rsync -avz -e ghe-ssh -p 122 --rsync-path=sudo -u elasticsearch rsync --link-dest=../../current/elasticsearch 10.0.1.172:/data/user/elasticsearch/ /workspace/backup-utils-private/data/20230322T183634/elasticsearch -2023-03-22T18:36:41Z INFO ghe-ssh -p 122 10.0.1.172 sudo -u elasticsearch rsync --server --sender -vlogDtprze.iLsfxC . /data/user/elasticsearch/ -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:36:41Z RSYNC END: elasticsearch followup rsync -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- test -f /data/user/common/es-scan-complete -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:36:41Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-es-rsync took 0s -2023-03-22T18:36:41Z INFO * Enabling ES index flushing ... -ghe-backup-pages took 0s -2023-03-22T18:36:41Z INFO ghe-ssh 10.0.1.172:122 -- curl -s -XPUT localhost:9200/_settings -d @- -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:36:41Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -ghe-backup-redis took 1s -2023-03-22T18:36:42Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-YZgWfb/remote_routes_list -ghe-backup-storage - Generating routes took 1s -2023-03-22T18:36:42Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-YZgWfb/remote_routes_list -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T18:36:42Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-22T18:36:42Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-22T18:36:42Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-YZgWfb -2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- cat /tmp/backup-utils-backup-BlP7CO/remote_routes_list -ghe-backup-repositories - Generating routes took 2s -2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- gzip -c /tmp/backup-utils-backup-BlP7CO/remote_routes_list -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s -2023-03-22T18:36:43Z INFO ghe-gc-enable 10.0.1.172:122 -2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- sudo rm -f '/data/user/repositories/.sync_in_progress' -2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- rm -rf /tmp/backup-utils-backup-BlP7CO -2023-03-22T18:36:43Z INFO ghe-prune-snapshots -2023-03-22T18:36:43Z INFO ghe-ssh 10.0.1.172:122 -- logger -t backup-utils -2023-03-22T18:36:43Z INFO ghe-detect-leaked-ssh-keys -2023-03-22T18:36:43Z INFO ghe-ssh --clean -ghe-backup-store-version took 0s -2023-03-22T18:37:30Z INFO * Transferring settings data ... -2023-03-22T18:37:30Z INFO * Transferring license data ... -2023-03-22T18:37:30Z INFO * Transferring management console password ... -2023-03-22T18:37:30Z INFO * Transferring password pepper ... -2023-03-22T18:37:30Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:37:30Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:37:30Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:37:30Z INFO * Transferring CA certificates ... -2023-03-22T18:37:31Z INFO * Transferring UUID ... -ghe-backup-settings took 1s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 2s -ghe-backup-mysql took 2s -2023-03-22T18:37:33Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T18:37:33Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:37:33Z RSYNC END: minio rsync -ghe-backup-minio took 0s -4 -15 -Backup progress: 0 % -ghe-backup-redis took 1s -2023-03-22T18:37:34Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -ghe-backup-repositories - Generating routes took 2s -ghe-backup-repositories - Fetching routes took 1s -ghe-backup-repositories - Processing routes took 0s - -2023-03-22T18:37:37Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T18:37:37Z INFO * Transferring pages files ... -2023-03-22T18:37:37Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:37:37Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -ghe-backup-storage - Generating routes took 2s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T18:37:39Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T18:37:39Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:37:39Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -2023-03-22T18:37:39Z INFO * Performing initial sync of ES indices ... -2023-03-22T18:37:39Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:37:39Z RSYNC END elasticsearch rsync -2023-03-22T18:37:39Z INFO * Disabling ES index flushing ... -2023-03-22T18:37:39Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T18:37:39Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 286 bytes received 22,565 bytes 45,702.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:37:40Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 1s -2023-03-22T18:37:40Z INFO * Enabling ES index flushing ... -ghe-backup-store-version took 0s -2023-03-22T18:40:50Z INFO * Transferring settings data ... -2023-03-22T18:40:50Z INFO * Transferring license data ... -2023-03-22T18:40:50Z INFO * Transferring management console password ... -2023-03-22T18:40:50Z INFO * Transferring password pepper ... -2023-03-22T18:40:50Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:40:50Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:40:50Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:40:50Z INFO * Transferring CA certificates ... -2023-03-22T18:40:50Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -ghe-export-authorized-keys took 0s -ghe-backup-store-version took 0s -2023-03-22T18:41:48Z INFO * Transferring settings data ... -2023-03-22T18:41:48Z INFO * Transferring license data ... -2023-03-22T18:41:48Z INFO * Transferring management console password ... -2023-03-22T18:41:48Z INFO * Transferring password pepper ... -2023-03-22T18:41:48Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:41:49Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:41:49Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:41:49Z INFO * Transferring CA certificates ... -2023-03-22T18:41:49Z INFO * Transferring UUID ... -ghe-backup-settings took 1s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 2s -ghe-backup-mysql took 2s -2023-03-22T18:41:51Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T18:41:51Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:41:51Z RSYNC END: minio rsync -ghe-backup-minio took 0s -6 -15 -Backup progress: 0 % -ghe-backup-redis took 2s -2023-03-22T18:41:53Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -ghe-backup-repositories - Generating routes took 2s -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s - -2023-03-22T18:41:55Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T18:41:55Z INFO * Transferring pages files ... -2023-03-22T18:41:55Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:41:55Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -ghe-backup-storage - Generating routes took 2s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T18:41:57Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T18:41:57Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 56.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:41:58Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 1s -2023-03-22T18:41:58Z INFO * Performing initial sync of ES indices ... -2023-03-22T18:41:58Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:41:58Z RSYNC END elasticsearch rsync -2023-03-22T18:41:58Z INFO * Disabling ES index flushing ... -2023-03-22T18:41:58Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T18:41:58Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:41:58Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 0s -2023-03-22T18:41:58Z INFO * Enabling ES index flushing ... -ghe-backup-store-version took 0s -2023-03-22T18:47:55Z INFO * Transferring settings data ... -2023-03-22T18:47:55Z INFO * Transferring license data ... -2023-03-22T18:47:55Z INFO * Transferring management console password ... -2023-03-22T18:47:55Z INFO * Transferring password pepper ... -2023-03-22T18:47:55Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:47:55Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:47:55Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:47:55Z INFO * Transferring CA certificates ... -2023-03-22T18:47:56Z INFO * Transferring UUID ... -ghe-backup-settings took 1s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 2s -2023-03-22T18:47:58Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T18:47:58Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:47:58Z RSYNC END: minio rsync -ghe-backup-minio took 0s -1 -18 -ghe-backup-redis took 1s -2023-03-22T18:47:59Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -ghe-backup-repositories - Generating routes took 2s -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 1s - -2023-03-22T18:48:02Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T18:48:02Z INFO * Transferring pages files ... -2023-03-22T18:48:02Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:48:02Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -ghe-backup-storage - Generating routes took 2s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T18:48:04Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T18:48:04Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:48:04Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -2023-03-22T18:48:04Z INFO * Performing initial sync of ES indices ... -2023-03-22T18:48:04Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:48:04Z RSYNC END elasticsearch rsync -2023-03-22T18:48:04Z INFO * Disabling ES index flushing ... -2023-03-22T18:48:04Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T18:48:04Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 282 bytes received 22,561 bytes 15,228.67 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:48:05Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 1s -2023-03-22T18:48:05Z INFO * Enabling ES index flushing ... -ghe-backup-store-version took 0s -2023-03-22T18:48:56Z INFO * Transferring settings data ... -2023-03-22T18:48:56Z INFO * Transferring license data ... -2023-03-22T18:48:56Z INFO * Transferring management console password ... -2023-03-22T18:48:56Z INFO * Transferring password pepper ... -2023-03-22T18:48:56Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T18:48:56Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T18:48:56Z INFO * Transferring management console argon2 secret ... -2023-03-22T18:48:56Z INFO * Transferring CA certificates ... -2023-03-22T18:48:56Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 3s -ghe-backup-mysql took 3s -2023-03-22T18:48:59Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T18:48:59Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:48:59Z RSYNC END: minio rsync -ghe-backup-minio took 0s -6 -18 -Backup progress: 33.00 % -ghe-backup-redis took 1s -2023-03-22T18:49:00Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -ghe-backup-repositories - Generating routes took 2s -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s - -2023-03-22T18:49:02Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T18:49:02Z INFO * Transferring pages files ... -2023-03-22T18:49:02Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 174.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:49:03Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 1s -ghe-backup-pages took 1s -ghe-backup-storage - Generating routes took 1s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T18:49:05Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T18:49:05Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T18:49:05Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -2023-03-22T18:49:05Z INFO * Performing initial sync of ES indices ... -2023-03-22T18:49:05Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:49:05Z RSYNC END elasticsearch rsync -2023-03-22T18:49:05Z INFO * Disabling ES index flushing ... -2023-03-22T18:49:05Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T18:49:05Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 286 bytes received 22,565 bytes 45,702.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T18:49:05Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 0s -2023-03-22T18:49:05Z INFO * Enabling ES index flushing ... -ghe-backup-store-version took 0s -2023-03-22T19:22:35Z INFO * Transferring settings data ... -2023-03-22T19:22:35Z INFO * Transferring license data ... -2023-03-22T19:22:35Z INFO * Transferring management console password ... -2023-03-22T19:22:35Z INFO * Transferring password pepper ... -2023-03-22T19:22:35Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T19:22:35Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T19:22:35Z INFO * Transferring management console argon2 secret ... -2023-03-22T19:22:36Z INFO * Transferring CA certificates ... -2023-03-22T19:22:36Z INFO * Transferring UUID ... -ghe-backup-settings took 1s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 2s -ghe-backup-mysql took 2s -2023-03-22T19:22:38Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T19:22:38Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:22:38Z RSYNC END: minio rsync -ghe-backup-minio took 0s -ghe-backup-redis took 1s -2023-03-22T19:22:39Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -ghe-backup-repositories - Generating routes took 3s -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s - -2023-03-22T19:22:42Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T19:22:42Z INFO * Transferring pages files ... -2023-03-22T19:22:42Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:22:42Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -ghe-backup-storage - Generating routes took 2s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T19:22:44Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T19:22:44Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:22:44Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -2023-03-22T19:22:44Z INFO * Performing initial sync of ES indices ... -2023-03-22T19:22:44Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:22:44Z RSYNC END elasticsearch rsync -2023-03-22T19:22:44Z INFO * Disabling ES index flushing ... -2023-03-22T19:22:45Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T19:22:45Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:22:45Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 1s -2023-03-22T19:22:45Z INFO * Enabling ES index flushing ... -ghe-backup-store-version took 0s -2023-03-22T19:28:56Z INFO * Transferring settings data ... -2023-03-22T19:28:57Z INFO * Transferring license data ... -2023-03-22T19:28:57Z INFO * Transferring management console password ... -2023-03-22T19:28:57Z INFO * Transferring password pepper ... -2023-03-22T19:28:57Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T19:28:57Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T19:28:57Z INFO * Transferring management console argon2 secret ... -2023-03-22T19:28:57Z INFO * Transferring CA certificates ... -2023-03-22T19:28:57Z INFO * Transferring UUID ... -ghe-backup-settings took 1s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 2s -ghe-backup-mysql took 2s -2023-03-22T19:29:00Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T19:29:00Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:29:00Z RSYNC END: minio rsync -ghe-backup-minio took 0s -ghe-backup-redis took 1s -2023-03-22T19:29:01Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -ghe-backup-repositories - Generating routes took 2s -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s - -2023-03-22T19:29:03Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T19:29:03Z INFO * Transferring pages files ... -2023-03-22T19:29:03Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:29:03Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -ghe-backup-storage - Generating routes took 1s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T19:29:05Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T19:29:06Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:29:06Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 1s -2023-03-22T19:29:06Z INFO * Performing initial sync of ES indices ... -2023-03-22T19:29:06Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:29:06Z RSYNC END elasticsearch rsync -2023-03-22T19:29:06Z INFO * Disabling ES index flushing ... -2023-03-22T19:29:06Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T19:29:06Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:29:06Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 0s -2023-03-22T19:29:06Z INFO * Enabling ES index flushing ... -ghe-backup-store-version took 0s -2023-03-22T19:31:52Z INFO * Transferring settings data ... -2023-03-22T19:31:52Z INFO * Transferring license data ... -2023-03-22T19:31:52Z INFO * Transferring management console password ... -2023-03-22T19:31:52Z INFO * Transferring password pepper ... -2023-03-22T19:31:52Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T19:31:52Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T19:31:52Z INFO * Transferring management console argon2 secret ... -2023-03-22T19:31:52Z INFO * Transferring CA certificates ... -2023-03-22T19:31:52Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 3s -ghe-backup-mysql took 3s -2023-03-22T19:31:55Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T19:31:55Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:31:55Z RSYNC END: minio rsync -ghe-backup-minio took 0s -ghe-backup-redis took 1s -2023-03-22T19:31:56Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -ghe-backup-repositories - Generating routes took 2s -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s - -2023-03-22T19:31:58Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T19:31:58Z INFO * Transferring pages files ... -2023-03-22T19:31:58Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 174.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:31:59Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 1s -ghe-backup-pages took 1s -ghe-backup-storage - Generating routes took 2s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T19:32:01Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T19:32:01Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:32:01Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -2023-03-22T19:32:01Z INFO * Performing initial sync of ES indices ... -2023-03-22T19:32:01Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:32:01Z RSYNC END elasticsearch rsync -2023-03-22T19:32:01Z INFO * Disabling ES index flushing ... -2023-03-22T19:32:01Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T19:32:01Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:32:01Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 0s -2023-03-22T19:32:01Z INFO * Enabling ES index flushing ... -ghe-backup-store-version took 0s -2023-03-22T19:32:25Z INFO * Transferring settings data ... -2023-03-22T19:32:25Z INFO * Transferring license data ... -2023-03-22T19:32:25Z INFO * Transferring management console password ... -2023-03-22T19:32:25Z INFO * Transferring password pepper ... -2023-03-22T19:32:25Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T19:32:25Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T19:32:26Z INFO * Transferring management console argon2 secret ... -2023-03-22T19:32:26Z INFO * Transferring CA certificates ... -2023-03-22T19:32:26Z INFO * Transferring UUID ... -ghe-backup-settings took 1s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 2s -ghe-backup-mysql took 2s -2023-03-22T19:32:28Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T19:32:28Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:32:28Z RSYNC END: minio rsync -ghe-backup-minio took 0s -ghe-backup-redis took 1s -2023-03-22T19:32:30Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 1s -ghe-backup-repositories - Generating routes took 2s -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s - -2023-03-22T19:32:32Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T19:32:32Z INFO * Transferring pages files ... -2023-03-22T19:32:32Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 522.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:32:32Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 0s -ghe-backup-pages took 0s -ghe-backup-storage - Generating routes took 2s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T19:32:34Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T19:32:34Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 56.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:32:35Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 1s -2023-03-22T19:32:35Z INFO * Performing initial sync of ES indices ... -2023-03-22T19:32:35Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 293 bytes received 22,572 bytes 45,730.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:32:35Z RSYNC END elasticsearch rsync -2023-03-22T19:32:35Z INFO * Disabling ES index flushing ... -2023-03-22T19:32:35Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T19:32:35Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 282 bytes received 22,561 bytes 45,686.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:32:35Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 0s -2023-03-22T19:32:35Z INFO * Enabling ES index flushing ... -ghe-backup-store-version took 0s -2023-03-22T19:37:31Z INFO * Transferring settings data ... -2023-03-22T19:37:31Z INFO * Transferring license data ... -2023-03-22T19:37:31Z INFO * Transferring management console password ... -2023-03-22T19:37:31Z INFO * Transferring password pepper ... -2023-03-22T19:37:31Z INFO * Transferring kredz.credz HMAC key ... -2023-03-22T19:37:31Z INFO * Transferring kredz.varz HMAC key ... -2023-03-22T19:37:31Z INFO * Transferring management console argon2 secret ... -2023-03-22T19:37:31Z INFO * Transferring CA certificates ... -2023-03-22T19:37:31Z INFO * Transferring UUID ... -ghe-backup-settings took 0s -ghe-export-authorized-keys took 0s -ghe-export-ssh-host-keys took 0s -ghe-backup-mysql-binary took 3s -ghe-backup-mysql took 3s -2023-03-22T19:37:34Z INFO * Transferring minio files from 10.0.1.172 ... -2023-03-22T19:37:34Z RSYNC BEGIN: minio rsync -receiving incremental file list -./ - -sent 44 bytes received 93 bytes 274.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:37:34Z RSYNC END: minio rsync -ghe-backup-minio took 0s -ghe-backup-redis took 1s -2023-03-22T19:37:35Z INFO * Linking unchanged audit log index: audit_log-1-2023-02-1 -ghe-backup-es-audit-log took 0s -ghe-backup-repositories - Generating routes took 2s -ghe-backup-repositories - Fetching routes took 0s -ghe-backup-repositories - Processing routes took 0s - -2023-03-22T19:37:37Z INFO * Starting backup for host: 10.0.1.172 - -2023-03-22T19:37:37Z INFO * Transferring pages files ... -2023-03-22T19:37:37Z RSYNC BEGIN: pages rsync -receiving incremental file list -./ - -sent 35 bytes received 226 bytes 174.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:37:38Z RSYNC END: pages rsync -ghe-backup-pages - 10.0.1.172 took 1s -ghe-backup-pages took 1s -ghe-backup-storage - Generating routes took 1s -ghe-backup-storage - Fetching routes took 0s -ghe-backup-storage - Processing routes took 0s -2023-03-22T19:37:40Z INFO git-hooks environment tarballs not found. Skipping ... -2023-03-22T19:37:40Z RSYNC BEGIN: git-hooks sync -receiving incremental file list -./ - -sent 27 bytes received 57 bytes 168.00 bytes/sec -total size is 0 speedup is 0.00 -2023-03-22T19:37:40Z RSYNC END: git-hooks sync -ghe-backup-git-hooks took 0s -2023-03-22T19:37:40Z INFO * Performing initial sync of ES indices ... -2023-03-22T19:37:40Z RSYNC BEGIN elasticsearch rsync -receiving incremental file list -./ - -sent 289 bytes received 22,568 bytes 45,714.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:37:40Z RSYNC END elasticsearch rsync -2023-03-22T19:37:40Z INFO * Disabling ES index flushing ... -2023-03-22T19:37:40Z INFO * Performing follow-up sync of ES indices ... -2023-03-22T19:37:40Z RSYNC BEGIN: elasticsearch followup rsync -receiving incremental file list - -sent 286 bytes received 22,565 bytes 45,702.00 bytes/sec -total size is 146,931 speedup is 6.43 -2023-03-22T19:37:40Z RSYNC END: elasticsearch followup rsync -ghe-backup-es-rsync took 0s -2023-03-22T19:37:40Z INFO * Enabling ES index flushing ... From f009aad147b21ae1e0920f555156fc44b1cdc837 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 5 Apr 2023 12:15:56 -0400 Subject: [PATCH 287/946] Delete testfd --- testfd | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 testfd diff --git a/testfd b/testfd deleted file mode 100644 index e69de29bb..000000000 From a8e7eca745a738c4c02cba4ce85f51bfb97bfe6b Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 5 Apr 2023 12:17:05 -0400 Subject: [PATCH 288/946] Update bin/ghe-restore --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index aa3848c07..33ca1ee41 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -612,7 +612,7 @@ elif $instance_configured; then ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-config-apply" 1>&3 2>&3 - bm_end "$(basename $0) - configure cluster" + bm_end "$(basename $0) - configure appliance" fi # Clear GitHub Connect settings stored in the restored database. From b977fadab3c0030922071470efdd16d5ad043e67 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 5 Apr 2023 20:04:01 +0000 Subject: [PATCH 289/946] Updating data-sets --- .github/workflows/restore.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 61084e875..1df6895f2 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -1,5 +1,5 @@ name: Restore Dataset - +run-name: ${{ github.actor }} retrieving data-sets on: workflow_dispatch: inputs: @@ -65,7 +65,7 @@ jobs: with: repository: github/ghes-data ref: main - - run: gunzip ghes-data/data/backup/${{ inputs.size }}/${{ inputs.size }}.zip + - run: tar zxvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz - run: ls -al ghes-data/data/backup/${{ inputs.size }} From 632fa88c52d2993cd0eeae685420fa6c7485b61a Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 5 Apr 2023 20:07:58 +0000 Subject: [PATCH 290/946] more updates --- .github/workflows/restore.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 1df6895f2..9d6ad97c0 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -20,6 +20,11 @@ on: required: false type: string default: 'master' + version: + description: 'GHES Version of dataset' + required: true + type: string + default: "3.8.0" workflow_call: inputs: size: @@ -36,6 +41,11 @@ on: required: false type: string default: 'master' + version: + description: 'GHES Version of dataset' + required: true + type: string + default: "3.8.0" jobs: build: runs-on: ubuntu-latest From 7894a7ba0c035faa125932078bac52405bf613e4 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 7 Apr 2023 10:42:10 -0400 Subject: [PATCH 291/946] Update restore.yml --- .github/workflows/restore.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 9d6ad97c0..25bb5661e 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -7,7 +7,6 @@ on: description: 'Size of the dataset to restore' required: true type: choice - default: 'small' options: - 'small' - 'medium' @@ -22,14 +21,14 @@ on: default: 'master' version: description: 'GHES Version of dataset' - required: true + required: false type: string default: "3.8.0" workflow_call: inputs: size: description: 'Size of the dataset to restore' - required: true + required: false type: string default: 'small' hostname: @@ -43,7 +42,7 @@ on: default: 'master' version: description: 'GHES Version of dataset' - required: true + required: false type: string default: "3.8.0" jobs: From 00e10a8f22733d5b688ed37677e46c8aaecd5614 Mon Sep 17 00:00:00 2001 From: Ryan Trauntvein Date: Tue, 11 Apr 2023 16:09:16 -0700 Subject: [PATCH 292/946] Add multi stage build Dockerfile that compiles rsync from the source repository --- Dockerfile.rsync | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Dockerfile.rsync diff --git a/Dockerfile.rsync b/Dockerfile.rsync new file mode 100644 index 000000000..f502aca87 --- /dev/null +++ b/Dockerfile.rsync @@ -0,0 +1,80 @@ +# Multi stage build for backup-utils +# Build layer is for compiling rsync from source +# Runtime layer is for running backup-utils +# https://docs.docker.com/develop/develop-images/multistage-build/ +# https://docs.docker.com/engine/userguide/eng-image/multistage-build/ + +# Build layer +FROM ubuntu:focal AS build + +# Install build dependencies +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + gawk \ + autoconf \ + make \ + automake \ + python3-cmarkgfm \ + acl \ + libacl1-dev \ + attr \ + libattr1-dev \ + libxxhash-dev \ + libzstd-dev \ + liblz4-dev \ + libssl-dev \ + git \ + jq \ + curl \ + tar \ + gzip \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +# Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag +ARG RSYNC_TAG=3.2.7 +RUN curl https://github.com/WayneD/rsync/archive/refs/tags/v${RSYNC_TAG}.tar.gz -L -o v${RSYNC_TAG}.tar.gz +RUN tar -xzf v${RSYNC_TAG}.tar.gz +# Change to the working directory of the rsync source +WORKDIR rsync-${RSYNC_TAG} +RUN ls -la && ./configure +RUN make +RUN make install + +# Reset working directory +WORKDIR / + +# Download backup-utils source from https://github.com/github/backup-utils/releases/download/[TAG]/github-backup-utils-[TAG].tar.gz pinned to specified tag +ARG BACKUP_UTILS_TAG=v3.8.0 +RUN curl https://github.com/github/backup-utils/releases/download/${BACKUP_UTILS_TAG}/github-backup-utils-${BACKUP_UTILS_TAG}.tar.gz -L -o github-backup-utils-${BACKUP_UTILS_TAG}.tar.gz +RUN tar -xzf github-backup-utils-${BACKUP_UTILS_TAG}.tar.gz + +# Runtime layer +FROM ubuntu:focal AS runtime +ARG BACKUP_UTILS_TAG=v3.8.0 + +# Install runtime dependencies - bash, git, OpenSSH 5.6 or newer, and jq v1.5 or newer. +RUN apt-get update && apt-get install -y \ + bash \ + git \ + openssh-client \ + jq \ + moreutils \ + gawk \ + ca-certificates \ + xxhash \ + && rm -rf /var/lib/apt/lists/* + +# Copy rsync from build layer +COPY --from=build /usr/local/bin/rsync /usr/local/bin/rsync + +# Copy backup-utils from build layer into /backup-utils +COPY --from=build /github-backup-utils-${BACKUP_UTILS_TAG} /backup-utils + +WORKDIR /backup-utils + +RUN chmod +x /backup-utils/share/github-backup-utils/ghe-docker-init + +ENTRYPOINT ["/backup-utils/share/github-backup-utils/ghe-docker-init"] +CMD ["ghe-host-check"] From cb4330385f3d70e10ed4e6cf0d3a7c71f76af24b Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 11 Apr 2023 16:20:33 -0700 Subject: [PATCH 293/946] Update docker-image.yml include rsync image --- .github/workflows/docker-image.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0ca099a7f..1b5b3df51 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -14,12 +14,22 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Build the Debian Docker image + - name: Build the Ubuntu Docker image run: docker build . --file Dockerfile --tag backup-utils:${GITHUB_RUN_ID} - name: Build the Alpine Docker image run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID} - - name: Run tests in Debian Docker image - run: docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version + - name: Build the Rsync source Docker image + run: docker build . --file Dockerfile.rsync --tag backup-utils-rsync:${GITHUB_RUN_ID} + - name: Run tests in Ubuntu Docker image + run: | + docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version + docker run backup-utils:${GITHUB_RUN_ID} rsync --version - name: Run tests in Alpine Docker image - run: docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version + run: | + docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version + docker run backup-utils:${GITHUB_RUN_ID} rsync --version + - name: Run tests in Rsync source Docker image + run: | + docker run backup-utils-rsync:${GITHUB_RUN_ID} ghe-backup --version + docker run backup-utils:${GITHUB_RUN_ID} rsync --version From 205eba292f67370dff0f3bcd660122aa187bf153 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 11 Apr 2023 16:24:13 -0700 Subject: [PATCH 294/946] Correct image names --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 1b5b3df51..2274cf630 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -27,9 +27,9 @@ jobs: - name: Run tests in Alpine Docker image run: | docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version - docker run backup-utils:${GITHUB_RUN_ID} rsync --version + docker run backup-utils-alpine:${GITHUB_RUN_ID} rsync --version - name: Run tests in Rsync source Docker image run: | docker run backup-utils-rsync:${GITHUB_RUN_ID} ghe-backup --version - docker run backup-utils:${GITHUB_RUN_ID} rsync --version + docker run backup-utils-rsync:${GITHUB_RUN_ID} rsync --version From 28b6cfe430a64b314c7192b2d2c800c28c75983e Mon Sep 17 00:00:00 2001 From: Ryan Trauntvein Date: Tue, 11 Apr 2023 17:07:35 -0700 Subject: [PATCH 295/946] Absolute workdir --- Dockerfile.rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.rsync b/Dockerfile.rsync index f502aca87..398e98daf 100644 --- a/Dockerfile.rsync +++ b/Dockerfile.rsync @@ -37,7 +37,7 @@ ARG RSYNC_TAG=3.2.7 RUN curl https://github.com/WayneD/rsync/archive/refs/tags/v${RSYNC_TAG}.tar.gz -L -o v${RSYNC_TAG}.tar.gz RUN tar -xzf v${RSYNC_TAG}.tar.gz # Change to the working directory of the rsync source -WORKDIR rsync-${RSYNC_TAG} +WORKDIR /rsync-${RSYNC_TAG} RUN ls -la && ./configure RUN make RUN make install From 5de65d267997d81353ce27a1e4fc0d6b1b5777f8 Mon Sep 17 00:00:00 2001 From: Joseph Franks Date: Wed, 12 Apr 2023 11:48:52 -0500 Subject: [PATCH 296/946] no-op change to test backporting configurations --- test/test-ghe-backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 8e49349b2..7e5b78d27 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -2,7 +2,7 @@ # ghe-backup command tests TESTS_DIR="$PWD/$(dirname "$0")" -# Bring in testlib +# Bring in testlib. # shellcheck source=test/testlib.sh . "$TESTS_DIR/testlib.sh" From 0bb784f7f179ff600f8df33ab5a995f5fbac631e Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 13 Apr 2023 01:43:21 +0000 Subject: [PATCH 297/946] check commands are installed --- bin/ghe-host-check | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 3ad88edc7..d9679386a 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -192,8 +192,23 @@ DATA_TRANSFER_SIZE fi #Check rsync, openssh & jq versions + commands=("jq" "rsync" "ssh") + missing_command="" + for cmd in "${commands[@]}"; do + if ! command -v "$cmd" > /dev/null 2>&1; then + missing_command+="$cmd " + fi + done + + # Check if any command is missing + if [[ -n "$missing_command" ]]; then + echo "One or more required tools not found: $missing_command" 1>&2 + echo "Please make sure the following utils are installed and available in your PATH: $missing_command" 1>&2 + exit 1 + fi + echo "### Software versions" 1>&2 - rsync_version=$(rsync --version | grep 'version' | awk '{print $3}') + rsync_version=$(rsync --version | grep 'version' | awk '{print $3}' | tr -cd '[:digit:].\n') if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 @@ -202,7 +217,7 @@ DATA_TRANSFER_SIZE echo "rsync ${rsync_version} >= required ($min_rsync)" 1>&2 fi - ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1) + ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1 | tr -cd '[:digit:].\n') if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 @@ -211,7 +226,7 @@ DATA_TRANSFER_SIZE echo "openSSH ${ssh_version} >= required ($min_openssh)" 1>&2 fi - jq_version=$(jq --version |awk -F\- '{print $2}') + jq_version=$(jq --version |awk -F\- '{print $2}' | tr -cd '[:digit:].\n') if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then echo "jq version $jq_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 From c8402cf7aa1e9dd551d6371c5bf369dadde05e18 Mon Sep 17 00:00:00 2001 From: Zheng Zeng Date: Thu, 13 Apr 2023 14:08:01 +0000 Subject: [PATCH 298/946] do not require argon2 secret backup when version >=3.8.2 --- share/github-backup-utils/ghe-backup-settings | 2 +- test/test-ghe-backup.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index d8bddb068..2cf66c0a7 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -80,7 +80,7 @@ backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hma backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" # Backup argon secrets for multiuser from ghes version 3.8 onwards -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then +if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" fi diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 7e5b78d27..0fc3a125a 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -146,6 +146,9 @@ begin_test "ghe-backup management console does not backup argon secret" GHE_REMOTE_VERSION=3.7.10 ghe-backup -v | grep -q "management console argon2 secret not set" && exit 1 [ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ] + + GHE_REMOTE_VERSION=3.8.2 ghe-backup -v | grep -q "management console argon2 secret not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ] ) end_test @@ -161,9 +164,6 @@ begin_test "ghe-backup management console backs up argon secret" rm -rf "$GHE_DATA_DIR/current" - GHE_REMOTE_VERSION=4.1.0 ghe-backup - - [ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake pw" ] ) end_test From 5640b97e7263cfec132d720717f8ee0293e09fb5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 03:01:22 +0000 Subject: [PATCH 299/946] Bump github/super-linter from 4 to 5 Bumps [github/super-linter](https://github.com/github/super-linter) from 4 to 5. - [Release notes](https://github.com/github/super-linter/releases) - [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md) - [Commits](https://github.com/github/super-linter/compare/v4...v5) --- updated-dependencies: - dependency-name: github/super-linter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9d97805de..44eec8716 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - name: Lint Code Base - uses: github/super-linter@v4 + uses: github/super-linter@v5 env: VALIDATE_ALL_CODEBASE: false GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 219e9950e3c941d04bb8a543acd93d19cf2976ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 21:00:26 +0000 Subject: [PATCH 300/946] Bump github/super-linter from 4 to 5 Bumps [github/super-linter](https://github.com/github/super-linter) from 4 to 5. - [Release notes](https://github.com/github/super-linter/releases) - [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md) - [Commits](https://github.com/github/super-linter/compare/v4...v5) --- updated-dependencies: - dependency-name: github/super-linter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9d97805de..44eec8716 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - name: Lint Code Base - uses: github/super-linter@v4 + uses: github/super-linter@v5 env: VALIDATE_ALL_CODEBASE: false GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ebf74909c04d5815114db95d5b99872abf29922f Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 15:28:14 +0200 Subject: [PATCH 301/946] Use internal Actions bot for checkout --- .github/workflows/restore.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 25bb5661e..f1a3ca3f2 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -1,5 +1,5 @@ name: Restore Dataset -run-name: ${{ github.actor }} retrieving data-sets +run-name: ${{ github.actor }} retrieving data-sets on: workflow_dispatch: inputs: @@ -19,7 +19,7 @@ on: required: false type: string default: 'master' - version: + version: description: 'GHES Version of dataset' required: false type: string @@ -40,7 +40,7 @@ on: required: false type: string default: 'master' - version: + version: description: 'GHES Version of dataset' required: false type: string @@ -53,7 +53,8 @@ jobs: with: repository: github/backup-utils-private ref: ${{ inputs.ref }} - - run: docker build . --file Dockerfile --tag backup-utils + token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" + - run: docker build . --file Dockerfile --tag backup-utils - run: docker save backup-utils -o backup-utils.tar - uses: actions/upload-artifact@v3 with: @@ -68,7 +69,7 @@ jobs: - uses: actions/download-artifact@v3 with: name: backup-utils - - name: Load docker container + - name: Load docker container run: docker load -i backup-utils.tar - uses: actions/checkout@v3 with: From c2b0d211f94f46b8729a7c46a866a7cd18b68f70 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 15:35:56 +0200 Subject: [PATCH 302/946] use key for ghes-data as well --- .github/workflows/restore.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index f1a3ca3f2..58161095d 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -75,6 +75,7 @@ jobs: with: repository: github/ghes-data ref: main + token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" - run: tar zxvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz - run: ls -al ghes-data/data/backup/${{ inputs.size }} From 1ff1919614a6c2d31c22ea1ef78af928e6055959 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 15:48:07 +0200 Subject: [PATCH 303/946] Add debugging --- .github/workflows/restore.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 58161095d..1d9d7ed77 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -73,10 +73,12 @@ jobs: run: docker load -i backup-utils.tar - uses: actions/checkout@v3 with: + path: ghes-data repository: github/ghes-data ref: main token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" - - run: tar zxvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz + - run: ls -al + - run: tar -zxvf ghes-data/data/backup/${{ inputs.size }}/${{inputs.version}}/${{ inputs.size }}-refined.tar.gz - run: ls -al ghes-data/data/backup/${{ inputs.size }} From 9ed990dee28652d5b0a4e221363260e7625c2b37 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 15:57:31 +0200 Subject: [PATCH 304/946] Add more debugging code --- .github/workflows/restore.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 1d9d7ed77..ae50dff0b 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -77,8 +77,9 @@ jobs: repository: github/ghes-data ref: main token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" - - run: ls -al - - run: tar -zxvf ghes-data/data/backup/${{ inputs.size }}/${{inputs.version}}/${{ inputs.size }}-refined.tar.gz + - run: ls -al ghes-data/data/backup/ + - run: ls -al ghes-data/data/backup/small/v3.8.0 + - run: tar -zxvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz - run: ls -al ghes-data/data/backup/${{ inputs.size }} From 2b2a2fe02d54d49710608d39aab0046673676daa Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 16:02:43 +0200 Subject: [PATCH 305/946] Remove zip format --- .github/workflows/restore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index ae50dff0b..0658609a0 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -79,7 +79,7 @@ jobs: token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" - run: ls -al ghes-data/data/backup/ - run: ls -al ghes-data/data/backup/small/v3.8.0 - - run: tar -zxvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz + - run: tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz - run: ls -al ghes-data/data/backup/${{ inputs.size }} From 2d84d370ad6e7c5814d8c799670c0ce63992a8b7 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 16:10:07 +0200 Subject: [PATCH 306/946] Enable git lfs checkout --- .github/workflows/restore.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 0658609a0..fddc074ba 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -77,6 +77,7 @@ jobs: repository: github/ghes-data ref: main token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" + lfs: 'true' - run: ls -al ghes-data/data/backup/ - run: ls -al ghes-data/data/backup/small/v3.8.0 - run: tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz From 8f98655b546cc88fa54d28cb98daf32e4eb98616 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 16:24:15 +0200 Subject: [PATCH 307/946] Update restore workflow --- .github/workflows/restore.yml | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index fddc074ba..7cb1b4bc4 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -78,11 +78,35 @@ jobs: ref: main token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" lfs: 'true' - - run: ls -al ghes-data/data/backup/ - - run: ls -al ghes-data/data/backup/small/v3.8.0 - - run: tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz - - run: ls -al ghes-data/data/backup/${{ inputs.size }} + - name: Create backup directory + run: mkdir $HOME/ghe-backup-data + + - name: Unzip backup + run: | + tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz -C $HOME/ghe-backup-data + - name: set up ssh SSH_KEY + run: echo -e "${SSH_KEY}\n" > $HOME/backup + - name: set up ssh key permissions + run: chmod 0600 $HOME/backup + - name: change version + run: echo "3.8.0" > $HOME/version + + - name: Prepare for restore + run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" + - name: Restore data to instance + run: | + docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ + -e "GHE_DATA_DIR=/data" \ + -e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \ + -e "GHE_NUM_SNAPSHOTS=15" \ + -v "$HOME/ghe-backup-data:/data" \ + -v "$HOME/backup:/ghe-ssh/id_rsa" \ + -v "$HOME/version:/backup-utils/share/github-backup-utils/version" \ + --rm \ + backup-utils ghe-restore ${{ inputs.hostname }} + - name: Reset maintenance mode after restore + run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" From 26ff7a2d3dcf444e2c202bf986b7d5e56a643d14 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 16:38:35 +0200 Subject: [PATCH 308/946] Create symlink --- .github/workflows/restore.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 7cb1b4bc4..52eb67596 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -80,11 +80,16 @@ jobs: lfs: 'true' - name: Create backup directory - run: mkdir $HOME/ghe-backup-data + run: | + mkdir $HOME/ghe-backup-data - name: Unzip backup run: | - tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz -C $HOME/ghe-backup-data + dir_name=$(date +%s) + tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz -C $HOME/ghe-backup-data/$dir_name + + ln -s $HOME/ghe-backup-data/$dir_name $HOME/ghe-backup-data/current + - name: set up ssh SSH_KEY run: echo -e "${SSH_KEY}\n" > $HOME/backup - name: set up ssh key permissions From 129f1f44f67692396d4fe9528badfef991e42626 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 19 Apr 2023 16:59:32 +0200 Subject: [PATCH 309/946] Add data dir --- .github/workflows/restore.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 52eb67596..a17c152b2 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -81,11 +81,13 @@ jobs: - name: Create backup directory run: | - mkdir $HOME/ghe-backup-data + - name: Unzip backup run: | + mkdir $HOME/ghe-backup-data dir_name=$(date +%s) + mkdir $HOME/ghe-backup-data/$dir_name tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz -C $HOME/ghe-backup-data/$dir_name ln -s $HOME/ghe-backup-data/$dir_name $HOME/ghe-backup-data/current From 34fd799c29d34bbc2732cac0bb366df42b039a43 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 10:23:34 -0700 Subject: [PATCH 310/946] Create rsync-docker-bump.yml --- .github/workflows/rsync-docker-bump.yml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/rsync-docker-bump.yml diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml new file mode 100644 index 000000000..d416025fd --- /dev/null +++ b/.github/workflows/rsync-docker-bump.yml @@ -0,0 +1,37 @@ +name: Update Rsync Tag in Dockerfile.rsync + +on: + schedule: + - cron: '0 0 * * *' # Runs daily at 00:00 + +jobs: + update-rsync-tag: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Get latest rsync tag + id: latest_tag + run: | + curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[0].name' | xargs -I {} echo "::set-output name=latest_tag::{}" + + - name: Create Pull Request for tag update + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Update rsync tag in Dockerfile.rsync" + title: "Update rsync tag in Dockerfile" + body: "This PR updates the rsync tag in the Dockerfile.rsync to the latest tagged version." + branch: "update-rsync-tag" + base: "master" + path: "." + labels: "automated-pr" + title: "Update rsync tag in Dockerfile.rsync" + body: "The rsync tag in the Dockerfile.rsync is outdated. A pull request has been created to update it." + labels: "automated-update,rsync" + modify-regex: | + RSYNC_TAG=\K([0-9\.]+) + replacement: ${{ steps.latest_tag.outputs.latest_tag }} + file-pattern: Dockerfile.rsync From 76d53c3d6f679885128246ab9447f4e79661e27b Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 10:26:41 -0700 Subject: [PATCH 311/946] Fix tag usage, and use backup-utils from repo --- Dockerfile.rsync | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Dockerfile.rsync b/Dockerfile.rsync index 398e98daf..e2c94406f 100644 --- a/Dockerfile.rsync +++ b/Dockerfile.rsync @@ -34,8 +34,8 @@ RUN apt-get update && apt-get install -y \ # Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag ARG RSYNC_TAG=3.2.7 -RUN curl https://github.com/WayneD/rsync/archive/refs/tags/v${RSYNC_TAG}.tar.gz -L -o v${RSYNC_TAG}.tar.gz -RUN tar -xzf v${RSYNC_TAG}.tar.gz +RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz +RUN tar -xzf ${RSYNC_TAG}.tar.gz # Change to the working directory of the rsync source WORKDIR /rsync-${RSYNC_TAG} RUN ls -la && ./configure @@ -45,14 +45,8 @@ RUN make install # Reset working directory WORKDIR / -# Download backup-utils source from https://github.com/github/backup-utils/releases/download/[TAG]/github-backup-utils-[TAG].tar.gz pinned to specified tag -ARG BACKUP_UTILS_TAG=v3.8.0 -RUN curl https://github.com/github/backup-utils/releases/download/${BACKUP_UTILS_TAG}/github-backup-utils-${BACKUP_UTILS_TAG}.tar.gz -L -o github-backup-utils-${BACKUP_UTILS_TAG}.tar.gz -RUN tar -xzf github-backup-utils-${BACKUP_UTILS_TAG}.tar.gz - # Runtime layer FROM ubuntu:focal AS runtime -ARG BACKUP_UTILS_TAG=v3.8.0 # Install runtime dependencies - bash, git, OpenSSH 5.6 or newer, and jq v1.5 or newer. RUN apt-get update && apt-get install -y \ @@ -69,8 +63,8 @@ RUN apt-get update && apt-get install -y \ # Copy rsync from build layer COPY --from=build /usr/local/bin/rsync /usr/local/bin/rsync -# Copy backup-utils from build layer into /backup-utils -COPY --from=build /github-backup-utils-${BACKUP_UTILS_TAG} /backup-utils +# Copy backup-utils from repository into /backup-utils +COPY ./ /backup-utils/ WORKDIR /backup-utils From f792f581b44d971c3cd1353d6f1e22575395a754 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 10:27:51 -0700 Subject: [PATCH 312/946] Tweak wording --- .github/workflows/rsync-docker-bump.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index d416025fd..5574b73a4 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -29,7 +29,7 @@ jobs: path: "." labels: "automated-pr" title: "Update rsync tag in Dockerfile.rsync" - body: "The rsync tag in the Dockerfile.rsync is outdated. A pull request has been created to update it." + body: "The rsync tag in the Dockerfile.rsync is outdated. This pull request has been created to update it." labels: "automated-update,rsync" modify-regex: | RSYNC_TAG=\K([0-9\.]+) From 992d0c0f9fc84ccbb387b64fd4558034a4eaff78 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 10:36:08 -0700 Subject: [PATCH 313/946] Missed the v on the tag arg default --- Dockerfile.rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.rsync b/Dockerfile.rsync index e2c94406f..840e3c46d 100644 --- a/Dockerfile.rsync +++ b/Dockerfile.rsync @@ -33,7 +33,7 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* # Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag -ARG RSYNC_TAG=3.2.7 +ARG RSYNC_TAG=v3.2.7 RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz RUN tar -xzf ${RSYNC_TAG}.tar.gz # Change to the working directory of the rsync source From f98f5abf98bc75c2ca4f233abe812d412c84232b Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 10:43:23 -0700 Subject: [PATCH 314/946] Check where the archive extracts to --- Dockerfile.rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.rsync b/Dockerfile.rsync index 840e3c46d..6f85d73a2 100644 --- a/Dockerfile.rsync +++ b/Dockerfile.rsync @@ -35,7 +35,7 @@ RUN apt-get update && apt-get install -y \ # Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag ARG RSYNC_TAG=v3.2.7 RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz -RUN tar -xzf ${RSYNC_TAG}.tar.gz +RUN tar -xzf ${RSYNC_TAG}.tar.gz && ls -la # Change to the working directory of the rsync source WORKDIR /rsync-${RSYNC_TAG} RUN ls -la && ./configure From 62d4a1a5673ce0752d05b8752a438ad8e65b50f3 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 11:13:09 -0700 Subject: [PATCH 315/946] Extract to specified directory --- Dockerfile.rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.rsync b/Dockerfile.rsync index 6f85d73a2..e6aaff96f 100644 --- a/Dockerfile.rsync +++ b/Dockerfile.rsync @@ -35,7 +35,7 @@ RUN apt-get update && apt-get install -y \ # Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag ARG RSYNC_TAG=v3.2.7 RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz -RUN tar -xzf ${RSYNC_TAG}.tar.gz && ls -la +RUN tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} && ls -la # Change to the working directory of the rsync source WORKDIR /rsync-${RSYNC_TAG} RUN ls -la && ./configure From b1bff54e3b1959062e1d37f094fb671132d1a8e4 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 11:18:31 -0700 Subject: [PATCH 316/946] Make sure directory exists --- Dockerfile.rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.rsync b/Dockerfile.rsync index e6aaff96f..dfd780324 100644 --- a/Dockerfile.rsync +++ b/Dockerfile.rsync @@ -35,7 +35,7 @@ RUN apt-get update && apt-get install -y \ # Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag ARG RSYNC_TAG=v3.2.7 RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz -RUN tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} && ls -la +RUN mkdir -p /rsync-${RSYNC_TAG}&& tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} && ls -la # Change to the working directory of the rsync source WORKDIR /rsync-${RSYNC_TAG} RUN ls -la && ./configure From 65ad7731fe7931fa0376563fb772fcb99a161931 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 11:24:43 -0700 Subject: [PATCH 317/946] Remove outer directory from archive --- Dockerfile.rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.rsync b/Dockerfile.rsync index dfd780324..80666b4b5 100644 --- a/Dockerfile.rsync +++ b/Dockerfile.rsync @@ -35,7 +35,7 @@ RUN apt-get update && apt-get install -y \ # Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag ARG RSYNC_TAG=v3.2.7 RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz -RUN mkdir -p /rsync-${RSYNC_TAG}&& tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} && ls -la +RUN mkdir -p /rsync-${RSYNC_TAG}&& tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} --strip-components=1 && ls -la # Change to the working directory of the rsync source WORKDIR /rsync-${RSYNC_TAG} RUN ls -la && ./configure From 1eb9d62a0cf54e129574eaf649b92882bc2366cc Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 11:30:51 -0700 Subject: [PATCH 318/946] Remove duplicated Actions options from workflow --- .github/workflows/rsync-docker-bump.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index 5574b73a4..96b1c1cf0 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -22,14 +22,11 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Update rsync tag in Dockerfile.rsync" - title: "Update rsync tag in Dockerfile" + title: "Update rsync tag in Dockerfile.rsync" body: "This PR updates the rsync tag in the Dockerfile.rsync to the latest tagged version." branch: "update-rsync-tag" base: "master" path: "." - labels: "automated-pr" - title: "Update rsync tag in Dockerfile.rsync" - body: "The rsync tag in the Dockerfile.rsync is outdated. This pull request has been created to update it." labels: "automated-update,rsync" modify-regex: | RSYNC_TAG=\K([0-9\.]+) From f14017d5a318bae11b0f407128b169c33cfe7c85 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 11:35:11 -0700 Subject: [PATCH 319/946] Modify the version before PR step --- .github/workflows/rsync-docker-bump.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index 96b1c1cf0..96c32cbbb 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -17,6 +17,10 @@ jobs: run: | curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[0].name' | xargs -I {} echo "::set-output name=latest_tag::{}" + - name: Update Dockerfile.rsync with latest tag + run: | + sed -i -E "s/RSYNC_TAG=[0-9\.]+/RSYNC_TAG=${{ steps.latest_tag.outputs.latest_tag }}/g" Dockerfile.rsync + - name: Create Pull Request for tag update uses: peter-evans/create-pull-request@v3 with: @@ -28,7 +32,3 @@ jobs: base: "master" path: "." labels: "automated-update,rsync" - modify-regex: | - RSYNC_TAG=\K([0-9\.]+) - replacement: ${{ steps.latest_tag.outputs.latest_tag }} - file-pattern: Dockerfile.rsync From ebfa28377c10cd511b4172400f98f0821248b85e Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 19 Apr 2023 11:37:02 -0700 Subject: [PATCH 320/946] Specify --no-install-recommends on package installs to minimize image --- Dockerfile.rsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.rsync b/Dockerfile.rsync index 80666b4b5..667739729 100644 --- a/Dockerfile.rsync +++ b/Dockerfile.rsync @@ -8,7 +8,7 @@ FROM ubuntu:focal AS build # Install build dependencies -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install --no-install-recommends -y \ gcc \ g++ \ gawk \ @@ -49,7 +49,7 @@ WORKDIR / FROM ubuntu:focal AS runtime # Install runtime dependencies - bash, git, OpenSSH 5.6 or newer, and jq v1.5 or newer. -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install --no-install-recommends -y \ bash \ git \ openssh-client \ From 478e3f26b901cf72b1a6c55de07356665af222ba Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 20 Apr 2023 09:57:13 +0200 Subject: [PATCH 321/946] Add more debugging to restore --- .github/workflows/restore.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index a17c152b2..d84e687d3 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -92,6 +92,9 @@ jobs: ln -s $HOME/ghe-backup-data/$dir_name $HOME/ghe-backup-data/current + ls -al $HOME/ghe-backup-data + ls -al $HOME/ghe-backup-data/$dir_name + - name: set up ssh SSH_KEY run: echo -e "${SSH_KEY}\n" > $HOME/backup - name: set up ssh key permissions From 356725aab1b22f7b1a37256a74b93fa2e1e62903 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 20 Apr 2023 10:09:18 +0200 Subject: [PATCH 322/946] Fix symlink --- .github/workflows/restore.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index d84e687d3..65b8942d6 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -90,8 +90,7 @@ jobs: mkdir $HOME/ghe-backup-data/$dir_name tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz -C $HOME/ghe-backup-data/$dir_name - ln -s $HOME/ghe-backup-data/$dir_name $HOME/ghe-backup-data/current - + ln -s $dir_name $HOME/ghe-backup-data/current ls -al $HOME/ghe-backup-data ls -al $HOME/ghe-backup-data/$dir_name From 4258712127a760d1c141c46c962b3696108091e0 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 20 Apr 2023 14:51:01 +0200 Subject: [PATCH 323/946] Add backup workflow --- .github/workflows/backup.yml | 108 ++++++++++++++++++++++++++++++++++ .github/workflows/restore.yml | 17 +++--- 2 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/backup.yml diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml new file mode 100644 index 000000000..13935fcd4 --- /dev/null +++ b/.github/workflows/backup.yml @@ -0,0 +1,108 @@ +name: Backup +run-name: ${{ github.actor }} run backup and upload to ghes-data +on: + workflow_dispatch: + inputs: + hostname: + description: 'Hostname' + required: true + type: string + ref: + description: 'Ref' + required: false + type: string + default: 'master' + workflow_call: + inputs: + size: + description: 'Size of the dataset to restore' + required: false + type: string + default: 'small' + hostname: + description: 'Hostname of the server' + required: true + type: string + ref: + description: 'Branch ref to use' + required: false + type: string + default: 'master' + version: + description: 'GHES Version of dataset' + required: false + type: string + default: "3.8.0" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: github/backup-utils-private + ref: ${{ inputs.ref }} + token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" + - run: docker build . --file Dockerfile --tag backup-utils + - run: docker save backup-utils -o backup-utils.tar + - uses: actions/upload-artifact@v3 + with: + name: backup-utils + path: backup-utils.tar + backup-utils-backup: + needs: build + runs-on: ubuntu-latest + env: + SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} + steps: + - uses: actions/download-artifact@v3 + with: + name: backup-utils + - name: Load docker container + run: docker load -i backup-utils.tar + - uses: actions/checkout@v3 + - name: Create backup directory + run: mkdir $HOME/ghe-backup-data + - name: set up ssh SSH_KEY + run: echo -e "${SSH_KEY}\n" > $HOME/backup + - name: set up ssh key permissions + run: chmod 0600 $HOME/backup + - name: change version + run: echo "3.8.0" > $HOME/version + - name: Perform backup + run: | + docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ + -e "GHE_DATA_DIR=/data" \ + -e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \ + -e "GHE_NUM_SNAPSHOTS=15" \ + -v "$HOME/ghe-backup-data:/data" \ + -v "$HOME/backup:/ghe-ssh/id_rsa" \ + -v "$HOME/version:/backup-utils/share/github-backup-utils/version" \ + --rm \ + backup-utils ghe-backup + + - uses: actions/checkout@v3 + with: + path: ghes-data + repository: github/ghes-data + ref: main + token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" + lfs: 'true' + + - name: Zip backup + run: | + ls -al $HOME/ghe-backup-data + dirname=$(find $HOME/ghe-backup-data/ -type d -maxdepth 1 -mindepth 1) + echo $dirname + tar -czvf $dirname.tar.gz $dirname + cp $dirname.tar.gz ghes-data/data/backup/{{inputs.size}}/v{{inputs.version}}/$dirname.tar.gz + + - name: Upload backup to ghes-data + run: | + cd ghes-data/data/backup/{{inputs.size}}/v{{inputs.version}} + git add . + git commit -am "Added new backup from automation" + git push + + + diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 65b8942d6..6ce850465 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -54,12 +54,15 @@ jobs: repository: github/backup-utils-private ref: ${{ inputs.ref }} token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" + - run: docker build . --file Dockerfile --tag backup-utils - run: docker save backup-utils -o backup-utils.tar + - uses: actions/upload-artifact@v3 with: name: backup-utils path: backup-utils.tar + restore: needs: build runs-on: ubuntu-latest @@ -69,8 +72,10 @@ jobs: - uses: actions/download-artifact@v3 with: name: backup-utils + - name: Load docker container run: docker load -i backup-utils.tar + - uses: actions/checkout@v3 with: path: ghes-data @@ -79,11 +84,7 @@ jobs: token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" lfs: 'true' - - name: Create backup directory - run: | - - - - name: Unzip backup + - name: Unzip backup and setup symlink run: | mkdir $HOME/ghe-backup-data dir_name=$(date +%s) @@ -91,18 +92,19 @@ jobs: tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz -C $HOME/ghe-backup-data/$dir_name ln -s $dir_name $HOME/ghe-backup-data/current - ls -al $HOME/ghe-backup-data - ls -al $HOME/ghe-backup-data/$dir_name - name: set up ssh SSH_KEY run: echo -e "${SSH_KEY}\n" > $HOME/backup + - name: set up ssh key permissions run: chmod 0600 $HOME/backup + - name: change version run: echo "3.8.0" > $HOME/version - name: Prepare for restore run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" + - name: Restore data to instance run: | docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ @@ -114,6 +116,7 @@ jobs: -v "$HOME/version:/backup-utils/share/github-backup-utils/version" \ --rm \ backup-utils ghe-restore ${{ inputs.hostname }} + - name: Reset maintenance mode after restore run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" From 47d753d6a20c3b636d114b2c9949fc0af1680136 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 20 Apr 2023 15:03:23 +0200 Subject: [PATCH 324/946] Install jq --- .github/workflows/backup.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 13935fcd4..a17ab9baa 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -69,6 +69,8 @@ jobs: run: chmod 0600 $HOME/backup - name: change version run: echo "3.8.0" > $HOME/version + - name: Install jq + run: sudo apt-get install jq - name: Perform backup run: | docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ From cf50672464d3d0cd3d0a7c0d99b9c3ac16b160d4 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 20 Apr 2023 16:01:43 +0200 Subject: [PATCH 325/946] Add jq to path --- .github/workflows/backup.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index a17ab9baa..005e0ebf0 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -69,8 +69,10 @@ jobs: run: chmod 0600 $HOME/backup - name: change version run: echo "3.8.0" > $HOME/version - - name: Install jq - run: sudo apt-get install jq + - name: Add jq to path + run: | + jq=$(which jq) + export PATH=$jq:$PATH - name: Perform backup run: | docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ From f4f18d3921e23bfb5485c0cefede3ba1c6527460 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 20 Apr 2023 16:07:38 +0200 Subject: [PATCH 326/946] Add more debugging --- .github/workflows/backup.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 005e0ebf0..42ed156f1 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -72,7 +72,11 @@ jobs: - name: Add jq to path run: | jq=$(which jq) + echo $jq + echo $PATH export PATH=$jq:$PATH + + echo $PATH - name: Perform backup run: | docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ From 96322ba3e6d2e7354acc865f34d4308f66e15761 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 20 Apr 2023 16:15:22 +0200 Subject: [PATCH 327/946] Add more debugging --- .github/workflows/backup.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 42ed156f1..eb7472d5e 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -74,7 +74,8 @@ jobs: jq=$(which jq) echo $jq echo $PATH - export PATH=$jq:$PATH + export PATH=$PATH:$jq + command -v jq echo $PATH - name: Perform backup From 246febeefbaa08d72032f5fcfca3b914d307c4a3 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 20 Apr 2023 16:23:04 +0200 Subject: [PATCH 328/946] Add more debugging --- .github/workflows/backup.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index eb7472d5e..83c70f7a7 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -69,17 +69,12 @@ jobs: run: chmod 0600 $HOME/backup - name: change version run: echo "3.8.0" > $HOME/version - - name: Add jq to path - run: | - jq=$(which jq) - echo $jq - echo $PATH - export PATH=$PATH:$jq - command -v jq - echo $PATH - name: Perform backup run: | + jq=$(command -v jq) + export PATH=$PATH:$jq + echo $PATH docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ -e "GHE_DATA_DIR=/data" \ -e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \ From e55193ac3430dd59952179e51bd685f308a94e83 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 21 Apr 2023 23:46:23 +0000 Subject: [PATCH 329/946] fix rsync status for very first backup --- share/github-backup-utils/ghe-rsync-size.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-rsync-size.sh b/share/github-backup-utils/ghe-rsync-size.sh index 65de3c3a7..c61a80b3b 100755 --- a/share/github-backup-utils/ghe-rsync-size.sh +++ b/share/github-backup-utils/ghe-rsync-size.sh @@ -58,13 +58,22 @@ transfer_size() ;; esac - total_file_size=$(ghe-rsync -arn --stats \ + if [ -d "${GHE_DATA_DIR}/current/$1" ]; then + total_file_size=$(ghe-rsync -arn --stats \ -e "ssh -q $GHE_EXTRA_SSH_OPTS -p 122 -l admin" \ --rsync-path="sudo -u $user rsync" \ "$link_dest"/"$1" \ --ignore-missing-args \ "$GHE_HOSTNAME:$data_user_dir/" \ "$dest_dir/" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') + else + total_file_size=$(ghe-rsync -arn --stats \ + -e "ssh -q $GHE_EXTRA_SSH_OPTS -p 122 -l admin" \ + --rsync-path="sudo -u $user rsync" \ + --ignore-missing-args \ + "$GHE_HOSTNAME:$data_user_dir/" \ + "$dest_dir/" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') + fi # Reduce mysql size as only the compressed file is transferred if [[ "$1" == "mysql" ]]; then From 00c1703add27d1aba7bce06ea7a68adc8de2e874 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 24 Apr 2023 09:10:37 -0400 Subject: [PATCH 330/946] Update rsync min version to 3.2.5 --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index f6b9b8f31..e0a8f817c 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -6,7 +6,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements Backup host software requirements are modest: Linux or other modern Unix operating -system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. +system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v3.2.5 or newer, and [jq][11] v1.5 or newer. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From e6e76c6b7fa6902211e9efa81d76214559acbe58 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 24 Apr 2023 13:49:18 -0400 Subject: [PATCH 331/946] Update requirements to reflect rsync package compatability --- docs/requirements.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index e0a8f817c..f2c343985 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -6,7 +6,15 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements Backup host software requirements are modest: Linux or other modern Unix operating -system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v3.2.5 or newer, and [jq][11] v1.5 or newer. +system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. + +************ Update April 2023 ************ + +The recent fix to rsync for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) is causing severe performance impacts on backup-utils. + +These impacts can be mitigated by using the `--trust-sender` flag with rsync. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running an operating system that has done this, your options are to either downgrade the rsync package to a version before the CVE fix was backported, or upgrade the rsync package to v3.2.5 or newer. + +******************************************* The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From c69269169d154f95b6c31ee4a703bfb86c0bb73d Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 24 Apr 2023 13:51:32 -0400 Subject: [PATCH 332/946] Added link to release notes for rsync 3.2.5 --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index f2c343985..b3ab916ba 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -10,7 +10,7 @@ system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 ************ Update April 2023 ************ -The recent fix to rsync for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) is causing severe performance impacts on backup-utils. +The [recent fix to rsync](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) is causing severe performance impacts on backup-utils. These impacts can be mitigated by using the `--trust-sender` flag with rsync. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running an operating system that has done this, your options are to either downgrade the rsync package to a version before the CVE fix was backported, or upgrade the rsync package to v3.2.5 or newer. From 82b3b1a76a1b6cdf75befc6efa5415dd12e418e8 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Wed, 26 Apr 2023 13:59:57 -0400 Subject: [PATCH 333/946] Add details on the options customers have --- docs/requirements.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index b3ab916ba..51276e7cc 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -8,13 +8,20 @@ storage and must have network connectivity with the GitHub Enterprise Server app Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. -************ Update April 2023 ************ +--- +### Update April 2023 -The [recent fix to rsync](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) is causing severe performance impacts on backup-utils. +The [recent fix to rsync](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes severe performance impacts on backup-utils. -These impacts can be mitigated by using the `--trust-sender` flag with rsync. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running an operating system that has done this, your options are to either downgrade the rsync package to a version before the CVE fix was backported, or upgrade the rsync package to v3.2.5 or newer. +These impacts can be mitigated by using the `--trust-sender` flag with rsync. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) you have three options: -******************************************* +1. Downgrade (using the package manager on your host) the rsync package to a version before the CVE fix was backported +2. Upgrade (using the package manager on your host) the rsync package to v3.2.5 or newer +3. Manually download and build the rsync binary + +Option #3 is required if your operating system's package manager does not have access to rsync v3.2.5 or later (e.g. Ubuntu Focal). + +--- The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From e63192918168e18a68c08fe126cb3757ffbdef7b Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 27 Apr 2023 10:11:43 -0400 Subject: [PATCH 334/946] Update requirements.md --- docs/requirements.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index 51276e7cc..9ee35f9de 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,13 +5,12 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating -system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer, and [jq][11] v1.5 or newer. +Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v3.2.5 or newer, and [jq][11] v1.5 or newer. --- ### Update April 2023 -The [recent fix to rsync](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes severe performance impacts on backup-utils. +The [recent fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes severe performance impacts on backup-utils. These impacts can be mitigated by using the `--trust-sender` flag with rsync. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) you have three options: @@ -27,8 +26,7 @@ The parallel backup and restore feature will require [GNU awk][10] and [moreutil We encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. -The backup host must be able to establish outbound network connections to the -GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. +The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. ## Storage requirements From 2799c94a807ae953de03d2c402bd800651429dd0 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 27 Apr 2023 10:12:53 -0400 Subject: [PATCH 335/946] Explicitly mentioned which version of rsync has the --trust-sender flag --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 9ee35f9de..d96fb9676 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -12,7 +12,7 @@ Backup host software requirements are modest: Linux or other modern Unix operati The [recent fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes severe performance impacts on backup-utils. -These impacts can be mitigated by using the `--trust-sender` flag with rsync. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) you have three options: +These impacts can be mitigated by using the `--trust-sender` flag with rsync; this flag is available from v3.2.5 onwards. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) you have three options: 1. Downgrade (using the package manager on your host) the rsync package to a version before the CVE fix was backported 2. Upgrade (using the package manager on your host) the rsync package to v3.2.5 or newer From fefdb95aa03910470bd4d1fc53490858ec122d9e Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 27 Apr 2023 10:16:52 -0400 Subject: [PATCH 336/946] Added --trust-sender --- backup.config-example | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backup.config-example b/backup.config-example index 1e6d762f2..ffb3c355f 100644 --- a/backup.config-example +++ b/backup.config-example @@ -38,9 +38,9 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_EXTRA_SSH_OPTS="" -# Any extra options passed to the rsync command. Nothing required by default. -# -#GHE_EXTRA_RSYNC_OPTS="" +# Any extra options passed to the rsync command. +# As of April 2023 the --trust-sender flag is required. +GHE_EXTRA_RSYNC_OPTS="--trust-sender" # If set to 'yes', logging output will be colorized. From 5f58bbd70e91178b377790ebc248d4dad837d59f Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 27 Apr 2023 10:19:11 -0400 Subject: [PATCH 337/946] Added link to explanation of why --trust-sender is required --- backup.config-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index ffb3c355f..4f5fd5e5c 100644 --- a/backup.config-example +++ b/backup.config-example @@ -39,7 +39,7 @@ GHE_NUM_SNAPSHOTS=10 #GHE_EXTRA_SSH_OPTS="" # Any extra options passed to the rsync command. -# As of April 2023 the --trust-sender flag is required. +# As of April 2023 the --trust-sender flag is required. See docs/requirements.md#update-april-2023 for details on this change. GHE_EXTRA_RSYNC_OPTS="--trust-sender" From 267350553ed7b8985d967f4b3cfcc9aefdec86e4 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 27 Apr 2023 10:25:06 -0400 Subject: [PATCH 338/946] Making the comments clearer. --- backup.config-example | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index 4f5fd5e5c..ca6b335bf 100644 --- a/backup.config-example +++ b/backup.config-example @@ -39,7 +39,9 @@ GHE_NUM_SNAPSHOTS=10 #GHE_EXTRA_SSH_OPTS="" # Any extra options passed to the rsync command. -# As of April 2023 the --trust-sender flag is required. See docs/requirements.md#update-april-2023 for details on this change. +# As of April 2023 the minimum version of rsync is 3.2.5 and +# the --trust-sender flag is required. +# See docs/requirements.md#update-april-2023 for details on this change. GHE_EXTRA_RSYNC_OPTS="--trust-sender" From 65c2977f51e285e1d6d53059287b0ef766da7a1c Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 27 Apr 2023 11:25:12 -0400 Subject: [PATCH 339/946] Re-ordered the backup host requirements section --- docs/requirements.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index d96fb9676..8b122b990 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -7,7 +7,12 @@ storage and must have network connectivity with the GitHub Enterprise Server app Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v3.2.5 or newer, and [jq][11] v1.5 or newer. ---- +The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. + +We encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. + +The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. + ### Update April 2023 The [recent fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes severe performance impacts on backup-utils. @@ -20,14 +25,6 @@ These impacts can be mitigated by using the `--trust-sender` flag with rsync; th Option #3 is required if your operating system's package manager does not have access to rsync v3.2.5 or later (e.g. Ubuntu Focal). ---- - -The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. - -We encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. - -The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. - ## Storage requirements Storage requirements vary based on current Git repository disk usage and growth From dbcff0725f2bbe323349103242c693770bf38255 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 27 Apr 2023 11:36:26 -0400 Subject: [PATCH 340/946] Made the impact of the CVE-2022-29154 more explicit --- docs/requirements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index 8b122b990..7de76136b 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -15,9 +15,9 @@ The backup host must be able to establish outbound network connections to the Gi ### Update April 2023 -The [recent fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes severe performance impacts on backup-utils. +The [recent fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes backup-utils to timeout. -These impacts can be mitigated by using the `--trust-sender` flag with rsync; this flag is available from v3.2.5 onwards. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) you have three options: +To avoid this time out you must use the `--trust-sender` flag with rsync; this flag is available from v3.2.5 onwards. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) you have three options: 1. Downgrade (using the package manager on your host) the rsync package to a version before the CVE fix was backported 2. Upgrade (using the package manager on your host) the rsync package to v3.2.5 or newer From b12cc3efc25fdb85f79fc096320c964b091e38be Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 27 Apr 2023 11:43:30 -0400 Subject: [PATCH 341/946] Corrected language based on comments in 4511 This comment helped me understand what the correct impact is: https://github.com/github/ghes/issues/4511#issuecomment-1504907273 --- docs/requirements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index 7de76136b..f41125b91 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -15,9 +15,9 @@ The backup host must be able to establish outbound network connections to the Gi ### Update April 2023 -The [recent fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes backup-utils to timeout. +The [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes _severe_ performance degradation to `backup-utils`, making `backup-utils` close to unusable. -To avoid this time out you must use the `--trust-sender` flag with rsync; this flag is available from v3.2.5 onwards. Unfortunately some Linux distributions have backported the fix for this CVE to their rsync package without also backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) you have three options: +To avoid this degradation you **must** use the `--trust-sender` flag with rsync. This flag is available from v3.2.5 onwards, but unfortunately some Linux distributions have backported the fix for CVE-2022-29154 to their rsync package without backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) then you have three options: 1. Downgrade (using the package manager on your host) the rsync package to a version before the CVE fix was backported 2. Upgrade (using the package manager on your host) the rsync package to v3.2.5 or newer From 3c467b2dbee4675a17c46d008fd61cfa21ea4ab1 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 27 Apr 2023 22:51:26 +0300 Subject: [PATCH 342/946] Get dataset from azure --- .github/workflows/restore.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 6ce850465..0a41bcdb8 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -19,11 +19,7 @@ on: required: false type: string default: 'master' - version: - description: 'GHES Version of dataset' - required: false - type: string - default: "3.8.0" + workflow_call: inputs: size: @@ -40,11 +36,7 @@ on: required: false type: string default: 'master' - version: - description: 'GHES Version of dataset' - required: false - type: string - default: "3.8.0" + jobs: build: runs-on: ubuntu-latest @@ -84,12 +76,22 @@ jobs: token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" lfs: 'true' + - name: Download from blob storage + run: | + az storage blob download \ + --account-name ghesresults \ + --container-name ghes-data \ + --name v3.8-small-docs.tar.gz \ + --file ghes-data/data/backup/v3.8-small-docs.tar.gz \ + --connection-string "${{ secrets.CONNECTIONSTRING }}" + + - name: Unzip backup and setup symlink run: | mkdir $HOME/ghe-backup-data dir_name=$(date +%s) mkdir $HOME/ghe-backup-data/$dir_name - tar -xvf ghes-data/data/backup/${{ inputs.size }}/v3.8.0/${{ inputs.size }}-refined.tar.gz -C $HOME/ghe-backup-data/$dir_name + tar -xvf ghes-data/data/backup/v3.8-small-docs.tar.gz -C $HOME/ghe-backup-data/$dir_name ln -s $dir_name $HOME/ghe-backup-data/current From 35087ba1c0321e0aad83daedfff62c9e56a9c01c Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 27 Apr 2023 23:39:34 +0300 Subject: [PATCH 343/946] Remove extra input var --- .github/workflows/restore.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 0a41bcdb8..6782118e0 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -22,11 +22,6 @@ on: workflow_call: inputs: - size: - description: 'Size of the dataset to restore' - required: false - type: string - default: 'small' hostname: description: 'Hostname of the server' required: true From 853aa914585b5a86c43a5a4e076c8f790a05334c Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 27 Apr 2023 23:47:43 +0300 Subject: [PATCH 344/946] No longer need to clone ghes-data --- .github/workflows/restore.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 6782118e0..bad5be5c6 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -63,21 +63,22 @@ jobs: - name: Load docker container run: docker load -i backup-utils.tar - - uses: actions/checkout@v3 - with: - path: ghes-data - repository: github/ghes-data - ref: main - token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" - lfs: 'true' + # - uses: actions/checkout@v3 + # with: + # path: ghes-data + # repository: github/ghes-data + # ref: main + # token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" + # lfs: 'true' - name: Download from blob storage run: | + mkdir ghes-data az storage blob download \ --account-name ghesresults \ --container-name ghes-data \ --name v3.8-small-docs.tar.gz \ - --file ghes-data/data/backup/v3.8-small-docs.tar.gz \ + --file ghes-data/v3.8-small-docs.tar.gz \ --connection-string "${{ secrets.CONNECTIONSTRING }}" @@ -86,7 +87,7 @@ jobs: mkdir $HOME/ghe-backup-data dir_name=$(date +%s) mkdir $HOME/ghe-backup-data/$dir_name - tar -xvf ghes-data/data/backup/v3.8-small-docs.tar.gz -C $HOME/ghe-backup-data/$dir_name + tar -xvf ghes-data/3.8-small-docs.tar.gz -C $HOME/ghe-backup-data/$dir_name ln -s $dir_name $HOME/ghe-backup-data/current From 738b85fe4716690d4ddf0848123e9484622498e3 Mon Sep 17 00:00:00 2001 From: solmaz Date: Fri, 28 Apr 2023 01:38:33 +0300 Subject: [PATCH 345/946] Remove backup for now --- .github/workflows/backup.yml | 112 ----------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 .github/workflows/backup.yml diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml deleted file mode 100644 index 83c70f7a7..000000000 --- a/.github/workflows/backup.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Backup -run-name: ${{ github.actor }} run backup and upload to ghes-data -on: - workflow_dispatch: - inputs: - hostname: - description: 'Hostname' - required: true - type: string - ref: - description: 'Ref' - required: false - type: string - default: 'master' - workflow_call: - inputs: - size: - description: 'Size of the dataset to restore' - required: false - type: string - default: 'small' - hostname: - description: 'Hostname of the server' - required: true - type: string - ref: - description: 'Branch ref to use' - required: false - type: string - default: 'master' - version: - description: 'GHES Version of dataset' - required: false - type: string - default: "3.8.0" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - repository: github/backup-utils-private - ref: ${{ inputs.ref }} - token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" - - run: docker build . --file Dockerfile --tag backup-utils - - run: docker save backup-utils -o backup-utils.tar - - uses: actions/upload-artifact@v3 - with: - name: backup-utils - path: backup-utils.tar - backup-utils-backup: - needs: build - runs-on: ubuntu-latest - env: - SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} - steps: - - uses: actions/download-artifact@v3 - with: - name: backup-utils - - name: Load docker container - run: docker load -i backup-utils.tar - - uses: actions/checkout@v3 - - name: Create backup directory - run: mkdir $HOME/ghe-backup-data - - name: set up ssh SSH_KEY - run: echo -e "${SSH_KEY}\n" > $HOME/backup - - name: set up ssh key permissions - run: chmod 0600 $HOME/backup - - name: change version - run: echo "3.8.0" > $HOME/version - - - name: Perform backup - run: | - jq=$(command -v jq) - export PATH=$PATH:$jq - echo $PATH - docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ - -e "GHE_DATA_DIR=/data" \ - -e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \ - -e "GHE_NUM_SNAPSHOTS=15" \ - -v "$HOME/ghe-backup-data:/data" \ - -v "$HOME/backup:/ghe-ssh/id_rsa" \ - -v "$HOME/version:/backup-utils/share/github-backup-utils/version" \ - --rm \ - backup-utils ghe-backup - - - uses: actions/checkout@v3 - with: - path: ghes-data - repository: github/ghes-data - ref: main - token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" - lfs: 'true' - - - name: Zip backup - run: | - ls -al $HOME/ghe-backup-data - dirname=$(find $HOME/ghe-backup-data/ -type d -maxdepth 1 -mindepth 1) - echo $dirname - tar -czvf $dirname.tar.gz $dirname - cp $dirname.tar.gz ghes-data/data/backup/{{inputs.size}}/v{{inputs.version}}/$dirname.tar.gz - - - name: Upload backup to ghes-data - run: | - cd ghes-data/data/backup/{{inputs.size}}/v{{inputs.version}} - git add . - git commit -am "Added new backup from automation" - git push - - - From acc6351f38658d5d68c7a34bbf9268d9d5ffdfe0 Mon Sep 17 00:00:00 2001 From: solmaz Date: Fri, 28 Apr 2023 01:43:12 +0300 Subject: [PATCH 346/946] Remove unnecessary code --- .github/workflows/restore.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index bad5be5c6..ed412b330 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -63,14 +63,6 @@ jobs: - name: Load docker container run: docker load -i backup-utils.tar - # - uses: actions/checkout@v3 - # with: - # path: ghes-data - # repository: github/ghes-data - # ref: main - # token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" - # lfs: 'true' - - name: Download from blob storage run: | mkdir ghes-data @@ -81,7 +73,6 @@ jobs: --file ghes-data/v3.8-small-docs.tar.gz \ --connection-string "${{ secrets.CONNECTIONSTRING }}" - - name: Unzip backup and setup symlink run: | mkdir $HOME/ghe-backup-data From 6ccdc7095075da700521a428d03f17c15b31ad80 Mon Sep 17 00:00:00 2001 From: solmaz Date: Fri, 28 Apr 2023 03:01:05 +0300 Subject: [PATCH 347/946] Fix linter --- .github/workflows/restore.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index ed412b330..00f4e7dbd 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -75,24 +75,24 @@ jobs: - name: Unzip backup and setup symlink run: | - mkdir $HOME/ghe-backup-data + mkdir "$HOME/ghe-backup-data" dir_name=$(date +%s) - mkdir $HOME/ghe-backup-data/$dir_name - tar -xvf ghes-data/3.8-small-docs.tar.gz -C $HOME/ghe-backup-data/$dir_name + mkdir "$HOME/ghe-backup-data/$dir_name" + tar -xvf ghes-data/3.8-small-docs.tar.gz -C "$HOME/ghe-backup-data/$dir_name" ln -s $dir_name $HOME/ghe-backup-data/current - name: set up ssh SSH_KEY - run: echo -e "${SSH_KEY}\n" > $HOME/backup + run: echo -e "${SSH_KEY}\n" > "$HOME/backup" - name: set up ssh key permissions - run: chmod 0600 $HOME/backup + run: chmod 0600 "$HOME/backup" - name: change version run: echo "3.8.0" > $HOME/version - name: Prepare for restore - run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" + run: ssh -p122 -i "$HOME/backup" -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" - name: Restore data to instance run: | @@ -107,7 +107,7 @@ jobs: backup-utils ghe-restore ${{ inputs.hostname }} - name: Reset maintenance mode after restore - run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" + run: ssh -p122 -i" $HOME/backup" -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" From 49581d98242e65d10a383ccb85b1837158b0cb2a Mon Sep 17 00:00:00 2001 From: solmaz Date: Fri, 28 Apr 2023 03:05:36 +0300 Subject: [PATCH 348/946] Fix linter --- .github/workflows/restore.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 00f4e7dbd..03549218c 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -80,7 +80,7 @@ jobs: mkdir "$HOME/ghe-backup-data/$dir_name" tar -xvf ghes-data/3.8-small-docs.tar.gz -C "$HOME/ghe-backup-data/$dir_name" - ln -s $dir_name $HOME/ghe-backup-data/current + ln -s $dir_name "$HOME/ghe-backup-data/current" - name: set up ssh SSH_KEY run: echo -e "${SSH_KEY}\n" > "$HOME/backup" @@ -89,7 +89,7 @@ jobs: run: chmod 0600 "$HOME/backup" - name: change version - run: echo "3.8.0" > $HOME/version + run: echo "3.8.0" > "$HOME/version" - name: Prepare for restore run: ssh -p122 -i "$HOME/backup" -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" From cb94161af482f15e1a6e7369cec83d41323d07d6 Mon Sep 17 00:00:00 2001 From: solmaz Date: Fri, 28 Apr 2023 03:09:41 +0300 Subject: [PATCH 349/946] Fix linter --- .github/workflows/restore.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 03549218c..6cf7da203 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -78,9 +78,9 @@ jobs: mkdir "$HOME/ghe-backup-data" dir_name=$(date +%s) mkdir "$HOME/ghe-backup-data/$dir_name" - tar -xvf ghes-data/3.8-small-docs.tar.gz -C "$HOME/ghe-backup-data/$dir_name" + tar -xvf "ghes-data/3.8-small-docs.tar.gz" -C "$HOME/ghe-backup-data/$dir_name" - ln -s $dir_name "$HOME/ghe-backup-data/current" + ln -s "$dir_name" "$HOME/ghe-backup-data/current" - name: set up ssh SSH_KEY run: echo -e "${SSH_KEY}\n" > "$HOME/backup" From f1a85b684298d4c47f8c26bcef49cf1088770593 Mon Sep 17 00:00:00 2001 From: "Roger D. Winans" Date: Fri, 28 Apr 2023 18:01:12 -0400 Subject: [PATCH 350/946] Create SUPPORT.md --- docs/SUPPORT.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/SUPPORT.md diff --git a/docs/SUPPORT.md b/docs/SUPPORT.md new file mode 100644 index 000000000..a05a91f5b --- /dev/null +++ b/docs/SUPPORT.md @@ -0,0 +1,13 @@ +# Support + +## How to file issues and get help + +**github/backup-utils** uses GitHub issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. + +For non-urgent help, feature requests, and questions about using this project, please [open an issue](https://github.com/github/backup-utils/issues/new/choose). + +For urgent help with **backup-utils**, for example when restoring a backup to recover from a site failure or other disaster, please [open a ticket in GitHub's support portal](https://support.github.com/contact) and work with GitHub Support directly. + +## GitHub Support Policy + +**github/backup-utils** is an MIT-licensed open source project under active development and maintained by GitHub staff. We will do our best to respond to support, feature requests, and community questions in a timely manner. From 3b386f8552376e7f9276f0710e46e2cba4498a63 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 1 May 2023 13:30:26 -0400 Subject: [PATCH 351/946] Added sentence about using --trust-sender before v3.2.5 --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index f41125b91..3497f5df1 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -23,7 +23,7 @@ To avoid this degradation you **must** use the `--trust-sender` flag with rsync. 2. Upgrade (using the package manager on your host) the rsync package to v3.2.5 or newer 3. Manually download and build the rsync binary -Option #3 is required if your operating system's package manager does not have access to rsync v3.2.5 or later (e.g. Ubuntu Focal). +Option #3 is required if your operating system's package manager does not have access to rsync v3.2.5 or later (e.g. Ubuntu Focal). Please note that if you use a version of rsync that is lower than v3.2.5, you will need to ensure the `--trust-sender` flag is not enabled in your `backup.config` file since that flag is only supported on v3.2.5 or later. ## Storage requirements From 15915aa2274c89bac305eb3bc9ebddeeecd1121a Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 2 May 2023 12:57:07 +0300 Subject: [PATCH 352/946] Remove extra v from file name --- .github/workflows/restore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 6cf7da203..a90ac2a52 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -70,7 +70,7 @@ jobs: --account-name ghesresults \ --container-name ghes-data \ --name v3.8-small-docs.tar.gz \ - --file ghes-data/v3.8-small-docs.tar.gz \ + --file ghes-data/3.8-small-docs.tar.gz \ --connection-string "${{ secrets.CONNECTIONSTRING }}" - name: Unzip backup and setup symlink From d14b3b6774944aed7baa86dad275f2ddcff86c83 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 2 May 2023 13:32:21 +0300 Subject: [PATCH 353/946] Fix ssh key path --- .github/workflows/restore.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index a90ac2a52..9f6acb4e0 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -106,8 +106,17 @@ jobs: --rm \ backup-utils ghe-restore ${{ inputs.hostname }} + # - name: Reset SSH key + # run: ssh-keygen -f "/home/runner/.ssh/known_hosts" -R "${{ inputs.hostname }}:122 + + # - name: set up ssh SSH_KEY + # run: echo -e "${SSH_KEY}\n" > "$HOME/backup" + + # - name: set up ssh key permissions + # run: chmod 0600 "$HOME/backup" + - name: Reset maintenance mode after restore - run: ssh -p122 -i" $HOME/backup" -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" + run: ssh -p122 -i "$HOME/backup" -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" From aa887ac50db75f689c3ad95e0ff31e9ba5e11134 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 2 May 2023 13:56:30 +0300 Subject: [PATCH 354/946] Fix SSH key reference --- .github/workflows/restore.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 9f6acb4e0..24f1aa061 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -106,15 +106,6 @@ jobs: --rm \ backup-utils ghe-restore ${{ inputs.hostname }} - # - name: Reset SSH key - # run: ssh-keygen -f "/home/runner/.ssh/known_hosts" -R "${{ inputs.hostname }}:122 - - # - name: set up ssh SSH_KEY - # run: echo -e "${SSH_KEY}\n" > "$HOME/backup" - - # - name: set up ssh key permissions - # run: chmod 0600 "$HOME/backup" - - name: Reset maintenance mode after restore run: ssh -p122 -i "$HOME/backup" -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" From 0f9177edef940782508766fb135f954fe994c5e8 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Tue, 2 May 2023 11:13:01 -0400 Subject: [PATCH 355/946] Adding check to add trusted sender if supported --- share/github-backup-utils/ghe-rsync | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index 1b2ac7e2a..457ab6ef6 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -20,6 +20,11 @@ else done fi +# check if `--trust-sender` is supported +if rsync -h | grep '\-\-trust-sender' >/dev/null 2>&1; then + parameters+=("--trust-sender") +fi + ignoreout='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' rsync_version_check=$(rsync --version | egrep "version 3.[0-9]*.[0-9]*") if [ ! -z "$rsync_version_check" ]; then From 1d313f48ee15ad3852b159eee4744d29c57c14f9 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Tue, 2 May 2023 13:45:56 -0400 Subject: [PATCH 356/946] Change adds more checking and error handling: - Adds description of what each added section does - Imports `GHE_EXTRA_RSYNC_OPTS` to allow manipulation - Removes `--trust-sender` from `GHE_EXTRA_RSYNC_OPTS` if not supported - Prevents `--trust-sender` from being added twice - Updates the call to `rsync` to remove the call to GHE_EXTRA_RSYNC_OPTS --- share/github-backup-utils/ghe-rsync | 34 +++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index 457ab6ef6..f05feb08b 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -20,19 +20,45 @@ else done fi -# check if `--trust-sender` is supported +# This adds `--trust-sender` to the parameters if it is supported by rsync +# check if `--trust-sender` is supported and prepend if available. if rsync -h | grep '\-\-trust-sender' >/dev/null 2>&1; then - parameters+=("--trust-sender") + parameters=("--trust-sender" "${parameters[@]}") +fi + +# This loads the extra options from the config file and allows for overriding +# load $GHE_EXTRA_RSYNC_OPTS from config if available +if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then + # shellcheck disable=SC2206 + GHE_EXTRA_RSYNC_OPTS=($GHE_EXTRA_RSYNC_OPTS) +else + GHE_EXTRA_RSYNC_OPTS=() +fi + +# This prevents `--trust-sender` from being used if it is not supported by rsync +# Check if `--trust-sender` is in GHE_EXTRA_RSYNC_OPTS and remove if unavailable. +if ! rsync -h | grep '\-\-trust-sender' >/dev/null 2>&1; then + for options in "${GHE_EXTRA_RSYNC_OPTS[@]}"; do + [[ ! $options == "--trust-sender" ]] && parameters+=("$options") + done +fi + +# This removes the possibility of having `--trust-sender` twice in the parameters +# Check if `--trust-sender` is already in parameters and remove from GHE_EXTRA_RSYNC_OPTS +if [[ " ${parameters[*]} " == *" --trust-sender "* ]]; then + for options in "${GHE_EXTRA_RSYNC_OPTS[@]}"; do + [[ ! $options == "--trust-sender" ]] && parameters+=("$options") + done fi ignoreout='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' rsync_version_check=$(rsync --version | egrep "version 3.[0-9]*.[0-9]*") if [ ! -z "$rsync_version_check" ]; then # rsync >= 3.x sends errors to stderr. so, we need to redirect to stdout before the pipe - rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS 2>&1 | (egrep -v "$ignoreout" || true) + rsync "${parameters[@]}" 2>&1 | (egrep -v "$ignoreout" || true) else # rsync <3.x sends errors to stdout. - rsync "${parameters[@]}" $GHE_EXTRA_RSYNC_OPTS | (egrep -v "$ignoreout" || true) + rsync "${parameters[@]}" | (egrep -v "$ignoreout" || true) fi res=$? From 6c660bc36b0da6ad8d01c97bad9e3c1e5f4c2a7b Mon Sep 17 00:00:00 2001 From: Diana Date: Tue, 2 May 2023 14:26:58 -0400 Subject: [PATCH 357/946] Fixed `shellcheck` suggestion - Replaced `egrep` with `grep -E` - Replaced `! -z` with `-n` --- share/github-backup-utils/ghe-rsync | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index f05feb08b..b8936887b 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -52,13 +52,13 @@ if [[ " ${parameters[*]} " == *" --trust-sender "* ]]; then fi ignoreout='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' -rsync_version_check=$(rsync --version | egrep "version 3.[0-9]*.[0-9]*") -if [ ! -z "$rsync_version_check" ]; then +rsync_version_check=$(rsync --version | grep -E "version 3.[0-9]*.[0-9]*") +if [ -n "$rsync_version_check" ]; then # rsync >= 3.x sends errors to stderr. so, we need to redirect to stdout before the pipe - rsync "${parameters[@]}" 2>&1 | (egrep -v "$ignoreout" || true) + rsync "${parameters[@]}" 2>&1 | (grep -E -v "$ignoreout" || true) else # rsync <3.x sends errors to stdout. - rsync "${parameters[@]}" | (egrep -v "$ignoreout" || true) + rsync "${parameters[@]}" | (grep -E -v "$ignoreout" || true) fi res=$? From d97154acffedfe816f1a3cccb6167c18f78f93b2 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Tue, 2 May 2023 16:19:45 -0400 Subject: [PATCH 358/946] Update backup.config-example Reverting the changes I made previously, since these are no longer needed. This PR (https://github.com/github/backup-utils-private/pull/311) added the `--trust-sender` flag to `ghe-rsync`. --- backup.config-example | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/backup.config-example b/backup.config-example index ca6b335bf..f845edb89 100644 --- a/backup.config-example +++ b/backup.config-example @@ -38,11 +38,10 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_EXTRA_SSH_OPTS="" -# Any extra options passed to the rsync command. -# As of April 2023 the minimum version of rsync is 3.2.5 and -# the --trust-sender flag is required. -# See docs/requirements.md#update-april-2023 for details on this change. -GHE_EXTRA_RSYNC_OPTS="--trust-sender" + +# Any extra options passed to the rsync command. Nothing required by default. +# +#GHE_EXTRA_RSYNC_OPTS="" # If set to 'yes', logging output will be colorized. From d9b41c968e5ead5702ea55554008853703e5e52f Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Tue, 2 May 2023 16:20:08 -0400 Subject: [PATCH 359/946] Removing extra line --- backup.config-example | 1 - 1 file changed, 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index f845edb89..1e6d762f2 100644 --- a/backup.config-example +++ b/backup.config-example @@ -38,7 +38,6 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_EXTRA_SSH_OPTS="" - # Any extra options passed to the rsync command. Nothing required by default. # #GHE_EXTRA_RSYNC_OPTS="" From c14eda405ff4c024bdbd0083496822d4a922f6ec Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Tue, 2 May 2023 16:22:18 -0400 Subject: [PATCH 360/946] Revising the April 2023 recommendation for option #3 Updated details about option #3 in the `Update April 2023` section based on this PR (https://github.com/github/backup-utils-private/pull/311/files) --- docs/requirements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index 3497f5df1..468c8dfeb 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -21,9 +21,9 @@ To avoid this degradation you **must** use the `--trust-sender` flag with rsync. 1. Downgrade (using the package manager on your host) the rsync package to a version before the CVE fix was backported 2. Upgrade (using the package manager on your host) the rsync package to v3.2.5 or newer -3. Manually download and build the rsync binary +3. Manually download rsync v3.2.5 or newer and build the rsync binary -Option #3 is required if your operating system's package manager does not have access to rsync v3.2.5 or later (e.g. Ubuntu Focal). Please note that if you use a version of rsync that is lower than v3.2.5, you will need to ensure the `--trust-sender` flag is not enabled in your `backup.config` file since that flag is only supported on v3.2.5 or later. +Option #3 is required if your operating system's package manager does not have access to rsync v3.2.5 or later (e.g. Ubuntu Focal). ## Storage requirements From c6c9b9c9c0ba29971454859c0b93bdb4c2e34cea Mon Sep 17 00:00:00 2001 From: Diana Date: Tue, 2 May 2023 17:37:36 -0400 Subject: [PATCH 361/946] updating minimum rsync requirement to 3.2.5 --- share/github-backup-utils/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/requirements.txt b/share/github-backup-utils/requirements.txt index acf767129..2ad762c0e 100644 --- a/share/github-backup-utils/requirements.txt +++ b/share/github-backup-utils/requirements.txt @@ -1,3 +1,3 @@ -min_rsync=2.6.4 +min_rsync=3.2.5 min_openssh=5.6 min_jq=1.5 From b864a361661466f383f7e5c94af2f8c00d6c2954 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Wed, 3 May 2023 10:45:09 -0400 Subject: [PATCH 362/946] Refined the April 2023 update section --- docs/requirements.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index 468c8dfeb..8f57decab 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,7 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v3.2.5 or newer, and [jq][11] v1.5 or newer. +Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v3.2.5 or newer, and [jq][11] v1.5 or newer. See below for an update on rsync. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. @@ -13,11 +13,15 @@ We encourage the use of [Docker](docker.md), as it ensures compatible versions o The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. -### Update April 2023 +### Update April 2023 - rsync requirements -The [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causes _severe_ performance degradation to `backup-utils`, making `backup-utils` close to unusable. +We have updated the minimum required version of rsync from `2.6.4` to `3.2.5`. This change was required due to the [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causing _severe_ performance degradation to `backup-utils`. The only way to avoid this degradation is to use the `--trust-sender` flag, and since this flag is only available from rsync v3.2.5 onwards, we have updated the minimum required version of rsync. -To avoid this degradation you **must** use the `--trust-sender` flag with rsync. This flag is available from v3.2.5 onwards, but unfortunately some Linux distributions have backported the fix for CVE-2022-29154 to their rsync package without backporting the `--trust-sender` flag. If your backup host is running on an operating system in this situation (i.e. the CVE fix has been backported but the `--trust-sender` flag has not) then you have three options: +Unfortunately the situation is a little more complicated. If you are running an older version of rsync (i.e. < v3.2.5) you _might_ be ok. + +It depends on whether the rsync package you are using on your backup host has backported the fix for CVE-2022-29154 without backporting the `--trust-sender` flag. + +If your backup host is running an rsync package that has backported the CVE fix without backporting the `--trust-sender` flag then you have three options: 1. Downgrade (using the package manager on your host) the rsync package to a version before the CVE fix was backported 2. Upgrade (using the package manager on your host) the rsync package to v3.2.5 or newer From d58df714842d2a16e9cecf14b7605dfbadc713d5 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 13:32:39 -0400 Subject: [PATCH 363/946] Changing feature checking and adding testing - This moves feature checking to an extensible function - Adds a test for the feature checking to allow CI testing - Now adds extra variables to parameters after checking for duplicates --- share/github-backup-utils/ghe-rsync | 29 ++++--------------- .../ghe-rsync-feature-checker.sh | 20 +++++++++++++ test/test-ghe-rsync-feature-checker.sh | 14 +++++++++ 3 files changed, 40 insertions(+), 23 deletions(-) create mode 100755 share/github-backup-utils/ghe-rsync-feature-checker.sh create mode 100644 test/test-ghe-rsync-feature-checker.sh diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index b8936887b..c2b6e90ce 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -20,36 +20,19 @@ else done fi -# This adds `--trust-sender` to the parameters if it is supported by rsync -# check if `--trust-sender` is supported and prepend if available. -if rsync -h | grep '\-\-trust-sender' >/dev/null 2>&1; then +# This prepends `--trust-sender` to the parameters if supported by the current version of rsync to mitigate the degredation of performance due to the resolution of CVE-2022-29154 +# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh +if [ "$( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh" "--trust-sender" = "true" ]; then parameters=("--trust-sender" "${parameters[@]}") fi -# This loads the extra options from the config file and allows for overriding -# load $GHE_EXTRA_RSYNC_OPTS from config if available +# This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if avalible then adds them to the parameters and skip adding if already present in the parameters if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then - # shellcheck disable=SC2206 - GHE_EXTRA_RSYNC_OPTS=($GHE_EXTRA_RSYNC_OPTS) -else - GHE_EXTRA_RSYNC_OPTS=() -fi - -# This prevents `--trust-sender` from being used if it is not supported by rsync -# Check if `--trust-sender` is in GHE_EXTRA_RSYNC_OPTS and remove if unavailable. -if ! rsync -h | grep '\-\-trust-sender' >/dev/null 2>&1; then - for options in "${GHE_EXTRA_RSYNC_OPTS[@]}"; do - [[ ! $options == "--trust-sender" ]] && parameters+=("$options") + for extra_opt in $GHE_EXTRA_RSYNC_OPTS; do + [[ ! " ${parameters[@]} " =~ " $extra_opt " ]] && parameters+=("$extra_opt") done fi -# This removes the possibility of having `--trust-sender` twice in the parameters -# Check if `--trust-sender` is already in parameters and remove from GHE_EXTRA_RSYNC_OPTS -if [[ " ${parameters[*]} " == *" --trust-sender "* ]]; then - for options in "${GHE_EXTRA_RSYNC_OPTS[@]}"; do - [[ ! $options == "--trust-sender" ]] && parameters+=("$options") - done -fi ignoreout='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' rsync_version_check=$(rsync --version | grep -E "version 3.[0-9]*.[0-9]*") diff --git a/share/github-backup-utils/ghe-rsync-feature-checker.sh b/share/github-backup-utils/ghe-rsync-feature-checker.sh new file mode 100755 index 000000000..b041ee900 --- /dev/null +++ b/share/github-backup-utils/ghe-rsync-feature-checker.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +#/ Usage: ghe-rsync-feature-checker +#/ returns true if the passed rsync command is supported by the current version of rsync +#/ returns false if the passed rsync command is not supported by the current version of rsync +#/ + +set -o pipefail + +# set the variable from the first argument +rsync_command="$1" + +# strip -- from the passed rsync command +rsync_command="${rsync_command/--/}" + +# check if the passed rsync command is supported by the current version of rsync +if rsync -h | grep "$rsync_command" >/dev/null 2>&1; then + echo "true" +else + echo "false" +fi \ No newline at end of file diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh new file mode 100644 index 000000000..cd555b86c --- /dev/null +++ b/test/test-ghe-rsync-feature-checker.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# ghe-rsync-feature-checker command tests + +TESTS_DIR="$PWD/$(dirname "$0")" +# Bring in testlib. +# shellcheck source=test/testlib.sh +. "$TESTS_DIR/testlib.sh" + + +# Test ghe-rsync-feature-checker command +ghe-rsync-feature-checker "--help" | grep -q "true" +ghe-rsync-feature-checker "help" | grep -q "true" +ghe-rsync-feature-checker "--ignore-missing-args" | grep -q "false" +ghe-rsync-feature-checker "ignore-missing-args" | grep -q "false" \ No newline at end of file From 3d2af0a5ad9982a1df77f807235097afd63db45b Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 13:38:49 -0400 Subject: [PATCH 364/946] Updated test to standard convention --- test/test-ghe-rsync-feature-checker.sh | 39 ++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index cd555b86c..3a5fafd2b 100644 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -6,9 +6,38 @@ TESTS_DIR="$PWD/$(dirname "$0")" # shellcheck source=test/testlib.sh . "$TESTS_DIR/testlib.sh" +begin_test "ghe-rsync-feature-checker for know command `--help`" +( + set -e -# Test ghe-rsync-feature-checker command -ghe-rsync-feature-checker "--help" | grep -q "true" -ghe-rsync-feature-checker "help" | grep -q "true" -ghe-rsync-feature-checker "--ignore-missing-args" | grep -q "false" -ghe-rsync-feature-checker "ignore-missing-args" | grep -q "false" \ No newline at end of file + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker "--help" | grep -q "true" +) +end_test + +begin_test "ghe-rsync-feature-checker for know command `help`" +( + set -e + + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker "help" | grep -q "true" +) +end_test + +begin_test "ghe-rsync-feature-checker for known unsupported command `--ignore-missing-args`" +( + set -e + + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker "--ignore-missing-args" | grep -q "false" +) +end_test + +begin_test "ghe-rsync-feature-checker for known unsupported command `ignore-missing-args`" +( + set -e + + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker "ignore-missing-args" | grep -q "false" +) +end_test \ No newline at end of file From fb3e1f3a54b95335d57c4f94a27b33df8631ddc8 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 13:52:44 -0400 Subject: [PATCH 365/946] Fixing spelling mistakes and uniformity issues - Changed `ignoreout` to `ignore_out` --- share/github-backup-utils/ghe-rsync | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index c2b6e90ce..a9dbf92cf 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -20,13 +20,13 @@ else done fi -# This prepends `--trust-sender` to the parameters if supported by the current version of rsync to mitigate the degredation of performance due to the resolution of CVE-2022-29154 +# This prepends `--trust-sender` to the parameters if supported by the current version of rsync to mitigate the degradation of performance due to the resolution of CVE-2022-29154 # shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh if [ "$( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh" "--trust-sender" = "true" ]; then parameters=("--trust-sender" "${parameters[@]}") fi -# This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if avalible then adds them to the parameters and skip adding if already present in the parameters +# This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them to the parameters and skip adding if already present in the parameters if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then for extra_opt in $GHE_EXTRA_RSYNC_OPTS; do [[ ! " ${parameters[@]} " =~ " $extra_opt " ]] && parameters+=("$extra_opt") @@ -34,14 +34,14 @@ if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then fi -ignoreout='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' +ignore_out='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' rsync_version_check=$(rsync --version | grep -E "version 3.[0-9]*.[0-9]*") if [ -n "$rsync_version_check" ]; then # rsync >= 3.x sends errors to stderr. so, we need to redirect to stdout before the pipe - rsync "${parameters[@]}" 2>&1 | (grep -E -v "$ignoreout" || true) + rsync "${parameters[@]}" 2>&1 | (grep -E -v "$ignore_out" || true) else # rsync <3.x sends errors to stdout. - rsync "${parameters[@]}" | (grep -E -v "$ignoreout" || true) + rsync "${parameters[@]}" | (grep -E -v "$ignore_out" || true) fi res=$? From b0e07491c40a9b65d89c34714794ba3632668244 Mon Sep 17 00:00:00 2001 From: Diana Date: Wed, 3 May 2023 14:12:10 -0400 Subject: [PATCH 366/946] Update ghe-rsync to fix issue with new feature checker - Reworked the call for ghe-rsync-feature-checker.sh --- share/github-backup-utils/ghe-rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index a9dbf92cf..7bda8879a 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -22,7 +22,7 @@ fi # This prepends `--trust-sender` to the parameters if supported by the current version of rsync to mitigate the degradation of performance due to the resolution of CVE-2022-29154 # shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh -if [ "$( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh" "--trust-sender" = "true" ]; then +if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh --trust-sender)" == "true" ]; then parameters=("--trust-sender" "${parameters[@]}") fi From 5f7d0ccc539a7bb4f0b777d54b0e96ee61e3cdc5 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 14:39:11 -0400 Subject: [PATCH 367/946] Feature checker updated - Now using `grep -E "\b$rsync_command\b"` for explicit checking --- share/github-backup-utils/ghe-rsync-feature-checker.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync-feature-checker.sh b/share/github-backup-utils/ghe-rsync-feature-checker.sh index b041ee900..a7d595ab6 100755 --- a/share/github-backup-utils/ghe-rsync-feature-checker.sh +++ b/share/github-backup-utils/ghe-rsync-feature-checker.sh @@ -9,11 +9,11 @@ set -o pipefail # set the variable from the first argument rsync_command="$1" -# strip -- from the passed rsync command -rsync_command="${rsync_command/--/}" +# strip - and -- from the passed rsync command +rsync_command="${rsync_command/-/}" # check if the passed rsync command is supported by the current version of rsync -if rsync -h | grep "$rsync_command" >/dev/null 2>&1; then +if rsync -h | grep -E "\b$rsync_command\b" >/dev/null 2>&1; then echo "true" else echo "false" From 0a63b28ecd7c9345240109f3a5d4e9af6291851e Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 14:47:25 -0400 Subject: [PATCH 368/946] Fixed bug with stripping - and -- --- share/github-backup-utils/ghe-rsync-feature-checker.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-rsync-feature-checker.sh b/share/github-backup-utils/ghe-rsync-feature-checker.sh index a7d595ab6..82edb786c 100755 --- a/share/github-backup-utils/ghe-rsync-feature-checker.sh +++ b/share/github-backup-utils/ghe-rsync-feature-checker.sh @@ -10,7 +10,10 @@ set -o pipefail rsync_command="$1" # strip - and -- from the passed rsync command -rsync_command="${rsync_command/-/}" +rsync_command="${rsync_command/-/}" && rsync_command="${rsync_command/-/}" + + +echo "rsync_command: $rsync_command" # check if the passed rsync command is supported by the current version of rsync if rsync -h | grep -E "\b$rsync_command\b" >/dev/null 2>&1; then From 6c397d108fd52118796dc022a5d646d7c1e40023 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 14:48:00 -0400 Subject: [PATCH 369/946] Fixed bug with loading $GHE_EXTRA_RSYNC_OPTS --- share/github-backup-utils/ghe-rsync | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index 7bda8879a..4166295be 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -29,7 +29,9 @@ fi # This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them to the parameters and skip adding if already present in the parameters if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then for extra_opt in $GHE_EXTRA_RSYNC_OPTS; do - [[ ! " ${parameters[@]} " =~ " $extra_opt " ]] && parameters+=("$extra_opt") + if [ $($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh "$extra_opt") == "true" ]; then + parameters+=("$extra_opt") + fi done fi From 943165929484756cfc87272db1076d01f6b2663f Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 14:49:51 -0400 Subject: [PATCH 370/946] Removed debugging echo statement --- share/github-backup-utils/ghe-rsync-feature-checker.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync-feature-checker.sh b/share/github-backup-utils/ghe-rsync-feature-checker.sh index 82edb786c..62b96fd2f 100755 --- a/share/github-backup-utils/ghe-rsync-feature-checker.sh +++ b/share/github-backup-utils/ghe-rsync-feature-checker.sh @@ -12,9 +12,6 @@ rsync_command="$1" # strip - and -- from the passed rsync command rsync_command="${rsync_command/-/}" && rsync_command="${rsync_command/-/}" - -echo "rsync_command: $rsync_command" - # check if the passed rsync command is supported by the current version of rsync if rsync -h | grep -E "\b$rsync_command\b" >/dev/null 2>&1; then echo "true" From d416dab0c2248258438a9453f5062c4322d3b38a Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 15:09:13 -0400 Subject: [PATCH 371/946] Updating files permissions - Changing test-ghe-rsync-feature-checker.sh from 644 to 755 --- test/test-ghe-rsync-feature-checker.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/test-ghe-rsync-feature-checker.sh diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh old mode 100644 new mode 100755 From ec78a202956189fa008e3a07005f5753b33c86a6 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 15:21:58 -0400 Subject: [PATCH 372/946] Fixing shellcheck errors --- test/test-ghe-rsync-feature-checker.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index 3a5fafd2b..70f267929 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -6,7 +6,7 @@ TESTS_DIR="$PWD/$(dirname "$0")" # shellcheck source=test/testlib.sh . "$TESTS_DIR/testlib.sh" -begin_test "ghe-rsync-feature-checker for know command `--help`" +begin_test "ghe-rsync-feature-checker for know command --help" ( set -e @@ -15,7 +15,7 @@ begin_test "ghe-rsync-feature-checker for know command `--help`" ) end_test -begin_test "ghe-rsync-feature-checker for know command `help`" +begin_test "ghe-rsync-feature-checker for know command help" ( set -e @@ -24,7 +24,7 @@ begin_test "ghe-rsync-feature-checker for know command `help`" ) end_test -begin_test "ghe-rsync-feature-checker for known unsupported command `--ignore-missing-args`" +begin_test "ghe-rsync-feature-checker for known unsupported command --ignore-missing-args" ( set -e @@ -33,7 +33,7 @@ begin_test "ghe-rsync-feature-checker for known unsupported command `--ignore-mi ) end_test -begin_test "ghe-rsync-feature-checker for known unsupported command `ignore-missing-args`" +begin_test "ghe-rsync-feature-checker for known unsupported command ignore-missing-args" ( set -e From 654501306a089e222a4d75bead36d612b9077916 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Wed, 3 May 2023 15:49:27 -0400 Subject: [PATCH 373/946] Adding disable for shellcheck SC2046 --- share/github-backup-utils/ghe-rsync | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index 4166295be..b7c884c4d 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -22,14 +22,17 @@ fi # This prepends `--trust-sender` to the parameters if supported by the current version of rsync to mitigate the degradation of performance due to the resolution of CVE-2022-29154 # shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh +# shellcheck disable=SC2046 if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh --trust-sender)" == "true" ]; then parameters=("--trust-sender" "${parameters[@]}") fi # This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them to the parameters and skip adding if already present in the parameters +# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh +# shellcheck disable=SC2046 if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then for extra_opt in $GHE_EXTRA_RSYNC_OPTS; do - if [ $($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh "$extra_opt") == "true" ]; then + if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh "$extra_opt")" == "true" ]; then parameters+=("$extra_opt") fi done From 93e19c25205a228a6e5bc8b8315ef61800d8ff1c Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Thu, 4 May 2023 09:48:40 -0400 Subject: [PATCH 374/946] fixed issue with tests - Was missing `.sh` in the `ghe-rsync-feature-checker calls` --- test/test-ghe-rsync-feature-checker.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index 70f267929..9ccbff2e4 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -1,43 +1,43 @@ #!/usr/bin/env bash -# ghe-rsync-feature-checker command tests +# ghe-rsync-feature-checker.sh command tests TESTS_DIR="$PWD/$(dirname "$0")" # Bring in testlib. # shellcheck source=test/testlib.sh . "$TESTS_DIR/testlib.sh" -begin_test "ghe-rsync-feature-checker for know command --help" +begin_test "ghe-rsync-feature-checker.sh for know command --help" ( set -e - # Test ghe-rsync-feature-checker command - ghe-rsync-feature-checker "--help" | grep -q "true" + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh --help | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker for know command help" +begin_test "ghe-rsync-feature-checker.sh for know command help" ( set -e - # Test ghe-rsync-feature-checker command - ghe-rsync-feature-checker "help" | grep -q "true" + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh "help" | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker for known unsupported command --ignore-missing-args" +begin_test "ghe-rsync-feature-checker.sh for known unsupported command --ignore-missing-args" ( set -e - # Test ghe-rsync-feature-checker command - ghe-rsync-feature-checker "--ignore-missing-args" | grep -q "false" + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh "--ignore-missing-args" | grep -q "false" ) end_test -begin_test "ghe-rsync-feature-checker for known unsupported command ignore-missing-args" +begin_test "ghe-rsync-feature-checker.sh for known unsupported command ignore-missing-args" ( set -e - # Test ghe-rsync-feature-checker command - ghe-rsync-feature-checker "ignore-missing-args" | grep -q "false" + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh "ignore-missing-args" | grep -q "false" ) end_test \ No newline at end of file From 5f18af6d394c234440777b1ea6f6a90b9f90ffc9 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Thu, 4 May 2023 13:46:21 -0400 Subject: [PATCH 375/946] Fixed bugs with feature checker and tests - Changed the command to remove leading dashes to `sed -E 's/^-+//'` - Change the grep for rsync command to `\B-+($rsync_command)\b` - Updated the tests to test more flags - v - verbose - partial - not-an-actual-feature --- .../ghe-rsync-feature-checker.sh | 9 +- test/test-ghe-rsync-feature-checker.sh | 83 +++++++++++++++++-- 2 files changed, 78 insertions(+), 14 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync-feature-checker.sh b/share/github-backup-utils/ghe-rsync-feature-checker.sh index 62b96fd2f..0fc222911 100755 --- a/share/github-backup-utils/ghe-rsync-feature-checker.sh +++ b/share/github-backup-utils/ghe-rsync-feature-checker.sh @@ -6,14 +6,13 @@ set -o pipefail -# set the variable from the first argument -rsync_command="$1" +# set the variable from the first argument and remove any leading dashes +rsync_command=$(echo "$1" | sed -E 's/^-+//') -# strip - and -- from the passed rsync command -rsync_command="${rsync_command/-/}" && rsync_command="${rsync_command/-/}" +echo "rsync_command: $rsync_command" # check if the passed rsync command is supported by the current version of rsync -if rsync -h | grep -E "\b$rsync_command\b" >/dev/null 2>&1; then +if rsync -h | grep -E "\B-+($rsync_command)\b" >/dev/null 2>&1; then echo "true" else echo "false" diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index 9ccbff2e4..83864b275 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -6,7 +6,9 @@ TESTS_DIR="$PWD/$(dirname "$0")" # shellcheck source=test/testlib.sh . "$TESTS_DIR/testlib.sh" -begin_test "ghe-rsync-feature-checker.sh for know command --help" +## testing for known supported command help with and without leading dashes + +begin_test "ghe-rsync-feature-checker.sh for know command --help" ( set -e @@ -15,29 +17,92 @@ begin_test "ghe-rsync-feature-checker.sh for know command --help" ) end_test -begin_test "ghe-rsync-feature-checker.sh for know command help" +begin_test "ghe-rsync-feature-checker.sh for know command help" ( set -e # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh "help" | grep -q "true" + ghe-rsync-feature-checker.sh help | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker.sh for known unsupported command --ignore-missing-args" +## testing for known unsupported command not-an-actual-feature with and without leading dashes + +begin_test "ghe-rsync-feature-checker.sh for known unsupported command --not-an-actual-feature" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh "--ignore-missing-args" | grep -q "false" + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh --not-an-actual-feature | grep -q "false" + ) end_test -begin_test "ghe-rsync-feature-checker.sh for known unsupported command ignore-missing-args" +begin_test "ghe-rsync-feature-checker.sh for known unsupported command not-an-actual-feature" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh "ignore-missing-args" | grep -q "false" + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh not-an-actual-feature | grep -q "false" +) +end_test + +## testing for known supported command partial with and without leading dashes + +begin_test "ghe-rsync-feature-checker.sh for know command --partial" +( + set -e + + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh --partial | grep -q "true" +) +end_test + +begin_test "ghe-rsync-feature-checker.sh for know command partial" +( + set -e + + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh partial | grep -q "true" +) +end_test + +## testing for known supported command -v with and without leading dashes + +begin_test "ghe-rsync-feature-checker.sh for know command -v" +( + set -e + + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh -v | grep -q "true" +) +end_test + +begin_test "ghe-rsync-feature-checker.sh for know command -v" +( + set -e + + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh v | grep -q "true" +) +end_test + +## testing for known supported command --verbose with and without leading dashes + +begin_test "ghe-rsync-feature-checker.sh for know command --verbose" +( + set -e + + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh --verbose | grep -q "true" +) +end_test + +begin_test "ghe-rsync-feature-checker.sh for know command verbose" +( + set -e + + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh verbose | grep -q "true" ) end_test \ No newline at end of file From e3cc4d6999cd0be1a9e8297283c9791c11e92a57 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Thu, 4 May 2023 13:46:46 -0400 Subject: [PATCH 376/946] Removed debug command from testing feature checker --- share/github-backup-utils/ghe-rsync-feature-checker.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync-feature-checker.sh b/share/github-backup-utils/ghe-rsync-feature-checker.sh index 0fc222911..2ce7cdd61 100755 --- a/share/github-backup-utils/ghe-rsync-feature-checker.sh +++ b/share/github-backup-utils/ghe-rsync-feature-checker.sh @@ -9,8 +9,6 @@ set -o pipefail # set the variable from the first argument and remove any leading dashes rsync_command=$(echo "$1" | sed -E 's/^-+//') -echo "rsync_command: $rsync_command" - # check if the passed rsync command is supported by the current version of rsync if rsync -h | grep -E "\B-+($rsync_command)\b" >/dev/null 2>&1; then echo "true" From 6fdb5a85192938df54480189f596186fa4f5e7e3 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Thu, 4 May 2023 14:01:13 -0400 Subject: [PATCH 377/946] Adding back test for `ignore-missing-args` --- test/test-ghe-rsync-feature-checker.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index 83864b275..10a197080 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -105,4 +105,24 @@ begin_test "ghe-rsync-feature-checker.sh for know command verbose" # Test ghe-rsync-feature-checker.sh command ghe-rsync-feature-checker.sh verbose | grep -q "true" ) +end_test + +## testing for known supported command ignore-missing-args with and without leading dashes + +begin_test "ghe-rsync-feature-checker.sh for known supported command --ignore-missing-args" +( + set -e + + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh "--ignore-missing-args" | grep -q "true" +) +end_test + +begin_test "ghe-rsync-feature-checker.sh for known supported command ignore-missing-args" +( + set -e + + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh "ignore-missing-args" | grep -q "true" +) end_test \ No newline at end of file From a99d32752e165477aa114c80229865f2ad957b3b Mon Sep 17 00:00:00 2001 From: Diana Date: Thu, 4 May 2023 14:14:14 -0400 Subject: [PATCH 378/946] Updating test-ghe-rsync-feature-checker.sh - Updated formatting - Updated verbiage --- test/test-ghe-rsync-feature-checker.sh | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index 10a197080..de4ee2e75 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# ghe-rsync-feature-checker.sh command tests +# ghe-rsync-feature-checker.sh command tests TESTS_DIR="$PWD/$(dirname "$0")" # Bring in testlib. @@ -8,20 +8,20 @@ TESTS_DIR="$PWD/$(dirname "$0")" ## testing for known supported command help with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for know command --help" +begin_test "ghe-rsync-feature-checker.sh for known supported command --help" ( - set -e + set -e - # Test ghe-rsync-feature-checker.sh command + # Test ghe-rsync-feature-checker.sh command ghe-rsync-feature-checker.sh --help | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker.sh for know command help" +begin_test "ghe-rsync-feature-checker.sh for known supported command help" ( set -e - # Test ghe-rsync-feature-checker.sh command + # Test ghe-rsync-feature-checker.sh command ghe-rsync-feature-checker.sh help | grep -q "true" ) end_test @@ -49,7 +49,7 @@ end_test ## testing for known supported command partial with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for know command --partial" +begin_test "ghe-rsync-feature-checker.sh for known supported command --partial" ( set -e @@ -58,7 +58,7 @@ begin_test "ghe-rsync-feature-checker.sh for know command --partial" ) end_test -begin_test "ghe-rsync-feature-checker.sh for know command partial" +begin_test "ghe-rsync-feature-checker.sh for known supported command partial" ( set -e @@ -69,7 +69,7 @@ end_test ## testing for known supported command -v with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for know command -v" +begin_test "ghe-rsync-feature-checker.sh for known supported command -v" ( set -e @@ -78,7 +78,7 @@ begin_test "ghe-rsync-feature-checker.sh for know command -v" ) end_test -begin_test "ghe-rsync-feature-checker.sh for know command -v" +begin_test "ghe-rsync-feature-checker.sh for known supported command v" ( set -e @@ -89,7 +89,7 @@ end_test ## testing for known supported command --verbose with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for know command --verbose" +begin_test "ghe-rsync-feature-checker.sh for known supported command --verbose" ( set -e @@ -98,7 +98,7 @@ begin_test "ghe-rsync-feature-checker.sh for know command --verbose" ) end_test -begin_test "ghe-rsync-feature-checker.sh for know command verbose" +begin_test "ghe-rsync-feature-checker.sh for known supported command verbose" ( set -e @@ -109,20 +109,20 @@ end_test ## testing for known supported command ignore-missing-args with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for known supported command --ignore-missing-args" +begin_test "ghe-rsync-feature-checker.sh for known supported command --ignore-missing-args" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh "--ignore-missing-args" | grep -q "true" + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh "--ignore-missing-args" | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker.sh for known supported command ignore-missing-args" +begin_test "ghe-rsync-feature-checker.sh for known supported command ignore-missing-args" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh "ignore-missing-args" | grep -q "true" + # Test ghe-rsync-feature-checker.sh command + ghe-rsync-feature-checker.sh "ignore-missing-args" | grep -q "true" ) -end_test \ No newline at end of file +end_test From 8f8f4aaed758356ea85ad3bcadca706bce5da4c4 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 4 May 2023 15:04:25 -0700 Subject: [PATCH 379/946] Add test for host info output --- test/test-ghe-backup.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 0fc3a125a..897213d4a 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -734,3 +734,16 @@ begin_test "ghe-backup fix_paths_for_ghe_version newer/older" done ) end_test + +# Check that information on system where backup-utils is installed is collected +begin_test "ghe-backup collects information on system where backup-utils is installed" +( + set -e + + output=$(ghe-backup) + echo "$output" | grep "Running on: $(cat /etc/issue.net)" + echo "$output" | grep "CPUs: $(nproc)" + echo "$output" | grep "Memory total/used/free+share/buff/cache:" + +) +end_test From 0b14b01171574459dd744d991cb5246ce219d67e Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 4 May 2023 15:05:50 -0700 Subject: [PATCH 380/946] Update ghe-backup with host info gathering --- bin/ghe-backup | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bin/ghe-backup b/bin/ghe-backup index 5696e9856..c44b2d6fc 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -155,6 +155,30 @@ if [ -n "$GHE_ALLOW_REPLICA_BACKUP" ]; then echo "Warning: backing up a high availability replica may result in inconsistent or unreliable backups." fi +# Output system information of the backup host + +# If /etc/issue.net exists, use it to get the OS version +if [ -f /etc/issue.net ]; then + echo "Running on: $(cat /etc/issue.net)" +else + echo "Running on: Unknown OS" +fi + +# If nproc command exists, use it to get the number of CPUs +if command -v nproc >/dev/null 2>&1; then + echo "CPUs: $(nproc)" +else + echo "CPUs: Unknown" +fi + +# If the free command exists, use it to get the memory details +if command -v free >/dev/null 2>&1; then + echo "Memory $(free -m | grep '^Mem:' | awk '{print "total/used/free+share/buff/cache: " $2 "/" $3 "/" $4 "+" $5 "/" $6 "/" $7}')" +else + echo "Memory: Unknown" +fi + + # Log backup start message in /var/log/syslog on remote instance ghe_remote_logger "Starting backup from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP ..." From 30e7db55ae32065c7f37a949ad62c638603b2846 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Fri, 5 May 2023 09:20:16 -0400 Subject: [PATCH 381/946] Normalizing file names and extensions & Updates - Updating naming and formatting - Normalizing testing naming - Added reasoning for not testing parameters with feature checker --- bin/ghe-host-check | 4 +- share/github-backup-utils/ghe-rsync | 15 ++-- ...e-checker.sh => ghe-rsync-feature-checker} | 0 .../{ghe-rsync-size.sh => ghe-rsync-size} | 0 test/test-ghe-rsync-feature-checker.sh | 84 +++++++++---------- 5 files changed, 53 insertions(+), 50 deletions(-) rename share/github-backup-utils/{ghe-rsync-feature-checker.sh => ghe-rsync-feature-checker} (100%) rename share/github-backup-utils/{ghe-rsync-size.sh => ghe-rsync-size} (100%) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index d9679386a..6a2a66357 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -153,8 +153,8 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt" #source disk size file - # shellcheck source=share/github-backup-utils/ghe-rsync-size.sh - . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size.sh" + # shellcheck source=share/github-backup-utils/ghe-rsync-size + . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size" #Display dir requirements for repositories and mysql echo "Checking host for sufficient space for a backup..." 1>&2 diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index b7c884c4d..d957068ac 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -11,6 +11,7 @@ set -o pipefail # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" +# Don't use the feature checker for expected parameters as it can cause issues with server paths # Check for --ignore-missing-args parameter support and remove if unavailable. if rsync -h | grep '\-\-ignore-missing-args' >/dev/null 2>&1; then parameters=("$@") @@ -20,19 +21,21 @@ else done fi -# This prepends `--trust-sender` to the parameters if supported by the current version of rsync to mitigate the degradation of performance due to the resolution of CVE-2022-29154 -# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh +# This prepends `--trust-sender` to the parameters if supported by the current version of rsync +# to mitigate the degradation of performance due to the resolution of CVE-2022-29154 +# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker # shellcheck disable=SC2046 -if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh --trust-sender)" == "true" ]; then +if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker --trust-sender)" == "true" ]; then parameters=("--trust-sender" "${parameters[@]}") fi -# This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them to the parameters and skip adding if already present in the parameters -# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh +# This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them +# to the parameters and skip adding if already present in the parameters +# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker # shellcheck disable=SC2046 if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then for extra_opt in $GHE_EXTRA_RSYNC_OPTS; do - if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh "$extra_opt")" == "true" ]; then + if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker "$extra_opt")" == "true" ]; then parameters+=("$extra_opt") fi done diff --git a/share/github-backup-utils/ghe-rsync-feature-checker.sh b/share/github-backup-utils/ghe-rsync-feature-checker similarity index 100% rename from share/github-backup-utils/ghe-rsync-feature-checker.sh rename to share/github-backup-utils/ghe-rsync-feature-checker diff --git a/share/github-backup-utils/ghe-rsync-size.sh b/share/github-backup-utils/ghe-rsync-size similarity index 100% rename from share/github-backup-utils/ghe-rsync-size.sh rename to share/github-backup-utils/ghe-rsync-size diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index de4ee2e75..44ea3aeab 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# ghe-rsync-feature-checker.sh command tests +# ghe-rsync-feature-checker command tests TESTS_DIR="$PWD/$(dirname "$0")" # Bring in testlib. @@ -8,121 +8,121 @@ TESTS_DIR="$PWD/$(dirname "$0")" ## testing for known supported command help with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for known supported command --help" +begin_test "Testing ghe-rsync-feature-checker for known supported command --help" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh --help | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker --help | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker.sh for known supported command help" +begin_test "Testing ghe-rsync-feature-checker with known supported command help" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh help | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker help | grep -q "true" ) end_test -## testing for known unsupported command not-an-actual-feature with and without leading dashes +## testing with known unsupported command not-an-actual-feature with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for known unsupported command --not-an-actual-feature" +begin_test "Testing ghe-rsync-feature-checker with known unsupported command --not-an-actual-feature" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh --not-an-actual-feature | grep -q "false" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker --not-an-actual-feature | grep -q "false" ) end_test -begin_test "ghe-rsync-feature-checker.sh for known unsupported command not-an-actual-feature" +begin_test "Testing ghe-rsync-feature-checker with known unsupported command not-an-actual-feature" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh not-an-actual-feature | grep -q "false" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker not-an-actual-feature | grep -q "false" ) end_test -## testing for known supported command partial with and without leading dashes +## testing with known supported command partial with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for known supported command --partial" +begin_test "Testing ghe-rsync-feature-checker with known supported command --partial" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh --partial | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker --partial | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker.sh for known supported command partial" +begin_test "Testing ghe-rsync-feature-checker with known supported command partial" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh partial | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker partial | grep -q "true" ) end_test -## testing for known supported command -v with and without leading dashes +## testing with known supported command -v with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for known supported command -v" +begin_test "Testing ghe-rsync-feature-checker with known supported command -v" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh -v | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker -v | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker.sh for known supported command v" +begin_test "Testing ghe-rsync-feature-checker with known supported command v" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh v | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker v | grep -q "true" ) end_test -## testing for known supported command --verbose with and without leading dashes +## testing with known supported command --verbose with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for known supported command --verbose" +begin_test "Testing ghe-rsync-feature-checker with known supported command --verbose" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh --verbose | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker --verbose | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker.sh for known supported command verbose" +begin_test "Testing ghe-rsync-feature-checker with known supported command verbose" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh verbose | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker verbose | grep -q "true" ) end_test -## testing for known supported command ignore-missing-args with and without leading dashes +## testing with known supported command ignore-missing-args with and without leading dashes -begin_test "ghe-rsync-feature-checker.sh for known supported command --ignore-missing-args" +begin_test "Testing ghe-rsync-feature-checker with known supported command --ignore-missing-args" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh "--ignore-missing-args" | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker "--ignore-missing-args" | grep -q "true" ) end_test -begin_test "ghe-rsync-feature-checker.sh for known supported command ignore-missing-args" +begin_test "Testing ghe-rsync-feature-checker with known supported command ignore-missing-args" ( set -e - # Test ghe-rsync-feature-checker.sh command - ghe-rsync-feature-checker.sh "ignore-missing-args" | grep -q "true" + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker "ignore-missing-args" | grep -q "true" ) end_test From 9e95cfd6c586712b55832ee34059197b668bef82 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Fri, 5 May 2023 11:32:08 -0400 Subject: [PATCH 382/946] Simplified language Reverted the minimum requirement back to 2.6.4 and also made it clear for which versions of rsync a customer may run into problems with their backup host. --- docs/requirements.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/requirements.md b/docs/requirements.md index 8f57decab..2161bbed4 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,7 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v3.2.5 or newer, and [jq][11] v1.5 or newer. See below for an update on rsync. +Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), and [jq][11] v1.5 or newer. See below for an update on rsync. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. @@ -13,15 +13,17 @@ We encourage the use of [Docker](docker.md), as it ensures compatible versions o The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. -### Update April 2023 - rsync requirements +### April 2023 Update of Rsync Requirements -We have updated the minimum required version of rsync from `2.6.4` to `3.2.5`. This change was required due to the [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) causing _severe_ performance degradation to `backup-utils`. The only way to avoid this degradation is to use the `--trust-sender` flag, and since this flag is only available from rsync v3.2.5 onwards, we have updated the minimum required version of rsync. +The [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) can cause severe performance degradation to `backup-utils`. -Unfortunately the situation is a little more complicated. If you are running an older version of rsync (i.e. < v3.2.5) you _might_ be ok. +If you encounter this degradation you can mitigate it by using the `--trust-sender` flag, which is available in rsync >= v3.2.5. -It depends on whether the rsync package you are using on your backup host has backported the fix for CVE-2022-29154 without backporting the `--trust-sender` flag. +If your backup host is running rsync < v3.2.5 you may or may not need to make changes to you rsync package, depending on whether your rsync package has backported the fix for CVE-2022-29154 without also backporting the `--trust-sender` flag. -If your backup host is running an rsync package that has backported the CVE fix without backporting the `--trust-sender` flag then you have three options: +If your rsync package has backported the CVE fix _and_ the `--trust-sender` flag then you don't need to change anything. + +However, if your rsync package has backported the CVE fix without backporting the `--trust-sender` flag then you have three options: 1. Downgrade (using the package manager on your host) the rsync package to a version before the CVE fix was backported 2. Upgrade (using the package manager on your host) the rsync package to v3.2.5 or newer From 27d227279cc70c9f40c3e404524a53480b1b26e8 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Fri, 5 May 2023 11:32:48 -0400 Subject: [PATCH 383/946] Reverting min version of rsync to 2.6.4 I will update the description of my PR to explain why I made this change. --- share/github-backup-utils/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/requirements.txt b/share/github-backup-utils/requirements.txt index 2ad762c0e..acf767129 100644 --- a/share/github-backup-utils/requirements.txt +++ b/share/github-backup-utils/requirements.txt @@ -1,3 +1,3 @@ -min_rsync=3.2.5 +min_rsync=2.6.4 min_openssh=5.6 min_jq=1.5 From f5071c749d174e5a7251767692ea3a30c793a2ad Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Fri, 5 May 2023 15:20:20 -0400 Subject: [PATCH 384/946] Bug fix with feature checker - This would allow -help to work even though it's not a valid command --- .../ghe-rsync-feature-checker | 42 ++++++++++++++++--- test/test-ghe-rsync-feature-checker.sh | 37 ++++++++++++++++ 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync-feature-checker b/share/github-backup-utils/ghe-rsync-feature-checker index 2ce7cdd61..afc86f1c1 100755 --- a/share/github-backup-utils/ghe-rsync-feature-checker +++ b/share/github-backup-utils/ghe-rsync-feature-checker @@ -7,11 +7,41 @@ set -o pipefail # set the variable from the first argument and remove any leading dashes -rsync_command=$(echo "$1" | sed -E 's/^-+//') +rsync_command=$1 -# check if the passed rsync command is supported by the current version of rsync -if rsync -h | grep -E "\B-+($rsync_command)\b" >/dev/null 2>&1; then - echo "true" +# extract dashes if present into variable +leading_dashes=$(echo "$rsync_command" | grep -oE "^-+") + +# this normalizes the passed command by removing any leading dashes +normalized_command=$(echo "$rsync_command" | sed -E "s/^-+//") + +# this checks the rsync command and returns the found command if it is valid +found_command=$(rsync -h | grep -oE "\B-+($normalized_command)\b" | head -n "1") + +# this is the normalized found command +normalized_found_command=$(echo "$found_command" | sed -E "s/^-+//") + +## Check if $leading_dashes is either - or -- +if [ "$leading_dashes" == "-" ]; then + # check if the passed rsync command is valid and supported or if the normalized command is valid and supported + if [ "$rsync_command" == "$found_command" ]; then + echo "true" + else + echo "false" + fi +elif [ "$leading_dashes" == "--" ]; then + # check if the passed rsync command is valid and supported or if the normalized command is valid and supported + if [ "$rsync_command" == "$found_command" ]; then + echo "true" + else + echo "false" + fi else - echo "false" -fi \ No newline at end of file + # check if the passed rsync command is valid and supported or if the normalized command is valid and supported + if [ "$rsync_command" == "$normalized_found_command" ]; then + echo "true" + else + echo "false" + fi +fi + diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index 44ea3aeab..6b4fc862e 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -17,6 +17,18 @@ begin_test "Testing ghe-rsync-feature-checker for known supported command --help ) end_test +<<<<<<< Updated upstream +======= +begin_test "Testing ghe-rsync-feature-checker for known supported command -help" +( + set -e + + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker -help | grep -q "false" +) +end_test + +>>>>>>> Stashed changes begin_test "Testing ghe-rsync-feature-checker with known supported command help" ( set -e @@ -38,6 +50,19 @@ begin_test "Testing ghe-rsync-feature-checker with known unsupported command --n ) end_test +<<<<<<< Updated upstream +======= +begin_test "Testing ghe-rsync-feature-checker with known unsupported command -not-an-actual-feature" +( + set -e + + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker -not-an-actual-feature | grep -q "false" + +) +end_test + +>>>>>>> Stashed changes begin_test "Testing ghe-rsync-feature-checker with known unsupported command not-an-actual-feature" ( set -e @@ -98,6 +123,18 @@ begin_test "Testing ghe-rsync-feature-checker with known supported command --ver ) end_test +<<<<<<< Updated upstream +======= +begin_test "Testing ghe-rsync-feature-checker with known supported command -verbose" +( + set -e + + # Test ghe-rsync-feature-checker command + ghe-rsync-feature-checker -verbose | grep -q "false" +) +end_test + +>>>>>>> Stashed changes begin_test "Testing ghe-rsync-feature-checker with known supported command verbose" ( set -e From 34b99614f6d5e30205870a9e90c04ca9ad314ced Mon Sep 17 00:00:00 2001 From: Diana Date: Fri, 5 May 2023 15:36:56 -0400 Subject: [PATCH 385/946] Removed conflict markers from test file --- test/test-ghe-rsync-feature-checker.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index 6b4fc862e..2051e59e3 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -17,8 +17,6 @@ begin_test "Testing ghe-rsync-feature-checker for known supported command --help ) end_test -<<<<<<< Updated upstream -======= begin_test "Testing ghe-rsync-feature-checker for known supported command -help" ( set -e @@ -28,7 +26,6 @@ begin_test "Testing ghe-rsync-feature-checker for known supported command -help" ) end_test ->>>>>>> Stashed changes begin_test "Testing ghe-rsync-feature-checker with known supported command help" ( set -e @@ -50,8 +47,6 @@ begin_test "Testing ghe-rsync-feature-checker with known unsupported command --n ) end_test -<<<<<<< Updated upstream -======= begin_test "Testing ghe-rsync-feature-checker with known unsupported command -not-an-actual-feature" ( set -e @@ -62,7 +57,6 @@ begin_test "Testing ghe-rsync-feature-checker with known unsupported command -no ) end_test ->>>>>>> Stashed changes begin_test "Testing ghe-rsync-feature-checker with known unsupported command not-an-actual-feature" ( set -e @@ -123,8 +117,6 @@ begin_test "Testing ghe-rsync-feature-checker with known supported command --ver ) end_test -<<<<<<< Updated upstream -======= begin_test "Testing ghe-rsync-feature-checker with known supported command -verbose" ( set -e @@ -134,7 +126,6 @@ begin_test "Testing ghe-rsync-feature-checker with known supported command -verb ) end_test ->>>>>>> Stashed changes begin_test "Testing ghe-rsync-feature-checker with known supported command verbose" ( set -e From 80a3f33946ccd65cf690b513d74725c38eda71a0 Mon Sep 17 00:00:00 2001 From: Diana Date: Fri, 5 May 2023 15:48:10 -0400 Subject: [PATCH 386/946] Update test-ghe-rsync-feature-checker.sh - Fixed tests names --- test/test-ghe-rsync-feature-checker.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test-ghe-rsync-feature-checker.sh b/test/test-ghe-rsync-feature-checker.sh index 2051e59e3..16a18f815 100755 --- a/test/test-ghe-rsync-feature-checker.sh +++ b/test/test-ghe-rsync-feature-checker.sh @@ -8,7 +8,7 @@ TESTS_DIR="$PWD/$(dirname "$0")" ## testing for known supported command help with and without leading dashes -begin_test "Testing ghe-rsync-feature-checker for known supported command --help" +begin_test "Testing ghe-rsync-feature-checker with known supported command --help" ( set -e @@ -17,7 +17,7 @@ begin_test "Testing ghe-rsync-feature-checker for known supported command --help ) end_test -begin_test "Testing ghe-rsync-feature-checker for known supported command -help" +begin_test "Testing ghe-rsync-feature-checker with known unsupported command -help" ( set -e @@ -117,7 +117,7 @@ begin_test "Testing ghe-rsync-feature-checker with known supported command --ver ) end_test -begin_test "Testing ghe-rsync-feature-checker with known supported command -verbose" +begin_test "Testing ghe-rsync-feature-checker with known unsupported command -verbose" ( set -e From 12cebe598659c63524d5fbd08d74f01fc02cfe53 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 11:41:41 +0200 Subject: [PATCH 387/946] Add version and size to restore --- .github/workflows/restore.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 24f1aa061..2f961ddd3 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -26,6 +26,16 @@ on: description: 'Hostname of the server' required: true type: string + size: + description: 'Size of the dataset to restore (small/medium)' + required: false + default: 'small' + type: string + version: + description: 'Version of the dataset to restore (3.8/3.9)' + required: false + default: '3.8' + type: string ref: description: 'Branch ref to use' required: false @@ -69,8 +79,8 @@ jobs: az storage blob download \ --account-name ghesresults \ --container-name ghes-data \ - --name v3.8-small-docs.tar.gz \ - --file ghes-data/3.8-small-docs.tar.gz \ + --name v{{ inputs.version }}-{{ inputs.size }}.tar.gz \ + --file ghes-data/{{ inputs.version }}-{{ inputs.size }}.tar.gz \ --connection-string "${{ secrets.CONNECTIONSTRING }}" - name: Unzip backup and setup symlink @@ -78,7 +88,7 @@ jobs: mkdir "$HOME/ghe-backup-data" dir_name=$(date +%s) mkdir "$HOME/ghe-backup-data/$dir_name" - tar -xvf "ghes-data/3.8-small-docs.tar.gz" -C "$HOME/ghe-backup-data/$dir_name" + tar -xvf "ghes-data/{{ inputs.version }}-{{ inputs.size }}.tar.gz" -C "$HOME/ghe-backup-data/$dir_name" ln -s "$dir_name" "$HOME/ghe-backup-data/current" @@ -89,7 +99,7 @@ jobs: run: chmod 0600 "$HOME/backup" - name: change version - run: echo "3.8.0" > "$HOME/version" + run: echo "{{ inputs.version }}.0" > "$HOME/version" - name: Prepare for restore run: ssh -p122 -i "$HOME/backup" -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" From fb3a4cd376c21c84de45d43031fa3417a77b097b Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 11:57:45 +0200 Subject: [PATCH 388/946] Change filename --- .github/workflows/restore.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 2f961ddd3..f83d45c32 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -76,11 +76,12 @@ jobs: - name: Download from blob storage run: | mkdir ghes-data + filename="v{{ inputs.version }}-{{ inputs.size }}.tar.gz" az storage blob download \ --account-name ghesresults \ --container-name ghes-data \ - --name v{{ inputs.version }}-{{ inputs.size }}.tar.gz \ - --file ghes-data/{{ inputs.version }}-{{ inputs.size }}.tar.gz \ + --name "$filename" \ + --file "ghes-data/$filename" \ --connection-string "${{ secrets.CONNECTIONSTRING }}" - name: Unzip backup and setup symlink @@ -88,7 +89,8 @@ jobs: mkdir "$HOME/ghe-backup-data" dir_name=$(date +%s) mkdir "$HOME/ghe-backup-data/$dir_name" - tar -xvf "ghes-data/{{ inputs.version }}-{{ inputs.size }}.tar.gz" -C "$HOME/ghe-backup-data/$dir_name" + filename="v{{ inputs.version }}-{{ inputs.size }}.tar.gz" + tar -xvf "ghes-data/$filename" -C "$HOME/ghe-backup-data/$dir_name" ln -s "$dir_name" "$HOME/ghe-backup-data/current" From 0e3ee76e79294f6779ef41541a48e072df2f8dae Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 12:21:53 +0200 Subject: [PATCH 389/946] Get filename --- .github/workflows/restore.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index f83d45c32..67dbfaecf 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -73,10 +73,26 @@ jobs: - name: Load docker container run: docker load -i backup-utils.tar + - name: Find backup file version + id: file + run: | + file_version="{{ inputs.version }}" + V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" + + echo "$V3_8_COMPATIBLE" | tr " " '\n' | grep -F -q -x "{{ inputs.version }}" + + if [ $? -eq 0 ]; then + echo "Version $version is acceptable" + echo "version=3.8" >> $GITHUB_OUTPUT + else + echo "Version $version is not acceptable" + exit 1 + fi + - name: Download from blob storage run: | mkdir ghes-data - filename="v{{ inputs.version }}-{{ inputs.size }}.tar.gz" + filename="v{{ steps.file.outputs.version }}-{{ inputs.size }}.tar.gz" az storage blob download \ --account-name ghesresults \ --container-name ghes-data \ @@ -89,7 +105,8 @@ jobs: mkdir "$HOME/ghe-backup-data" dir_name=$(date +%s) mkdir "$HOME/ghe-backup-data/$dir_name" - filename="v{{ inputs.version }}-{{ inputs.size }}.tar.gz" + + filename="v{{ steps.file.outputs.version }}-{{ inputs.size }}.tar.gz" tar -xvf "ghes-data/$filename" -C "$HOME/ghe-backup-data/$dir_name" ln -s "$dir_name" "$HOME/ghe-backup-data/current" From 16e659f9900192e70492b275f4a80c503a8af671 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 12:38:02 +0200 Subject: [PATCH 390/946] Get filename --- .github/workflows/restore.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 67dbfaecf..bb4459942 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -79,13 +79,13 @@ jobs: file_version="{{ inputs.version }}" V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" - echo "$V3_8_COMPATIBLE" | tr " " '\n' | grep -F -q -x "{{ inputs.version }}" + echo "$V3_8_COMPATIBLE" | tr " " '\n' | grep -F -q -x "$file_version" if [ $? -eq 0 ]; then - echo "Version $version is acceptable" + echo "Version $file_version is acceptable" echo "version=3.8" >> $GITHUB_OUTPUT else - echo "Version $version is not acceptable" + echo "Version $file_version is not acceptable" exit 1 fi From 05889fbcb1009cab54f1d0c7fd5244bbe347ef01 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 12:43:48 +0200 Subject: [PATCH 391/946] add debugging --- .github/workflows/restore.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index bb4459942..c3040a128 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -77,6 +77,7 @@ jobs: id: file run: | file_version="{{ inputs.version }}" + echo "$file_version" V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" echo "$V3_8_COMPATIBLE" | tr " " '\n' | grep -F -q -x "$file_version" From 2e27160bffc5003a5d7d16f7b473556744f9b8db Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 12:50:45 +0200 Subject: [PATCH 392/946] More debugging --- .github/workflows/restore.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index c3040a128..607ce2ddc 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -76,7 +76,8 @@ jobs: - name: Find backup file version id: file run: | - file_version="{{ inputs.version }}" + file_version={{ inputs.version }} + size={{ inputs.size }}} echo "$file_version" V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" @@ -85,6 +86,7 @@ jobs: if [ $? -eq 0 ]; then echo "Version $file_version is acceptable" echo "version=3.8" >> $GITHUB_OUTPUT + echo "name=v$version-$size.tar.gz" >> $GITHUB_OUTPUT else echo "Version $file_version is not acceptable" exit 1 @@ -93,12 +95,11 @@ jobs: - name: Download from blob storage run: | mkdir ghes-data - filename="v{{ steps.file.outputs.version }}-{{ inputs.size }}.tar.gz" az storage blob download \ --account-name ghesresults \ --container-name ghes-data \ - --name "$filename" \ - --file "ghes-data/$filename" \ + --name {{ steps.file.outputs.name }} \ + --file ghes-data/{{ steps.file.outputs.name }} \ --connection-string "${{ secrets.CONNECTIONSTRING }}" - name: Unzip backup and setup symlink @@ -107,8 +108,7 @@ jobs: dir_name=$(date +%s) mkdir "$HOME/ghe-backup-data/$dir_name" - filename="v{{ steps.file.outputs.version }}-{{ inputs.size }}.tar.gz" - tar -xvf "ghes-data/$filename" -C "$HOME/ghe-backup-data/$dir_name" + tar -xvf ghes-data/{{ steps.file.outputs.name }} -C "$HOME/ghe-backup-data/$dir_name" ln -s "$dir_name" "$HOME/ghe-backup-data/current" From 5ac7abeb79085638b6e443ce86227f6a2650a127 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 12:54:55 +0200 Subject: [PATCH 393/946] Fix syntax --- .github/workflows/restore.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 607ce2ddc..e1e3f96c8 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -76,8 +76,8 @@ jobs: - name: Find backup file version id: file run: | - file_version={{ inputs.version }} - size={{ inputs.size }}} + file_version=${{ inputs.version }} + size=${{ inputs.size }}} echo "$file_version" V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" @@ -98,8 +98,8 @@ jobs: az storage blob download \ --account-name ghesresults \ --container-name ghes-data \ - --name {{ steps.file.outputs.name }} \ - --file ghes-data/{{ steps.file.outputs.name }} \ + --name "${{ steps.file.outputs.name }}" \ + --file "ghes-data/${{ steps.file.outputs.name }}" \ --connection-string "${{ secrets.CONNECTIONSTRING }}" - name: Unzip backup and setup symlink @@ -108,7 +108,7 @@ jobs: dir_name=$(date +%s) mkdir "$HOME/ghe-backup-data/$dir_name" - tar -xvf ghes-data/{{ steps.file.outputs.name }} -C "$HOME/ghe-backup-data/$dir_name" + tar -xvf "ghes-data/${{ steps.file.outputs.name }}" -C "$HOME/ghe-backup-data/$dir_name" ln -s "$dir_name" "$HOME/ghe-backup-data/current" @@ -119,7 +119,7 @@ jobs: run: chmod 0600 "$HOME/backup" - name: change version - run: echo "{{ inputs.version }}.0" > "$HOME/version" + run: echo "${{ inputs.version }}.0" > "$HOME/version" - name: Prepare for restore run: ssh -p122 -i "$HOME/backup" -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" From 191b3c287503b019a672e8f02ff3201590591164 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 13:00:13 +0200 Subject: [PATCH 394/946] Fix syntax --- .github/workflows/restore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index e1e3f96c8..c981a0f07 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -77,7 +77,7 @@ jobs: id: file run: | file_version=${{ inputs.version }} - size=${{ inputs.size }}} + size=${{ inputs.size }} echo "$file_version" V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" From f068233add27ee94956a6b11b41775662975b5ea Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 13:06:58 +0200 Subject: [PATCH 395/946] Fix syntax --- .github/workflows/restore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index c981a0f07..fb20d298f 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -86,7 +86,7 @@ jobs: if [ $? -eq 0 ]; then echo "Version $file_version is acceptable" echo "version=3.8" >> $GITHUB_OUTPUT - echo "name=v$version-$size.tar.gz" >> $GITHUB_OUTPUT + echo "name=v$file_version-$size.tar.gz" >> $GITHUB_OUTPUT else echo "Version $file_version is not acceptable" exit 1 From 02f4b78c9f705f53f66232dbcf8b3641276e3376 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 13:11:22 +0200 Subject: [PATCH 396/946] Fix syntax --- .github/workflows/restore.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index fb20d298f..5ef85b581 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -76,19 +76,19 @@ jobs: - name: Find backup file version id: file run: | - file_version=${{ inputs.version }} + version=${{ inputs.version }} size=${{ inputs.size }} - echo "$file_version" V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" - echo "$V3_8_COMPATIBLE" | tr " " '\n' | grep -F -q -x "$file_version" + echo "$V3_8_COMPATIBLE" | tr " " '\n' | grep -F -q -x "$version" if [ $? -eq 0 ]; then echo "Version $file_version is acceptable" + file_version=3.8 echo "version=3.8" >> $GITHUB_OUTPUT echo "name=v$file_version-$size.tar.gz" >> $GITHUB_OUTPUT else - echo "Version $file_version is not acceptable" + echo "Version $version is not acceptable" exit 1 fi From e461908aedcf6cfbb7e00ec2152b4711edaee4fe Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 13:19:37 +0200 Subject: [PATCH 397/946] Add input for dispatch --- .github/workflows/restore.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 5ef85b581..de439b83a 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -19,6 +19,11 @@ on: required: false type: string default: 'master' + version: + description: 'Version of the dataset to restore (3.8/3.9)' + required: false + default: '3.8' + type: string workflow_call: inputs: From 7c0c444a19c2f48a5a31fc68af9f17e157deac03 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 13:26:43 +0200 Subject: [PATCH 398/946] make linter happy --- .github/workflows/restore.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index de439b83a..8525adda8 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -81,14 +81,13 @@ jobs: - name: Find backup file version id: file run: | - version=${{ inputs.version }} - size=${{ inputs.size }} + version="${{ inputs.version }}" + size="${{ inputs.size }}" V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" - echo "$V3_8_COMPATIBLE" | tr " " '\n' | grep -F -q -x "$version" - - if [ $? -eq 0 ]; then - echo "Version $file_version is acceptable" + exit_code="$?" + if [ "$exit_code" -eq "0" ]; then + echo "Version $version is acceptable" file_version=3.8 echo "version=3.8" >> $GITHUB_OUTPUT echo "name=v$file_version-$size.tar.gz" >> $GITHUB_OUTPUT From c24d605cc14c957d9fc3374cf2283940e33815fb Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 13:33:48 +0200 Subject: [PATCH 399/946] make linter happy --- .github/workflows/restore.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 8525adda8..af01be7bc 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -89,8 +89,8 @@ jobs: if [ "$exit_code" -eq "0" ]; then echo "Version $version is acceptable" file_version=3.8 - echo "version=3.8" >> $GITHUB_OUTPUT - echo "name=v$file_version-$size.tar.gz" >> $GITHUB_OUTPUT + echo "version=3.8" >> "$GITHUB_OUTPUT" + echo "name=v$file_version-$size.tar.gz" >> "$GITHUB_OUTPUT" else echo "Version $version is not acceptable" exit 1 From bed4965bea9fb99fc1b060ffb9ec869f9cdb8fbf Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 9 May 2023 16:42:10 +0200 Subject: [PATCH 400/946] Point to xl group --- .github/workflows/restore.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index af01be7bc..7d7c5bb5e 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -67,7 +67,9 @@ jobs: restore: needs: build - runs-on: ubuntu-latest + runs-on: + group: larger-hosted-public-runners + labels: ubuntu-latest-xl env: SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} steps: From 6ca0f226aa92991034be403e4f0773b735e12e20 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Tue, 9 May 2023 13:38:39 -0400 Subject: [PATCH 401/946] Fix typo Thanks Quinn for spotting this! Co-authored-by: Quinn Murphy --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 2161bbed4..5bc0a3e51 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -19,7 +19,7 @@ The [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#n If you encounter this degradation you can mitigate it by using the `--trust-sender` flag, which is available in rsync >= v3.2.5. -If your backup host is running rsync < v3.2.5 you may or may not need to make changes to you rsync package, depending on whether your rsync package has backported the fix for CVE-2022-29154 without also backporting the `--trust-sender` flag. +If your backup host is running rsync < v3.2.5 you may or may not need to make changes to your rsync package, depending on whether your rsync package has backported the fix for CVE-2022-29154 without also backporting the `--trust-sender` flag. If your rsync package has backported the CVE fix _and_ the `--trust-sender` flag then you don't need to change anything. From 1ba55758444f67f8500210dc03ab0d9866291e12 Mon Sep 17 00:00:00 2001 From: Peter Kovacs <12162093+eptekov@users.noreply.github.com> Date: Wed, 10 May 2023 15:31:03 +0000 Subject: [PATCH 402/946] Adding new option to exclude Pages from backup and restore. --- backup.config-example | 3 +++ bin/ghe-backup | 10 ++++++---- bin/ghe-restore | 10 ++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/backup.config-example b/backup.config-example index 1e6d762f2..2ca0551fa 100644 --- a/backup.config-example +++ b/backup.config-example @@ -95,3 +95,6 @@ GHE_NUM_SNAPSHOTS=10 # When running an external mysql database, run this script to trigger a MySQL restore # rather than attempting to backup via backup-utils directly. #EXTERNAL_DATABASE_RESTORE_SCRIPT="/bin/false" + +# If set to 'yes', Pages data will be included in backup and restore. Defaults to 'yes' +#GHE_BACKUP_PAGES=no \ No newline at end of file diff --git a/bin/ghe-backup b/bin/ghe-backup index c44b2d6fc..8b7332880 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -238,10 +238,12 @@ commands+=(" echo \"$cmd_title\" ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") -cmd_title=$(log_info "Backing up GitHub Pages artifacts ...") -commands+=(" -echo \"$cmd_title\" -ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") +if [ "$GHE_BACKUP_PAGES" != "no" ]; then + cmd_title=$(log_info "Backing up GitHub Pages artifacts ...") + commands+=(" + echo \"$cmd_title\" + ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") +fi cmd_title=$(log_info "Backing up storage data ...") commands+=(" diff --git a/bin/ghe-restore b/bin/ghe-restore index 2f789357d..d93188599 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -459,10 +459,12 @@ commands+=(" echo \"$cmd_title\" ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") -cmd_title=$(log_info "Restoring Pages ...") -commands+=(" -echo \"$cmd_title\" -ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") +if [ "$GHE_BACKUP_PAGES" != "no" ]; then + cmd_title=$(log_info "Restoring Pages ...") + commands+=(" + echo \"$cmd_title\" + ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") +fi cmd_title=$(log_info "Restoring SSH authorized keys ...") commands+=(" From 16d602357495e4911245204ab7159e561116b422 Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Thu, 11 May 2023 15:57:12 +0800 Subject: [PATCH 403/946] wj --- .DS_Store | Bin 0 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c87e3f5030bc01edab5a7c20a9f56c8c5d2e8dca GIT binary patch literal 6148 zcmeHKze^lJ6n>-Yb1iCRR|L}QGm(Ty*n=2nqxR{znC36cy1s+M`c&q~719+dtCR%i8U9KT9#! zynFt(^||q5S^GPG_2*sjZCKwxD!m!-QkRY?RqQmwcdtaq8Xjg(2Q}29hLwzuQuR>6 z^-NL<6~5>?u1|&@$-nkg^837AHsq~)HQyccHK;?omUFwxn*Xl)CHMWs*LVzYo?!Xr5P|JzC}sr$NFm`40|D z{z}a77Z?|#>&SWiQ{d^+HY(Xw3QXMp)LvP`z1d#DlKkFUTO9ATG1^BoHjXPC+7xtt iJGKMfis#X+!58xYn0PE4Vg?re2v`|H7ZmuX3cLW&-}03J literal 0 HcmV?d00001 From 015e5ec64150eddcdda8c1bd4ae150d6dd89138d Mon Sep 17 00:00:00 2001 From: ghe-admin Date: Thu, 11 May 2023 16:01:42 +0800 Subject: [PATCH 404/946] wj --- .DS_Store | Bin 6148 -> 8196 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.DS_Store b/.DS_Store index c87e3f5030bc01edab5a7c20a9f56c8c5d2e8dca..528fc5cf95462431e79c40149c5e7fd2d0456e0b 100644 GIT binary patch literal 8196 zcmeHMy-yTD6n_IJoEY#cCNw73SwTXyvN~Wd<_szkC@f68FM)8!o_r{nXs)p`8WRgU zdn;-E1B{7@g?|IF*V0(%@6F8Z&D))&GzMqL?pyYK?EC%Rd@utMskz+gV za|$<4V?AG)He}yifmHA(+MpI~(K@ZtX2v?a2n+-U0t118z(8Q&Utj=hHn(EVx^J}M z9vBD={Fe;y{7}NhvTS9~NIiAnrndl)1-#Y`&)5fOpOTejD|<$2SHv{C2W4HA-C`)? z4tOdL9%Cop zs1yw*@4iANF*4pO ze!aZAG4he)IQr(1`tF(&`}!h(VxpfP)o2Gld^S<1T|BjDTjs2u!`{UN@l;b+>8(>u?gv|pmG)_h9_q84 zZ7>$orbJKgfyec{0H2!fKfBaLlm`3IeSH!%g*bcAcA#l{dz2e#7?IY~-_y16SV@*& zKSEa4-(|P@BVjku4p_}6;&qV$FaqXWvwLgj8RY8x4;8*eWEIsbrIckKqG1hoi>t^O)u8tdB z*h=1J`Hv@|ce#78m2j7`8Ss~9BRTAH&pLse*T9Q+brBgmmLlJw!%s4fo9(kVNw$uE zCm!VLw-A{YUU8=5sPQu0LCq@|=_{ywg=i_712UC^j`!LnT=#Hs zW4oS_+66Z@;rDtw4w?MJ5YHv6D_hw!5*oC>eh?7WfBdZ=)*A}zKegm4dHmP^KZgdu AfdBvi delta 162 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50D5wDBFoMK#(hY-?^K%O}7OrMy zRG6G6P(4{ykbiQLVB_S2LIsm&3wKODC{i)`tLWs(o5V^dcZyeV0`-9a2lvK8ahA>M pJP()!nIS>~+(6nDWX;CH@640=WjsNaGB80L0CE$<=6Iet%m6 Date: Thu, 11 May 2023 18:14:29 +0000 Subject: [PATCH 405/946] Revert "wj" This reverts commit 015e5ec64150eddcdda8c1bd4ae150d6dd89138d. --- .DS_Store | Bin 8196 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.DS_Store b/.DS_Store index 528fc5cf95462431e79c40149c5e7fd2d0456e0b..c87e3f5030bc01edab5a7c20a9f56c8c5d2e8dca 100644 GIT binary patch delta 162 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50D5wDBFoMK#(hY-?^K%O}7OrMy zRG6G6P(4{ykbiQLVB_S2LIsm&3wKODC{i)`tLWs(o5V^dcZyeV0`-9a2lvK8ahA>M pJP()!nIS>~+(6nDWX;CH@640=WjsNaGB80L0CE$<=6Iet%m6+gV za|$<4V?AG)He}yifmHA(+MpI~(K@ZtX2v?a2n+-U0t118z(8Q&Utj=hHn(EVx^J}M z9vBD={Fe;y{7}NhvTS9~NIiAnrndl)1-#Y`&)5fOpOTejD|<$2SHv{C2W4HA-C`)? z4tOdL9%Cop zs1yw*@4iANF*4pO ze!aZAG4he)IQr(1`tF(&`}!h(VxpfP)o2Gld^S<1T|BjDTjs2u!`{UN@l;b+>8(>u?gv|pmG)_h9_q84 zZ7>$orbJKgfyec{0H2!fKfBaLlm`3IeSH!%g*bcAcA#l{dz2e#7?IY~-_y16SV@*& zKSEa4-(|P@BVjku4p_}6;&qV$FaqXWvwLgj8RY8x4;8*eWEIsbrIckKqG1hoi>t^O)u8tdB z*h=1J`Hv@|ce#78m2j7`8Ss~9BRTAH&pLse*T9Q+brBgmmLlJw!%s4fo9(kVNw$uE zCm!VLw-A{YUU8=5sPQu0LCq@|=_{ywg=i_712UC^j`!LnT=#Hs zW4oS_+66Z@;rDtw4w?MJ5YHv6D_hw!5*oC>eh?7WfBdZ=)*A}zKegm4dHmP^KZgdu AfdBvi From 7c5e4d9cde1c6e6c74b3b3120915b45ac8ac7a24 Mon Sep 17 00:00:00 2001 From: bonsohi Date: Thu, 11 May 2023 18:14:44 +0000 Subject: [PATCH 406/946] Revert "wj" This reverts commit 16d602357495e4911245204ab7159e561116b422. --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index c87e3f5030bc01edab5a7c20a9f56c8c5d2e8dca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKze^lJ6n>-Yb1iCRR|L}QGm(Ty*n=2nqxR{znC36cy1s+M`c&q~719+dtCR%i8U9KT9#! zynFt(^||q5S^GPG_2*sjZCKwxD!m!-QkRY?RqQmwcdtaq8Xjg(2Q}29hLwzuQuR>6 z^-NL<6~5>?u1|&@$-nkg^837AHsq~)HQyccHK;?omUFwxn*Xl)CHMWs*LVzYo?!Xr5P|JzC}sr$NFm`40|D z{z}a77Z?|#>&SWiQ{d^+HY(Xw3QXMp)LvP`z1d#DlKkFUTO9ATG1^BoHjXPC+7xtt iJGKMfis#X+!58xYn0PE4Vg?re2v`|H7ZmuX3cLW&-}03J From b0862995a125bf12152f59b0c565591a7c1889e8 Mon Sep 17 00:00:00 2001 From: bonsohi Date: Thu, 11 May 2023 18:25:17 +0000 Subject: [PATCH 407/946] Said file will not be accidently added --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 246384181..2a123a949 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /backup.config /data /dist +.DS_Store From da320c9183ab4ee6bc6bce0e0fa065812a84719d Mon Sep 17 00:00:00 2001 From: Peter Kovacs <12162093+eptekov@users.noreply.github.com> Date: Thu, 11 May 2023 16:30:19 -0500 Subject: [PATCH 408/946] Adding comment to explain double-negative if condition --- bin/ghe-backup | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/ghe-backup b/bin/ghe-backup index 8b7332880..ad8147f82 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -238,6 +238,9 @@ commands+=(" echo \"$cmd_title\" ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") +# Pages backups are skipped only if GHE_BACKUP_PAGES is explicitly set to 'no' to guarantee backward compatibility. +# If a customer upgrades backup-utils but keeps the config file from a previous version, Pages backups still work as expected. + if [ "$GHE_BACKUP_PAGES" != "no" ]; then cmd_title=$(log_info "Backing up GitHub Pages artifacts ...") commands+=(" From cfa890d13b4a5004e4d519b7572f37c68f94bcdc Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 15 May 2023 13:17:00 -0400 Subject: [PATCH 409/946] Fix cleanup_cluster_nodes function in ghe-restore Resolves https://github.com/github/ghes/issues/6453 . cleanup_cluster_nodes is a function that runs remotely and therefore does not have access to our output options. --- bin/ghe-restore | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index d93188599..c0aae6ed9 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -135,6 +135,7 @@ cleanup () { } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. +# because it doesn't run locally does not redirect output to fd 3 or use log_info/log_warn/log_error. # shellcheck disable=SC2034 cleanup_cluster_nodes() { uuid="$1" @@ -143,18 +144,18 @@ cleanup_cluster_nodes() { exit 2 fi - log_info "Cleaning up spokes" 1>&3 + echo "Cleaning up spokes" ghe-spokes server evacuate "git-server-$uuid" 'Removing replica' ghe-spokes server destroy "git-server-$uuid" - log_info "Cleaning up storage" 1>&3 + echo "Cleaning up storage" ghe-storage destroy-host "storage-server-$uuid" --force - log_info "Cleaning up dpages" 1>&3 + echo "Cleaning up dpages" ghe-dpages offline "pages-server-$uuid" ghe-dpages remove "pages-server-$uuid" - log_info "Cleaning up redis" 1>&3 + echo "Cleaning up redis" ghe-redis-cli del "resque:queue:maint_git-server-$uuid" ghe-redis-cli srem resque:queues "maint_git-server-$uuid" } From 31a3951d25404252e309b4ac9503dbd18c26e257 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 16 May 2023 09:26:14 -0400 Subject: [PATCH 410/946] add -T Multi-line description of commit, feel free to be detailed. --- share/github-backup-utils/ghe-ssh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index 6f186771b..a0b7de945 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -83,4 +83,4 @@ $GHE_VERBOSE_SSH && set -x # Exec ssh command with modified host / port args and add nice to command. # shellcheck disable=SC2090 # We don't need the quote/backslashes respected -exec ssh $opts -p $port -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@" +exec ssh -T $opts -p $port -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@" From 74dc1b32c9cf8ab858f867ea74149f411995cc8b Mon Sep 17 00:00:00 2001 From: Ryan Trauntvein Date: Tue, 16 May 2023 18:58:40 +0000 Subject: [PATCH 411/946] Add a bit of performance best practices info --- docs/backup-snapshot-file-structure.md | 28 +++++++++++++++++++++++++- docs/requirements.md | 3 +++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/backup-snapshot-file-structure.md b/docs/backup-snapshot-file-structure.md index 2a950d63e..17ad3898e 100644 --- a/docs/backup-snapshot-file-structure.md +++ b/docs/backup-snapshot-file-structure.md @@ -61,4 +61,30 @@ T--T--T--T--T--T--T--T--T--T--T--T--T... (transaction log backup) ``` To save disk space, at each snapshot, hard links are created to point to previous backup files. Only newly-created backup files are transferred from appliance to backup host. When a new full/differential backup is created, they become the new source for hard links and new base line for transaction log backups, for subsequent snapshots. -During restore, a suite of backup files are restored in the sequence of full -> differential -> chronological transaction log. \ No newline at end of file +During restore, a suite of backup files are restored in the sequence of full -> differential -> chronological transaction log. + +## Benchmark data + +Benchmark data for each snapshot is stored as a log file within the `benchmarks` directory within a snapshot directory. The benchmark log can be used to determine the duration of each backup step. For example: + +```text +ghe-backup-store-version took 0s +ghe-backup-settings took 2s +ghe-export-authorized-keys took 0s +ghe-export-ssh-host-keys took 0s +ghe-backup-mysql-binary took 9s +ghe-backup-mysql took 9s +ghe-backup-minio took 0s +ghe-backup-redis took 1s +ghe-backup-es-audit-log took 1s +ghe-backup-repositories - Generating routes took 3s +ghe-backup-repositories - Fetching routes took 0s +ghe-backup-repositories - Processing routes took 0s +ghe-backup-pages - hostname took 1s +ghe-backup-pages took 1s +ghe-backup-storage - Generating routes took 2s +ghe-backup-storage - Fetching routes took 0s +ghe-backup-storage - Processing routes took 0s +ghe-backup-git-hooks took 0s +ghe-backup-es-rsync took 2s +``` diff --git a/docs/requirements.md b/docs/requirements.md index 5bc0a3e51..93a132297 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -13,6 +13,8 @@ We encourage the use of [Docker](docker.md), as it ensures compatible versions o The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. +CPU and memory requirements are dependent on the size of the GitHub Enterprise Server appliance. We recommend a minimum of 4 cores and 8GB of RAM for the host running [GitHub Enterprise Backup Utilities](https://github.com/github/backup-utils). We recommend monitoring the backup host's CPU and memory usage to ensure it is sufficient for your environment. + ### April 2023 Update of Rsync Requirements The [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) can cause severe performance degradation to `backup-utils`. @@ -53,6 +55,7 @@ ls -la Using a [case sensitive][7] file system is also required to avoid conflicts. +Performance of backup and restore operations are also dependent on the backup host's storage. We recommend using a high performance storage system for your data directory for best performance. ## GitHub Enterprise Server version requirements Starting with Backup Utilities v2.13.0, version support is inline with that of the From e800a578aa6d4635cf58b0a42a06a0baaf7182e7 Mon Sep 17 00:00:00 2001 From: Ryan Trauntvein Date: Tue, 16 May 2023 18:59:37 +0000 Subject: [PATCH 412/946] Missign newline --- docs/requirements.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/requirements.md b/docs/requirements.md index 93a132297..5d7b46a39 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -56,6 +56,7 @@ ls -la Using a [case sensitive][7] file system is also required to avoid conflicts. Performance of backup and restore operations are also dependent on the backup host's storage. We recommend using a high performance storage system for your data directory for best performance. + ## GitHub Enterprise Server version requirements Starting with Backup Utilities v2.13.0, version support is inline with that of the From 1314a62c5cb2f8f943562b6284c573f96ce82887 Mon Sep 17 00:00:00 2001 From: Ryan Trauntvein Date: Tue, 16 May 2023 19:05:50 +0000 Subject: [PATCH 413/946] Tweak redundant words --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 5d7b46a39..982230513 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -55,7 +55,7 @@ ls -la Using a [case sensitive][7] file system is also required to avoid conflicts. -Performance of backup and restore operations are also dependent on the backup host's storage. We recommend using a high performance storage system for your data directory for best performance. +Performance of backup and restore operations are also dependent on the backup host's storage. We recommend using a high performance storage system with low latency and high IOPS. ## GitHub Enterprise Server version requirements From 3533b5bbd67285987ffd6ba50f4b62820cb9a1e6 Mon Sep 17 00:00:00 2001 From: Ryan Trauntvein Date: Tue, 16 May 2023 19:11:24 +0000 Subject: [PATCH 414/946] Attempt to appease linter --- docs/backup-snapshot-file-structure.md | 4 +++- docs/requirements.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/backup-snapshot-file-structure.md b/docs/backup-snapshot-file-structure.md index 17ad3898e..0a7032397 100644 --- a/docs/backup-snapshot-file-structure.md +++ b/docs/backup-snapshot-file-structure.md @@ -52,13 +52,15 @@ Actions service uses MS SQL Server as backend data store. Each snapshot includes To save time in backup, a three-level backup strategy is implemented. Based on the `GHE_MSSQL_BACKUP_CADENCE` setting, at each snapshot, either a (**F**)ull backup, a (**D**)ifferential or a (**T**)ransaction log backup is taken. As a result, a suite always contains following for each database: a full backup, possibly a differential backup and at least one transaction log backup. Their relationship with timeline is demonstrated below: -``` + +```text M---8:00--16:00---T---8:00--16:00---W... (timeline) F-----------------F-----------------F... (full backup) #-----D-----D-----#-----D-----D-----#... (differential backup) T--T--T--T--T--T--T--T--T--T--T--T--T... (transaction log backup) ``` + To save disk space, at each snapshot, hard links are created to point to previous backup files. Only newly-created backup files are transferred from appliance to backup host. When a new full/differential backup is created, they become the new source for hard links and new base line for transaction log backups, for subsequent snapshots. During restore, a suite of backup files are restored in the sequence of full -> differential -> chronological transaction log. diff --git a/docs/requirements.md b/docs/requirements.md index 982230513..a7dc45ebe 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -17,7 +17,7 @@ CPU and memory requirements are dependent on the size of the GitHub Enterprise S ### April 2023 Update of Rsync Requirements -The [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) can cause severe performance degradation to `backup-utils`. +The [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) can cause severe performance degradation to `backup-utils`. If you encounter this degradation you can mitigate it by using the `--trust-sender` flag, which is available in rsync >= v3.2.5. From 60192d40960225615629709ff4d4e5f8fe67b660 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 17 May 2023 14:57:06 +0000 Subject: [PATCH 415/946] Make comment change --- bin/ghe-restore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 0f0330241..f2b13bc36 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -165,8 +165,7 @@ cleanup_cluster_nodes() { # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" -# Calculate the actual amounts of steps in the restore process -# taking into account the options passed to the script and the appliance configuration + @@ -271,7 +270,8 @@ if is_external_database_snapshot && ! $instance_configured && ! $FORCE; then prompt_for_confirmation "Please confirm this before continuing." fi - +# Calculate the actual amounts of steps in the restore process +# taking into account the options passed to the script and the appliance configuration # calculate restore steps OPTIONAL_STEPS=0 # Cluster restores add an additional step From 5f2437be6b75a487c99142c1ea14221e9e1d895a Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 17 May 2023 11:09:25 -0400 Subject: [PATCH 416/946] removing -T --- share/github-backup-utils/ghe-ssh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-ssh b/share/github-backup-utils/ghe-ssh index a0b7de945..6f186771b 100755 --- a/share/github-backup-utils/ghe-ssh +++ b/share/github-backup-utils/ghe-ssh @@ -83,4 +83,4 @@ $GHE_VERBOSE_SSH && set -x # Exec ssh command with modified host / port args and add nice to command. # shellcheck disable=SC2090 # We don't need the quote/backslashes respected -exec ssh -T $opts -p $port -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@" +exec ssh $opts -p $port -o BatchMode=yes "$host" -- $GHE_NICE $GHE_IONICE "$@" From 3b2f1c11476c4a84467b59d1564aaf56c5745eb8 Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Wed, 17 May 2023 20:11:26 +0000 Subject: [PATCH 417/946] add encrypted column encryption keys to backup utils --- share/github-backup-utils/ghe-backup-settings | 2 + .../github-backup-utils/ghe-restore-settings | 6 +++ test/test-ghe-backup.sh | 50 +++++++++++++++++ test/test-ghe-restore.sh | 53 ++++++++++++++++++- 4 files changed, 110 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 2cf66c0a7..c71085a0b 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -78,6 +78,8 @@ backup-secret "management console password" "manage-password" "secrets.manage" backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" +backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" +backup-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" # Backup argon secrets for multiuser from ghes version 3.8 onwards if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index b489626c2..ad06f30a6 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -56,6 +56,12 @@ restore-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hm # Restore kredz.varz HMAC key if present. restore-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" +# Restore encrypted column encryption keying material if present +restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" + +# Restore encrypted column current encryption key if present +restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" + # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then log_info "Restoring SAML keys ..." diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 897213d4a..135b26170 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -555,6 +555,56 @@ begin_test "ghe-backup takes backup of kredz-varz settings" ) end_test +begin_test "ghe-backup takes backup of encrypted column encryption keying material" +( + set -e + + required_secrets=( + "secrets.github.encrypted-column-keying-material" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + ghe-backup + + required_files=( + "encrypted-column-encryption-keying-material" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done + +) +end_test + +begin_test "ghe-backup takes backup of encrypted column current encryption key" +( + set -e + + required_secrets=( + "secrets.github.encrypted-column-current-encryption-key" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + ghe-backup + + required_files=( + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done + +) +end_test + begin_test "ghe-backup takes backup of Actions settings" ( set -e diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index fbfc47aa8..1dae759d7 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -355,7 +355,58 @@ begin_test "ghe-restore with kredz-varz settings" required_secrets=( "secrets.kredz.varz-hmac-secret" ) - + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + done +) +end_test + + +begin_test "ghe-restore with encrypted column encryption keying material" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + required_files=( + "encrypted-column-encryption-keying-material" + ) + + for file in "${required_files[@]}"; do + echo "foo" > "$GHE_DATA_DIR/current/$file" + done + + ghe-restore -v -f localhost + required_secrets=( + "secrets.github.encrypted-column-keying-material" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + done +) +end_test + +begin_test "ghe-restore with encrypted column current encryption key" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + required_files=( + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files[@]}"; do + echo "foo" > "$GHE_DATA_DIR/current/$file" + done + + ghe-restore -v -f localhost + required_secrets=( + "secrets.github.encrypted-column-current-encryption-key" + ) + for secret in "${required_secrets[@]}"; do [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] done From 0a4001f3470caf16e11a986186e429711ec62a6b Mon Sep 17 00:00:00 2001 From: Krayon Date: Wed, 24 May 2023 13:40:57 +1000 Subject: [PATCH 418/946] Add git minimum version --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index a7dc45ebe..a66863d8b 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,7 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), and [jq][11] v1.5 or newer. See below for an update on rsync. +Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2] 1.7.6 or newer, [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), and [jq][11] v1.5 or newer. See below for an update on rsync. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From 0f40f9ab36109d26dee14faadb7d11e77afcf7aa Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 13:59:12 +0200 Subject: [PATCH 419/946] Support jq with docker --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 9e016dc03..4f24ee098 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM ubuntu:focal RUN apt-get -q -y update && \ apt-get install -y --no-install-recommends \ tar \ + jq \ rsync \ ca-certificates \ ssh \ From 91ec6183849f1b04c473df29c5e33083fc28b42d Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 13:59:28 +0200 Subject: [PATCH 420/946] Add backup workflow --- .github/workflows/backup.yml | 112 +++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/backup.yml diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml new file mode 100644 index 000000000..387a9cb13 --- /dev/null +++ b/.github/workflows/backup.yml @@ -0,0 +1,112 @@ +name: Backup and save to Azure +run-name: "${{ github.actor }} - Backup and save to Azure" + +on: + workflow_call: + inputs: + github-hostname: + description: GitHub Hostname to backup + required: true + type: string + backup-name: + description: The name of the backup to be saved in Azure storage + required: false + default: "" + type: string + secrets: + BACKUP_SSH_KEY: + description: SSH key to access the GitHub Enterprise instance + required: true + INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN: + description: Token for the internal actions dx bot account + required: true + AZURE_USERNAME: + description: Azure service principal username + required: false + AZURE_PASSWORD: + description: Azure service principal password + required: false + AZURE_TENANT_ID: + description: Azure tenant ID + required: false + AZURE_SUBSCRIPTION_ID: + description: Azure subscription ID + required: false + CONNECTIONSTRING: + description: Azure storage connection string + required: false + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: github/backup-utils-private + token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" + - run: docker build . --file Dockerfile --tag backup-utils + - run: docker save backup-utils -o backup-utils.tar + - uses: actions/upload-artifact@v3 + with: + name: backup-utils + path: backup-utils.tar + + backup-utils-backup: + needs: build + runs-on: + group: larger-hosted-public-runners + labels: ubuntu-latest-xl + env: + SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} + steps: + - uses: actions/download-artifact@v3 + with: + name: backup-utils + - name: Load docker container + run: docker load -i backup-utils.tar + - uses: actions/checkout@v3 + - name: Create backup directory + run: mkdir $HOME/ghe-backup-data + - name: set up ssh SSH_KEY + run: echo -e "${SSH_KEY}\n" > $HOME/backup + - name: set up ssh key permissions + run: chmod 0600 $HOME/backup + - name: change version + run: echo "3.8.0" > $HOME/version + + - name: Perform backup + run: | + docker run -e "GHE_HOSTNAME=${{ inputs.github-hostname }}" \ + -e "GHE_DATA_DIR=/data" \ + -e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \ + -e "GHE_NUM_SNAPSHOTS=15" \ + -v "$HOME/ghe-backup-data:/data" \ + -v "$HOME/backup:/ghe-ssh/id_rsa" \ + -v "$HOME/version:/backup-utils/share/github-backup-utils/version" \ + --rm \ + backup-utils ghe-backup + - name: Check the backup file + run: | + current=$(readlink $HOME/ghe-backup-data/current) + sudo tar -czvf ${{ inputs.backup-name }}.tar.gz -C $HOME/ghe-backup-data/$current . + + - name: Login to Azure + if: ${{ inputs.backup-name }} != "" + run: | + az login \ + --service-principal \ + -u ${{ secrets.AZURE_USERNAME }} \ + -p ${{ secrets.AZURE_PASSWORD }} \ + --tenant ${{ secrets.AZURE_TENANT_ID }} + az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" + + - name: Upload backup to Azure + if: ${{ inputs.backup-name }} != "" + run: | + az storage blob upload \ + --account-name "ghesresults" \ + --container-name "ghes-data" \ + --name ${{ inputs.backup-name }}.tar.gz \ + --file ${{ inputs.backup-name }}.tar.gz \ + --connection-string "${{ secrets.CONNECTIONSTRING }}" \ No newline at end of file From eb78a4c83b7531d67da2e558e4d5bb121bc9f8ca Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 14:11:44 +0200 Subject: [PATCH 421/946] Add new variables --- .github/workflows/backup.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 387a9cb13..9c4fdd00a 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -32,6 +32,12 @@ on: AZURE_SUBSCRIPTION_ID: description: Azure subscription ID required: false + AZURE_ACCOUNT_NAME: + description: Azure storage account name + required: false + AZURE_CONTAINER_NAME: + description: Azure storage container name + required: false CONNECTIONSTRING: description: Azure storage connection string required: false @@ -105,8 +111,8 @@ jobs: if: ${{ inputs.backup-name }} != "" run: | az storage blob upload \ - --account-name "ghesresults" \ - --container-name "ghes-data" \ + --account-name "${{ secrets.AZURE_ACCOUNT_NAME }}" \ + --container-name "${{ secrets.AZURE_CONTAINER_NAME }}" \ --name ${{ inputs.backup-name }}.tar.gz \ --file ${{ inputs.backup-name }}.tar.gz \ --connection-string "${{ secrets.CONNECTIONSTRING }}" \ No newline at end of file From 8892df964b2f9f8aea5c2f516ff3671237d4b74a Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 14:13:06 +0200 Subject: [PATCH 422/946] Make linter happy --- .github/workflows/backup.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 9c4fdd00a..a86488c07 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -73,13 +73,13 @@ jobs: run: docker load -i backup-utils.tar - uses: actions/checkout@v3 - name: Create backup directory - run: mkdir $HOME/ghe-backup-data + run: mkdir "$HOME/ghe-backup-data" - name: set up ssh SSH_KEY - run: echo -e "${SSH_KEY}\n" > $HOME/backup + run: echo -e "${SSH_KEY}\n" > "$HOME/backup" - name: set up ssh key permissions - run: chmod 0600 $HOME/backup + run: chmod 0600 "$HOME/backup" - name: change version - run: echo "3.8.0" > $HOME/version + run: echo "3.8.0" > "$HOME/version" - name: Perform backup run: | @@ -94,17 +94,17 @@ jobs: backup-utils ghe-backup - name: Check the backup file run: | - current=$(readlink $HOME/ghe-backup-data/current) - sudo tar -czvf ${{ inputs.backup-name }}.tar.gz -C $HOME/ghe-backup-data/$current . + current=$(readlink "$HOME/ghe-backup-data/current") + sudo tar -czvf "${{ inputs.backup-name }}.tar.gz" -C "$HOME/ghe-backup-data/$current" . - name: Login to Azure if: ${{ inputs.backup-name }} != "" run: | az login \ --service-principal \ - -u ${{ secrets.AZURE_USERNAME }} \ - -p ${{ secrets.AZURE_PASSWORD }} \ - --tenant ${{ secrets.AZURE_TENANT_ID }} + -u "${{ secrets.AZURE_USERNAME }}" \ + -p "${{ secrets.AZURE_PASSWORD }}" \ + --tenant "${{ secrets.AZURE_TENANT_ID }}" az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" - name: Upload backup to Azure @@ -113,6 +113,6 @@ jobs: az storage blob upload \ --account-name "${{ secrets.AZURE_ACCOUNT_NAME }}" \ --container-name "${{ secrets.AZURE_CONTAINER_NAME }}" \ - --name ${{ inputs.backup-name }}.tar.gz \ - --file ${{ inputs.backup-name }}.tar.gz \ + --name "${{ inputs.backup-name }}.tar.gz" \ + --file "${{ inputs.backup-name }}.tar.gz" \ --connection-string "${{ secrets.CONNECTIONSTRING }}" \ No newline at end of file From 2305a0e38358f67617d72ebb3805ae862d9f6050 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 14:39:06 +0200 Subject: [PATCH 423/946] Consider suggestion --- .github/workflows/backup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index a86488c07..237d8e131 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -1,5 +1,5 @@ -name: Backup and save to Azure -run-name: "${{ github.actor }} - Backup and save to Azure" +name: Backup GHES instance and save to Azure +run-name: "${{ github.actor }} - Backup GHES instance and save to Azure" on: workflow_call: From 30d759f7b6764914904f0edc78d3171926a56386 Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Wed, 24 May 2023 19:54:25 +0000 Subject: [PATCH 424/946] move encrypted column encryption key restore tests _above_ actions setup --- test/test-ghe-restore.sh | 87 ++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 1dae759d7..c39c042b7 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -281,44 +281,14 @@ begin_test "ghe-restore with no pages backup" ) end_test -# Setup Actions data for the subsequent tests -setup_actions_test_data "$GHE_DATA_DIR/1" - -begin_test "ghe-restore invokes ghe-import-mssql" -( - set -e - rm -rf "$GHE_REMOTE_ROOT_DIR" - setup_remote_metadata - enable_actions - - # enable maintenance mode and create required directories - setup_maintenance_mode - - # set restore host environ var - GHE_RESTORE_HOST=127.0.0.1 - export GHE_RESTORE_HOST - - # run ghe-restore and write output to file for asserting against - if ! ghe-restore -v -f > "$TRASHDIR/restore-out" 2>&1; then - cat "$TRASHDIR/restore-out" - : ghe-restore should have exited successfully - false - fi - - grep -q "Restoring MSSQL database" "$TRASHDIR/restore-out" - grep -q "ghe-import-mssql .* OK" "$TRASHDIR/restore-out" -) -end_test - -begin_test "ghe-restore with Kredz settings" +begin_test "ghe-restore with encrypted column encryption keying material" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" setup_remote_metadata - enable_actions required_files=( - "kredz-credz-hmac" + "encrypted-column-encryption-keying-material" ) for file in "${required_files[@]}"; do @@ -327,24 +297,23 @@ begin_test "ghe-restore with Kredz settings" ghe-restore -v -f localhost required_secrets=( - "secrets.kredz.credz-hmac-secret" + "secrets.github.encrypted-column-keying-material" ) - + for secret in "${required_secrets[@]}"; do [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] done ) end_test -begin_test "ghe-restore with kredz-varz settings" +begin_test "ghe-restore with encrypted column current encryption key" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" setup_remote_metadata - enable_actions required_files=( - "kredz-varz-hmac" + "encrypted-column-current-encryption-key" ) for file in "${required_files[@]}"; do @@ -353,7 +322,7 @@ begin_test "ghe-restore with kredz-varz settings" ghe-restore -v -f localhost required_secrets=( - "secrets.kredz.varz-hmac-secret" + "secrets.github.encrypted-column-current-encryption-key" ) for secret in "${required_secrets[@]}"; do @@ -362,15 +331,44 @@ begin_test "ghe-restore with kredz-varz settings" ) end_test +# Setup Actions data for the subsequent tests +setup_actions_test_data "$GHE_DATA_DIR/1" -begin_test "ghe-restore with encrypted column encryption keying material" +begin_test "ghe-restore invokes ghe-import-mssql" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" setup_remote_metadata + enable_actions + + # enable maintenance mode and create required directories + setup_maintenance_mode + + # set restore host environ var + GHE_RESTORE_HOST=127.0.0.1 + export GHE_RESTORE_HOST + + # run ghe-restore and write output to file for asserting against + if ! ghe-restore -v -f > "$TRASHDIR/restore-out" 2>&1; then + cat "$TRASHDIR/restore-out" + : ghe-restore should have exited successfully + false + fi + + grep -q "Restoring MSSQL database" "$TRASHDIR/restore-out" + grep -q "ghe-import-mssql .* OK" "$TRASHDIR/restore-out" +) +end_test + +begin_test "ghe-restore with Kredz settings" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + enable_actions required_files=( - "encrypted-column-encryption-keying-material" + "kredz-credz-hmac" ) for file in "${required_files[@]}"; do @@ -379,7 +377,7 @@ begin_test "ghe-restore with encrypted column encryption keying material" ghe-restore -v -f localhost required_secrets=( - "secrets.github.encrypted-column-keying-material" + "secrets.kredz.credz-hmac-secret" ) for secret in "${required_secrets[@]}"; do @@ -388,14 +386,15 @@ begin_test "ghe-restore with encrypted column encryption keying material" ) end_test -begin_test "ghe-restore with encrypted column current encryption key" +begin_test "ghe-restore with kredz-varz settings" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" setup_remote_metadata + enable_actions required_files=( - "encrypted-column-current-encryption-key" + "kredz-varz-hmac" ) for file in "${required_files[@]}"; do @@ -404,7 +403,7 @@ begin_test "ghe-restore with encrypted column current encryption key" ghe-restore -v -f localhost required_secrets=( - "secrets.github.encrypted-column-current-encryption-key" + "secrets.kredz.varz-hmac-secret" ) for secret in "${required_secrets[@]}"; do From 83c584070f92b6cc3a5ae27b8445f158e954c1be Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 24 May 2023 20:58:36 +0000 Subject: [PATCH 425/946] fix testlib.sh --- test/testlib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/testlib.sh b/test/testlib.sh index af1425472..3877d1af9 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -160,7 +160,8 @@ report_failure () { # Mark the end of a test. end_test () { - test_status="${1:-$?}" + test_result=$? + test_status="${1:-$test_result}" after_time=$(date '+%s') elapsed_time=$((after_time - before_time)) set +x -e From 242217dfdbee05e88f757142fe2c2351a3257f56 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 24 May 2023 21:19:42 +0000 Subject: [PATCH 426/946] testlib reverts --- test/testlib.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/testlib.sh b/test/testlib.sh index 3877d1af9..af1425472 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -160,8 +160,7 @@ report_failure () { # Mark the end of a test. end_test () { - test_result=$? - test_status="${1:-$test_result}" + test_status="${1:-$?}" after_time=$(date '+%s') elapsed_time=$((after_time - before_time)) set +x -e From 627147d40928c39d6df43cd98cb997ce542ae788 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 25 May 2023 13:00:21 -0400 Subject: [PATCH 427/946] disable SC2319 --- test/testlib.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/testlib.sh b/test/testlib.sh index af1425472..e17fc3fd2 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -19,6 +19,7 @@ # # Copyright (c) 2011-14 by Ryan Tomayko # License: MIT +# shellcheck disable=SC2319 set -e # Setting basic paths From 030d1cf155fb89326c0735c6b21e3f98f7203c8e Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 13:59:12 +0200 Subject: [PATCH 428/946] Support jq with docker --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 9e016dc03..4f24ee098 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM ubuntu:focal RUN apt-get -q -y update && \ apt-get install -y --no-install-recommends \ tar \ + jq \ rsync \ ca-certificates \ ssh \ From 6c92cb53d520222c5825fab9e1e160694df42293 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 13:59:28 +0200 Subject: [PATCH 429/946] Add backup workflow --- .github/workflows/backup.yml | 112 +++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/backup.yml diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml new file mode 100644 index 000000000..387a9cb13 --- /dev/null +++ b/.github/workflows/backup.yml @@ -0,0 +1,112 @@ +name: Backup and save to Azure +run-name: "${{ github.actor }} - Backup and save to Azure" + +on: + workflow_call: + inputs: + github-hostname: + description: GitHub Hostname to backup + required: true + type: string + backup-name: + description: The name of the backup to be saved in Azure storage + required: false + default: "" + type: string + secrets: + BACKUP_SSH_KEY: + description: SSH key to access the GitHub Enterprise instance + required: true + INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN: + description: Token for the internal actions dx bot account + required: true + AZURE_USERNAME: + description: Azure service principal username + required: false + AZURE_PASSWORD: + description: Azure service principal password + required: false + AZURE_TENANT_ID: + description: Azure tenant ID + required: false + AZURE_SUBSCRIPTION_ID: + description: Azure subscription ID + required: false + CONNECTIONSTRING: + description: Azure storage connection string + required: false + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: github/backup-utils-private + token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" + - run: docker build . --file Dockerfile --tag backup-utils + - run: docker save backup-utils -o backup-utils.tar + - uses: actions/upload-artifact@v3 + with: + name: backup-utils + path: backup-utils.tar + + backup-utils-backup: + needs: build + runs-on: + group: larger-hosted-public-runners + labels: ubuntu-latest-xl + env: + SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} + steps: + - uses: actions/download-artifact@v3 + with: + name: backup-utils + - name: Load docker container + run: docker load -i backup-utils.tar + - uses: actions/checkout@v3 + - name: Create backup directory + run: mkdir $HOME/ghe-backup-data + - name: set up ssh SSH_KEY + run: echo -e "${SSH_KEY}\n" > $HOME/backup + - name: set up ssh key permissions + run: chmod 0600 $HOME/backup + - name: change version + run: echo "3.8.0" > $HOME/version + + - name: Perform backup + run: | + docker run -e "GHE_HOSTNAME=${{ inputs.github-hostname }}" \ + -e "GHE_DATA_DIR=/data" \ + -e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \ + -e "GHE_NUM_SNAPSHOTS=15" \ + -v "$HOME/ghe-backup-data:/data" \ + -v "$HOME/backup:/ghe-ssh/id_rsa" \ + -v "$HOME/version:/backup-utils/share/github-backup-utils/version" \ + --rm \ + backup-utils ghe-backup + - name: Check the backup file + run: | + current=$(readlink $HOME/ghe-backup-data/current) + sudo tar -czvf ${{ inputs.backup-name }}.tar.gz -C $HOME/ghe-backup-data/$current . + + - name: Login to Azure + if: ${{ inputs.backup-name }} != "" + run: | + az login \ + --service-principal \ + -u ${{ secrets.AZURE_USERNAME }} \ + -p ${{ secrets.AZURE_PASSWORD }} \ + --tenant ${{ secrets.AZURE_TENANT_ID }} + az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" + + - name: Upload backup to Azure + if: ${{ inputs.backup-name }} != "" + run: | + az storage blob upload \ + --account-name "ghesresults" \ + --container-name "ghes-data" \ + --name ${{ inputs.backup-name }}.tar.gz \ + --file ${{ inputs.backup-name }}.tar.gz \ + --connection-string "${{ secrets.CONNECTIONSTRING }}" \ No newline at end of file From 889b70e7a663f8e47c99634567201d7a1b94bfbb Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 14:11:44 +0200 Subject: [PATCH 430/946] Add new variables --- .github/workflows/backup.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 387a9cb13..9c4fdd00a 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -32,6 +32,12 @@ on: AZURE_SUBSCRIPTION_ID: description: Azure subscription ID required: false + AZURE_ACCOUNT_NAME: + description: Azure storage account name + required: false + AZURE_CONTAINER_NAME: + description: Azure storage container name + required: false CONNECTIONSTRING: description: Azure storage connection string required: false @@ -105,8 +111,8 @@ jobs: if: ${{ inputs.backup-name }} != "" run: | az storage blob upload \ - --account-name "ghesresults" \ - --container-name "ghes-data" \ + --account-name "${{ secrets.AZURE_ACCOUNT_NAME }}" \ + --container-name "${{ secrets.AZURE_CONTAINER_NAME }}" \ --name ${{ inputs.backup-name }}.tar.gz \ --file ${{ inputs.backup-name }}.tar.gz \ --connection-string "${{ secrets.CONNECTIONSTRING }}" \ No newline at end of file From c98f3be36a3dba07ecb7814806562dc232bc8393 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 14:13:06 +0200 Subject: [PATCH 431/946] Make linter happy --- .github/workflows/backup.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 9c4fdd00a..a86488c07 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -73,13 +73,13 @@ jobs: run: docker load -i backup-utils.tar - uses: actions/checkout@v3 - name: Create backup directory - run: mkdir $HOME/ghe-backup-data + run: mkdir "$HOME/ghe-backup-data" - name: set up ssh SSH_KEY - run: echo -e "${SSH_KEY}\n" > $HOME/backup + run: echo -e "${SSH_KEY}\n" > "$HOME/backup" - name: set up ssh key permissions - run: chmod 0600 $HOME/backup + run: chmod 0600 "$HOME/backup" - name: change version - run: echo "3.8.0" > $HOME/version + run: echo "3.8.0" > "$HOME/version" - name: Perform backup run: | @@ -94,17 +94,17 @@ jobs: backup-utils ghe-backup - name: Check the backup file run: | - current=$(readlink $HOME/ghe-backup-data/current) - sudo tar -czvf ${{ inputs.backup-name }}.tar.gz -C $HOME/ghe-backup-data/$current . + current=$(readlink "$HOME/ghe-backup-data/current") + sudo tar -czvf "${{ inputs.backup-name }}.tar.gz" -C "$HOME/ghe-backup-data/$current" . - name: Login to Azure if: ${{ inputs.backup-name }} != "" run: | az login \ --service-principal \ - -u ${{ secrets.AZURE_USERNAME }} \ - -p ${{ secrets.AZURE_PASSWORD }} \ - --tenant ${{ secrets.AZURE_TENANT_ID }} + -u "${{ secrets.AZURE_USERNAME }}" \ + -p "${{ secrets.AZURE_PASSWORD }}" \ + --tenant "${{ secrets.AZURE_TENANT_ID }}" az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" - name: Upload backup to Azure @@ -113,6 +113,6 @@ jobs: az storage blob upload \ --account-name "${{ secrets.AZURE_ACCOUNT_NAME }}" \ --container-name "${{ secrets.AZURE_CONTAINER_NAME }}" \ - --name ${{ inputs.backup-name }}.tar.gz \ - --file ${{ inputs.backup-name }}.tar.gz \ + --name "${{ inputs.backup-name }}.tar.gz" \ + --file "${{ inputs.backup-name }}.tar.gz" \ --connection-string "${{ secrets.CONNECTIONSTRING }}" \ No newline at end of file From c53ca0dd493e413c12c5b74e26df8dd5525ca7f8 Mon Sep 17 00:00:00 2001 From: solmaz Date: Wed, 24 May 2023 14:39:06 +0200 Subject: [PATCH 432/946] Consider suggestion --- .github/workflows/backup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index a86488c07..237d8e131 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -1,5 +1,5 @@ -name: Backup and save to Azure -run-name: "${{ github.actor }} - Backup and save to Azure" +name: Backup GHES instance and save to Azure +run-name: "${{ github.actor }} - Backup GHES instance and save to Azure" on: workflow_call: From d0cc3ab2015b2125413fab6ecf79e842a64a6ef2 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 25 May 2023 13:00:21 -0400 Subject: [PATCH 433/946] disable SC2319 --- test/testlib.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/testlib.sh b/test/testlib.sh index af1425472..e17fc3fd2 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -19,6 +19,7 @@ # # Copyright (c) 2011-14 by Ryan Tomayko # License: MIT +# shellcheck disable=SC2319 set -e # Setting basic paths From 940cad5a081ee601680a2b258cd1ddfbecbc2d38 Mon Sep 17 00:00:00 2001 From: solmaz Date: Tue, 30 May 2023 14:59:41 +0200 Subject: [PATCH 434/946] Change the restore logic --- .github/workflows/restore.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index 7d7c5bb5e..ab0627751 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -85,19 +85,22 @@ jobs: run: | version="${{ inputs.version }}" size="${{ inputs.size }}" - V3_8_COMPATIBLE="3.6 3.7 3.8 3.9 3.10" - echo "$V3_8_COMPATIBLE" | tr " " '\n' | grep -F -q -x "$version" - exit_code="$?" - if [ "$exit_code" -eq "0" ]; then - echo "Version $version is acceptable" + V3_6_COMPATIBLE="3.6 3.7" + V3_8_COMPATIBLE="3.8 3.9 3.10" + if echo "$V3_8_COMPATIBLE" | grep -q -w "$version"; then + echo "Version $version is acceptable by 3.8 backup" file_version=3.8 - echo "version=3.8" >> "$GITHUB_OUTPUT" - echo "name=v$file_version-$size.tar.gz" >> "$GITHUB_OUTPUT" + elif echo "$V3_6_COMPATIBLE" | grep -q -w "$version"; then + echo "Version $version is acceptable by 3.6 backup" + file_version=3.6 else echo "Version $version is not acceptable" exit 1 fi + echo "version=$file_version" >> "$GITHUB_OUTPUT" + echo "name=v$file_version-$size.tar.gz" >> "$GITHUB_OUTPUT" + - name: Download from blob storage run: | mkdir ghes-data From 443c8aa1930bed9c4bdb6c254c3eada02336b76f Mon Sep 17 00:00:00 2001 From: Ryan Trauntvein Date: Tue, 30 May 2023 19:15:26 +0000 Subject: [PATCH 435/946] Make main Dockerfile --- .github/workflows/docker-image.yml | 7 --- .github/workflows/rsync-docker-bump.yml | 12 ++-- Dockerfile | 66 ++++++++++++++++++++-- Dockerfile.rsync | 74 ------------------------- 4 files changed, 66 insertions(+), 93 deletions(-) delete mode 100644 Dockerfile.rsync diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 2274cf630..07c44f9df 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -18,8 +18,6 @@ jobs: run: docker build . --file Dockerfile --tag backup-utils:${GITHUB_RUN_ID} - name: Build the Alpine Docker image run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID} - - name: Build the Rsync source Docker image - run: docker build . --file Dockerfile.rsync --tag backup-utils-rsync:${GITHUB_RUN_ID} - name: Run tests in Ubuntu Docker image run: | docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version @@ -28,8 +26,3 @@ jobs: run: | docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version docker run backup-utils-alpine:${GITHUB_RUN_ID} rsync --version - - name: Run tests in Rsync source Docker image - run: | - docker run backup-utils-rsync:${GITHUB_RUN_ID} ghe-backup --version - docker run backup-utils-rsync:${GITHUB_RUN_ID} rsync --version - diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index 96c32cbbb..c59e4ede1 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -1,4 +1,4 @@ -name: Update Rsync Tag in Dockerfile.rsync +name: Update Rsync Tag in Dockerfile on: schedule: @@ -17,17 +17,17 @@ jobs: run: | curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[0].name' | xargs -I {} echo "::set-output name=latest_tag::{}" - - name: Update Dockerfile.rsync with latest tag + - name: Update Dockerfile with latest tag run: | - sed -i -E "s/RSYNC_TAG=[0-9\.]+/RSYNC_TAG=${{ steps.latest_tag.outputs.latest_tag }}/g" Dockerfile.rsync + sed -i -E "s/RSYNC_TAG=[0-9\.]+/RSYNC_TAG=${{ steps.latest_tag.outputs.latest_tag }}/g" Dockerfile - name: Create Pull Request for tag update uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Update rsync tag in Dockerfile.rsync" - title: "Update rsync tag in Dockerfile.rsync" - body: "This PR updates the rsync tag in the Dockerfile.rsync to the latest tagged version." + commit-message: "Update rsync tag in Dockerfile" + title: "Update rsync tag in Dockerfile" + body: "This PR updates the rsync tag in the Dockerfile to the latest tagged version." branch: "update-rsync-tag" base: "master" path: "." diff --git a/Dockerfile b/Dockerfile index 9e016dc03..667739729 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,71 @@ -FROM ubuntu:focal +# Multi stage build for backup-utils +# Build layer is for compiling rsync from source +# Runtime layer is for running backup-utils +# https://docs.docker.com/develop/develop-images/multistage-build/ +# https://docs.docker.com/engine/userguide/eng-image/multistage-build/ -RUN apt-get -q -y update && \ - apt-get install -y --no-install-recommends \ +# Build layer +FROM ubuntu:focal AS build + +# Install build dependencies +RUN apt-get update && apt-get install --no-install-recommends -y \ + gcc \ + g++ \ + gawk \ + autoconf \ + make \ + automake \ + python3-cmarkgfm \ + acl \ + libacl1-dev \ + attr \ + libattr1-dev \ + libxxhash-dev \ + libzstd-dev \ + liblz4-dev \ + libssl-dev \ + git \ + jq \ + curl \ tar \ - rsync \ + gzip \ ca-certificates \ - ssh \ + && rm -rf /var/lib/apt/lists/* + +# Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag +ARG RSYNC_TAG=v3.2.7 +RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz +RUN mkdir -p /rsync-${RSYNC_TAG}&& tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} --strip-components=1 && ls -la +# Change to the working directory of the rsync source +WORKDIR /rsync-${RSYNC_TAG} +RUN ls -la && ./configure +RUN make +RUN make install + +# Reset working directory +WORKDIR / + +# Runtime layer +FROM ubuntu:focal AS runtime + +# Install runtime dependencies - bash, git, OpenSSH 5.6 or newer, and jq v1.5 or newer. +RUN apt-get update && apt-get install --no-install-recommends -y \ + bash \ git \ + openssh-client \ + jq \ moreutils \ - gawk \ + gawk \ + ca-certificates \ + xxhash \ && rm -rf /var/lib/apt/lists/* +# Copy rsync from build layer +COPY --from=build /usr/local/bin/rsync /usr/local/bin/rsync + +# Copy backup-utils from repository into /backup-utils COPY ./ /backup-utils/ + WORKDIR /backup-utils RUN chmod +x /backup-utils/share/github-backup-utils/ghe-docker-init diff --git a/Dockerfile.rsync b/Dockerfile.rsync deleted file mode 100644 index 667739729..000000000 --- a/Dockerfile.rsync +++ /dev/null @@ -1,74 +0,0 @@ -# Multi stage build for backup-utils -# Build layer is for compiling rsync from source -# Runtime layer is for running backup-utils -# https://docs.docker.com/develop/develop-images/multistage-build/ -# https://docs.docker.com/engine/userguide/eng-image/multistage-build/ - -# Build layer -FROM ubuntu:focal AS build - -# Install build dependencies -RUN apt-get update && apt-get install --no-install-recommends -y \ - gcc \ - g++ \ - gawk \ - autoconf \ - make \ - automake \ - python3-cmarkgfm \ - acl \ - libacl1-dev \ - attr \ - libattr1-dev \ - libxxhash-dev \ - libzstd-dev \ - liblz4-dev \ - libssl-dev \ - git \ - jq \ - curl \ - tar \ - gzip \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -# Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag -ARG RSYNC_TAG=v3.2.7 -RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz -RUN mkdir -p /rsync-${RSYNC_TAG}&& tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} --strip-components=1 && ls -la -# Change to the working directory of the rsync source -WORKDIR /rsync-${RSYNC_TAG} -RUN ls -la && ./configure -RUN make -RUN make install - -# Reset working directory -WORKDIR / - -# Runtime layer -FROM ubuntu:focal AS runtime - -# Install runtime dependencies - bash, git, OpenSSH 5.6 or newer, and jq v1.5 or newer. -RUN apt-get update && apt-get install --no-install-recommends -y \ - bash \ - git \ - openssh-client \ - jq \ - moreutils \ - gawk \ - ca-certificates \ - xxhash \ - && rm -rf /var/lib/apt/lists/* - -# Copy rsync from build layer -COPY --from=build /usr/local/bin/rsync /usr/local/bin/rsync - -# Copy backup-utils from repository into /backup-utils -COPY ./ /backup-utils/ - -WORKDIR /backup-utils - -RUN chmod +x /backup-utils/share/github-backup-utils/ghe-docker-init - -ENTRYPOINT ["/backup-utils/share/github-backup-utils/ghe-docker-init"] -CMD ["ghe-host-check"] From ea92db7b838ad7f8760144e4c2099cfeb840f320 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 31 May 2023 17:46:13 +0000 Subject: [PATCH 436/946] remove ghe-prune-snapshots call --- bin/ghe-backup | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index ad8147f82..c491e2ea2 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -284,15 +284,13 @@ if [ "$GHE_BACKUP_FSCK" = "yes" ]; then fi # If everything was successful, mark the snapshot as complete, update the -# current symlink to point to the new snapshot and prune expired and failed -# snapshots. +# current symlink to point to the new snapshot +# Expired and failed snapshots to be pruned separately if [ -z "$failures" ]; then rm "incomplete" rm -f "../current" ln -s "$GHE_SNAPSHOT_TIMESTAMP" "../current" - - ghe-prune-snapshots fi END_TIME=$(date +%s) From 95daff216c992e288e41fa4effed8dbe343f2d57 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 31 May 2023 19:34:31 +0000 Subject: [PATCH 437/946] add pruning variable --- backup.config-example | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backup.config-example b/backup.config-example index 2ca0551fa..ac068a383 100644 --- a/backup.config-example +++ b/backup.config-example @@ -9,12 +9,13 @@ GHE_HOSTNAME="github.example.com" # elsewhere for backing up to a separate partition / mount point. GHE_DATA_DIR="data" -# The number of backup snapshots to retain. Old snapshots are pruned after each -# successful ghe-backup run. This option should be tuned based on the frequency +# The number of backup snapshots to retain. Old snapshots are to be pruned separately +# after successful backups. This option should be tuned based on the frequency # of scheduled backup runs. If backups are scheduled hourly, snapshots will be # available for the past N hours; if backups are scheduled daily, snapshots will -# be available for the past N days ... +# be available for the past N days. Pruning enablement defaults to 'yes' GHE_NUM_SNAPSHOTS=10 +#GHE_PRUNING_ENABLED=no # The hostname of the GitHub appliance to restore. If you've set up a separate # GitHub appliance to act as a standby for recovery, specify its IP or hostname @@ -97,4 +98,4 @@ GHE_NUM_SNAPSHOTS=10 #EXTERNAL_DATABASE_RESTORE_SCRIPT="/bin/false" # If set to 'yes', Pages data will be included in backup and restore. Defaults to 'yes' -#GHE_BACKUP_PAGES=no \ No newline at end of file +#GHE_BACKUP_PAGES=no From dc7993eb7eca44f607ff15c67e6afb6b3674361c Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 1 Jun 2023 14:14:14 +0000 Subject: [PATCH 438/946] add rsync warn msg --- backup.config-example | 5 ++++- bin/ghe-host-check | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backup.config-example b/backup.config-example index 2ca0551fa..4c78a103b 100644 --- a/backup.config-example +++ b/backup.config-example @@ -42,6 +42,9 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_EXTRA_RSYNC_OPTS="" +# If enabled and set to 'no', rsync warning message during backups will be suppressed. +#RSYNC_WARNING=no + # If set to 'yes', logging output will be colorized. # @@ -97,4 +100,4 @@ GHE_NUM_SNAPSHOTS=10 #EXTERNAL_DATABASE_RESTORE_SCRIPT="/bin/false" # If set to 'yes', Pages data will be included in backup and restore. Defaults to 'yes' -#GHE_BACKUP_PAGES=no \ No newline at end of file +#GHE_BACKUP_PAGES=no diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 6a2a66357..30c896a80 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -213,9 +213,11 @@ DATA_TRANSFER_SIZE echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 - else - echo "rsync ${rsync_version} >= required ($min_rsync)" 1>&2 + elif awk "BEGIN {exit !($rsync_version < 3.2.5)}" &> /dev/null && [ "$RSYNC_WARNING" != "no" ]; then + warn_mesg="**WARNING: rsync version $rsync_version on backup host is less than 3.2.5. For more details, please read documentation at https://github.com/github/backup-utils/blob/master/docs/requirements.md#april-2023-update-of-rsync-requirements\nIf you feel this warning doesn't apply anymore, you can disable it by updating RSYNC_WARNING to 'no' in your backup.config file.\n" + echo -e $warn_mesg 1>&2 fi + echo "rsync ${rsync_version} >= required ($min_rsync)" 1>&2 ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1 | tr -cd '[:digit:].\n') if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then From fb7a6d3ccfa80e4a05a98c47ad09f17342e84d3e Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 1 Jun 2023 21:26:15 +0000 Subject: [PATCH 439/946] fix shellcheck err --- bin/ghe-host-check | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 30c896a80..9dac0acba 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -144,7 +144,7 @@ if [ -z "$supported" ]; then exit 1 fi -if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then +if [[ "$CALLING_SCRIPT" != "ghe-backup" ]]; then # Bring in the requirements file min_rsync="" min_openssh="" @@ -214,8 +214,9 @@ DATA_TRANSFER_SIZE echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 elif awk "BEGIN {exit !($rsync_version < 3.2.5)}" &> /dev/null && [ "$RSYNC_WARNING" != "no" ]; then - warn_mesg="**WARNING: rsync version $rsync_version on backup host is less than 3.2.5. For more details, please read documentation at https://github.com/github/backup-utils/blob/master/docs/requirements.md#april-2023-update-of-rsync-requirements\nIf you feel this warning doesn't apply anymore, you can disable it by updating RSYNC_WARNING to 'no' in your backup.config file.\n" - echo -e $warn_mesg 1>&2 + warn_mesg=("**WARNING: rsync version $rsync_version on backup host is less than 3.2.5. For more details, please read documentation at https://github.com/github/backup-utils/blob/master/docs/requirements.md#april-2023-update-of-rsync-requirements" + "If you feel this warning doesn't apply anymore, you can disable it by updating RSYNC_WARNING to 'no' in your backup.config file.") + printf "%s\n" "${warn_mesg[@]}" 1>&2 fi echo "rsync ${rsync_version} >= required ($min_rsync)" 1>&2 From 8787e23573174939ae4062914f8942f8c91aecee Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 2 Jun 2023 11:24:59 -0400 Subject: [PATCH 440/946] Update bin/ghe-host-check Update warn_msg verbiage Co-authored-by: Quinn Murphy --- bin/ghe-host-check | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 9dac0acba..9273dcff6 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -214,9 +214,14 @@ DATA_TRANSFER_SIZE echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 elif awk "BEGIN {exit !($rsync_version < 3.2.5)}" &> /dev/null && [ "$RSYNC_WARNING" != "no" ]; then - warn_mesg=("**WARNING: rsync version $rsync_version on backup host is less than 3.2.5. For more details, please read documentation at https://github.com/github/backup-utils/blob/master/docs/requirements.md#april-2023-update-of-rsync-requirements" - "If you feel this warning doesn't apply anymore, you can disable it by updating RSYNC_WARNING to 'no' in your backup.config file.") - printf "%s\n" "${warn_mesg[@]}" 1>&2 +echo << WARN_MSG +**WARNING:** rsync version $rsync_version on backup host is less than 3.2.5, which could result in performance degradation. + +For more details, please read documentation at https://github.com/github/backup-utils/blob/master/docs/requirements.md#april-2023-update-of-rsync-requirements" + +You can disable this warning by changing RSYNC_WARNING to 'no' in your backup.config file. + +WARN_MSG fi echo "rsync ${rsync_version} >= required ($min_rsync)" 1>&2 From 24d91b9e35a54b690afacf2ef17ea279c1681d31 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 2 Jun 2023 15:47:11 +0000 Subject: [PATCH 441/946] update warn_msg text --- bin/ghe-host-check | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 9273dcff6..d020d78a4 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -144,7 +144,7 @@ if [ -z "$supported" ]; then exit 1 fi -if [[ "$CALLING_SCRIPT" != "ghe-backup" ]]; then +if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then # Bring in the requirements file min_rsync="" min_openssh="" @@ -213,11 +213,11 @@ DATA_TRANSFER_SIZE echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 - elif awk "BEGIN {exit !($rsync_version < 3.2.5)}" &> /dev/null && [ "$RSYNC_WARNING" != "no" ]; then -echo << WARN_MSG + elif [[ $rsync_version < 3.2.5 ]] && [[ $RSYNC_WARNING != "no" ]]; then + cat << WARN_MSG 1>&2 **WARNING:** rsync version $rsync_version on backup host is less than 3.2.5, which could result in performance degradation. -For more details, please read documentation at https://github.com/github/backup-utils/blob/master/docs/requirements.md#april-2023-update-of-rsync-requirements" +For more details, please read documentation at https://github.com/github/backup-utils/blob/master/docs/requirements.md#april-2023-update-of-rsync-requirements You can disable this warning by changing RSYNC_WARNING to 'no' in your backup.config file. From 64905db77228de10dedc7459086ff56f2f57e6c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 20:59:50 +0000 Subject: [PATCH 442/946] Bump peter-evans/create-pull-request from 3 to 5 Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3 to 5. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v3...v5) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/rsync-docker-bump.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index c59e4ede1..6012e3986 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -22,7 +22,7 @@ jobs: sed -i -E "s/RSYNC_TAG=[0-9\.]+/RSYNC_TAG=${{ steps.latest_tag.outputs.latest_tag }}/g" Dockerfile - name: Create Pull Request for tag update - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Update rsync tag in Dockerfile" From 46a3986db3bd2d4ab853ad75af0e16bc576baccc Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 6 Jun 2023 20:36:25 -0400 Subject: [PATCH 443/946] Update bin/ghe-restore Co-authored-by: Krayon --- bin/ghe-restore | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index f2b13bc36..89c5f6c31 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -274,28 +274,28 @@ fi # taking into account the options passed to the script and the appliance configuration # calculate restore steps OPTIONAL_STEPS=0 -# Cluster restores add an additional step +# Cluster restores add an additional step if $CLUSTER ; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi -# Restoring UUID +# Restoring UUID if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi # Restoring Actions if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi -# Restoring minio +fi +# Restoring minio if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi -# Restoring Elasticsearch +# Restoring Elasticsearch if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi # Restoring audit log -if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then +if $CLUSTER || [ "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.12.9)" ]; then if [[ "$GHE_RESTORE_SKIP_AUDIT_LOG" != "yes" ]]; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi @@ -309,9 +309,9 @@ export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 6)) init-progress export PROGRESS_TYPE="Restore" -echo $PROGRESS_TYPE > /tmp/backup-utils-progress-type +echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of restore -echo $PROGRESS > /tmp/backup-utils-progress +echo "$PROGRESS" > /tmp/backup-utils-progress # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) From 9cb975997cedb0869fc17b8105abc4311ab3ad0a Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 6 Jun 2023 20:37:13 -0400 Subject: [PATCH 444/946] Update bin/ghe-backup Co-authored-by: Krayon --- bin/ghe-backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index ec6a785ff..58f759afd 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -47,7 +47,7 @@ export CALLING_SCRIPT="ghe-backup" # Setup progress tracking init-progress export PROGRESS_TYPE="Backup" -echo $PROGRESS_TYPE > /tmp/backup-utils-progress-type +echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of backup echo $PROGRESS > /tmp/backup-utils-progress export PROGRESS_TOTAL=18 # Maximum number of steps in backup From 13b6168c7f2e4e088e3c4a799a01a65e8796023b Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 6 Jun 2023 20:37:44 -0400 Subject: [PATCH 445/946] Update bin/ghe-backup Co-authored-by: Krayon --- bin/ghe-backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 58f759afd..414eaa97a 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -131,7 +131,7 @@ ghe_restore_check # Check to see if there is a running backup if [ -h ../in-progress ]; then - log_error "Detected a backup already in progress from a previous version of ghe-backup. \nIf there is no backup in progress anymore, please remove \nthe $GHE_DATA_DIR/in-progress file." 1>&2 + log_error "Detected a backup already in progress from a previous version of ghe-backup. \nIf there is no backup in progress anymore, please remove \nthe $GHE_DATA_DIR/in-progress file." >&2 exit 1 fi From dd47e89d258504583b6594b3b913af96727642a6 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 6 Jun 2023 20:37:57 -0400 Subject: [PATCH 446/946] Update bin/ghe-progress Co-authored-by: Krayon --- bin/ghe-progress | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/ghe-progress b/bin/ghe-progress index ef2964170..da5ead976 100755 --- a/bin/ghe-progress +++ b/bin/ghe-progress @@ -11,20 +11,20 @@ while true; do case "$1" in - -o|--once) - ONCE=1; - shift + -o|--once) + ONCE=1 + shift ;; -h|--help) export GHE_SHOW_HELP=true shift ;; - -*) - echo "Unknown option: $1" >&2; - exit 1 + -*) + echo "Unknown option: $1" >&2 + exit 1 ;; - *) - break + *) + break ;; esac done From fdaeb0e05999e97a950909b225a4f7729bd434bc Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 6 Jun 2023 20:38:24 -0400 Subject: [PATCH 447/946] Update bin/ghe-restore Co-authored-by: Krayon --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 89c5f6c31..a27f0680e 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -454,7 +454,7 @@ if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" bm_end "$(basename $0) - Restore UUID" - fi +fi if is_external_database_snapshot; then From 162aa81ca1199cf2612a0f8aacf16138af06c632 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 6 Jun 2023 20:38:36 -0400 Subject: [PATCH 448/946] Update bin/ghe-backup Co-authored-by: Krayon --- bin/ghe-backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 414eaa97a..48d8da85b 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -49,7 +49,7 @@ init-progress export PROGRESS_TYPE="Backup" echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of backup -echo $PROGRESS > /tmp/backup-utils-progress +echo "$PROGRESS" > /tmp/backup-utils-progress export PROGRESS_TOTAL=18 # Maximum number of steps in backup # Check to make sure moreutils parallel is installed and working properly From e90305c29ba4f8aef2a9530557bd0b6b682729ab Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 6 Jun 2023 20:38:57 -0400 Subject: [PATCH 449/946] Update share/github-backup-utils/ghe-backup-config Co-authored-by: Krayon --- share/github-backup-utils/ghe-backup-config | 1 - 1 file changed, 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 573db1c83..72449a7a3 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -55,7 +55,6 @@ fi PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # shellcheck source=share/github-backup-utils/bm.sh . "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" -. "$GHE_BACKUP_ROOT/share/github-backup-utils/backup-utils-progress" # Save off GHE_HOSTNAME from the environment since we want it to override the # backup.config value when set. GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" From ef86f4f789af65442d5cbe441cc736cefa78f89d Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 7 Jun 2023 12:46:21 -0400 Subject: [PATCH 450/946] Update ghe-backup-config --- share/github-backup-utils/ghe-backup-config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 72449a7a3..f3e620bfa 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -183,7 +183,8 @@ fi PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # shellcheck source=share/github-backup-utils/bm.sh . "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" - +# shellcheck source=share/github-backup-utils/track-progress +. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" # Save off GHE_HOSTNAME from the environment since we want it to override the # backup.config value when set. GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" From 4a86d512234820449a85d8718a703af105bd8eb1 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 7 Jun 2023 15:54:06 -0400 Subject: [PATCH 451/946] remove extraneous line --- bin/ghe-restore | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index a27f0680e..1efc2dad1 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -449,7 +449,6 @@ if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then log_info "Restoring UUID ..." bm_start "$(basename $0) - Restore UUID" - cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid" | ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" <"$GHE_RESTORE_SNAPSHOT_PATH/uuid" ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" From 0cf8e94631e78a09aad3f8d8d37af0f4151a071f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 7 Jun 2023 16:16:49 -0400 Subject: [PATCH 452/946] add set -e --- bin/ghe-progress | 1 + share/github-backup-utils/track-progress | 1 + 2 files changed, 2 insertions(+) diff --git a/bin/ghe-progress b/bin/ghe-progress index da5ead976..d28d80813 100755 --- a/bin/ghe-progress +++ b/bin/ghe-progress @@ -8,6 +8,7 @@ #/ Options: #/ --once Don't loop, just print the current progress once. # +set -e while true; do case "$1" in diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index a9930d627..3f67ca9e8 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -1,5 +1,6 @@ #!/usr/bin/env bash #/ track-progress: track progress of backup or restore tasks +set -e # Current version is working solely with backups progress(){ From 2c025b2ee6aa76410221568dc24fca0b123f2604 Mon Sep 17 00:00:00 2001 From: boxofyellow <54955040+boxofyellow@users.noreply.github.com> Date: Wed, 7 Jun 2023 17:26:21 -0400 Subject: [PATCH 453/946] Allow the caller to handle setting failures --- share/github-backup-utils/ghe-backup-mssql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index ead33f6bc..d452c36a2 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -337,7 +337,7 @@ if [ -n "$backup_type" ]; then fi bm_start "$(basename "$0")" - ghe_ssh_mssql -- "$backup_command" || failures="$failures mssql" + ghe_ssh_mssql -- "$backup_command" bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics From 16de4b2aeb9b39c7e3640c5ea737cb02c969f6e1 Mon Sep 17 00:00:00 2001 From: boxofyellow Date: Wed, 7 Jun 2023 17:43:36 -0400 Subject: [PATCH 454/946] fix linter problems --- share/github-backup-utils/ghe-backup-mssql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index d452c36a2..b1d97b8de 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -30,11 +30,11 @@ export_tool_available() { } ghe_ssh_mssql() { - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "$@" + ghe-ssh "$opts" "$ssh_config_file_opt" "$GHE_MSSQL_PRIMARY_HOST" "$@" } cleanup() { - rm -rf $tempdir + rm -rf "$tempdir" } trap 'cleanup' EXIT INT @@ -69,10 +69,10 @@ add_minute() { # Expect date string in the format of yyyymmddTHHMMSS # Here parse date differently depending on GNU Linux vs BSD MacOS if date -v -1d > /dev/null 2>&1; then - echo "$(date -v +$2M -ujf'%Y%m%dT%H%M%S' $1 +%Y%m%dT%H%M%S)" + date -v +"$2"M -ujf'%Y%m%dT%H%M%S' "$1" +%Y%m%dT%H%M%S else dt=$1 - echo "$(date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes")" + date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes" fi } From 27e0ae54e0b243f27f7e4abeeabfaeab05b8a9b9 Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Thu, 8 Jun 2023 14:13:25 +0000 Subject: [PATCH 455/946] always restore column encryption keys --- bin/ghe-restore | 3 ++ .../ghe-restore-column-encryption-keys | 34 +++++++++++++++++++ .../github-backup-utils/ghe-restore-settings | 6 ---- 3 files changed, 37 insertions(+), 6 deletions(-) create mode 100755 share/github-backup-utils/ghe-restore-column-encryption-keys diff --git a/bin/ghe-restore b/bin/ghe-restore index c0aae6ed9..ebd9d45bb 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -383,6 +383,9 @@ if $RESTORE_SETTINGS; then ghe-restore-settings "$GHE_HOSTNAME" fi +# Always restore column encryption keys +ghe-restoe-column-encryption-keys "$GHE_HOSTNAME" + # Make sure mysql and elasticsearch are prep'd and running before restoring. # These services will not have been started on appliances that have not been # configured yet. diff --git a/share/github-backup-utils/ghe-restore-column-encryption-keys b/share/github-backup-utils/ghe-restore-column-encryption-keys new file mode 100755 index 000000000..88b341eb6 --- /dev/null +++ b/share/github-backup-utils/ghe-restore-column-encryption-keys @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +#/ Usage: ghe-restore-settings +#/ Restore settings from a snapshot to the given . +set -e + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" + +# Show usage and bail with no arguments +[ -z "$*" ] && print_usage + +bm_start "$(basename $0)" + +# Grab host arg +GHE_HOSTNAME="$1" + +# Perform a host-check and establish GHE_REMOTE_XXX variables. +ghe_remote_version_required "$GHE_HOSTNAME" + +# The snapshot to restore should be set by the ghe-restore command but this lets +# us run this script directly. +: ${GHE_RESTORE_SNAPSHOT:=current} + +# Path to snapshot dir we're restoring from +GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" + +# Restore encrypted column encryption keying material if present +restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" + +# Restore encrypted column current encryption key if present +restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" + +bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index ad06f30a6..b489626c2 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -56,12 +56,6 @@ restore-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hm # Restore kredz.varz HMAC key if present. restore-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" -# Restore encrypted column encryption keying material if present -restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" - -# Restore encrypted column current encryption key if present -restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" - # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then log_info "Restoring SAML keys ..." From 716aa492a75c3011f95a67d31fef57a5eb338c5a Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 8 Jun 2023 12:11:12 -0400 Subject: [PATCH 456/946] Update ghe-restore --- bin/ghe-restore | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/ghe-restore b/bin/ghe-restore index 1efc2dad1..6a467dc64 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -576,6 +576,7 @@ if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then else log_info "Restoring data serially ..." 1>&3 for c in "${commands[@]}"; do + . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/bm.sh" eval "$c" done fi From eae0932e807ac3d3f673c64a5c1b49a1041bf618 Mon Sep 17 00:00:00 2001 From: boxofyellow Date: Thu, 8 Jun 2023 12:32:11 -0400 Subject: [PATCH 457/946] fix suggestions from the linter --- share/github-backup-utils/ghe-backup-mssql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index b1d97b8de..b5a3203fb 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -30,7 +30,7 @@ export_tool_available() { } ghe_ssh_mssql() { - ghe-ssh "$opts" "$ssh_config_file_opt" "$GHE_MSSQL_PRIMARY_HOST" "$@" + ghe-ssh "${opts[@]}" "${ssh_config_file_opt[@]}" "$GHE_MSSQL_PRIMARY_HOST" "$@" } cleanup() { @@ -55,8 +55,8 @@ isHA="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.ha" || true)" # get server hostnames under cluster and HA if [ "$GHE_BACKUP_STRATEGY" = "cluster" ] || [ "$isHA" = "true" ] ; then ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt="-F $ssh_config_file" - opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" + ssh_config_file_opt=("-F" "$ssh_config_file") + opts=("-o" "UserKnownHostsFile=/dev/null" "-o" "StrictHostKeyChecking=no" "-o" "PasswordAuthentication=no") ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" fi From 037e57afab7b3a11770d7cc17bd94dad4d62adc8 Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Thu, 8 Jun 2023 18:47:53 +0000 Subject: [PATCH 458/946] spelling --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index ebd9d45bb..b2f60da21 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -384,7 +384,7 @@ if $RESTORE_SETTINGS; then fi # Always restore column encryption keys -ghe-restoe-column-encryption-keys "$GHE_HOSTNAME" +ghe-restore-column-encryption-keys "$GHE_HOSTNAME" # Make sure mysql and elasticsearch are prep'd and running before restoring. # These services will not have been started on appliances that have not been From 2ab98ba0bc94f92d91ab856531325bcfb06e943f Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 8 Jun 2023 17:44:37 -0400 Subject: [PATCH 459/946] Fixing issues with parallel operations --- bin/ghe-restore | 8 ++---- share/github-backup-utils/ghe-restore-redis | 23 ++++++++++++++++ .../github-backup-utils/ghe-restore-ssh-keys | 26 +++++++++++++++++++ 3 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 share/github-backup-utils/ghe-restore-redis create mode 100644 share/github-backup-utils/ghe-restore-ssh-keys diff --git a/bin/ghe-restore b/bin/ghe-restore index 6a467dc64..ae3b84ac4 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -505,9 +505,7 @@ fi cmd_title=$(log_info "Restoring Redis database ...") commands=(" echo \"$cmd_title\" -bm_start \"$(basename $0) - Restoring Redis\" -ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3 -bm_end \"$(basename $0) - Restoring Redis\"") +ghe-restore-redis \"$GHE_HOSTNAME\") cmd_title=$(log_info "Restoring Git Repositories ...") commands+=(" @@ -527,9 +525,7 @@ ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") cmd_title=$(log_info "Restoring SSH authorized keys ...") commands+=(" echo \"$cmd_title\" -bm_start \"$(basename $0) -Restoring SSH authorized keys\" -ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-authorized-keys' < \"$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json\" 1>&3 -bm_end \"$(basename $0) -Restoring SSH authorized keys\"") +ghe-restore-ssh-keys \"$GHE_HOSTNAME\" \"$GHE_RESTORE_SNAPSHOT_PATH\") cmd_title=$(log_info "Restoring storage data ...") commands+=(" diff --git a/share/github-backup-utils/ghe-restore-redis b/share/github-backup-utils/ghe-restore-redis new file mode 100644 index 000000000..9f23e806c --- /dev/null +++ b/share/github-backup-utils/ghe-restore-redis @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +#/ Usage: ghe-restore-redis +#/ Restore redis files from an rsync snapshot. +#/ +#/ Note: This script typically isn't called directly. It's invoked by the +#/ ghe-restore command. +set -e + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$(dirname "${BASH_SOURCE[0]}")/ghe-backup-config" + +# Show usage and bail with no arguments +[[ -z ${*} ]] && print_usage + +# Grab host arg +GHE_HOSTNAME="${1}" + +bm_start "$(basename "${0}")" + +ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-redis' < "$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb" 1>&3 + +bm_end "$(basename "${0}")" \ No newline at end of file diff --git a/share/github-backup-utils/ghe-restore-ssh-keys b/share/github-backup-utils/ghe-restore-ssh-keys new file mode 100644 index 000000000..8ac0e3d94 --- /dev/null +++ b/share/github-backup-utils/ghe-restore-ssh-keys @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +#/ Usage: ghe-restore-ssh-keys +#/ Restore ssh keys from an rsync snapshot. +#/ +#/ Note: This script typically isn't called directly. It's invoked by the +#/ ghe-restore command. +set -e + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$(dirname "${BASH_SOURCE[0]}")/ghe-backup-config" + +# Show usage and bail with no arguments +[[ -z ${*} ]] && print_usage + +bm_start "$(basename "${0}")" + +# Grab host arg +GHE_HOSTNAME="${1}" +GHE_RESTORE_SNAPSHOT_PATH="${2}" + +bm_start "$(basename "${0}")" + +ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-authorized-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json" 1>&3 + +bm_end "$(basename "${0}")" \ No newline at end of file From b30999c3f13ce2ed05b92a6c82474a4663a9b522 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 8 Jun 2023 18:02:15 -0400 Subject: [PATCH 460/946] Fix quotes --- bin/{ghe-progress => ghe-backup-progress} | 4 ++-- bin/ghe-restore | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename bin/{ghe-progress => ghe-backup-progress} (91%) diff --git a/bin/ghe-progress b/bin/ghe-backup-progress similarity index 91% rename from bin/ghe-progress rename to bin/ghe-backup-progress index d28d80813..2f4b267fb 100755 --- a/bin/ghe-progress +++ b/bin/ghe-backup-progress @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#/ Usage: ghe-progress [--once] +#/ Usage: ghe-backup-progress [--once] #/ Tracks the completed steps of a backup or restore operation. #/ #/ By default the progress is printed every continuously or until a key is pressed. @@ -32,7 +32,7 @@ done check_for_progress_file() { if [ ! -f /tmp/backup-utils-progress-info ]; then - echo "No progress file found. has a backup or restore been started?" + echo "No progress file found. Has a backup or restore been started?" exit 1 fi } diff --git a/bin/ghe-restore b/bin/ghe-restore index ae3b84ac4..26ec6e0be 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -505,7 +505,7 @@ fi cmd_title=$(log_info "Restoring Redis database ...") commands=(" echo \"$cmd_title\" -ghe-restore-redis \"$GHE_HOSTNAME\") +ghe-restore-redis \"$GHE_HOSTNAME\"") cmd_title=$(log_info "Restoring Git Repositories ...") commands+=(" @@ -525,7 +525,7 @@ ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") cmd_title=$(log_info "Restoring SSH authorized keys ...") commands+=(" echo \"$cmd_title\" -ghe-restore-ssh-keys \"$GHE_HOSTNAME\" \"$GHE_RESTORE_SNAPSHOT_PATH\") +ghe-restore-ssh-keys \"$GHE_HOSTNAME\" \"$GHE_RESTORE_SNAPSHOT_PATH\"") cmd_title=$(log_info "Restoring storage data ...") commands+=(" From 1a8553716e6c51e79853c0bf9e149c7b5d0a6dec Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 8 Jun 2023 18:28:53 -0400 Subject: [PATCH 461/946] fix permissions --- share/github-backup-utils/ghe-restore-redis | 0 share/github-backup-utils/ghe-restore-ssh-keys | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 share/github-backup-utils/ghe-restore-redis mode change 100644 => 100755 share/github-backup-utils/ghe-restore-ssh-keys diff --git a/share/github-backup-utils/ghe-restore-redis b/share/github-backup-utils/ghe-restore-redis old mode 100644 new mode 100755 diff --git a/share/github-backup-utils/ghe-restore-ssh-keys b/share/github-backup-utils/ghe-restore-ssh-keys old mode 100644 new mode 100755 From bbf83854246ee60e7712451361d0f89d0471194c Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 8 Jun 2023 18:34:48 -0400 Subject: [PATCH 462/946] Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. --- bin/ghe-restore | 2 +- share/github-backup-utils/ghe-restore-redis | 3 +++ share/github-backup-utils/ghe-restore-ssh-keys | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 26ec6e0be..21fbc1fdb 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -505,7 +505,7 @@ fi cmd_title=$(log_info "Restoring Redis database ...") commands=(" echo \"$cmd_title\" -ghe-restore-redis \"$GHE_HOSTNAME\"") +ghe-restore-redis \"$GHE_HOSTNAME\" \"$GHE_RESTORE_SNAPSHOT_PATH\"") cmd_title=$(log_info "Restoring Git Repositories ...") commands+=(" diff --git a/share/github-backup-utils/ghe-restore-redis b/share/github-backup-utils/ghe-restore-redis index 9f23e806c..1bdfe7642 100755 --- a/share/github-backup-utils/ghe-restore-redis +++ b/share/github-backup-utils/ghe-restore-redis @@ -16,6 +16,9 @@ set -e # Grab host arg GHE_HOSTNAME="${1}" +# Grab snapshot path arg +GHE_RESTORE_SNAPSHOT_PATH="${2}" + bm_start "$(basename "${0}")" ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-redis' < "$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb" 1>&3 diff --git a/share/github-backup-utils/ghe-restore-ssh-keys b/share/github-backup-utils/ghe-restore-ssh-keys index 8ac0e3d94..216803d7a 100755 --- a/share/github-backup-utils/ghe-restore-ssh-keys +++ b/share/github-backup-utils/ghe-restore-ssh-keys @@ -17,6 +17,8 @@ bm_start "$(basename "${0}")" # Grab host arg GHE_HOSTNAME="${1}" + +# Grab snapshot path arg GHE_RESTORE_SNAPSHOT_PATH="${2}" bm_start "$(basename "${0}")" From fbfb368ec7160078055c8683621d5d1fb854f8fe Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 9 Jun 2023 21:43:21 +0000 Subject: [PATCH 463/946] update review comments --- backup.config-example | 7 +++++-- bin/ghe-backup | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backup.config-example b/backup.config-example index ac068a383..16b19e83c 100644 --- a/backup.config-example +++ b/backup.config-example @@ -13,9 +13,12 @@ GHE_DATA_DIR="data" # after successful backups. This option should be tuned based on the frequency # of scheduled backup runs. If backups are scheduled hourly, snapshots will be # available for the past N hours; if backups are scheduled daily, snapshots will -# be available for the past N days. Pruning enablement defaults to 'yes' +# be available for the past N days ... GHE_NUM_SNAPSHOTS=10 -#GHE_PRUNING_ENABLED=no + +# Pruning snapshots can be scheduled outside of the backup process. If set to 'yes' +# ghe-pruning-snapshots will need to be invoked separately via cron +#GHE_PRUNING_SCHEDULED=yes # The hostname of the GitHub appliance to restore. If you've set up a separate # GitHub appliance to act as a standby for recovery, specify its IP or hostname diff --git a/bin/ghe-backup b/bin/ghe-backup index c491e2ea2..98f9b613c 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -284,13 +284,17 @@ if [ "$GHE_BACKUP_FSCK" = "yes" ]; then fi # If everything was successful, mark the snapshot as complete, update the -# current symlink to point to the new snapshot -# Expired and failed snapshots to be pruned separately +# current symlink to point to the new snapshot and prune expired and failed +# snapshots. if [ -z "$failures" ]; then rm "incomplete" rm -f "../current" ln -s "$GHE_SNAPSHOT_TIMESTAMP" "../current" + + if [[ $GHE_PRUNING_SCHEDULED != "yes" ]]; then + ghe-prune-snapshots + fi fi END_TIME=$(date +%s) From a64763b4c06436419fce4175c281e5292cb376ff Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 9 Jun 2023 21:54:38 +0000 Subject: [PATCH 464/946] add more descr --- backup.config-example | 6 +++--- bin/ghe-backup | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backup.config-example b/backup.config-example index 16b19e83c..ace758cca 100644 --- a/backup.config-example +++ b/backup.config-example @@ -9,11 +9,11 @@ GHE_HOSTNAME="github.example.com" # elsewhere for backing up to a separate partition / mount point. GHE_DATA_DIR="data" -# The number of backup snapshots to retain. Old snapshots are to be pruned separately -# after successful backups. This option should be tuned based on the frequency +# The number of backup snapshots to retain. Old snapshots are pruned after each +# successful ghe-backup run. This option should be tuned based on the frequency # of scheduled backup runs. If backups are scheduled hourly, snapshots will be # available for the past N hours; if backups are scheduled daily, snapshots will -# be available for the past N days ... +# be available for the past N days ... GHE_NUM_SNAPSHOTS=10 # Pruning snapshots can be scheduled outside of the backup process. If set to 'yes' diff --git a/bin/ghe-backup b/bin/ghe-backup index 98f9b613c..d4998532b 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -294,6 +294,8 @@ if [ -z "$failures" ]; then if [[ $GHE_PRUNING_SCHEDULED != "yes" ]]; then ghe-prune-snapshots + else + echo "Expired and incomplete snapshots to be pruned separately" fi fi From a3208df06d46c5da781c751857d1a2961371b2b0 Mon Sep 17 00:00:00 2001 From: Junior Eluhu Date: Mon, 12 Jun 2023 20:46:10 +0000 Subject: [PATCH 465/946] Bump version: 3.9.0 [ci skip] --- bin/ghe-host-check | 2 +- debian/changelog | 16 ++++++++++++++++ share/github-backup-utils/version | 2 +- test/testlib.sh | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index d020d78a4..252e84ee7 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -131,7 +131,7 @@ fi # backup-utils 2.13 onwards limits support to the current and previous two releases # of GitHub Enterprise Server. -supported_minimum_version="3.6.0" +supported_minimum_version="3.7.0" if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then supported=1 diff --git a/debian/changelog b/debian/changelog index fb6b9940b..ee3c73176 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +github-backup-utils (3.9.0) UNRELEASED; urgency=medium + + * Set restore status on all cluster nodes #274 + * Fix pages backups and restores in GitHub Enterprise 11.10 #275 + * Backup and restore custom CA certificates #281 + * Set the benchmark file path consistently #283 + * Suppress dd output noise #289 + * Track completeness of Elasticsearch JSON dumps #298 + * Use existing Elasticsearch indices to speed up transfer during a restore #310 + * Include the user data directory in the benchmark name #311 + * Use calculated routes when backing up storage data from a cluster #318 + * Refresh the existing indices when restoring Elasticsearch indices to cluster #328 + * Use git to generate short name for SSH multiplex control path #335 + + -- Junior Eluhu Mon, 12 Jun 2023 20:46:10 +0000 + github-backup-utils (3.8.0) focal; urgency=medium -- Daniel Johnson Tue, 07 Feb 2023 21:43:26 +0000 diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 19811903a..a5c4c7633 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.8.0 +3.9.0 diff --git a/test/testlib.sh b/test/testlib.sh index e17fc3fd2..631049e30 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -43,7 +43,7 @@ export GHE_BACKUP_CONFIG GHE_DATA_DIR GHE_REMOTE_DATA_DIR GHE_REMOTE_ROOT_DIR # The default remote appliance version. This may be set in the environment prior # to invoking tests to emulate a different remote vm version. -: ${GHE_TEST_REMOTE_VERSION:=3.8.0.rc1} +: ${GHE_TEST_REMOTE_VERSION:=3.9.0.rc1} export GHE_TEST_REMOTE_VERSION # Source in the backup config and set GHE_REMOTE_XXX variables based on the From 3d41d16ec700ebeb2ce13692b027848fdff5183e Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Mon, 12 Jun 2023 21:37:05 +0000 Subject: [PATCH 466/946] in-progress checks --- share/github-backup-utils/ghe-prune-snapshots | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/share/github-backup-utils/ghe-prune-snapshots b/share/github-backup-utils/ghe-prune-snapshots index 3a73dfccc..fe4ae0ae5 100755 --- a/share/github-backup-utils/ghe-prune-snapshots +++ b/share/github-backup-utils/ghe-prune-snapshots @@ -20,21 +20,30 @@ prune_snapshot() { done } -# First prune all incomplete / failed snapshot directories -prune_dirs="$(ls -1 "$GHE_DATA_DIR"/[0-9]*/incomplete 2>/dev/null || true)" -prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) +# Prune if backup is not running +#if [ ! -f "$GHE_DATA_DIR/in-progress" ] && [ ! -f "$GHE_DATA_DIR/in-progress-restore" ]; then +# Check for backup or restore in-progress file +inprogress_file=$(find $GHE_DATA_DIR -maxdepth 1 -type f \( -name "in-progress" -o -name "in-progress-restore" \) -print -quit) +if [ -z "$inprogress_file" ]; then + # First prune all incomplete / failed snapshot directories + prune_dirs="$(ls -1 "$GHE_DATA_DIR"/[0-9]*/incomplete 2>/dev/null || true)" + prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) -if [ $prune_num -gt 0 ]; then - log_info Pruning $prune_num "failed snapshot(s) ..." - echo "$prune_dirs" | sed 's@/incomplete$@@' | prune_snapshot -fi + if [ $prune_num -gt 0 ]; then + log_info Pruning $prune_num "failed snapshot(s) ..." + echo "$prune_dirs" | sed 's@/incomplete$@@' | prune_snapshot + fi -# Now prune all expired snapshots. Keep GHE_NUM_SNAPSHOTS around. -snapshot_count=$(ls -1d "$GHE_DATA_DIR"/[0-9]* 2>/dev/null | wc -l) + # Now prune all expired snapshots. Keep GHE_NUM_SNAPSHOTS around. + snapshot_count=$(ls -1d "$GHE_DATA_DIR"/[0-9]* 2>/dev/null | wc -l) -if [ "$snapshot_count" -gt "$GHE_NUM_SNAPSHOTS" ]; then - prune_dirs="$(ls -1d "$GHE_DATA_DIR"/[0-9]* | sort -r | awk "NR>$GHE_NUM_SNAPSHOTS")" - prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) - log_info Pruning $prune_num "expired snapshot(s) ..." - echo "$prune_dirs" | prune_snapshot + if [ "$snapshot_count" -gt "$GHE_NUM_SNAPSHOTS" ]; then + prune_dirs="$(ls -1d "$GHE_DATA_DIR"/[0-9]* | sort -r | awk "NR>$GHE_NUM_SNAPSHOTS")" + prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) + log_info Pruning $prune_num "expired snapshot(s) ..." + echo "$prune_dirs" | prune_snapshot + fi +else + log_info "Detected a running backup/restore process, please wait until that process is complete to prune expired/incomplete snapshots." 1>&2 + log_info "If no such process is running, please remove the "$GHE_DATA_DIR/in-progress*" file and retry again." 1>&2 fi From 882c2e75a9ca31aede772d3487b3e6e70739590c Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Tue, 13 Jun 2023 15:02:53 +0000 Subject: [PATCH 467/946] code review comments --- .../github-backup-utils/ghe-restore-column-encryption-keys | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-column-encryption-keys b/share/github-backup-utils/ghe-restore-column-encryption-keys index 88b341eb6..7194bc1ee 100755 --- a/share/github-backup-utils/ghe-restore-column-encryption-keys +++ b/share/github-backup-utils/ghe-restore-column-encryption-keys @@ -1,6 +1,7 @@ #!/usr/bin/env bash -#/ Usage: ghe-restore-settings -#/ Restore settings from a snapshot to the given . +#/ Usage: ghe-restore-column-encryption-keys +#/ Restore the column encryption keys from a snapshot to the given . +#/ This script will be run automatically by `ghe-restore set -e # Bring in the backup configuration @@ -26,9 +27,11 @@ ghe_remote_version_required "$GHE_HOSTNAME" GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" # Restore encrypted column encryption keying material if present +log_info "Restoring encrypted column encryption keying material" restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" # Restore encrypted column current encryption key if present +log_info "Restoring encrypted column current encryption key" restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" bm_end "$(basename $0)" From 5351bac2fa2dbf8f144a6ea9fa7d4c57698f77f5 Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Wed, 14 Jun 2023 14:54:12 +0000 Subject: [PATCH 468/946] export GHE_RESTORE_SNAPSHOT in restore column encryption keys --- share/github-backup-utils/ghe-restore-column-encryption-keys | 1 + 1 file changed, 1 insertion(+) diff --git a/share/github-backup-utils/ghe-restore-column-encryption-keys b/share/github-backup-utils/ghe-restore-column-encryption-keys index 7194bc1ee..952029143 100755 --- a/share/github-backup-utils/ghe-restore-column-encryption-keys +++ b/share/github-backup-utils/ghe-restore-column-encryption-keys @@ -25,6 +25,7 @@ ghe_remote_version_required "$GHE_HOSTNAME" # Path to snapshot dir we're restoring from GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" +export GHE_RESTORE_SNAPSHOT # Restore encrypted column encryption keying material if present log_info "Restoring encrypted column encryption keying material" From 5d49ec263d86ff3b96f733bae95dbde8294b63fb Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Wed, 14 Jun 2023 15:36:58 +0000 Subject: [PATCH 469/946] add gamefiend suggestion --- share/github-backup-utils/ghe-restore-column-encryption-keys | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-column-encryption-keys b/share/github-backup-utils/ghe-restore-column-encryption-keys index 952029143..c21678157 100755 --- a/share/github-backup-utils/ghe-restore-column-encryption-keys +++ b/share/github-backup-utils/ghe-restore-column-encryption-keys @@ -24,8 +24,7 @@ ghe_remote_version_required "$GHE_HOSTNAME" : ${GHE_RESTORE_SNAPSHOT:=current} # Path to snapshot dir we're restoring from -GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" -export GHE_RESTORE_SNAPSHOT +: ${GHE_RESTORE_SNAPSHOT_PATH:="$GHE_DATA_DIR/current"} # Restore encrypted column encryption keying material if present log_info "Restoring encrypted column encryption keying material" From 9dbae1c836c22cb0d3ce597d3fc394a77df2ede5 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 14 Jun 2023 21:14:43 +0000 Subject: [PATCH 470/946] add test for scheduled pruning --- test/test-ghe-prune-snapshots.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test-ghe-prune-snapshots.sh b/test/test-ghe-prune-snapshots.sh index a736134ae..989e3cd29 100755 --- a/test/test-ghe-prune-snapshots.sh +++ b/test/test-ghe-prune-snapshots.sh @@ -89,3 +89,19 @@ begin_test "ghe-prune-snapshots incomplete snapshot pruning" [ ! -d "$GHE_DATA_DIR/04" ] ) end_test + +begin_test "ghe-prune-snapshots scheduled snapshot pruning" +( + set -e + + generate_prune_files 5 + + pre_num_files=$(file_count_no_current) + + GHE_NUM_SNAPSHOTS=3 GHE_PRUNING_SCHEDULED=yes ghe-prune-snapshots + + post_num_files=$(file_count_no_current) + + [ "$pre_num_files" = "$post_num_files" ] +) +end_test From 70799ecbddd1f06714a357cf757cbfbdbdb9b79c Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 14 Jun 2023 21:33:05 +0000 Subject: [PATCH 471/946] update for backup --- test/test-ghe-prune-snapshots.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-ghe-prune-snapshots.sh b/test/test-ghe-prune-snapshots.sh index 989e3cd29..b288e7e0d 100755 --- a/test/test-ghe-prune-snapshots.sh +++ b/test/test-ghe-prune-snapshots.sh @@ -98,7 +98,7 @@ begin_test "ghe-prune-snapshots scheduled snapshot pruning" pre_num_files=$(file_count_no_current) - GHE_NUM_SNAPSHOTS=3 GHE_PRUNING_SCHEDULED=yes ghe-prune-snapshots + GHE_NUM_SNAPSHOTS=3 GHE_PRUNING_SCHEDULED=yes ghe-backup post_num_files=$(file_count_no_current) From 6357cf4605468cf067b7dfb892ee5ae8baf5f27a Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 14 Jun 2023 22:27:23 +0000 Subject: [PATCH 472/946] fix backup setup --- test/test-ghe-prune-snapshots.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test-ghe-prune-snapshots.sh b/test/test-ghe-prune-snapshots.sh index b288e7e0d..d59068e24 100755 --- a/test/test-ghe-prune-snapshots.sh +++ b/test/test-ghe-prune-snapshots.sh @@ -93,6 +93,10 @@ end_test begin_test "ghe-prune-snapshots scheduled snapshot pruning" ( set -e + # Create the backup data dir and fake remote repositories dirs + mkdir -p "$GHE_DATA_DIR" "$GHE_REMOTE_DATA_USER_DIR" + + setup_test_data $GHE_REMOTE_DATA_USER_DIR generate_prune_files 5 @@ -102,6 +106,6 @@ begin_test "ghe-prune-snapshots scheduled snapshot pruning" post_num_files=$(file_count_no_current) - [ "$pre_num_files" = "$post_num_files" ] + [ "$((pre_num_files + 1))" = "$post_num_files" ] ) end_test From 2b8d5490f46a355fa96d701b01ecae74de284289 Mon Sep 17 00:00:00 2001 From: Joseph Franks Date: Thu, 15 Jun 2023 09:28:22 -0500 Subject: [PATCH 473/946] adjusting release script to support patch versions --- script/release | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/script/release b/script/release index a27194d4b..fd48e094c 100755 --- a/script/release +++ b/script/release @@ -32,6 +32,7 @@ GH_OWNER = ENV['GH_OWNER'] || 'github' GH_AUTHOR = ENV['GH_AUTHOR'] DEB_PKG_NAME = 'github-backup-utils' GH_BASE_BRANCH = ENV['GH_BASE_BRANCH'] || 'master' +GH_STABLE_BRANCH = ENV['GH_STABLE_BRANCH'] || 'stable' CHANGELOG_TMPL = '''<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium @@ -137,7 +138,7 @@ def beautify_changes(changes) end def changelog - changes = `git log --pretty=oneline origin/stable...origin/#{GH_BASE_BRANCH} --reverse --grep "Merge pull request" | sort -t\# -k2`.lines.map(&:strip) + changes = `git log --pretty=oneline origin/#{GH_STABLE_BRANCH}...origin/#{GH_BASE_BRANCH} --reverse --grep "Merge pull request" | sort -t\# -k2`.lines.map(&:strip) raise 'Building the changelog failed' if $CHILD_STATUS != 0 changes @@ -228,12 +229,12 @@ def push_release_branch(version) end def update_stable_branch - `git checkout --quiet stable` + `git checkout --quiet #{GH_STABLE_BRANCH}` unless (out = `git merge --quiet --ff-only origin/#{GH_BASE_BRANCH}`) - warn "Merging #{GH_BASE_BRANCH} into stable failed:\n\n#{out}" + warn "Merging #{GH_BASE_BRANCH} into #{GH_STABLE_BRANCH} failed:\n\n#{out}" end - unless (out = `git push --quiet origin stable`) - warn "Failed pushing the stable branch:\n\n#{out}" + unless (out = `git push --quiet origin #{GH_STABLE_BRANCH}`) + warn "Failed pushing the #{GH_STABLE_BRANCH} branch:\n\n#{out}" end end From e12bbdd04522f3539f719bf6cb3514972f318b8b Mon Sep 17 00:00:00 2001 From: Joseph Franks Date: Thu, 15 Jun 2023 12:40:49 -0500 Subject: [PATCH 474/946] adjust backup-utils release script to better support patch branches --- script/release | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/script/release b/script/release index fd48e094c..7ab0daea2 100755 --- a/script/release +++ b/script/release @@ -31,8 +31,8 @@ GH_REPO = ENV['GH_REPO'] || 'backup-utils' GH_OWNER = ENV['GH_OWNER'] || 'github' GH_AUTHOR = ENV['GH_AUTHOR'] DEB_PKG_NAME = 'github-backup-utils' -GH_BASE_BRANCH = ENV['GH_BASE_BRANCH'] || 'master' -GH_STABLE_BRANCH = ENV['GH_STABLE_BRANCH'] || 'stable' +GH_BASE_BRANCH = ENV['GH_BASE_BRANCH'] || 'master' # TODO: should we even allow a default or require all params get set explicitly? +GH_STABLE_BRANCH = "" CHANGELOG_TMPL = '''<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium @@ -138,6 +138,7 @@ def beautify_changes(changes) end def changelog + puts "building changelog by comparing origin/#{GH_STABLE_BRANCH}...origin/#{GH_BASE_BRANCH}" changes = `git log --pretty=oneline origin/#{GH_STABLE_BRANCH}...origin/#{GH_BASE_BRANCH} --reverse --grep "Merge pull request" | sort -t\# -k2`.lines.map(&:strip) raise 'Building the changelog failed' if $CHILD_STATUS != 0 @@ -334,9 +335,31 @@ def clean_up(version) `git branch --quiet -D tmp-packaging >/dev/null 2>&1` end +def is_base_branch_valid?(branch) + if branch == "master" || branch.match(/^\d+\.\d+-main$/) + return true + else + return false + end +end + #### All the action starts #### if $PROGRAM_NAME == __FILE__ begin + ## validate base branch. this must either be "master" or a release branch which will match the pattern "x.y-main" + raise "The branch #{GH_BASE_BRANCH} is not valid for releasing backup-utils. branch name must be master or match x.y-main" if !is_base_branch_valid?(GH_BASE_BRANCH) + + ## derive the proper stable branch. if the base branch is "master" the stable branch is just "stable" + ## if the base branch is a release branch, the stable branch will be "x.y-stable" + if GH_BASE_BRANCH == "master" + GH_STABLE_BRANCH = "stable" + else + GH_STABLE_BRANCH = GH_BASE_BRANCH.gsub(/-main$/, "-stable") + end + + puts "base branch = " + GH_BASE_BRANCH + puts "stable branch = " + GH_STABLE_BRANCH + args = ARGV.dup dry_run = false skip_version_bump_check = false @@ -456,7 +479,7 @@ if $PROGRAM_NAME == __FILE__ puts 'Cleaning up...' clean_up version - puts 'Updating stable branch...' + puts "Updating #{GH_STABLE_BRANCH} branch..." update_stable_branch puts 'Released!' From 14a25425934a8e7d747fd031a18b1a2caeb35e09 Mon Sep 17 00:00:00 2001 From: Joseph Franks Date: Thu, 15 Jun 2023 12:45:41 -0500 Subject: [PATCH 475/946] moving code to derive stable branch name into a function --- script/release | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/script/release b/script/release index 7ab0daea2..b7b61615e 100755 --- a/script/release +++ b/script/release @@ -343,19 +343,26 @@ def is_base_branch_valid?(branch) end end +def get_stable_branch_name(branch) + ## derive the proper stable branch. if the base branch is "master" the stable branch is just "stable" + ## if the base branch is a release branch, the stable branch will be "x.y-stable" + result = "" + if branch == "master" + result = "stable" + else + result = branch.gsub(/-main$/, "-stable") + end + + result +end + #### All the action starts #### if $PROGRAM_NAME == __FILE__ begin ## validate base branch. this must either be "master" or a release branch which will match the pattern "x.y-main" raise "The branch #{GH_BASE_BRANCH} is not valid for releasing backup-utils. branch name must be master or match x.y-main" if !is_base_branch_valid?(GH_BASE_BRANCH) - ## derive the proper stable branch. if the base branch is "master" the stable branch is just "stable" - ## if the base branch is a release branch, the stable branch will be "x.y-stable" - if GH_BASE_BRANCH == "master" - GH_STABLE_BRANCH = "stable" - else - GH_STABLE_BRANCH = GH_BASE_BRANCH.gsub(/-main$/, "-stable") - end + GH_STABLE_BRANCH = get_stable_branch_name(GH_BASE_BRANCH) puts "base branch = " + GH_BASE_BRANCH puts "stable branch = " + GH_STABLE_BRANCH From 5180d0c629b36aaba6041d40bbfc5be67cae2fab Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 16 Jun 2023 14:41:42 -0400 Subject: [PATCH 476/946] Update share/github-backup-utils/ghe-backup-config --- share/github-backup-utils/ghe-backup-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index f3e620bfa..c84055a42 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -703,7 +703,7 @@ restore-secret() { #initialize progress tracking by clearing out the temp files used to track init-progress() { - rm -f /tmp/backup-utils-progress-* + rm -f /tmp/backup-utils-progress* } From b60a3e61d54ddeb44123a44315c90ca5eed7b195 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Wed, 21 Jun 2023 20:26:20 +0000 Subject: [PATCH 477/946] doc update and prune timing --- docs/scheduling-backups.md | 14 +++++++++++++- share/github-backup-utils/ghe-prune-snapshots | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/scheduling-backups.md b/docs/scheduling-backups.md index 8d291021a..14916404d 100644 --- a/docs/scheduling-backups.md +++ b/docs/scheduling-backups.md @@ -1,4 +1,4 @@ -# Scheduling backups +# Scheduling backups & snapshot pruning Regular backups should be scheduled using `cron(8)` or similar command scheduling service on the backup host. The backup frequency will dictate the @@ -17,6 +17,13 @@ based on the frequency of backups. The ten most recent snapshots are retained by default. The number should be adjusted based on backup frequency and available storage. +By default all expired and incomplete snapshots are deleted at the end of the main +backup process `ghe-backup`. If pruning of these snapshots takes a long time you can +choose to disable the pruning process from the backup run and schedule it separately. +This can be achieved by enabling the `GHE_PRUNING_SCHEDULED` option in `backup.config`. +Please note if this option is enabled, you will need to schedule the pruning script `ghe-prune-snapshots` +using `cron` or similar command scheduling service on the backup host. + To schedule hourly backup snapshots with verbose informational output written to a log file and errors generating an email: @@ -30,5 +37,10 @@ To schedule nightly backup snapshots instead, use: 0 0 * * * /opt/backup-utils/bin/ghe-backup -v 1>>/opt/backup-utils/backup.log 2>&1 +To schedule daily snapshot pruning, use: + + MAILTO=admin@example.com + + 0 3 * * * /opt/backup-utils/share/github-backup-utils/ghe-prune-snapshots 1>>/opt/backup-utils/prune-snapshots.log 2>&1 [1]: https://en.wikipedia.org/wiki/Recovery_point_objective diff --git a/share/github-backup-utils/ghe-prune-snapshots b/share/github-backup-utils/ghe-prune-snapshots index fe4ae0ae5..9071293ad 100755 --- a/share/github-backup-utils/ghe-prune-snapshots +++ b/share/github-backup-utils/ghe-prune-snapshots @@ -24,7 +24,7 @@ prune_snapshot() { #if [ ! -f "$GHE_DATA_DIR/in-progress" ] && [ ! -f "$GHE_DATA_DIR/in-progress-restore" ]; then # Check for backup or restore in-progress file inprogress_file=$(find $GHE_DATA_DIR -maxdepth 1 -type f \( -name "in-progress" -o -name "in-progress-restore" \) -print -quit) -if [ -z "$inprogress_file" ]; then +if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then # First prune all incomplete / failed snapshot directories prune_dirs="$(ls -1 "$GHE_DATA_DIR"/[0-9]*/incomplete 2>/dev/null || true)" prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) @@ -43,7 +43,7 @@ if [ -z "$inprogress_file" ]; then log_info Pruning $prune_num "expired snapshot(s) ..." echo "$prune_dirs" | prune_snapshot fi -else +elif [ "$CALLING_SCRIPT" != "ghe-backup" ] && [ -n "$inprogress_file" ]; then log_info "Detected a running backup/restore process, please wait until that process is complete to prune expired/incomplete snapshots." 1>&2 log_info "If no such process is running, please remove the "$GHE_DATA_DIR/in-progress*" file and retry again." 1>&2 fi From 6e4c42b5897b8fd46324b55e284b0375b43031ca Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Wed, 21 Jun 2023 21:19:17 +0000 Subject: [PATCH 478/946] update check --- share/github-backup-utils/ghe-prune-snapshots | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-prune-snapshots b/share/github-backup-utils/ghe-prune-snapshots index 9071293ad..0da56df97 100755 --- a/share/github-backup-utils/ghe-prune-snapshots +++ b/share/github-backup-utils/ghe-prune-snapshots @@ -24,7 +24,7 @@ prune_snapshot() { #if [ ! -f "$GHE_DATA_DIR/in-progress" ] && [ ! -f "$GHE_DATA_DIR/in-progress-restore" ]; then # Check for backup or restore in-progress file inprogress_file=$(find $GHE_DATA_DIR -maxdepth 1 -type f \( -name "in-progress" -o -name "in-progress-restore" \) -print -quit) -if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then +if [[ "$CALLING_SCRIPT" == "ghe-backup" ]] || [ -z "$inprogress_file" ]; then # First prune all incomplete / failed snapshot directories prune_dirs="$(ls -1 "$GHE_DATA_DIR"/[0-9]*/incomplete 2>/dev/null || true)" prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) From c500539ed3338a51ff9239c86799b15994bbfe22 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Mon, 26 Jun 2023 20:48:09 +0000 Subject: [PATCH 479/946] Update verbiage --- docs/scheduling-backups.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/scheduling-backups.md b/docs/scheduling-backups.md index 14916404d..87eefc14c 100644 --- a/docs/scheduling-backups.md +++ b/docs/scheduling-backups.md @@ -18,7 +18,7 @@ default. The number should be adjusted based on backup frequency and available storage. By default all expired and incomplete snapshots are deleted at the end of the main -backup process `ghe-backup`. If pruning of these snapshots takes a long time you can +backup process `ghe-backup`. If pruning these snapshots takes a long time you can choose to disable the pruning process from the backup run and schedule it separately. This can be achieved by enabling the `GHE_PRUNING_SCHEDULED` option in `backup.config`. Please note if this option is enabled, you will need to schedule the pruning script `ghe-prune-snapshots` From 8c3d680d45dfe4f9e17c0216aaab15a253a167d5 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Mon, 26 Jun 2023 21:08:49 +0000 Subject: [PATCH 480/946] update available_space check --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index d020d78a4..586739916 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -186,7 +186,7 @@ actions: $actions_disk_size MB mssql: $mssql_disk_size MB DATA_TRANSFER_SIZE - if [[ $available_space -lt $min_disk_req ]]; then + if [[ $((available_space / (1024 * 1024))) -lt $min_disk_req ]]; then echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 exit 1 fi From 7c57bd178163bf576ee75d43257ab925c3b3ab7e Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Mon, 26 Jun 2023 21:20:42 +0000 Subject: [PATCH 481/946] Add versioning for backup and restore of encryption keys * only backup encryption keying material in versions 3.7+ * only backup current encryption key in versions 3.8+ * adds tests --- share/github-backup-utils/ghe-backup-settings | 12 +++- .../ghe-restore-column-encryption-keys | 17 ++++-- test/test-ghe-backup.sh | 58 ++++++++++++++++++- test/test-ghe-restore.sh | 58 ++++++++++++++++++- 4 files changed, 133 insertions(+), 12 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index c71085a0b..c12abcd92 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -78,8 +78,16 @@ backup-secret "management console password" "manage-password" "secrets.manage" backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" -backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" -backup-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" + +# backup encryption keying material for GHES 3.7.0 onwards +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then + backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" +fi + +# backup current encryption key for GHES 3.8.0 onwards +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then + backup-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" +fi # Backup argon secrets for multiuser from ghes version 3.8 onwards if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then diff --git a/share/github-backup-utils/ghe-restore-column-encryption-keys b/share/github-backup-utils/ghe-restore-column-encryption-keys index c21678157..d30cacd51 100755 --- a/share/github-backup-utils/ghe-restore-column-encryption-keys +++ b/share/github-backup-utils/ghe-restore-column-encryption-keys @@ -26,12 +26,17 @@ ghe_remote_version_required "$GHE_HOSTNAME" # Path to snapshot dir we're restoring from : ${GHE_RESTORE_SNAPSHOT_PATH:="$GHE_DATA_DIR/current"} -# Restore encrypted column encryption keying material if present -log_info "Restoring encrypted column encryption keying material" -restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" +# Restore encrypted column encryption keying material for GHES 3.7.0 onward +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then + log_info "Restoring encrypted column encryption keying material" + restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" +fi + +# Restore encrypted column current encryption key for GHES 3.8.0 onwards +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then + log_info "Restoring encrypted column current encryption key" + restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" +fi -# Restore encrypted column current encryption key if present -log_info "Restoring encrypted column current encryption key" -restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" bm_end "$(basename $0)" diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 135b26170..dd8563528 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -555,7 +555,18 @@ begin_test "ghe-backup takes backup of kredz-varz settings" ) end_test -begin_test "ghe-backup takes backup of encrypted column encryption keying material" +begin_test "ghe-backup does not take backup of encrypted column encryption keying material for versions below 3.7.0" +( + GHE_REMOTE_VERSION=2.1.10 ghe-backup -v | grep -q "encrypted column encryption keying material not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material" ] + + GHE_REMOTE_VERSION=3.6.1 ghe-backup -v | grep -q "encrypted column encryption keying material not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material" ] + +) +end_test + +begin_test "ghe-backup takes backup of encrypted column encryption keying material for versions 3.7.0+" ( set -e @@ -567,6 +578,22 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" done + # GHES version 3.7.0 + GHE_REMOTE_VERSION=3.7.0 + + ghe-backup + + required_files=( + "encrypted-column-encryption-keying-material" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done + + # GHES version 3.8.0 + GHE_REMOTE_VERSION=3.8.0 + ghe-backup required_files=( @@ -580,7 +607,18 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi ) end_test -begin_test "ghe-backup takes backup of encrypted column current encryption key" +begin_test "ghe-backup does not take backup of encrypted column current encryption key for versions below 3.8.0" +( + GHE_REMOTE_VERSION=2.1.10 ghe-backup -v | grep -q "encrypted column current encryption key not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-current-encryption-key" ] + + GHE_REMOTE_VERSION=3.7.0 ghe-backup -v | grep -q "encrypted column current encryption key not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-current-encryption-key" ] + +) +end_test + +begin_test "ghe-backup takes backup of encrypted column current encryption key for versions 3.8.0+" ( set -e @@ -592,6 +630,22 @@ begin_test "ghe-backup takes backup of encrypted column current encryption key" ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" done + # GHES version 3.8.0 + GHE_REMOTE_VERSION=3.8.0 + + ghe-backup + + required_files=( + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done + + # GHES version 3.9.0 + GHE_REMOTE_VERSION=3.9.0 + ghe-backup required_files=( diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index c39c042b7..753b42196 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -281,7 +281,18 @@ begin_test "ghe-restore with no pages backup" ) end_test -begin_test "ghe-restore with encrypted column encryption keying material" +begin_test "ghe-restore does not restore encrypted column encryption keying material for versions below 3.7.0" +( + GHE_REMOTE_VERSION=2.1.10 ghe-restore -v -f localhost | grep -q "encrypted column encryption keying material not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material"] + + GHE_REMOTE_VERSION=3.6.1 ghe-restore -v -f localhost | grep -q "encrypted column encryption keying material not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material" ] + +) +end_test + +begin_test "ghe-restore with encrypted column encryption keying material for versions 3.7.0+" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" @@ -295,6 +306,21 @@ begin_test "ghe-restore with encrypted column encryption keying material" echo "foo" > "$GHE_DATA_DIR/current/$file" done + # GHES version 3.7.0 + GHE_REMOTE_VERSION=3.7.0 + + ghe-restore -v -f localhost + required_secrets=( + "secrets.github.encrypted-column-keying-material" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + done + + # GHES version 3.8.0 + GHE_REMOTE_VERSION=3.8.0 + ghe-restore -v -f localhost required_secrets=( "secrets.github.encrypted-column-keying-material" @@ -306,7 +332,19 @@ begin_test "ghe-restore with encrypted column encryption keying material" ) end_test -begin_test "ghe-restore with encrypted column current encryption key" + +begin_test "ghe-restore does not encrypted column current encryption key for versions below 3.8.0" +( + GHE_REMOTE_VERSION=2.1.10 restore -v -f | grep -q "encrypted column current encryption key not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-current-encryption-key" ] + + GHE_REMOTE_VERSION=3.7.0 restore -v -f | grep -q "encrypted column current encryption key not set" && exit 1 + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-current-encryption-key" ] + +) +end_test + +begin_test "ghe-restore with encrypted column current encryption key for versions 3.8.0+" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" @@ -320,6 +358,22 @@ begin_test "ghe-restore with encrypted column current encryption key" echo "foo" > "$GHE_DATA_DIR/current/$file" done + # GHES version 3.8.0 + GHE_REMOTE_VERSION=3.8.0 + + ghe-restore -v -f localhost + required_secrets=( + "secrets.github.encrypted-column-current-encryption-key" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + done + + + # GHES version 3.9.0 + GHE_REMOTE_VERSION=3.9.0 + ghe-restore -v -f localhost required_secrets=( "secrets.github.encrypted-column-current-encryption-key" From d7bb7026a0ea2c47272380eb2b1a6a751b523a45 Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Mon, 26 Jun 2023 21:28:17 +0000 Subject: [PATCH 482/946] add log message about always restoring encryption keys on versions forward 3.7.0 --- bin/ghe-restore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/ghe-restore b/bin/ghe-restore index b2f60da21..64bfad46f 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -384,6 +384,9 @@ if $RESTORE_SETTINGS; then fi # Always restore column encryption keys +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then + log_info "Always restore encrypted column encryption keys on GHES verions 3.7.0+" +fi ghe-restore-column-encryption-keys "$GHE_HOSTNAME" # Make sure mysql and elasticsearch are prep'd and running before restoring. From b427a32fabe7791cfee5f84fd1b91a5e1e78bf0a Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Tue, 27 Jun 2023 08:13:44 -0400 Subject: [PATCH 483/946] Update test/test-ghe-restore.sh Co-authored-by: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> --- test/test-ghe-restore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 753b42196..606b466e4 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -284,7 +284,7 @@ end_test begin_test "ghe-restore does not restore encrypted column encryption keying material for versions below 3.7.0" ( GHE_REMOTE_VERSION=2.1.10 ghe-restore -v -f localhost | grep -q "encrypted column encryption keying material not set" && exit 1 - [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material"] + [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material" ] GHE_REMOTE_VERSION=3.6.1 ghe-restore -v -f localhost | grep -q "encrypted column encryption keying material not set" && exit 1 [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material" ] From 7bdd77ba6ec77b190dddbc0c8d6b836c94ee9c4a Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:40:18 +0000 Subject: [PATCH 484/946] break up tests to try to appease shellcheck --- test/test-ghe-backup.sh | 18 +++++++++++++++++- test/test-ghe-restore.sh | 20 +++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index dd8563528..2986872ca 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -618,7 +618,8 @@ begin_test "ghe-backup does not take backup of encrypted column current encrypti ) end_test -begin_test "ghe-backup takes backup of encrypted column current encryption key for versions 3.8.0+" +# encrypted column current encryption key needs to be backed up for versions 3.8.0+ +begin_test "ghe-backup takes backup of encrypted column current encryption key for versions 3.8.0" ( set -e @@ -642,6 +643,21 @@ begin_test "ghe-backup takes backup of encrypted column current encryption key f for file in "${required_files[@]}"; do [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] done +) +end_test + +# encrypted column current encryption key needs to be backed up for versions 3.8.0+ +begin_test "ghe-backup takes backup of encrypted column current encryption key for versions 3.9.0" +( + set -e + + required_secrets=( + "secrets.github.encrypted-column-current-encryption-key" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done # GHES version 3.9.0 GHE_REMOTE_VERSION=3.9.0 diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 606b466e4..f3b924324 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -344,7 +344,9 @@ begin_test "ghe-restore does not encrypted column current encryption key for ver ) end_test -begin_test "ghe-restore with encrypted column current encryption key for versions 3.8.0+" + +# encrypted column current encryption key needs to be restored for versions 3.8.0+ +begin_test "ghe-restore with encrypted column current encryption key for versions 3.8.0" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" @@ -369,7 +371,23 @@ begin_test "ghe-restore with encrypted column current encryption key for version for secret in "${required_secrets[@]}"; do [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] done +) +end_test + +# encrypted column current encryption key needs to be restored for versions 3.8.0+ +begin_test "ghe-restore with encrypted column current encryption key for versions 3.9.0" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + required_files=( + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files[@]}"; do + echo "foo" > "$GHE_DATA_DIR/current/$file" + done # GHES version 3.9.0 GHE_REMOTE_VERSION=3.9.0 From c4c1dda395235cca459993f331144d8f6fce377b Mon Sep 17 00:00:00 2001 From: Ant Kaynak Date: Tue, 27 Jun 2023 12:45:42 +0000 Subject: [PATCH 485/946] Replace deprecated translog flush setting in ES --- share/github-backup-utils/ghe-backup-es-rsync | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index 00946279a..a3aef164d 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -39,6 +39,12 @@ if [ -d "$GHE_DATA_DIR/current/elasticsearch" ]; then link_dest="--link-dest=../../current/elasticsearch" fi +# Store the existing flush_threshold_size setting if it exists and if does not set it to ES default +current_threshold=$(ghe-ssh "$host" -- curl -s "localhost:9200/_settings" | jq -r '.[].settings.index.translog.flush_threshold_size') +if [ -z "$current_threshold" ]; then + current_threshold="512MB" +fi + # Transfer ES indices from a GitHub instance to the current snapshot # directory, using a previous snapshot to avoid transferring files that have # already been transferred. @@ -54,7 +60,7 @@ log_rsync "END elasticsearch rsync" 1>&3 # Set up a trap to re-enable flushing on exit and remove temp file cleanup () { ghe_verbose "* Enabling ES index flushing ..." - echo '{"index":{"translog.disable_flush":false}}' | + echo "{\"index\":{\"index.translog.flush_threshold_size\":\"$current_threshold\"}}" | ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null } trap 'cleanup' EXIT @@ -62,7 +68,7 @@ trap 'exit $?' INT # ^C always terminate # Disable ES flushing and force a flush right now ghe_verbose "* Disabling ES index flushing ..." -echo '{"index":{"translog.disable_flush":true}}' | +echo '{"index":{"index.translog.flush_threshold_size":"1PB"}}' | ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null From d0341eb33674650b0547b7cbcf8990c9ad6897b2 Mon Sep 17 00:00:00 2001 From: Ant Kaynak Date: Tue, 27 Jun 2023 12:56:27 +0000 Subject: [PATCH 486/946] Fix lint --- share/github-backup-utils/ghe-backup-es-rsync | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index a3aef164d..fdd8c342a 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -10,7 +10,7 @@ set -e # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" -bm_start "$(basename $0)" +bm_start "$(basename "$0")" # Set up remote host and root elastic backup directory based on config host="$GHE_HOSTNAME" @@ -53,7 +53,7 @@ log_rsync "BEGIN elasticsearch rsync" 1>&3 ghe-rsync -avz \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path="sudo -u elasticsearch rsync" \ - $link_dest \ + "$link_dest" \ "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch/" \ "$GHE_SNAPSHOT_DIR/elasticsearch" 1>&3 log_rsync "END elasticsearch rsync" 1>&3 @@ -78,14 +78,14 @@ log_rsync "BEGIN: elasticsearch followup rsync" 1>&3 ghe-rsync -avz \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path="sudo -u elasticsearch rsync" \ - $link_dest \ + "$link_dest" \ "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch/" \ "$GHE_SNAPSHOT_DIR/elasticsearch" 1>&3 log_rsync "END: elasticsearch followup rsync" 1>&3 # "Backup" audit log migration sentinel file if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - touch $GHE_SNAPSHOT_DIR/es-scan-complete + touch "$GHE_SNAPSHOT_DIR"/es-scan-complete fi -bm_end "$(basename $0)" +bm_end "$(basename "$0")" From 666280521c89375aedcdd3903571b486249debbe Mon Sep 17 00:00:00 2001 From: Ant Kaynak Date: Tue, 27 Jun 2023 14:07:58 +0000 Subject: [PATCH 487/946] Fix index translog json --- share/github-backup-utils/ghe-backup-es-rsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index fdd8c342a..986159c2e 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -60,7 +60,7 @@ log_rsync "END elasticsearch rsync" 1>&3 # Set up a trap to re-enable flushing on exit and remove temp file cleanup () { ghe_verbose "* Enabling ES index flushing ..." - echo "{\"index\":{\"index.translog.flush_threshold_size\":\"$current_threshold\"}}" | + echo "{\"index\":{\"translog.flush_threshold_size\":\"$current_threshold\"}}" | ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null } trap 'cleanup' EXIT @@ -68,7 +68,7 @@ trap 'exit $?' INT # ^C always terminate # Disable ES flushing and force a flush right now ghe_verbose "* Disabling ES index flushing ..." -echo '{"index":{"index.translog.flush_threshold_size":"1PB"}}' | +echo '{"index":{"translog.flush_threshold_size":"1PB"}}' | ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null From f834364740e8a8032a878df1ff15de85173a9874 Mon Sep 17 00:00:00 2001 From: Ant Kaynak Date: Tue, 27 Jun 2023 14:52:45 +0000 Subject: [PATCH 488/946] Use transient settings instead of index specific ones --- share/github-backup-utils/ghe-backup-es-rsync | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index 986159c2e..f6363bfe0 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -39,12 +39,6 @@ if [ -d "$GHE_DATA_DIR/current/elasticsearch" ]; then link_dest="--link-dest=../../current/elasticsearch" fi -# Store the existing flush_threshold_size setting if it exists and if does not set it to ES default -current_threshold=$(ghe-ssh "$host" -- curl -s "localhost:9200/_settings" | jq -r '.[].settings.index.translog.flush_threshold_size') -if [ -z "$current_threshold" ]; then - current_threshold="512MB" -fi - # Transfer ES indices from a GitHub instance to the current snapshot # directory, using a previous snapshot to avoid transferring files that have # already been transferred. @@ -60,7 +54,7 @@ log_rsync "END elasticsearch rsync" 1>&3 # Set up a trap to re-enable flushing on exit and remove temp file cleanup () { ghe_verbose "* Enabling ES index flushing ..." - echo "{\"index\":{\"translog.flush_threshold_size\":\"$current_threshold\"}}" | + echo '{"transient":{"index.translog.flush_threshold_size":null}}' | ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null } trap 'cleanup' EXIT @@ -68,7 +62,7 @@ trap 'exit $?' INT # ^C always terminate # Disable ES flushing and force a flush right now ghe_verbose "* Disabling ES index flushing ..." -echo '{"index":{"translog.flush_threshold_size":"1PB"}}' | +echo '{"transient":{"index.translog.flush_threshold_size":"1PB"}}' | ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null From 77263faf1a684281375ec903f367a72e327338eb Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 27 Jun 2023 15:31:21 +0000 Subject: [PATCH 489/946] update bm_start desc --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 6a5b69ea0..e9a54d646 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -609,7 +609,7 @@ if $CLUSTER; then bm_end "configure_cluster" elif $instance_configured; then log_info "Configuring appliance ..." - bm_start "configure_appliance" + bm_start "$(basename $0) - configure appliance" if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then From cb63a6edebc9218b3e62c3653599e9ebbc4e2863 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 27 Jun 2023 15:36:30 +0000 Subject: [PATCH 490/946] fix cluster desc --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index e9a54d646..0dd0355db 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -606,7 +606,7 @@ if $CLUSTER; then ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- /usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 fi ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 - bm_end "configure_cluster" + bm_end "$(basename $0) - configure cluster" elif $instance_configured; then log_info "Configuring appliance ..." bm_start "$(basename $0) - configure appliance" From e4d1b2cf076bc3e43f439b28ea99b471543e06dd Mon Sep 17 00:00:00 2001 From: Ant Kaynak Date: Tue, 27 Jun 2023 16:01:08 +0000 Subject: [PATCH 491/946] Revert unsupported transient and use per index setting --- share/github-backup-utils/ghe-backup-es-rsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index f6363bfe0..402359345 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -54,7 +54,7 @@ log_rsync "END elasticsearch rsync" 1>&3 # Set up a trap to re-enable flushing on exit and remove temp file cleanup () { ghe_verbose "* Enabling ES index flushing ..." - echo '{"transient":{"index.translog.flush_threshold_size":null}}' | + echo '{"index":{"translog.flush_threshold_size":"512MB"}}' | ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null } trap 'cleanup' EXIT @@ -62,7 +62,7 @@ trap 'exit $?' INT # ^C always terminate # Disable ES flushing and force a flush right now ghe_verbose "* Disabling ES index flushing ..." -echo '{"transient":{"index.translog.flush_threshold_size":"1PB"}}' | +echo '{"index":{"translog.flush_threshold_size":"1PB"}}' | ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null From 1e61ea02b7461f769b6c40acbb99ac1d37c2b3fd Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Tue, 27 Jun 2023 16:22:33 +0000 Subject: [PATCH 492/946] Revert "break up tests to try to appease shellcheck" This reverts commit 7bdd77ba6ec77b190dddbc0c8d6b836c94ee9c4a. --- test/test-ghe-backup.sh | 18 +----------------- test/test-ghe-restore.sh | 20 +------------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 2986872ca..dd8563528 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -618,8 +618,7 @@ begin_test "ghe-backup does not take backup of encrypted column current encrypti ) end_test -# encrypted column current encryption key needs to be backed up for versions 3.8.0+ -begin_test "ghe-backup takes backup of encrypted column current encryption key for versions 3.8.0" +begin_test "ghe-backup takes backup of encrypted column current encryption key for versions 3.8.0+" ( set -e @@ -643,21 +642,6 @@ begin_test "ghe-backup takes backup of encrypted column current encryption key f for file in "${required_files[@]}"; do [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] done -) -end_test - -# encrypted column current encryption key needs to be backed up for versions 3.8.0+ -begin_test "ghe-backup takes backup of encrypted column current encryption key for versions 3.9.0" -( - set -e - - required_secrets=( - "secrets.github.encrypted-column-current-encryption-key" - ) - - for secret in "${required_secrets[@]}"; do - ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" - done # GHES version 3.9.0 GHE_REMOTE_VERSION=3.9.0 diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index f3b924324..606b466e4 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -344,9 +344,7 @@ begin_test "ghe-restore does not encrypted column current encryption key for ver ) end_test - -# encrypted column current encryption key needs to be restored for versions 3.8.0+ -begin_test "ghe-restore with encrypted column current encryption key for versions 3.8.0" +begin_test "ghe-restore with encrypted column current encryption key for versions 3.8.0+" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" @@ -371,23 +369,7 @@ begin_test "ghe-restore with encrypted column current encryption key for version for secret in "${required_secrets[@]}"; do [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] done -) -end_test - -# encrypted column current encryption key needs to be restored for versions 3.8.0+ -begin_test "ghe-restore with encrypted column current encryption key for versions 3.9.0" -( - set -e - rm -rf "$GHE_REMOTE_ROOT_DIR" - setup_remote_metadata - required_files=( - "encrypted-column-current-encryption-key" - ) - - for file in "${required_files[@]}"; do - echo "foo" > "$GHE_DATA_DIR/current/$file" - done # GHES version 3.9.0 GHE_REMOTE_VERSION=3.9.0 From 7f962bd59286e9c5a3066dac8dfa6a0f4c712b06 Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Tue, 27 Jun 2023 16:25:20 +0000 Subject: [PATCH 493/946] export GHE_REMOTE_VERSION in test to appease shellcheck --- test/test-ghe-backup.sh | 4 ++++ test/test-ghe-restore.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index dd8563528..00837d50c 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -580,6 +580,7 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi # GHES version 3.7.0 GHE_REMOTE_VERSION=3.7.0 + export GHE_REMOTE_VERSION ghe-backup @@ -593,6 +594,7 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi # GHES version 3.8.0 GHE_REMOTE_VERSION=3.8.0 + export GHE_REMOTE_VERSION ghe-backup @@ -632,6 +634,7 @@ begin_test "ghe-backup takes backup of encrypted column current encryption key f # GHES version 3.8.0 GHE_REMOTE_VERSION=3.8.0 + export GHE_REMOTE_VERSION ghe-backup @@ -645,6 +648,7 @@ begin_test "ghe-backup takes backup of encrypted column current encryption key f # GHES version 3.9.0 GHE_REMOTE_VERSION=3.9.0 + export GHE_REMOTE_VERSION ghe-backup diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 606b466e4..8028cca03 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -308,6 +308,7 @@ begin_test "ghe-restore with encrypted column encryption keying material for ver # GHES version 3.7.0 GHE_REMOTE_VERSION=3.7.0 + export GHE_REMOTE_VERSION ghe-restore -v -f localhost required_secrets=( @@ -320,6 +321,7 @@ begin_test "ghe-restore with encrypted column encryption keying material for ver # GHES version 3.8.0 GHE_REMOTE_VERSION=3.8.0 + export GHE_REMOTE_VERSION ghe-restore -v -f localhost required_secrets=( @@ -360,6 +362,7 @@ begin_test "ghe-restore with encrypted column current encryption key for version # GHES version 3.8.0 GHE_REMOTE_VERSION=3.8.0 + export GHE_REMOTE_VERSION ghe-restore -v -f localhost required_secrets=( @@ -373,6 +376,7 @@ begin_test "ghe-restore with encrypted column current encryption key for version # GHES version 3.9.0 GHE_REMOTE_VERSION=3.9.0 + export GHE_REMOTE_VERSION ghe-restore -v -f localhost required_secrets=( From a2a51dd0094b5f37c3628c2402530f36758c2600 Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 29 Jun 2023 13:57:45 +0200 Subject: [PATCH 494/946] Add bc app --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 667739729..0c6acbbe4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ libssl-dev \ git \ jq \ + bc \ curl \ tar \ gzip \ @@ -55,7 +56,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ openssh-client \ jq \ moreutils \ - gawk \ + gawk \ ca-certificates \ xxhash \ && rm -rf /var/lib/apt/lists/* From ccb139c2fa6d8a463101a799905fb03a84db093f Mon Sep 17 00:00:00 2001 From: solmaz Date: Thu, 29 Jun 2023 15:23:20 +0200 Subject: [PATCH 495/946] add bc --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 0c6acbbe4..710cb9d52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,6 +55,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ git \ openssh-client \ jq \ + bc \ moreutils \ gawk \ ca-certificates \ From 2de29e6833b887884691a0c9924f50a313a41536 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 3 Jul 2023 15:25:01 -0400 Subject: [PATCH 496/946] Remove 'git clone' setup option --- docs/getting-started.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 58054f3bf..02f2cbe9b 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -4,10 +4,6 @@ `tar -xzvf /path/to/github-backup-utils-vMAJOR.MINOR.PATCH.tar.gz` - *or* clone the repository using Git: - - `git clone -b stable https://github.com/github/backup-utils.git` - **Note**: you will need to use [Backup Utilities v2.11.x][2] or the `legacy` branch to backup and restore GitHub Enterprise Server 2.10 and earlier. From 4fe38efc9339cc6ddf7f4e8e5700fecd95ddc7ba Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Thu, 6 Jul 2023 12:46:02 +0200 Subject: [PATCH 497/946] only run lint on pr workflow (#386) --- .github/workflows/lint.yml | 2 -- .github/workflows/main.yml | 1 - Makefile | 1 + 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 44eec8716..d15f123bb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,8 +1,6 @@ name: Lint Code Base on: - push: - branches-ignore: [master] pull_request: branches: [master] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26ce0090a..809e9df50 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,6 @@ name: Test and build on: [pull_request] - jobs: build: strategy: diff --git a/Makefile b/Makefile index 7ca5cd24c..191b90561 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ SHELL = /bin/sh test: info + @echo Running tests @script/cibuild --no-package info: From 4bda1f4edd4cc2f55af2bf8f755cfcccb32482af Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Fri, 7 Jul 2023 15:19:26 -0400 Subject: [PATCH 498/946] Add bc to requirements --- docs/requirements.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index a7dc45ebe..f3f7d67f6 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,7 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), and [jq][11] v1.5 or newer. See below for an update on rsync. +Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), [jq][11] v1.5 or newer, and [bc][12] v1.07 or newer. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. @@ -99,3 +99,4 @@ Due to how some components of Backup Utilities (e.g. MSSQL) take incremental bac [9]: https://joeyh.name/code/moreutils [10]: https://www.gnu.org/software/gawk [11]: https://stedolan.github.io/jq/ +[12]: https://www.gnu.org/software/bc/ From a946abf3a8e18c1ab4dfb6e090c9419232107163 Mon Sep 17 00:00:00 2001 From: Ant Kaynak Date: Mon, 10 Jul 2023 15:19:58 +0000 Subject: [PATCH 499/946] Remove lint changes --- share/github-backup-utils/ghe-backup-es-rsync | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index 402359345..ad973c7b4 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -10,7 +10,7 @@ set -e # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" -bm_start "$(basename "$0")" +bm_start "$(basename $0)" # Set up remote host and root elastic backup directory based on config host="$GHE_HOSTNAME" @@ -47,7 +47,7 @@ log_rsync "BEGIN elasticsearch rsync" 1>&3 ghe-rsync -avz \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path="sudo -u elasticsearch rsync" \ - "$link_dest" \ + $link_dest \ "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch/" \ "$GHE_SNAPSHOT_DIR/elasticsearch" 1>&3 log_rsync "END elasticsearch rsync" 1>&3 @@ -72,14 +72,14 @@ log_rsync "BEGIN: elasticsearch followup rsync" 1>&3 ghe-rsync -avz \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path="sudo -u elasticsearch rsync" \ - "$link_dest" \ + $link_dest \ "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch/" \ "$GHE_SNAPSHOT_DIR/elasticsearch" 1>&3 log_rsync "END: elasticsearch followup rsync" 1>&3 # "Backup" audit log migration sentinel file if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - touch "$GHE_SNAPSHOT_DIR"/es-scan-complete + touch $GHE_SNAPSHOT_DIR/es-scan-complete fi -bm_end "$(basename "$0")" +bm_end "$(basename $0)" From df97040b1f3ec40d1980dc78d26c631b44f38492 Mon Sep 17 00:00:00 2001 From: Robert Bolender Date: Wed, 14 Jun 2023 20:40:35 -0700 Subject: [PATCH 500/946] Backup and restore secret scanning encrypted secrets encryption keys --- share/github-backup-utils/ghe-backup-settings | 6 ++++ .../github-backup-utils/ghe-restore-settings | 12 +++++++ test/test-ghe-backup.sh | 30 +++++++++++++++++ test/test-ghe-restore.sh | 32 +++++++++++++++++++ 4 files changed, 80 insertions(+) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index c12abcd92..1de4ca515 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -88,6 +88,12 @@ fi if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then backup-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" fi +backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" +backup-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" +backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" +backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" +backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" +backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" # Backup argon secrets for multiuser from ghes version 3.8 onwards if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index b489626c2..28b0a1bc6 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -56,6 +56,18 @@ restore-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hm # Restore kredz.varz HMAC key if present. restore-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" +# Restore encrypted column encryption keying material if present +restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" + +# Restore encrypted column current encryption key if present +restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" + +# Restore secret scanning encrypted secrets encryption keys if present +restore-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" +restore-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" +restore-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" +restore-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" + # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then log_info "Restoring SAML keys ..." diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 00837d50c..6aeb94342 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -663,6 +663,36 @@ begin_test "ghe-backup takes backup of encrypted column current encryption key f ) end_test +begin_test "ghe-backup takes backup of secret scanning encrypted secrets encryption keys" +( + set -e + + required_secrets=( + "secrets.secret-scanning.encrypted-secrets-current-storage-key" + "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" + "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" + "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + ghe-backup + + required_files=( + "secret-scanning-encrypted-secrets-current-storage-key" + "secret-scanning-encrypted-secrets-delimited-storage-keys" + "secret-scanning-encrypted-secrets-current-shared-transit-key" + "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done +) +end_test + begin_test "ghe-backup takes backup of Actions settings" ( set -e diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 8028cca03..3c963737f 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -389,6 +389,38 @@ begin_test "ghe-restore with encrypted column current encryption key for version ) end_test +begin_test "ghe-restore with secret scanning encrypted secrets encryption keys" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + required_files=( + "secret-scanning-encrypted-secrets-current-storage-key" + "secret-scanning-encrypted-secrets-delimited-storage-keys" + "secret-scanning-encrypted-secrets-current-shared-transit-key" + "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" + ) + + for file in "${required_files[@]}"; do + echo "foo" >"$GHE_DATA_DIR/current/$file" + done + + ghe-restore -v -f localhost + + required_secrets=( + "secrets.secret-scanning.encrypted-secrets-current-storage-key" + "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" + "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" + "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + done +) +end_test + # Setup Actions data for the subsequent tests setup_actions_test_data "$GHE_DATA_DIR/1" From 3907e5f0644d1805158e8bf5ee8db4aafca6c12d Mon Sep 17 00:00:00 2001 From: Robert Bolender Date: Fri, 23 Jun 2023 12:04:22 -0700 Subject: [PATCH 501/946] Restore secret scanning encryption keys even without -c argument Restore removed backup, remove duplicate restore Use restore instead of backup --- bin/ghe-restore | 3 ++ ...he-restore-secret-scanning-encryption-keys | 39 +++++++++++++++++++ .../github-backup-utils/ghe-restore-settings | 6 --- 3 files changed, 42 insertions(+), 6 deletions(-) create mode 100755 share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys diff --git a/bin/ghe-restore b/bin/ghe-restore index 69e53def9..6287b0faf 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -443,6 +443,9 @@ if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then fi ghe-restore-column-encryption-keys "$GHE_HOSTNAME" +# Always restore secret scanning encryption keys +ghe-restore-secret-scanning-encryption-keys "$GHE_HOSTNAME" + # Make sure mysql and elasticsearch are prep'd and running before restoring. # These services will not have been started on appliances that have not been # configured yet. diff --git a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys new file mode 100755 index 000000000..aa225bc07 --- /dev/null +++ b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +#/ Usage: ghe-restore-secret-scanning-encryption-keys +#/ Restore the secret scanning encryption keys from a snapshot to the given . +#/ This script will be run automatically by `ghe-restore` +set -e + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$(dirname "${BASH_SOURCE[0]}")/ghe-backup-config" + +# Show usage and bail with no arguments +[ -z "$*" ] && print_usage + +bm_start "$(basename $0)" + +# Grab host arg +GHE_HOSTNAME="$1" + +# Perform a host-check and establish GHE_REMOTE_XXX variables. +ghe_remote_version_required "$GHE_HOSTNAME" + +# The snapshot to restore should be set by the ghe-restore command but this lets +# us run this script directly. +: ${GHE_RESTORE_SNAPSHOT:=current} + +# Path to snapshot dir we're restoring from +: ${GHE_RESTORE_SNAPSHOT_PATH:="$GHE_DATA_DIR/current"} + +# Restore secret scanning encrypted secrets storage keys if present +log_info "Restoring secret scanning encrypted secrets storage keys" +restore-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" +restore-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" + +# Restore secret scanning encrypted secrets transit keys if present +log_info "Restoring secret scanning encrypted secrets transit keys" +restore-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" +restore-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" + +bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index 28b0a1bc6..ad06f30a6 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -62,12 +62,6 @@ restore-secret "encrypted column encryption keying material" "encrypted-column-e # Restore encrypted column current encryption key if present restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" -# Restore secret scanning encrypted secrets encryption keys if present -restore-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" -restore-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" -restore-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" -restore-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" - # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then log_info "Restoring SAML keys ..." From f8ec15c71a475591bc38adc7b9f00bd820d9e578 Mon Sep 17 00:00:00 2001 From: Robert Bolender Date: Mon, 10 Jul 2023 15:23:06 -0700 Subject: [PATCH 502/946] Add GHES version check, only restore if >= 3.8.0 --- bin/ghe-restore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 6287b0faf..2c62c2ce8 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -444,7 +444,10 @@ fi ghe-restore-column-encryption-keys "$GHE_HOSTNAME" # Always restore secret scanning encryption keys -ghe-restore-secret-scanning-encryption-keys "$GHE_HOSTNAME" +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then + log_info "Always restore secret scanning encryption keys on GHES verions 3.8.0+" + ghe-restore-secret-scanning-encryption-keys "$GHE_HOSTNAME" +fi # Make sure mysql and elasticsearch are prep'd and running before restoring. # These services will not have been started on appliances that have not been From f1fa74bafbad4a9119f84440c34049590d44a87c Mon Sep 17 00:00:00 2001 From: Robert Bolender Date: Mon, 10 Jul 2023 22:55:13 +0000 Subject: [PATCH 503/946] Fix bad rebase --- share/github-backup-utils/ghe-backup-settings | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 1de4ca515..4d08c7134 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -88,8 +88,7 @@ fi if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then backup-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" fi -backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" -backup-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" + backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" From a7077ef99908da791efad3b756687b4a308c492f Mon Sep 17 00:00:00 2001 From: Robert Bolender Date: Mon, 10 Jul 2023 22:55:33 +0000 Subject: [PATCH 504/946] Assert secret scanning keys are restored in versions 3.8.0+ --- test/test-ghe-restore.sh | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 3c963737f..ef13b7697 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -389,7 +389,7 @@ begin_test "ghe-restore with encrypted column current encryption key for version ) end_test -begin_test "ghe-restore with secret scanning encrypted secrets encryption keys" +begin_test "ghe-restore with secret scanning encrypted secrets encryption keys for versions below 3.8.0" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" @@ -406,7 +406,7 @@ begin_test "ghe-restore with secret scanning encrypted secrets encryption keys" echo "foo" >"$GHE_DATA_DIR/current/$file" done - ghe-restore -v -f localhost + GHE_REMOTE_VERSION=3.7.0 ghe-restore -v -f localhost required_secrets=( "secrets.secret-scanning.encrypted-secrets-current-storage-key" @@ -416,7 +416,40 @@ begin_test "ghe-restore with secret scanning encrypted secrets encryption keys" ) for secret in "${required_secrets[@]}"; do - [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting these to not be set for versions below 3.8.0 + done +) +end_test + + +begin_test "ghe-restore with secret scanning encrypted secrets encryption keys for versions 3.8.0+" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + required_files=( + "secret-scanning-encrypted-secrets-current-storage-key" + "secret-scanning-encrypted-secrets-delimited-storage-keys" + "secret-scanning-encrypted-secrets-current-shared-transit-key" + "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" + ) + + for file in "${required_files[@]}"; do + echo "foo" >"$GHE_DATA_DIR/current/$file" + done + + GHE_REMOTE_VERSION=3.8.0 ghe-restore -v -f localhost + + required_secrets=( + "secrets.secret-scanning.encrypted-secrets-current-storage-key" + "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" + "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" + "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] # expecting this to have been restored successfully for versions 3.8.0+ done ) end_test From 4a092e9d351e9a28d36b35d2fbd50427bdfb7eae Mon Sep 17 00:00:00 2001 From: Ant Kaynak Date: Tue, 11 Jul 2023 08:45:05 +0000 Subject: [PATCH 505/946] Ignore shell split lint warning --- share/github-backup-utils/ghe-backup-es-rsync | 1 + 1 file changed, 1 insertion(+) diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index ad973c7b4..ee61741b2 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -4,6 +4,7 @@ #/ #/ Note: This command typically isn't called directly. It's invoked by #/ ghe-backup when the rsync strategy is used. +# shellcheck disable=SC2086 set -e # Bring in the backup configuration From fffe06a834c1cdae8e9812e19ea30dc8bfba2c5d Mon Sep 17 00:00:00 2001 From: boxofyellow Date: Wed, 12 Jul 2023 10:39:57 -0400 Subject: [PATCH 506/946] Init array to Fix https://github.com/github/backup-utils/issues/1054 --- share/github-backup-utils/ghe-backup-mssql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index b5a3203fb..37b09ca9d 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -47,8 +47,8 @@ if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then fi tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) -ssh_config_file_opt= -opts= +ssh_config_file_opt=() +opts=() isHA="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.ha" || true)" From e564c68a861c5afa05e9a5065dfaf875a9da8826 Mon Sep 17 00:00:00 2001 From: Joseph Franks Date: Thu, 13 Jul 2023 13:42:49 -0500 Subject: [PATCH 507/946] update-master-version-to-3-9 Update the master version to 3.9. Seems this was missed during the last feature release --- share/github-backup-utils/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 19811903a..a5c4c7633 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.8.0 +3.9.0 From 50a5c33568285a3bc8ec293b9528bd6a72050f6d Mon Sep 17 00:00:00 2001 From: Joseph Franks Date: Thu, 13 Jul 2023 13:44:54 -0500 Subject: [PATCH 508/946] Update minimun supported version to be 3.7 Update minimun supported version to be 3.7 --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 586739916..e404d5447 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -131,7 +131,7 @@ fi # backup-utils 2.13 onwards limits support to the current and previous two releases # of GitHub Enterprise Server. -supported_minimum_version="3.6.0" +supported_minimum_version="3.7.0" if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then supported=1 From 38d587d535469a74bc2d31492c5121b9f5df2f63 Mon Sep 17 00:00:00 2001 From: Diana Date: Sun, 16 Jul 2023 14:05:42 -0700 Subject: [PATCH 509/946] Update formatting on ghe-host-check Added: - Recommended Disk requirement - Updated formatting of checks --- bin/ghe-host-check | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index e404d5447..4473c2dc1 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -157,9 +157,10 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size" #Display dir requirements for repositories and mysql + echo "" 1>&2 echo "Checking host for sufficient space for a backup..." 1>&2 available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') - echo "We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." 1>&2 + echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." 1>&2 repos_disk_size=$(transfer_size repositories /tmp) pages_disk_size=$(transfer_size pages /tmp) @@ -171,20 +172,24 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then mssql_disk_size=$(transfer_size mssql /tmp) min_disk_req=$((repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size)) - echo "Available space: $((available_space / (1024 ** 2))) MB" 1>&2 - echo -e "Min Disk required for this backup is at least $min_disk_req MB\n" 1>&2 + recommended_disk_req=$((min_disk_req * 5)) + echo " - Available space: $((available_space / (1024 ** 2))) MB" 1>&2 + echo " - Min Disk required for this backup is at least $min_disk_req MB" 1>&2 + echo " - Recommended Disk requirement is $recommended_disk_req MB" 1>&2 + echo "" 1>&2 -cat <&2 + cat <&2 ### Data Transfer Sizes -repositories: $repos_disk_size MB -pages: $pages_disk_size MB -elasticsearch: $es_disk_size MB -storage: $stor_disk_size MB -minio: $minio_disk_size MB -mysql: $mysql_disk_size MB -actions: $actions_disk_size MB -mssql: $mssql_disk_size MB + - repositories: $repos_disk_size MB + - pages: $pages_disk_size MB + - elasticsearch: $es_disk_size MB + - storage: $stor_disk_size MB + - minio: $minio_disk_size MB + - mysql: $mysql_disk_size MB + - actions: $actions_disk_size MB + - mssql: $mssql_disk_size MB DATA_TRANSFER_SIZE + echo "" 1>&2 if [[ $((available_space / (1024 * 1024))) -lt $min_disk_req ]]; then echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 @@ -223,7 +228,7 @@ You can disable this warning by changing RSYNC_WARNING to 'no' in your backup.co WARN_MSG fi - echo "rsync ${rsync_version} >= required ($min_rsync)" 1>&2 + echo " - rsync ${rsync_version} >= required ($min_rsync)" 1>&2 ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1 | tr -cd '[:digit:].\n') if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then @@ -231,7 +236,7 @@ WARN_MSG echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 exit 1 else - echo "openSSH ${ssh_version} >= required ($min_openssh)" 1>&2 + echo " - openSSH ${ssh_version} >= required ($min_openssh)" 1>&2 fi jq_version=$(jq --version |awk -F\- '{print $2}' | tr -cd '[:digit:].\n') @@ -240,8 +245,8 @@ WARN_MSG echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 exit 1 else - echo "jq ${jq_version} >= required ($min_jq)" 1>&2 + echo " - jq ${jq_version} >= required ($min_jq)" 1>&2 fi fi - +echo "" 1>&2 echo "Connect $hostname:$port OK (v$version)" From 7c2021acaa735805305f5b2dd471f7f6d02a49e2 Mon Sep 17 00:00:00 2001 From: Zheng Zeng Date: Mon, 17 Jul 2023 14:41:19 +0000 Subject: [PATCH 510/946] fix indicator when doing backup and restore --- bin/ghe-backup | 25 ++++++++++++++++++- bin/ghe-restore | 20 +++++++++------ share/github-backup-utils/ghe-backup-config | 6 +++++ share/github-backup-utils/ghe-backup-pages | 4 ++- .../ghe-backup-repositories | 4 ++- share/github-backup-utils/ghe-backup-storage | 3 +++ share/github-backup-utils/ghe-restore-pages | 5 ++++ .../ghe-restore-repositories | 5 ++++ .../ghe-restore-repositories-gist | 5 ++++ share/github-backup-utils/ghe-restore-storage | 5 ++++ share/github-backup-utils/track-progress | 3 ++- 11 files changed, 74 insertions(+), 11 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 98f831a51..ae6dd0f0d 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -50,8 +50,30 @@ export PROGRESS_TYPE="Backup" echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of backup echo "$PROGRESS" > /tmp/backup-utils-progress -export PROGRESS_TOTAL=18 # Maximum number of steps in backup +OPTIONAL_STEPS=0 +# Backup actions+mssql +if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 2)) +fi + +# Backup fsck +if [ "$GHE_BACKUP_FSCK" = "yes" ]; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi + +# Backup minio +if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi + +# Backup pages +if [ "$GHE_BACKUP_PAGES" != "no" ]; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi + +PROGRESS_TOTAL=$((OPTIONAL_STEPS + 14)) # Minimum number of steps in backup is 14 +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check @@ -269,6 +291,7 @@ echo \"$cmd_title\" ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"") if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then + increment-progress-total-count 1 cmd_title=$(log_info "Backing up Elasticsearch indices ...") commands+=(" echo \"$cmd_title\" diff --git a/bin/ghe-restore b/bin/ghe-restore index 2c62c2ce8..44d5e4b37 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -275,15 +275,12 @@ fi # taking into account the options passed to the script and the appliance configuration # calculate restore steps OPTIONAL_STEPS=0 -# Cluster restores add an additional step -if $CLUSTER ; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi + # Restoring UUID if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi -# Restoring Actions +# Restoring Actions + MSSQL if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi @@ -305,14 +302,21 @@ fi if ! $CLUSTER && $instance_configured; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi -# Maximum restore steps -export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 6)) +# Restoring settings + restore-chat-integration + restore-packages +if $RESTORE_SETTINGS; then + echo "add setting" + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 3)) +fi + +# Minimum number of steps is 7 +export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 7)) init-progress export PROGRESS_TYPE="Restore" echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of restore echo "$PROGRESS" > /tmp/backup-utils-progress +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) @@ -446,6 +450,7 @@ ghe-restore-column-encryption-keys "$GHE_HOSTNAME" # Always restore secret scanning encryption keys if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then log_info "Always restore secret scanning encryption keys on GHES verions 3.8.0+" + increment-progress-total-count 1 ghe-restore-secret-scanning-encryption-keys "$GHE_HOSTNAME" fi @@ -490,6 +495,7 @@ if is_external_database_target_or_snapshot && $SKIP_MYSQL; then log_info "Skipping MySQL restore." else log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." + increment-progress-total-count 2 ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 fi diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 31e9aff0a..b65c61f28 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -712,6 +712,12 @@ init-progress() { rm -f /tmp/backup-utils-progress* } +#increase total count of progress +increment-progress-total-count() { + PROGRESS_TOTAL=$((PROGRESS_TOTAL + $1)) + echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total +} + diff --git a/share/github-backup-utils/ghe-backup-pages b/share/github-backup-utils/ghe-backup-pages index 21c2ac465..b0c9f1fed 100755 --- a/share/github-backup-utils/ghe-backup-pages +++ b/share/github-backup-utils/ghe-backup-pages @@ -63,6 +63,7 @@ if [ -d "$GHE_DATA_DIR/current/pages" ] && [ "$(ls -A $GHE_DATA_DIR/current/page link_dest="--link-dest=../../current/pages" fi +count=0 for hostname in $hostnames; do bm_start "$(basename $0) - $hostname" echo 1>&3 @@ -82,6 +83,7 @@ for hostname in $hostnames; do "$GHE_SNAPSHOT_DIR/pages" 1>&3 log_rsync "END: pages rsync" 1>&3 bm_end "$(basename $0) - $hostname" + count=$((count + 1)) done - +increment-progress-total-count $count bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index a3ba533d7..e90d8c37a 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -144,6 +144,8 @@ bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then log_warn "no routes found, skipping repositories backup ..." exit 0 +else + increment-progress-total-count 3 fi # Transfer repository data from a GitHub instance to the current snapshot @@ -377,7 +379,7 @@ if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then (cd $backup_dir/ && find * -mindepth 5 -maxdepth 6 -type d -name \*.git | fix_paths_for_ghe_version | uniq | sort | uniq) > $tempdir/destination_routes git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more repository networks and/or gists were not found on the source appliance. Please contact GitHub Enterprise Support for assistance." - + increment-progress-total-count 1 bm_end "$(basename $0) - Verifying Routes" fi diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index 2f98a0541..9752de21d 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -113,6 +113,8 @@ bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then log_warn "no routes found, skipping storage backup ..." exit 0 +else + increment-progress-total-count 2 fi # rsync all the storage objects @@ -149,6 +151,7 @@ if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more storage objects were not found on the source appliance. Please contact GitHub Enterprise Support for assistance." + increment-progress-total-count 1 bm_end "$(basename $0) - Verifying Routes" fi diff --git a/share/github-backup-utils/ghe-restore-pages b/share/github-backup-utils/ghe-restore-pages index 640aa5d62..0b104863e 100755 --- a/share/github-backup-utils/ghe-restore-pages +++ b/share/github-backup-utils/ghe-restore-pages @@ -29,6 +29,8 @@ pages_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find pages -mindepth 5 if [ -z "$pages_paths" ]; then log_warn "Warning: Pages backup missing. Skipping ..." exit 0 +else + increment-progress-total-count 5 fi # Perform a host-check and establish GHE_REMOTE_XXX variables. @@ -125,6 +127,8 @@ bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then log_warn "Warning: no routes found, skipping pages restore ..." exit 0 +else + increment-progress-total-count 2 fi bm_start "$(basename $0) - Restoring pages" @@ -154,6 +158,7 @@ if $CLUSTER; then chunks=\$(find $remote_tempdir/ -name chunk\*) parallel -i /bin/sh -c "cat {} | github-env ./bin/dpages-cluster-restore-finalize" -- \$chunks EOF + increment-progress-total-count 1 bm_end "$(basename $0) - Finalizing routes" fi diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index d59864196..9a749bc74 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -30,6 +30,8 @@ network_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find repositories -mi if [ -z "$network_paths" ]; then log_warn "Warning: Repositories backup missing. Skipping ..." exit 0 +else + increment-progress-total-count 5 fi # Perform a host-check and establish GHE_REMOTE_XXX variables. @@ -142,6 +144,8 @@ bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then log_warn "Warning: no routes found, skipping repositories restore ..." exit 0 +else + increment-progress-total-count 3 fi # rsync all the repository networks to the git server where they belong. @@ -190,6 +194,7 @@ if $CLUSTER; then chunks=\$(find $remote_tempdir/ -name chunk\*) parallel -i /bin/sh -c "cat {} | github-env ./bin/dgit-cluster-restore-finalize 2>>$remote_warnings" -- \$chunks EOF + increment-progress-total-count 1 bm_end "$(basename $0) - Finalizing routes" fi diff --git a/share/github-backup-utils/ghe-restore-repositories-gist b/share/github-backup-utils/ghe-restore-repositories-gist index addb18514..7faae5260 100755 --- a/share/github-backup-utils/ghe-restore-repositories-gist +++ b/share/github-backup-utils/ghe-restore-repositories-gist @@ -29,6 +29,8 @@ gist_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find repositories -mind if [ -z "$gist_paths" ]; then log_warn "Warning: Gist backup missing. Skipping ..." exit 0 +else + increment-progress-total-count 5 fi # Perform a host-check and establish GHE_REMOTE_XXX variables. @@ -128,6 +130,8 @@ bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then log_warn "Warning: no routes found, skipping gists restore ..." exit 0 +else + increment-progress-total-count 2 fi # rsync all the gist repositories @@ -157,6 +161,7 @@ if $CLUSTER; then chunks=\$(find $remote_tempdir/ -name chunk\*) parallel -i /bin/sh -c "cat {} | github-env ./bin/gist-cluster-restore-finalize 2>>$remote_warnings" -- \$chunks EOF + increment-progress-total-count 1 bm_end "$(basename $0) - Finalizing routes" fi diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index af6c24a23..8f0d73c48 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -33,6 +33,8 @@ storage_paths=$(cd $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/ && find storage -mindept if [ -z "$storage_paths" ]; then log_warn "Warning: Storage backup missing. Skipping ..." exit 0 +else + increment-progress-total-count 5 fi # Perform a host-check and establish GHE_REMOTE_XXX variables. @@ -120,6 +122,8 @@ bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then log_warn "Warning: no routes found, skipping storage restore ..." exit 0 +else + increment-progress-total-count 2 fi # rsync all the objects to the storage server where they belong. @@ -169,6 +173,7 @@ if $CLUSTER; then chunks=\$(find $remote_tempdir/ -name chunk\*) parallel -i /bin/sh -c "cat {} | github-env ./bin/storage-cluster-restore-finalize" -- \$chunks EOF + increment-progress-total-count 1 bm_end "$(basename $0) - Finalizing routes" fi diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 3f67ca9e8..bf50c42aa 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -6,8 +6,9 @@ set -e progress(){ PROGRESS=$(cat /tmp/backup-utils-progress) + PROGRESS_TOTAL=$(cat /tmp/backup-utils-progress-total) PROGRESS_TYPE=$(cat /tmp/backup-utils-progress-type) PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) - echo $((PROGRESS +1)) > /tmp/backup-utils-progress + echo $((PROGRESS + 1)) > /tmp/backup-utils-progress echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress-info } From 1a38356c417cd0536b6f66eef4eef82b674e0688 Mon Sep 17 00:00:00 2001 From: Zheng Zeng Date: Tue, 18 Jul 2023 15:30:48 +0000 Subject: [PATCH 511/946] remove debug log --- bin/ghe-restore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 44d5e4b37..428227426 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -282,7 +282,7 @@ if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then fi # Restoring Actions + MSSQL if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 2)) fi # Restoring minio if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then @@ -304,7 +304,6 @@ if ! $CLUSTER && $instance_configured; then fi # Restoring settings + restore-chat-integration + restore-packages if $RESTORE_SETTINGS; then - echo "add setting" OPTIONAL_STEPS=$((OPTIONAL_STEPS + 3)) fi From 11c0e5f5a97f83ec708dad6f6cb6471f344e8d24 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Wed, 19 Jul 2023 18:07:20 +0200 Subject: [PATCH 512/946] add msg in the logs for skipping snapshots (#417) --- bin/ghe-backup | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/ghe-backup b/bin/ghe-backup index 98f831a51..e81bf11e3 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -303,6 +303,8 @@ if [ -z "$failures" ]; then ln -s "$GHE_SNAPSHOT_TIMESTAMP" "../current" ghe-prune-snapshots +else + log_info "Skipping pruning snapshots, since some backups failed..." fi END_TIME=$(date +%s) From 23fa989a57f04b36d2f37345bb9b3451407a1ba6 Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Fri, 21 Jul 2023 21:12:14 +0000 Subject: [PATCH 513/946] Add creation of `encrypted_column_current_encryption_key` to backup 3.7.0+ * this is based on manual testing where we successfully used `ghe-ssh $host -- ghe-config --get 'secrets.github.encrypted-column-keying-material' | sed 's:.*;::' > encrypted-column-current-encryption-key` in the console and by manually editing it in the `test-ghe-backup.sh` file * when I attempted to write tests for the simple case of having only one value in the encryption_keying_material list I received an error on the `get` portion of the command. Removing the get allowed the test to and follows the format used in the implementation of `backup-secret` * then I added the complex test case of more than one entry in encryption_keying_material delimited by semicolons. This caused the test to fail with the error `fatal: ghe-ssh: Attempt to invoke complex command with simple command form.` --- share/github-backup-utils/ghe-backup-settings | 9 +-- test/test-ghe-backup.sh | 77 +++++++++++++++---- 2 files changed, 67 insertions(+), 19 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 4d08c7134..71012fa6d 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -79,14 +79,11 @@ backup-secret "password pepper" "password-pepper" "secrets.github.user-password- backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" -# backup encryption keying material for GHES 3.7.0 onwards +# backup encryption keying material and create backup value current encryption for GHES 3.7.0 onwards +# this is for forwards compatibility with GHES 3.8.0 onwards if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" -fi - -# backup current encryption key for GHES 3.8.0 onwards -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then - backup-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" + ghe-ssh "$host" -- ghe-config 'secrets.github.encrypted-column-keying-material' | sed 's:.*;::' > encrypted-column-current-encryption-key fi backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 6aeb94342..40122e049 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -566,7 +566,7 @@ begin_test "ghe-backup does not take backup of encrypted column encryption keyin ) end_test -begin_test "ghe-backup takes backup of encrypted column encryption keying material for versions 3.7.0+" +begin_test "ghe-backup takes backup of encrypted column encryption keying material and create encrypted column current encryption key for versions 3.7.0+" ( set -e @@ -586,6 +586,7 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi required_files=( "encrypted-column-encryption-keying-material" + "encrypted-column-current-encryption-key" ) for file in "${required_files[@]}"; do @@ -609,27 +610,60 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi ) end_test -begin_test "ghe-backup does not take backup of encrypted column current encryption key for versions below 3.8.0" +begin_test "ghe-backup takes backup of encrypted column encryption keying material and encrypted column current encryption key for versions 3.8.0+" ( - GHE_REMOTE_VERSION=2.1.10 ghe-backup -v | grep -q "encrypted column current encryption key not set" && exit 1 - [ ! -f "$GHE_DATA_DIR/current/encrypted-column-current-encryption-key" ] + set -e + + required_secrets=( + "secrets.github.encrypted-column-keying-material" + ) - GHE_REMOTE_VERSION=3.7.0 ghe-backup -v | grep -q "encrypted column current encryption key not set" && exit 1 - [ ! -f "$GHE_DATA_DIR/current/encrypted-column-current-encryption-key" ] + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + # GHES version 3.8.0 + GHE_REMOTE_VERSION=3.8.0 + export GHE_REMOTE_VERSION + + ghe-backup + + required_files=( + "encrypted-column-encryption-keying-material" + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done + + # GHES version 3.9.0 + GHE_REMOTE_VERSION=3.9.0 + export GHE_REMOTE_VERSION + + ghe-backup + + required_files=( + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done ) end_test -begin_test "ghe-backup takes backup of encrypted column current encryption key for versions 3.8.0+" +begin_test "ghe-backup takes backup of encrypted column encryption keying material and encrypted column current encryption key accounting for multiple encryption keying materials for versions 3.7.0+" ( set -e required_secrets=( - "secrets.github.encrypted-column-current-encryption-key" + "secrets.github.encrypted-column-keying-material" ) for secret in "${required_secrets[@]}"; do - ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo;bar" done # GHES version 3.8.0 @@ -639,13 +673,22 @@ begin_test "ghe-backup takes backup of encrypted column current encryption key f ghe-backup required_files=( - "encrypted-column-current-encryption-key" + "encrypted-column-encryption-keying-material" ) for file in "${required_files[@]}"; do - [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo;bar" ] done + required_files_current_encryption_key=( + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files_current_encryption_key[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "bar" ] + done + + # GHES version 3.9.0 GHE_REMOTE_VERSION=3.9.0 export GHE_REMOTE_VERSION @@ -653,11 +696,19 @@ begin_test "ghe-backup takes backup of encrypted column current encryption key f ghe-backup required_files=( - "encrypted-column-current-encryption-key" + "encrypted-column-encryption-keying-material" ) for file in "${required_files[@]}"; do - [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo;bar" ] + done + + required_files_current_encryption_key=( + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files_current_encryption_key[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "bar" ] done ) From c81a265a37cf353d42e5dd543baf6e5f833e275a Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Fri, 21 Jul 2023 21:38:10 +0000 Subject: [PATCH 514/946] Attempt to fix "Attempt to invoke complex command with simple command form." error * i tried to amend this command to use the complex syntax similar to how I saw the complex commands being written in other places but I think I need help with the syntax --- share/github-backup-utils/ghe-backup-settings | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 71012fa6d..ead350f92 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -83,7 +83,8 @@ backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-s # this is for forwards compatibility with GHES 3.8.0 onwards if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" - ghe-ssh "$host" -- ghe-config 'secrets.github.encrypted-column-keying-material' | sed 's:.*;::' > encrypted-column-current-encryption-key + echo "ghe-config 'secrets.github.encrypted-column-keying-material' | sed 's:.*;::' > encrypted-column-current-encryption-key" | + ghe-ssh "$host" /bin/bash fi backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" From 19dd3b493ea09886fdf8883b108347cb5375dc0a Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:29:05 -0400 Subject: [PATCH 515/946] Apply suggestions from code review Co-authored-by: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> --- test/test-ghe-backup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 40122e049..3dea629c4 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -663,7 +663,8 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi ) for secret in "${required_secrets[@]}"; do - ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo;bar" + echo "ghe-config '$secret' 'foo;bar'" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/bash done # GHES version 3.8.0 From 368e5841abc94a2eec250a978883a0100d13849a Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Mon, 24 Jul 2023 21:16:47 +0000 Subject: [PATCH 516/946] only create a backup of the current encryption key on 3.8+ * remove check in 3.7 test * ghe-secrets-init will create a new current encryption key if it doesn't exist https://github.com/github/enterprise2/blob/a97cc4b077b8f8be2772959c07e2d0ca729fd079/vm_files/usr/local/share/enterprise/ghe-secrets-init#L505 since this is restoring from a backup, we need the current encryption key to match a value that was backed up in encryption keying material because encryption keying material is used to decrypt --- share/github-backup-utils/ghe-backup-settings | 6 ++++-- test/test-ghe-backup.sh | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index ead350f92..43bd41029 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -83,8 +83,10 @@ backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-s # this is for forwards compatibility with GHES 3.8.0 onwards if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" - echo "ghe-config 'secrets.github.encrypted-column-keying-material' | sed 's:.*;::' > encrypted-column-current-encryption-key" | - ghe-ssh "$host" /bin/bash +fi + +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then + cat "$GHE_SNAPSHOT_DIR/encrypted-column-encryption-keying-material" | sed 's:.*;::' > "$GHE_SNAPSHOT_DIR/encrypted-column-current-encryption-key" fi backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 3dea629c4..8fd42948e 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -586,7 +586,6 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi required_files=( "encrypted-column-encryption-keying-material" - "encrypted-column-current-encryption-key" ) for file in "${required_files[@]}"; do From 79d487591def1c48e7affe2d314a73a70c6e4bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Thu, 13 Jul 2023 15:51:23 +0200 Subject: [PATCH 517/946] Avoid redundant rsync operations In noncluster environments in a high-availability configuration, there is only one target server to restore repository data onto. However, the current implementation performs one rsync task per node in the replication network. In a setup with one primary instance and two passive replicas, this would amount to three rsync tasks with identical or almost identical file lists. Aside from the rsync task for transferring repository data from the backup snapshot onto the target server, the other rsync operations per replica are unnecessary. Avoiding these redundant rsync tasks reduces the runtime of ghe-restore-repositories by about 12 % for a customer with roughly 1 TB of repository data. With GHE_PARALLEL_ENABLED=yes configured, this change also prevents a race condition, which could occur when multiple rsync processes try to write to the same file on the target server at the same time. --- .../ghe-restore-repositories | 77 ++++++++++--------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index d59864196..e8e1dcdbe 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -102,42 +102,49 @@ done > $tmp_list IFS=$OLDIFS bm_end "$(basename $0) - Building network list" -# The server returns a list of routes: -# -# a/nw/a8/3f/02/100000855 dgit-node1 dgit-node2 dgit-node3 -# a/nw/a8/bc/8d/100000880 dgit-node1 dgit-node2 dgit-node4 -# a/nw/a5/06/81/100000659 dgit-node3 dgit-node2 dgit-node4 -# ... -# -# One route per line. -# -# NOTE: The route generation is performed on the appliance as it is considerably -# more performant than performing over an SSH pipe. -# -bm_start "$(basename $0) - Transferring network list" -cat $tmp_list | ghe-ssh "$GHE_HOSTNAME" -- sponge $remote_tmp_list -cat $tmp_list | ghe_debug -bm_end "$(basename $0) - Transferring network list" - -bm_start "$(basename $0) - Generating routes" -restore_routes_script="github-env ./bin/dgit-cluster-restore-routes" -if ghe-ssh "$GHE_HOSTNAME" test -e /usr/local/share/enterprise/ghe-restore-network-routes; then - restore_routes_script="/usr/local/share/enterprise/ghe-restore-network-routes" +if $CLUSTER; then + # The server returns a list of routes: + # + # a/nw/a8/3f/02/100000855 dgit-node1 dgit-node2 dgit-node3 + # a/nw/a8/bc/8d/100000880 dgit-node1 dgit-node2 dgit-node4 + # a/nw/a5/06/81/100000659 dgit-node3 dgit-node2 dgit-node4 + # ... + # + # One route per line. + # + # NOTE: The route generation is performed on the appliance as it is considerably + # more performant than performing over an SSH pipe. + # + bm_start "$(basename $0) - Transferring network list" + cat $tmp_list | ghe-ssh "$GHE_HOSTNAME" -- sponge $remote_tmp_list + cat $tmp_list | ghe_debug + bm_end "$(basename $0) - Transferring network list" + + bm_start "$(basename $0) - Generating routes" + restore_routes_script="github-env ./bin/dgit-cluster-restore-routes" + if ghe-ssh "$GHE_HOSTNAME" test -e /usr/local/share/enterprise/ghe-restore-network-routes; then + restore_routes_script="/usr/local/share/enterprise/ghe-restore-network-routes" + fi + echo "cat $remote_tmp_list | $restore_routes_script | grep 'git-server-' > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash + ghe-ssh "$GHE_HOSTNAME" -- cat $remote_routes_list | ghe_debug + bm_end "$(basename $0) - Generating routes" + + bm_start "$(basename $0) - Fetching routes" + ghe-ssh "$GHE_HOSTNAME" -- gzip -c $remote_routes_list | gzip -d > $routes_list + cat $routes_list | ghe_debug + bm_end "$(basename $0) - Fetching routes" + + bm_start "$(basename $0) - Processing routes" + + cat $routes_list | awk -v tempdir="$tempdir" '{ for(i=2;i<=NF;i++){ print $1 > (tempdir"/"$i".rsync") }}' + cat $routes_list | awk '{ n = split($1, p, "/"); printf p[n] " /data/repositories/" $1; $1=""; print $0}' > $to_restore + ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" + bm_end "$(basename $0) - Processing routes" +else + # In noncluster setups, the primary instance owns all repository networks, so all network paths + # are to be synchronized to the primary instance. + cp "$tmp_list" "$tempdir/git-server-primary.rsync" fi -echo "cat $remote_tmp_list | $restore_routes_script | grep 'git-server-' > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash -ghe-ssh "$GHE_HOSTNAME" -- cat $remote_routes_list | ghe_debug -bm_end "$(basename $0) - Generating routes" - -bm_start "$(basename $0) - Fetching routes" -ghe-ssh "$GHE_HOSTNAME" -- gzip -c $remote_routes_list | gzip -d > $routes_list -cat $routes_list | ghe_debug -bm_end "$(basename $0) - Fetching routes" - -bm_start "$(basename $0) - Processing routes" -cat $routes_list | awk -v tempdir="$tempdir" '{ for(i=2;i<=NF;i++){ print $1 > (tempdir"/"$i".rsync") }}' -cat $routes_list | awk '{ n = split($1, p, "/"); printf p[n] " /data/repositories/" $1; $1=""; print $0}' > $to_restore -ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" -bm_end "$(basename $0) - Processing routes" if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then log_warn "Warning: no routes found, skipping repositories restore ..." From 632da3cb50f7a3e0bda2f5b248dc70e52d4c00ef Mon Sep 17 00:00:00 2001 From: Zheng Zeng Date: Tue, 25 Jul 2023 15:55:56 +0000 Subject: [PATCH 518/946] make increment inline --- share/github-backup-utils/ghe-backup-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index b65c61f28..65e863b56 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -714,7 +714,7 @@ init-progress() { #increase total count of progress increment-progress-total-count() { - PROGRESS_TOTAL=$((PROGRESS_TOTAL + $1)) + ((PROGRESS_TOTAL += $1)) echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total } From 0671226fcd779b044736eb2a8ef425e3138a559d Mon Sep 17 00:00:00 2001 From: Diana Date: Wed, 26 Jul 2023 03:01:28 -0700 Subject: [PATCH 519/946] Update rsync version warning to remove cat --- bin/ghe-host-check | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 4473c2dc1..211ea8c78 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -219,14 +219,10 @@ DATA_TRANSFER_SIZE echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 exit 1 elif [[ $rsync_version < 3.2.5 ]] && [[ $RSYNC_WARNING != "no" ]]; then - cat << WARN_MSG 1>&2 -**WARNING:** rsync version $rsync_version on backup host is less than 3.2.5, which could result in performance degradation. - -For more details, please read documentation at https://github.com/github/backup-utils/blob/master/docs/requirements.md#april-2023-update-of-rsync-requirements - -You can disable this warning by changing RSYNC_WARNING to 'no' in your backup.config file. - -WARN_MSG + printf "\n **WARNING:** rsync version %s on backup host is less than 3.2.5, which could result in performance degradation. + For more details, please read documentation at https://gh.io/april-2023-update-of-rsync-requirements + You can disable this warning by changing RSYNC_WARNING to 'no' in your backup.config file.\n\n" \ + "$rsync_version" 1>&2 fi echo " - rsync ${rsync_version} >= required ($min_rsync)" 1>&2 From 24ec2c670a141afbb9224f062c3111b9d7f79cc3 Mon Sep 17 00:00:00 2001 From: Zheng Zeng Date: Wed, 26 Jul 2023 15:23:49 +0000 Subject: [PATCH 520/946] fix test --- bin/ghe-backup | 4 +++- bin/ghe-restore | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index ae6dd0f0d..4bd8d5bb3 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -46,6 +46,8 @@ export CALLING_SCRIPT="ghe-backup" # Setup progress tracking init-progress +export PROGRESS_TOTAL=14 # Minimum number of steps in backup is 14 +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total export PROGRESS_TYPE="Backup" echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of backup @@ -72,7 +74,7 @@ if [ "$GHE_BACKUP_PAGES" != "no" ]; then OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) fi -PROGRESS_TOTAL=$((OPTIONAL_STEPS + 14)) # Minimum number of steps in backup is 14 +PROGRESS_TOTAL=$((OPTIONAL_STEPS + PROGRESS_TOTAL)) # Minimum number of steps in backup is 14 echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check diff --git a/bin/ghe-restore b/bin/ghe-restore index 428227426..6d646ad54 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -311,11 +311,11 @@ fi export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 7)) init-progress +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total export PROGRESS_TYPE="Restore" echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type export PROGRESS=0 # Used to track progress of restore echo "$PROGRESS" > /tmp/backup-utils-progress -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) From c670c4eae21dd0161a83ba3cf49a7ca28611b3fd Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:18:33 +0000 Subject: [PATCH 521/946] create the encrypted column current encryption key backup on 3.7.0+ * the previous implementation effectively only created the current encryption key backup on versions 3.8.0+ which does not help in the situation when a customer is upgrading from 3.7 to 3.8 or 3.9 --- share/github-backup-utils/ghe-backup-settings | 3 - test/test-ghe-backup.sh | 66 +++++++------------ 2 files changed, 25 insertions(+), 44 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 43bd41029..3a05feba7 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -83,9 +83,6 @@ backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-s # this is for forwards compatibility with GHES 3.8.0 onwards if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" -fi - -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then cat "$GHE_SNAPSHOT_DIR/encrypted-column-encryption-keying-material" | sed 's:.*;::' > "$GHE_SNAPSHOT_DIR/encrypted-column-current-encryption-key" fi diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 8fd42948e..f1b730d4e 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -555,17 +555,6 @@ begin_test "ghe-backup takes backup of kredz-varz settings" ) end_test -begin_test "ghe-backup does not take backup of encrypted column encryption keying material for versions below 3.7.0" -( - GHE_REMOTE_VERSION=2.1.10 ghe-backup -v | grep -q "encrypted column encryption keying material not set" && exit 1 - [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material" ] - - GHE_REMOTE_VERSION=3.6.1 ghe-backup -v | grep -q "encrypted column encryption keying material not set" && exit 1 - [ ! -f "$GHE_DATA_DIR/current/encrypted-column-keying-material" ] - -) -end_test - begin_test "ghe-backup takes backup of encrypted column encryption keying material and create encrypted column current encryption key for versions 3.7.0+" ( set -e @@ -586,6 +575,7 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi required_files=( "encrypted-column-encryption-keying-material" + "encrypted-column-current-encryption-key" ) for file in "${required_files[@]}"; do @@ -598,35 +588,6 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi ghe-backup - required_files=( - "encrypted-column-encryption-keying-material" - ) - - for file in "${required_files[@]}"; do - [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] - done - -) -end_test - -begin_test "ghe-backup takes backup of encrypted column encryption keying material and encrypted column current encryption key for versions 3.8.0+" -( - set -e - - required_secrets=( - "secrets.github.encrypted-column-keying-material" - ) - - for secret in "${required_secrets[@]}"; do - ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" - done - - # GHES version 3.8.0 - GHE_REMOTE_VERSION=3.8.0 - export GHE_REMOTE_VERSION - - ghe-backup - required_files=( "encrypted-column-encryption-keying-material" "encrypted-column-current-encryption-key" @@ -666,7 +627,30 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi ghe-ssh "$GHE_HOSTNAME" -- /bin/bash done - # GHES version 3.8.0 + # GHES version 3.7.0 + GHE_REMOTE_VERSION=3.7.0 + export GHE_REMOTE_VERSION + + ghe-backup + + required_files=( + "encrypted-column-encryption-keying-material" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo;bar" ] + done + + required_files_current_encryption_key=( + "encrypted-column-current-encryption-key" + ) + + for file in "${required_files_current_encryption_key[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "bar" ] + done + + + # GHES version 3.8.0 GHE_REMOTE_VERSION=3.8.0 export GHE_REMOTE_VERSION From 91b21fe085105f34ea4b03690fb3ec7fa2dcf7a3 Mon Sep 17 00:00:00 2001 From: David Daly Date: Thu, 27 Jul 2023 16:22:52 +0000 Subject: [PATCH 522/946] backup container prefix for actions --- share/github-backup-utils/ghe-backup-config | 14 +++++++------- share/github-backup-utils/ghe-backup-settings | 1 + share/github-backup-utils/ghe-restore-actions | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 31e9aff0a..00bcf716e 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -372,13 +372,13 @@ export GHE_DATA_DIR : "${GHE_RELEASE_FILE:="/etc/github/enterprise-release"}" # Check that utils are not being run directly on GHE appliance. -if [ -f "$GHE_RELEASE_FILE" ]; then - echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 - echo " The backup utilities should be run on a host dedicated to" 1>&2 - echo " long-term permanent storage and must have network connectivity" 1>&2 - echo " with the GitHub Enterprise appliance." 1>&2 - exit 1 -fi +# if [ -f "$GHE_RELEASE_FILE" ]; then +# echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 +# echo " The backup utilities should be run on a host dedicated to" 1>&2 +# echo " long-term permanent storage and must have network connectivity" 1>&2 +# echo " with the GitHub Enterprise appliance." 1>&2 +# exit 1 +# fi GHE_CREATE_DATA_DIR=${GHE_CREATE_DATA_DIR:-yes} diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 43bd41029..ad1c4e49c 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -122,6 +122,7 @@ if ghe-ssh "$host" -- ghe-config --true app.actions.enabled; then backup-secret "Actions secondary encryption cert thumbprint" "actions-secondary-encryption-cert-thumbprint" "secrets.actions.SecondaryEncryptionCertificateThumbprint" backup-secret "Actions service principal cert" "actions-service-principal-cert" "secrets.actions.ServicePrincipalCertificate" --best-effort backup-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" + backup-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" backup-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" backup-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 93596033a..af33c60d4 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -68,6 +68,7 @@ restore-secret "Actions S2S encryption cert" "actions-s2s-encryption-cert" "secr restore-secret "Actions secondary encryption cert thumbprint" "actions-secondary-encryption-cert-thumbprint" "secrets.actions.SecondaryEncryptionCertificateThumbprint" restore-secret "Actions service principal cert" "actions-service-principal-cert" "secrets.actions.ServicePrincipalCertificate" restore-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" +restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" restore-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" restore-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" From 591416ccd98ddd9065362ac74efaa488aba18b06 Mon Sep 17 00:00:00 2001 From: David Daly Date: Thu, 27 Jul 2023 18:47:17 +0000 Subject: [PATCH 523/946] fix track-progress --- share/github-backup-utils/track-progress | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 3f67ca9e8..1381cbbef 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -7,7 +7,7 @@ progress(){ PROGRESS=$(cat /tmp/backup-utils-progress) PROGRESS_TYPE=$(cat /tmp/backup-utils-progress-type) - PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) + PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100") echo $((PROGRESS +1)) > /tmp/backup-utils-progress echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress-info } From d83e0085ff44d355167ec066b418a45244941cec Mon Sep 17 00:00:00 2001 From: David Daly Date: Fri, 28 Jul 2023 18:31:21 +0000 Subject: [PATCH 524/946] update to only restore prefix when using -c --- share/github-backup-utils/ghe-backup-config | 14 +++++++------- share/github-backup-utils/ghe-restore-actions | 8 +++++++- share/github-backup-utils/track-progress | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 00bcf716e..31e9aff0a 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -372,13 +372,13 @@ export GHE_DATA_DIR : "${GHE_RELEASE_FILE:="/etc/github/enterprise-release"}" # Check that utils are not being run directly on GHE appliance. -# if [ -f "$GHE_RELEASE_FILE" ]; then -# echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 -# echo " The backup utilities should be run on a host dedicated to" 1>&2 -# echo " long-term permanent storage and must have network connectivity" 1>&2 -# echo " with the GitHub Enterprise appliance." 1>&2 -# exit 1 -# fi +if [ -f "$GHE_RELEASE_FILE" ]; then + echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 + echo " The backup utilities should be run on a host dedicated to" 1>&2 + echo " long-term permanent storage and must have network connectivity" 1>&2 + echo " with the GitHub Enterprise appliance." 1>&2 + exit 1 +fi GHE_CREATE_DATA_DIR=${GHE_CREATE_DATA_DIR:-yes} diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index af33c60d4..3db864c6f 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -68,7 +68,6 @@ restore-secret "Actions S2S encryption cert" "actions-s2s-encryption-cert" "secr restore-secret "Actions secondary encryption cert thumbprint" "actions-secondary-encryption-cert-thumbprint" "secrets.actions.SecondaryEncryptionCertificateThumbprint" restore-secret "Actions service principal cert" "actions-service-principal-cert" "secrets.actions.ServicePrincipalCertificate" restore-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" -restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" restore-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" restore-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" @@ -86,6 +85,13 @@ restore-secret "Actions Launch service private key" "actions-launch-app-app-priv restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" "secrets.launch.token-oauth-key" restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert" +# Restore storage container prefix, but only if the `-c` option is used with ghe-restore +# `-c` should be used if restoring to an unconfigured appliance or when sif restoring to an unconfigured appliance or when +# specified manually. +# This is to avoid a staging instance using the same bucket prefix settings as production in the case of a staging instance restored from production +if $RESTORE_SETTINGS; then + restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" +fi # Setup the database logins. ghe_verbose "* Restoring database logins and users to $host ..." diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 1381cbbef..3f67ca9e8 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -7,7 +7,7 @@ progress(){ PROGRESS=$(cat /tmp/backup-utils-progress) PROGRESS_TYPE=$(cat /tmp/backup-utils-progress-type) - PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100") + PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) echo $((PROGRESS +1)) > /tmp/backup-utils-progress echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress-info } From 5529410f9517ba44ae52e2e96c8683057a74150b Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 1 Aug 2023 18:37:03 -0400 Subject: [PATCH 525/946] Incremental MySQL Backups and Restores (#366) Implementing incremental mysql backups for 3.10 Co-authored-by: Dax Amin Co-authored-by: Manuel Bergler Co-authored-by: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> --- .gitignore | 2 + bin/ghe-backup | 31 +- bin/ghe-restore | 23 +- share/github-backup-utils/ghe-backup-config | 7 +- share/github-backup-utils/ghe-backup-mysql | 8 + .../ghe-backup-mysql-binary | 46 +- .../ghe-incremental-backup-restore | 397 ++++++++++++++++++ share/github-backup-utils/ghe-prune-snapshots | 86 +++- .../ghe-restore-mysql-binary | 61 ++- share/github-backup-utils/version | 2 +- test/test-ghe-backup.sh | 61 +++ test/testlib.sh | 12 + 12 files changed, 705 insertions(+), 31 deletions(-) create mode 100644 share/github-backup-utils/ghe-incremental-backup-restore diff --git a/.gitignore b/.gitignore index 246384181..e6a5a2890 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /backup.config /data /dist +dash +parallel diff --git a/bin/ghe-backup b/bin/ghe-backup index 62359899b..d818c6be4 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -27,6 +27,10 @@ while true; do export GHE_VERBOSE=true shift ;; + -i|--incremental) + export GHE_INCREMENTAL=true + shift + ;; -*) echo "Error: invalid argument: '$1'" 1>&2 exit 1 @@ -173,17 +177,34 @@ if [ -f ../in-progress ]; then fi fi +# Perform a host connection check and establish the remote appliance version. +# The version is available in the GHE_REMOTE_VERSION variable and also written +# to a version file in the snapshot directory itself. +ghe_remote_version_required +echo "$GHE_REMOTE_VERSION" > version + +# check that incremental settings are valid if set +is_inc=$(is_incremental_backup_feature_on) + +if [ "$is_inc" = true ]; then +if [ "$GHE_VERSION_MAJOR" -lt 3 ] && [ "$GHE_VERSION_MINOR" -lt 10 ]; then + log_error "Cannot only perform incremental backups on enterprise version 3.10 or higher" + exit 1 +fi + incremental_backup_check + # If everything is ok, check if we have hit GHE_MAX_INCREMENTAL_BACKUPS, performing pruning actions if necessary + check_for_incremental_max_backups + # initialize incremental backup if it hasn't been done yet + incremental_backup_init +fi + echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress echo "$GHE_SNAPSHOT_TIMESTAMP $$" > "${GHE_DATA_DIR}/in-progress-backup" START_TIME=$(date +%s) log_info "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" -# Perform a host connection check and establish the remote appliance version. -# The version is available in the GHE_REMOTE_VERSION variable and also written -# to a version file in the snapshot directory itself. -ghe_remote_version_required -echo "$GHE_REMOTE_VERSION" > version + if [ -n "$GHE_ALLOW_REPLICA_BACKUP" ]; then echo "Warning: backing up a high availability replica may result in inconsistent or unreliable backups." diff --git a/bin/ghe-restore b/bin/ghe-restore index 6d646ad54..67061265b 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -71,6 +71,10 @@ while true; do export GHE_VERBOSE=true shift ;; + -i|--incremental) + export GHE_INCREMENTAL=true + shift + ;; -*) echo "Error: invalid argument: '$1'" 1>&2 exit 1 @@ -321,6 +325,21 @@ echo "$PROGRESS" > /tmp/backup-utils-progress START_TIME=$(date +%s) log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" +if [ "$GHE_INCREMENTAL" ]; then + log_info "Incremental restore from snapshot $GHE_RESTORE_SNAPSHOT" + # If we see 'inc_previous' prepended to the snapshot name, then + # we set $INC_FULL_BACKUP and $INC_SNAPSHOT_DATA to $INC_PREVIOUS_FULL_BACKUP and + # $INC_PREVIOUS_SNAPSHOT_DATA respectively. Otherwise, leave them at default setting + # so that incremental restore is from current cycle + if [[ "$GHE_RESTORE_SNAPSHOT" =~ ^inc_previous ]]; then + INC_FULL_BACKUP=$INC_PREVIOUS_FULL_BACKUP + INC_SNAPSHOT_DATA=$INC_PREVIOUS_SNAPSHOT_DATA + log_info "Incremental restore from previous cycle snapshot. Using $INC_FULL_BACKUP" + log_info "Incremental restore from previous cycle snapshot. Using $INC_SNAPSHOT_DATA" + fi + log_info "Validating snapshot $GHE_RESTORE_SNAPSHOT" + validate_inc_snapshot_data "$GHE_RESTORE_SNAPSHOT" +fi ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." # Create an in-progress-restore file to prevent simultaneous backup or restore runs echo "${START_TIME} $$" > "${GHE_DATA_DIR}/in-progress-restore" @@ -498,6 +517,8 @@ else ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 fi + + if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then log_info "Stopping Actions before restoring databases ..." # We mark Actions as stopped even if the `ghe-actions-stop` @@ -601,7 +622,7 @@ fi log_info "Restarting memcached ..." 1>&3 bm_start "$(basename $0) - Restarting memcached" echo "sudo restart -q memcached 2>/dev/null || true" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh +ghe-ssh "$GHE_HOSTNAME" -- /bin/sh bm_end "$(basename $0) - Restarting memcached" # Prevent GitHub Connect jobs running before we've had a chance to reset diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 65e863b56..02a8df435 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -183,6 +183,8 @@ fi PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # shellcheck source=share/github-backup-utils/bm.sh . "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" +# shellcheck source=share/github-backup-utils/ghe-incremental-backup-restore +. "$GHE_BACKUP_ROOT/share/github-backup-utils/ghe-incremental-backup-restore" # shellcheck source=share/github-backup-utils/track-progress . "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" # Save off GHE_HOSTNAME from the environment since we want it to override the @@ -712,12 +714,9 @@ init-progress() { rm -f /tmp/backup-utils-progress* } + #increase total count of progress increment-progress-total-count() { ((PROGRESS_TOTAL += $1)) echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total } - - - - diff --git a/share/github-backup-utils/ghe-backup-mysql b/share/github-backup-utils/ghe-backup-mysql index 0ae9172ce..733051bc4 100755 --- a/share/github-backup-utils/ghe-backup-mysql +++ b/share/github-backup-utils/ghe-backup-mysql @@ -33,6 +33,14 @@ else if is_binary_backup_feature_on; then ghe-backup-mysql-binary else + # if incremental backups are turned on, we can't do them with + # logical backups, so we need to tell the user and exit + is_inc=$(is_incremental_backup_feature_on) + if [ $is_inc = true ]; then + log_warn "Incremental backups are configured on the target environment." + log_warn "Incremental backup is not supported with a logical MySQL backup. Please disable incremental backups with 'ghe-config mysql.backup.incremental false'" + exit 1 + fi ghe-backup-mysql-logical fi fi diff --git a/share/github-backup-utils/ghe-backup-mysql-binary b/share/github-backup-utils/ghe-backup-mysql-binary index 70091cbba..106757c71 100755 --- a/share/github-backup-utils/ghe-backup-mysql-binary +++ b/share/github-backup-utils/ghe-backup-mysql-binary @@ -16,9 +16,45 @@ bm_start "$(basename $0)" ghe_remote_version_required "$GHE_HOSTNAME" log_verbose "Backing up MySQL database using binary backup strategy ..." - -echo "set -o pipefail; ghe-export-mysql" | -ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" -echo "NO_ADDITIONAL_COMPRESSION" > "$GHE_SNAPSHOT_DIR/mysql-binary-backup-sentinel" - +is_inc=$(is_incremental_backup_feature_on) +if [ $is_inc = true ]; then + log_verbose "Incremental backups are configured on the target environment." + log_info "Performing incremental backup of MySQL database ..." 1>&3 + INC_TYPE=$(full_or_incremental_backup) + INC_LSN="" + if [ "$INC_TYPE" == "full" ]; then + log_info "Incremental backup type: $INC_TYPE" 1>&3 + INC_LSN=0 # 0 means full backup + else + validate_inc_snapshot_data + log_info "Incremental backup type: $INC_TYPE" 1>&3 + INC_LSN=$(retrieve_last_lsn) + fi + echo "set -o pipefail; env INC_BACKUP=$INC_LSN ghe-export-mysql" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" + echo "NO_ADDITIONAL_COMPRESSION" > "$GHE_SNAPSHOT_DIR/mysql-binary-backup-sentinel" + # Ensure that we capture the xtrabackup_checkpoints file from the remote host + log_info "Checking if incremental backup is part of a cluster" + GET_LSN=$(get_cluster_lsn "$GHE_HOSTNAME") + ghe-ssh "$GHE_HOSTNAME" "$GET_LSN" > "$GHE_SNAPSHOT_DIR/xtrabackup_checkpoints" + if [ "$INC_TYPE" == "full" ]; then + log_info "Adding $GHE_SNAPSHOT_DIR to the list of full backups" 1>&3 + update_inc_full_backup "$GHE_SNAPSHOT_DIR" + else + log_info "Adding $GHE_SNAPSHOT_DIR to the list of incremental backups" 1>&3 + update_inc_snapshot_data "$GHE_SNAPSHOT_DIR" + fi + bm_end "$(basename $0)" + exit 0 +fi +# if incremental backup isn't enabled, or we are performing a full backup as part of the process, +# fall through and do a full backup + echo "set -o pipefail; ghe-export-mysql" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" + echo "NO_ADDITIONAL_COMPRESSION" > "$GHE_SNAPSHOT_DIR/mysql-binary-backup-sentinel" + is_inc=$(is_incremental_backup_feature_on) + if [ $is_inc = true ]; then + update_inc_full_backup "$GHE_SNAPSHOT_DIR" + fi bm_end "$(basename $0)" + diff --git a/share/github-backup-utils/ghe-incremental-backup-restore b/share/github-backup-utils/ghe-incremental-backup-restore new file mode 100644 index 000000000..fd1309fe6 --- /dev/null +++ b/share/github-backup-utils/ghe-incremental-backup-restore @@ -0,0 +1,397 @@ +#!/bin/bash +# ghe-incremental-backup-restore +# contains functions used for incremental backups and restores. +# Not called directly, but rather sourced from other scripts. +# Incremental backups are only supported on backup-utils 3.10 and greater. + +# INC_FULL_BACKUP is a file that tracks the last full backup that we have done for the current incremental backup cycle. +export INC_FULL_BACKUP="inc_full_backup" +# INC_PREVIOUS_FULL_BACKUP is a file that tracks the last full backup that we have done for the previous incremental backup cycle. +# Kept around for a cycle to ensure that we have a rolling window of incremental backups. +export INC_PREVIOUS_FULL_BACKUP="inc_previous_full_backup" +# PRUNE_FULL_BACKUP is a file that tracks the full backups that need to be pruned. +export PRUNE_FULL_BACKUP="prune_inc_previous_full_backup" +# INC_SNAPSHOT_DATA is a file that tracks the incremental backups that we have done for the current incremental backup cycle. +export INC_SNAPSHOT_DATA="inc_snapshot_data" +# INC_PREVIOUS_SNAPSHOT_DATA is a file that tracks the incremental backups that we have done for the previous incremental backup cycle. +export INC_PREVIOUS_SNAPSHOT_DATA="inc_previous_snapshot_data" +# PRUNE_SNAPSHOT_DATA is a file that tracks the incremental backups that need to be pruned. +export PRUNE_SNAPSHOT_DATA="prune_inc_previous_snapshot_data" + +# Check if incremental backups are enabled. +is_incremental_backup_feature_on() { + if [ "$GHE_INCREMENTAL" ]; then + echo "true" + else + echo "false" + fi +} + +# Do sanity checks on incremental backups. +incremental_backup_check() { + if $GHE_INCREMENTAL; then + if [ -z "$GHE_INCREMENTAL_MAX_BACKUPS" ]; then + log_error "incremental backups require GHE_INCREMENTAL_MAX_BACKUPS to be set" 1>&2 + exit 1 + fi + if [ "$GHE_INCREMENTAL_MAX_BACKUPS" -lt 1 ]; then + log_error "GHE_INCREMENTAL_MAX_BACKUPS must be greater than 0" 1>&3 + exit 1 + fi + fi +} + +# initialize incremental backup. We create a file 'inc_snapshot_data' +# in $GHE_DATA_DIR to track the incremental backups that we have done. +# We also create a file called 'inc_full_backup' that tracks the last +# full backup that we have done that the incremental backups are based on. +# If the file does not exist, we create it and leave it blank. +incremental_backup_init() { + if $GHE_INCREMENTAL; then + if [ ! -f "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA" ]; then + touch "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA" + fi + if [ ! -f "$GHE_DATA_DIR/$INC_FULL_BACKUP" ]; then + touch "$GHE_DATA_DIR/$INC_FULL_BACKUP" + fi + fi +} + +# if incremental backups are enabled, we check if we have up to max incremental backups +# if we do, if there are no folders with 'inc_previous', we move the current list of +# incremental backups to 'inc_previous_snapshot_data' and 'inc_previous_full_backup' +# using set_previous_incremental_backup. If there are folders with 'inc_previous', we +# prune them using set_prune_incremental_backup. +check_for_incremental_max_backups(){ + if $GHE_INCREMENTAL; then + # decrement the number of snapshots by 1 to account for the full backup + if [ "$(cat "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA" | wc -l)" -ge "$((GHE_INCREMENTAL_MAX_BACKUPS-1))" ]; then + if [ -z "$(ls -d "$GHE_DATA_DIR"/inc_previous* 2>/dev/null)" ]; then + set_to_inc_previous + else + set_to_prune + set_to_inc_previous + fi + fi + fi +} +# retrieve the lsn of the snapshot directory passed in as an argument +# from xtrabackup_checkpoint which would be in $GHE_DATA_DIR/ +retrieve_lsn(){ + local lsn + if $GHE_INCREMENTAL; then + if [ -z "$1" ]; then + log_error "retrieve_lsn requires a snapshot directory to be passed in" 1>&3 + exit 1 + fi + if [ ! -d "$1" ]; then + log_error "retrieve_lsn requires a valid snapshot directory to be passed in" 1>&3 + exit 1 + fi + if [ ! -f "$1/xtrabackup_checkpoints" ]; then + log_error "retrieve_lsn requires a valid xtrabackup_checkpoints file in $1" 1>&3 + exit 1 + fi + lsn=$(grep 'to_lsn' < "$1/xtrabackup_checkpoints" | cut -d' ' -f3) + echo "$lsn" + fi +} +# retrieve the lsn of the last snapshot directory in the file 'inc_snapshot_data' +# use that directory to call the retrieve_lsn function to get the lsn +# if inc_snapshot_data is empty, use the full backup directory to get the lsn + +retrieve_last_lsn(){ + local lsn backup_data last_snapshot_dir + if $GHE_INCREMENTAL; then + if [ ! -f "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA" ]; then + log_error "retrieve_last_lsn requires a valid inc_snapshot_data file in $GHE_DATA_DIR" 1>&3 + exit 1 + fi + if [ -z "$(cat "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA")" ]; then + backup_data=$(cat "$GHE_DATA_DIR/$INC_FULL_BACKUP") + lsn=$(retrieve_lsn "$backup_data") + log_info "No incremental backups have been done yet. Using full backup directory $backup_data to get previous lsn ($lsn)" 1>&3 + else + last_snapshot_dir=$(tail -n 1 "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA") + log_info "Using incremental directory $last_snapshot_dir to get previous lsn" 1>&3 + lsn=$(retrieve_lsn "$last_snapshot_dir") + fi + echo "$lsn" + fi +} + +# determine if we need to do a full backup or an incremental backup +# based on the number of snapshots we have and the number of incremental +# backups we have done. If we have done GHE_INCREMENTAL_MAX_BACKUPS +# incremental backups, we do a full backup. Otherwise, we do an incremental +# backup. We also do a full backup if we have not done any backups yet. +# We determine that by checking the value of the file 'inc_full_backup' +# in $GHE_DATA_DIR. If the file is blank, we need to do a full backup. +# If the file exists and points to a directory, then we are doing an incremental. +full_or_incremental_backup(){ + if $GHE_INCREMENTAL; then + if [ ! -f "$GHE_DATA_DIR/$INC_FULL_BACKUP" ]; then + echo "full" + elif [ -z "$(cat "$GHE_DATA_DIR/$INC_FULL_BACKUP")" ]; then + echo "full" + elif [ "$(cat "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA" | wc -l)" == "$GHE_INCREMENTAL_MAX_BACKUPS" ]; then + echo "full" + else + echo "incremental" + fi + fi +} + +# add snapshot directory to the list of incremental backups we have done +# in the file 'inc_snapshot_data' in $GHE_DATA_DIR. +update_inc_snapshot_data(){ + if $GHE_INCREMENTAL; then + if [ -z "$1" ]; then + log_error "update_snapshot_data requires a snapshot directory to be passed in" 1>&3 + exit 1 + fi + INC_DATA_DIR="$GHE_DATA_DIR/$(basename $1)" + if [ ! -d "$INC_DATA_DIR" ]; then + log_error "update_snapshot_data requires a valid snapshot directory to be passed in" 1>&3 + exit 1 + fi + echo "$1" >> "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA" + fi +} + +# update the file 'inc_full_backup' in $GHE_DATA_DIR to point to the passed in +# snapshot directory. This is the snapshot directory that the incremental backups +# will be based on. +update_inc_full_backup(){ + if $GHE_INCREMENTAL; then + if [ -z "$1" ]; then + log_error "update_inc_full_backup requires a snapshot directory to be passed in" 1>&3 + exit 1 + fi + DIR="$GHE_DATA_DIR/$(basename "$1")" + if [ ! -d "$DIR" ]; then + log_error "update_inc_full_backup requires a valid snapshot directory to be passed in" 1>&3 + exit 1 + fi + echo "$1" > "$GHE_DATA_DIR/$INC_FULL_BACKUP" + fi +} + +# validate that inc_snapshot_data file. For each snapshot directory in the file, +# the directory should exist and its lsn retrieved from xtrabackups_checkpoint +# should be lower than the next snapshot directory in the file. If the lsn is +# not lower, then we have a problem and we warn the user and tell them to perform +# a full backup. +validate_inc_snapshot_data(){ + if $GHE_INCREMENTAL; then + local snapshot_data full_data lines snapshot_data_array snapshot_data_array_length i + + snapshot_data=$(cat "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA") + if [ -z "$snapshot_data" ]; then + log_info "no incremental snapshots yet, will make first incremental from full backup" 1>&3 + full_data=$(cat "$GHE_DATA_DIR/$INC_FULL_BACKUP") + log_info "validating full backup $full_data" 1>&3 + snapshot_data="$full_data" + fi + readarray -t snapshot_data_array <<< "$snapshot_data" + snapshot_data_array_length=${#snapshot_data_array[@]} + log_info "$snapshot_data_array_length snapshot directories found in inc_snapshot_data" + i=0 + # I would normally use a for loop here, but I need to utilize before + # and after values of the array index to compare the lsn values + while [ $i -lt "$snapshot_data_array_length" ]; do + # if this is the first snapshot directory, we don't need to compare + # it to the previous snapshot directory + if [ "$snapshot_data_array_length" -gt 0 ]; then + local snapshot_dir + + + snapshot_dir=${snapshot_data_array[$i]} + if [ ! -d "$snapshot_dir" ]; then + log_error "snapshot directory $snapshot_dir does not exist" 1>&3 + exit 1 + fi + local lsn next_lsn + log_info "retrieving lsn for snapshot directory $snapshot_dir" 1>&3 + lsn=$(retrieve_lsn "$snapshot_dir") + if [ $i -lt $((snapshot_data_array_length-1)) ]; then + local next_snapshot_dir + next_snapshot_dir=${snapshot_data_array[$((i+1))]} + next_lsn=$(retrieve_lsn "$next_snapshot_dir") + if [ "$lsn" -ge "$next_lsn" ]; then + log_error "snapshot directory $snapshot_dir has an lsn of $lsn which is greater than or equal to the next snapshot directory $next_snapshot_dir with an lsn of $next_lsn" 1>&2 + log_error "incremental backups are invalid. Please perform a full backup" 1>&3 + exit 1 + fi + log_info "$snapshot_dir lsn = $lsn, $next_snapshot_dir lsn = $next_lsn" 1>&3 + fi + i=$((i+1)) + else + log_info "retrieving lsn for snapshot directory $snapshot_data" 1>&3 + lsn=$(retrieve_lsn "$snapshot_data") + log_info "$snapshot_data is the only incremental snapshot, lsn=$lsn" 1>&3 + fi + done + fi +} + +# returns whether the supplied directory is in inc_full_backup or not. +# if the directory is in inc_full_backup, then we return true, otherwise +# we return false. +is_full_backup(){ + if [ -z "$1" ]; then + log_error "is_full_backup requires a snapshot directory to be passed in, received $1" 1>&3 + exit 1 + fi + BACKUP_DIR="$GHE_DATA_DIR/$(basename "$1")" + if [ ! -d "$BACKUP_DIR" ]; then + log_error "is_full_backup requires a valid snapshot directory to be passed in, received $1" 1>&3 + exit 1 + fi + if [ "$1" = "$(cat "$GHE_DATA_DIR/$INC_FULL_BACKUP")" ]; then + echo "true" + else + echo "false" + fi +} + +# returns the full backup directory from the inc_full_backup file +# should ever only be one line in the file +get_full_backup(){ + if $GHE_INCREMENTAL; then + backup_dir=$(cat "$GHE_DATA_DIR/$INC_FULL_BACKUP") + basename "$backup_dir" + fi +} + +# retrieve the incremental backups in the list up to and including the passed in +# snapshot directory. If the snapshot directory is not in the list, then we +# return a blank string. +get_incremental_backups(){ + if $GHE_INCREMENTAL; then + if [ -z "$1" ]; then + log_error "get_incremental_backups requires a snapshot directory to be passed in" 1>&3 + exit 1 + fi + if [ ! -d "$1" ]; then + log_error "get_incremental_backups requires a valid snapshot directory to be passed in" 1>&3 + exit 1 + fi + local incremental_backups + incremental_backups="" + snapshot_data=$(cat "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA") + while IFS= read -r line; do + if [[ "$line" == "$1" ]]; then + incremental_backups="$incremental_backups $(basename "$line")" + break + fi + incremental_backups="$incremental_backups $(basename "$line")" + done <<< "$snapshot_data" + echo "$incremental_backups" + fi +} + +get_cluster_lsn(){ + local GHE_HOSTNAME + GHE_HOSTNAME=$1 + + ghe-ssh "$GHE_HOSTNAME" "[ -f /etc/github/cluster ] && [ -z \"$LOCAL_MYSQL\" ]" + + if [ $? -eq 0 ]; then + local_host=$(ghe-ssh "$GHE_HOSTNAME" "cat /etc/github/cluster") + mysql_master=$(ghe-ssh "$GHE_HOSTNAME" "ghe-config cluster.mysql-master") + + if [ "$local_host" != "$mysql_master" ]; then + echo "ssh -p 122 admin@$mysql_master -- sudo cat /tmp/lsndir/xtrabackup_checkpoints" + else + echo "sudo cat /tmp/lsndir/xtrabackup_checkpoints" + fi + else + echo "sudo cat /tmp/lsndir/xtrabackup_checkpoints" + fi +} + +# Change our ssh command based on if we are in a cluster or not +# cluster_restore_ssh_cmd(){ +# local GHE_HOSTNAME +# GHE_HOSTNAME=$1 + +# ghe-ssh "$GHE_HOSTNAME" "[ -f /etc/github/cluster ] && [ -z \"$LOCAL_MYSQL\" ]" + +# if [ $? -eq 0 ]; then +# local_host=$(ghe-ssh "$GHE_HOSTNAME" "cat /etc/github/cluster") +# mysql_master=$(ghe-ssh "$GHE_HOSTNAME" "ghe-config cluster.mysql-master") + +# if [ "$local_host" != "$mysql_master" ]; then +# echo "ssh -p 122 admin@$mysql_master" +# else +# echo "" +# fi +# } + +# used to set the previous incremental backups. +# takes every directory in $GHE_DATA_DIR/$INC_FULL_BACKUP and +# $GHE_DATA_DIR/$INC_SNAPSHOT_DATA and renames them by prepending +# inc_previous to the beginning. We also change inc_full_backup and +# inc_snapshot_data to inc_previous_full_backup and inc_previous_snapshot_data +set_to_inc_previous(){ + log_info "setting previous incremental backups" 1>&3 + full_backup=$(cat "$GHE_DATA_DIR/$INC_FULL_BACKUP") + snapshot_data=$(cat "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA") + if [ -n "$full_backup" ]; then + inc_previous_full_backup_dir="inc_previous_$(basename "$full_backup")" + log_info "moving $full_backup to $GHE_DATA_DIR/$inc_previous_full_backup_dir" 1>&3 + mv "$full_backup" "$GHE_DATA_DIR/$inc_previous_full_backup_dir" + echo "$GHE_DATA_DIR/$inc_previous_full_backup_dir" > "$GHE_DATA_DIR/$INC_PREVIOUS_FULL_BACKUP" + log_info "removing $GHE_DATA_DIR/$INC_FULL_BACKUP" 1>&3 + rm -f "$GHE_DATA_DIR/$INC_FULL_BACKUP" + fi + if [ -n "$snapshot_data" ]; then + while IFS= read -r line; do + local inc_previous_snapshot_dir + inc_previous_snapshot_dir="inc_previous_$(basename "$line")" + log_info "moving $GHE_DATA_DIR/$line to $GHE_DATA_DIR/$inc_previous_snapshot_dir" 1>&3 + mv "$line" "$GHE_DATA_DIR/$inc_previous_snapshot_dir" + echo "$GHE_DATA_DIR/$inc_previous_snapshot_dir" >> "$GHE_DATA_DIR/$INC_PREVIOUS_SNAPSHOT_DATA" + done <<< "$snapshot_data" + log_info "removing $GHE_DATA_DIR/$INC_SNAPSHOT_DATA" 1>&3 + rm -f "$GHE_DATA_DIR/$INC_SNAPSHOT_DATA" + fi + +} + +# set directories prepended with "inc_previous" to be prepended with prune +# this enables the directories to be pruned by ghe-snapshot. +# Will prepend prune to each inc_previous folder in $GHE_DATA_DIR +# and will remove $GHE_DATA_DIR/inc_previous_full_backup and +# will remove $GHE_DATA_DIR/inc_previous_snapshot_data +set_to_prune(){ + log_info "setting previous incremental backups to be pruned" 1>&3 + previous_full_backup=$(cat "$GHE_DATA_DIR/$INC_PREVIOUS_FULL_BACKUP") + previous_snapshot_data=$(cat "$GHE_DATA_DIR/$INC_PREVIOUS_SNAPSHOT_DATA") + if [ -n "$previous_full_backup" ]; then + prune_full_backup_dir="prune_$(basename "$previous_full_backup")" + log_info "moving $GHE_DATA_DIR/$previous_full_backup to $GHE_DATA_DIR/$prune_full_backup_dir" 1>&3 + mv "$previous_full_backup" "$GHE_DATA_DIR/$prune_full_backup_dir" + mv "$GHE_DATA_DIR/$INC_PREVIOUS_FULL_BACKUP" "$GHE_DATA_DIR/$PRUNE_FULL_BACKUP" + log_info "removing $GHE_DATA_DIR/inc_previous_full_backup" 1>&3 + echo "$GHE_DATA_DIR/$prune_full_backup_dir" >> "$GHE_DATA_DIR/$PRUNE_FULL_BACKUP" + fi + if [ -n "$previous_snapshot_data" ]; then + while IFS= read -r line; do + local prune_snapshot_dir + prune_snapshot_dir="prune_$(basename "$line")" + log_info "moving $GHE_DATA_DIR/$line to $GHE_DATA_DIR/prune_$line" 1>&3 + mv "$line" "$GHE_DATA_DIR/$prune_snapshot_dir" + echo "$GHE_DATA_DIR/$prune_snapshot_dir" >> "$GHE_DATA_DIR/$PRUNE_SNAPSHOT_DATA" + done <<< "$previous_snapshot_data" + log_info "removing $GHE_DATA_DIR/$INC_PREVIOUS_SNAPSHOT_DATA" 1>&3 + rm -f "$GHE_DATA_DIR/$INC_PREVIOUS_SNAPSHOT_DATA" + fi + +} + +test_restore_output(){ + log_info "$INC_FULL_BACKUP" + log_info "$INC_SNAPSHOT_DATA" +} diff --git a/share/github-backup-utils/ghe-prune-snapshots b/share/github-backup-utils/ghe-prune-snapshots index 0da56df97..b71c39f0b 100755 --- a/share/github-backup-utils/ghe-prune-snapshots +++ b/share/github-backup-utils/ghe-prune-snapshots @@ -13,10 +13,51 @@ set -e prune_snapshot() { local prune_dir while read prune_dir; do - [ -n "$prune_dir" ] || return - touch "$prune_dir/incomplete" + [ -n "$prune_dir" ] || return + # ignore any directory that is included in inc_full_backup or inc_snapshot_data + # the files should be filtered out earlier, but this is a safeguard to make sure. + # inc_previous_* and prune_inc_previous are ignored by default + if grep -q "$prune_dir" "$GHE_DATA_DIR/inc_full_backup" || grep "$prune_dir" "$GHE_DATA_DIR/inc_snapshot_data"; then + continue + fi + # skip if the directory is not a directory or blank + if [ ! -d "$prune_dir" ] || [ -z "$prune_dir" ]; then + log_info "Skipping blank or non-directory: $prune_dir" 1>&3 + continue + fi + +# Track these steps as they can be difficult to track down if they fail. + + log_info "Pruning directory $prune_dir" 1>&3 + touch "$prune_dir/incomplete" + if [ $? -ne 0 ]; then + log_info "Failed to create $prune_dir/incomplete" 1>&3 + fi + find "$prune_dir" -mindepth 1 -maxdepth 1 -not -path "$prune_dir/incomplete" -print0 | xargs -0 rm -rf + if [ $? -ne 0 ] ; then + log_info "Failed to prune $prune_dir" 1>&3 + fi + rm -rf "$prune_dir" + if [ $? -ne 0 ]; then + log_info "Failed to remove $prune_dir" 1>&3 + fi + done +} + +# Utilize similar logic for incremental backups, except we will only prune directories that start with "prune_". Any directory +# prepended with this will be pruned. Otherwise, we use similar logic to the prune_snapshot function. +prune_incremental_snapshot() { + local incremental_prune_dir + + while read incremental_prune_dir; do + if [ -d "$incremental_prune_dir" ]; then + touch "$incremental_prune_dir/incomplete" + find "$incremental_prune_dir" -mindepth 1 -maxdepth 1 -not -path "$incremental_prune_dir/incomplete" -print0 | xargs -0 rm -rf + fi + + rm -rf "$incremental_prune_dir" done } @@ -28,6 +69,7 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]] || [ -z "$inprogress_file" ]; then # First prune all incomplete / failed snapshot directories prune_dirs="$(ls -1 "$GHE_DATA_DIR"/[0-9]*/incomplete 2>/dev/null || true)" prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) + incremental_prune_dirs="$(ls -1 "$GHE_DATA_DIR"/prune* 2>/dev/null || true)" if [ $prune_num -gt 0 ]; then log_info Pruning $prune_num "failed snapshot(s) ..." @@ -37,12 +79,40 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]] || [ -z "$inprogress_file" ]; then # Now prune all expired snapshots. Keep GHE_NUM_SNAPSHOTS around. snapshot_count=$(ls -1d "$GHE_DATA_DIR"/[0-9]* 2>/dev/null | wc -l) - if [ "$snapshot_count" -gt "$GHE_NUM_SNAPSHOTS" ]; then - prune_dirs="$(ls -1d "$GHE_DATA_DIR"/[0-9]* | sort -r | awk "NR>$GHE_NUM_SNAPSHOTS")" - prune_num=$(echo "$prune_dirs" | grep -v '^$' | wc -l) - log_info Pruning $prune_num "expired snapshot(s) ..." - echo "$prune_dirs" | prune_snapshot - fi +if [ "$snapshot_count" -gt "$GHE_NUM_SNAPSHOTS" ]; then + # Get the list of directories that need pruning + dirs_to_prune="" + if [ -f "$GHE_DATA_DIR/inc_full_backup" ]; then +# Read the list of directories from inc_full_backup file into the exclude_list +exclude_list=$(cat "$GHE_DATA_DIR"/inc_full_backup | tr '\n' ' ') + +# Add inc_snapshot_data directory to the exclude_list +exclude_list+=" $(cat "$GHE_DATA_DIR"/inc_snapshot_data)" + log_info "Excluding directories from pruning: $exclude_list" 1>&3 + scan_dirs="$(ls -1d "$GHE_DATA_DIR"/[0-9]*)" + log_info "Scanning directories: $scan_dirs" 1>&3 + dirs_to_prune=$(echo "$scan_dirs" | grep -v -F "$exclude_list" | sort -r | awk "NR > $GHE_NUM_SNAPSHOTS") + else + dirs_to_prune="$(ls -1d "$GHE_DATA_DIR"/[0-9]* | sort -r | awk "NR>$GHE_NUM_SNAPSHOTS")" + fi + + # Count the number of directories to be pruned + prune_num=$(echo "$dirs_to_prune" | grep -c '^') + + log_info "Pruning $prune_num expired snapshot(s) ..." + log_info "Pruning directories: $dirs_to_prune" 1>&3 + echo "$dirs_to_prune" | prune_snapshot +fi + +# Prune incremental snapshots afterward +incremental_snapshot_count=$(ls -1d "$GHE_DATA_DIR"/prune* 2>/dev/null | wc -l) +if [ $incremental_snapshot_count -gt 0 ]; then + incremental_prune_dirs="$(ls -1d "$GHE_DATA_DIR"/prune*)" + log_info "Pruning $incremental_snapshot_count stale incremental backups..." + echo "$incremental_prune_dirs" | prune_incremental_snapshot +fi + + elif [ "$CALLING_SCRIPT" != "ghe-backup" ] && [ -n "$inprogress_file" ]; then log_info "Detected a running backup/restore process, please wait until that process is complete to prune expired/incomplete snapshots." 1>&2 log_info "If no such process is running, please remove the "$GHE_DATA_DIR/in-progress*" file and retry again." 1>&2 diff --git a/share/github-backup-utils/ghe-restore-mysql-binary b/share/github-backup-utils/ghe-restore-mysql-binary index 2a4374c88..b35fd7392 100755 --- a/share/github-backup-utils/ghe-restore-mysql-binary +++ b/share/github-backup-utils/ghe-restore-mysql-binary @@ -17,6 +17,13 @@ bm_start "$(basename $0)" # Grab host arg GHE_HOSTNAME="$1" +if [ "$GHE_INCREMENTAL" ]; then +echo "Incremental backup is configured." +else +echo "I don't see that incremental backup is configured. $GHE_INCREMENTAL" +fi + +#exit 0 # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. ghe_remote_version_required "$GHE_HOSTNAME" @@ -57,17 +64,57 @@ else fi cleanup() { - ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo rm -rf $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz" + ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo rm -rf $GHE_REMOTE_DATA_USER_DIR/tmp/*" + ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo rm -rf /tmp/incremental-backup-files.txt" } trap 'cleanup' INT TERM EXIT - +log_info "Creating temporary directory on remote host at $GHE_REMOTE_DATA_USER_DIR/tmp ..." 1>&3 ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo mkdir -p '$GHE_REMOTE_DATA_USER_DIR/tmp'" 1>&3 -# Transfer MySQL data from the snapshot to the GitHub instance. -cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" +# If incremental restore is enabled, we need to upload the incremental backup file to the remote host +# We get a list of all the incremental backup files up to the snapshot we want to restore +# If the snapshot happens to be a full backup, we don't need to upload any incremental backup files +# Otherwise we follow this procedure: +# - for each incremental backup, create a directory in the format: +# $GHE_REMOTE_DATA_USER_DIR/tmp/incremental-restore-snapshot-dir/mysql.sql.gz +# - upload the incremental backup file to the directory +is_full=$(is_full_backup "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT") +is_inc=$(is_incremental_backup_feature_on) -log_info "Restore MySQL database ..." -# Import the database -echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 +if [ "$is_inc" = true ] && [ "$is_full" = false ]; then + log_info "Uploading incremental backup directories to the remote host ..." 1>&3 + full_backup_dir=$(get_full_backup) + log_info "Full backup directory: $full_backup_dir" 1>&3 + #recreate the incremental-backup-files.txt file + if [ -f "/tmp/incremental-backup-files.txt" ]; then + rm "/tmp/incremental-backup-files.txt" + fi + touch "/tmp/incremental-backup-files.txt" + for incremental_backup in $(get_incremental_backups "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"); do + echo "$incremental_backup" >> "/tmp/incremental-backup-files.txt" + log_info "Incremental files to upload: $incremental_backup" 1>&3 + log_info "Creating directory $GHE_REMOTE_DATA_USER_DIR/tmp/$incremental_backup on remote host..." 1>&3 + ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- " sudo mkdir -p '$GHE_REMOTE_DATA_USER_DIR/tmp/$incremental_backup'" + log_info "Uploading incremental backup file $GHE_DATA_DIR/$incremental_backup to the remote host ..." 1>&3 + cat "$GHE_DATA_DIR/$incremental_backup/mysql.sql.gz" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- " sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/$incremental_backup/mysql.sql.gz >/dev/null 2>&1" + done + + # Transfer the full backup to the remote host + log_info "Uploading full backup file $GHE_DATA_DIR/$full_backup_dir/mysql.sql.gz to the remote host ..." 1>&3 + cat $GHE_DATA_DIR/$full_backup_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" + # Pass the list of incremental backup files + ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- " sudo dd of=/tmp/incremental-backup-files.txt >/dev/null 2>&1" < "/tmp/incremental-backup-files.txt" + # Restore the full backup and the incremental backup files + log_info "Restoring full backup from $GHE_REMOTE_DATA_USER_DIR/tmp/full/mysql.sql.gz ..." 1>&3 + echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 + + +else + log_info "Uploading $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mysql.sql.gz MySQL data to the remote host $GHE_RESTORE_HOST in $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz ..." 1>&3 + cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" + log_info "Restore MySQL database ..." + # Import the database + echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 +fi bm_end "$(basename $0)" diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index a5c4c7633..30291cba2 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.9.0 +3.10.0 diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index f1b730d4e..46df090f8 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -50,6 +50,67 @@ begin_test "ghe-backup subsequent snapshot" ) end_test +begin_test "ghe-backup incremental" +( + set -e + sleep 1 + + setup_incremental_backup_config + + # check that no current symlink exists yet + [ -d "$GHE_DATA_DIR/current" ] + + # run it + # this time expect full backup + ghe-backup -i + + # check metadata files are created + [ -e "$GHE_DATA_DIR/inc_full_backup" ] + [ -e "$GHE_DATA_DIR/inc_snapshot_data" ] + + # check the metadata + expected_full_backup=$(wc -l < "$GHE_DATA_DIR/inc_full_backup") + expected_incremental_backup=$(wc -l < "$GHE_DATA_DIR/inc_snapshot_data") + # should have 1 full backup and 0 incremental backup + [ $expected_full_backup -eq 1 ] + [ $expected_incremental_backup -eq 0 ] + + # re-run + # this time expect incremental backup + ghe-backup -i + + expected_full_backup=$(wc -l < "$GHE_DATA_DIR/inc_full_backup") + expected_incremental_backup=$(wc -l < "$GHE_DATA_DIR/inc_snapshot_data") + # should have 1 full backup and 1 incremental backup + [ $expected_full_backup -eq 1 ] + [ $expected_incremental_backup -eq 1 ] + + # re-run + # this time expect yet another incremental backup + ghe-backup -i + + expected_full_backup=$(wc -l < "$GHE_DATA_DIR/inc_full_backup") + expected_incremental_backup=$(wc -l < "$GHE_DATA_DIR/inc_snapshot_data") + # should have 1 full backup and 2 incremental backup + [ $expected_full_backup -eq 1 ] + [ $expected_incremental_backup -eq 2 ] +) +end_test + +begin_test "ghe-backup incremental without config" +( + set -e + sleep 1 + + # set incorrect config for incremental backup + ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config mysql.backup.binary false' + export GHE_INCREMENTAL_MAX_BACKUPS=1 + + # check ghe-backup fails + ! ghe-backup -i +) +end_test + begin_test "ghe-backup logs the benchmark" ( set -e diff --git a/test/testlib.sh b/test/testlib.sh index e17fc3fd2..5dd5ac451 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -327,6 +327,14 @@ setup_test_data () { setup_minio_test_data "$GHE_DATA_DIR" } +setup_incremental_backup_config() { + ghe-ssh "$GHE_HOSTNAME" -- 'mkdir -p /tmp/lsndir' + ghe-ssh "$GHE_HOSTNAME" -- 'echo "fake xtrabackup checkpoint" > /tmp/lsndir/xtrabackup_checkpoints' + + enable_binary_backup + export GHE_INCREMENTAL_MAX_BACKUPS=10 +} + setup_actions_test_data() { local loc=$1 @@ -583,6 +591,10 @@ is_minio_enabled() { ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled' } +enable_binary_backup() { + ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config mysql.backup.binary true' +} + setup_moreutils_parallel() { # CI servers may have moreutils parallel and GNU parallel installed. # We need moreutils parallel From d9b90b4e5da311ef0940805d55fc9050ae7a93d0 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 2 Aug 2023 14:01:12 -0400 Subject: [PATCH 526/946] Cat inc full backups fix (#461) * Initial commit of incremental backups Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Add more backup functions Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * add restore implementation * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Subject line (try to keep under 50 characters) Multi-line description of commit, feel free to be detailed. * Add basic test * bug fix when checking incremental backup on * functional test * tests for incremental backup * revert version * typo * add end_test * Makes command work in cluster or HA * updating version * Update bin/ghe-restore Co-authored-by: Manuel Bergler * Put test of version in correct place * implement moving to inc_previous and prune_ * adding incremental max detection * Adding tweaks to restore * remove redis code * tweak pruning * typo fix * Amend pruning test * tweak pruning snapshots * finalizing tweaks to snapshot pruning * troubleshooting * tweaking ghe-prune-snapshots * last tweaks * Resolve #7039 --------- Co-authored-by: Dax Amin Co-authored-by: Manuel Bergler --- .../ghe-incremental-backup-restore | 17 ----------------- .../ghe-restore-mysql-binary | 9 +++++++-- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/share/github-backup-utils/ghe-incremental-backup-restore b/share/github-backup-utils/ghe-incremental-backup-restore index fd1309fe6..860f35775 100644 --- a/share/github-backup-utils/ghe-incremental-backup-restore +++ b/share/github-backup-utils/ghe-incremental-backup-restore @@ -311,23 +311,6 @@ get_cluster_lsn(){ fi } -# Change our ssh command based on if we are in a cluster or not -# cluster_restore_ssh_cmd(){ -# local GHE_HOSTNAME -# GHE_HOSTNAME=$1 - -# ghe-ssh "$GHE_HOSTNAME" "[ -f /etc/github/cluster ] && [ -z \"$LOCAL_MYSQL\" ]" - -# if [ $? -eq 0 ]; then -# local_host=$(ghe-ssh "$GHE_HOSTNAME" "cat /etc/github/cluster") -# mysql_master=$(ghe-ssh "$GHE_HOSTNAME" "ghe-config cluster.mysql-master") - -# if [ "$local_host" != "$mysql_master" ]; then -# echo "ssh -p 122 admin@$mysql_master" -# else -# echo "" -# fi -# } # used to set the previous incremental backups. # takes every directory in $GHE_DATA_DIR/$INC_FULL_BACKUP and diff --git a/share/github-backup-utils/ghe-restore-mysql-binary b/share/github-backup-utils/ghe-restore-mysql-binary index b35fd7392..afff663eb 100755 --- a/share/github-backup-utils/ghe-restore-mysql-binary +++ b/share/github-backup-utils/ghe-restore-mysql-binary @@ -78,9 +78,13 @@ ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo mkdir -p '$GHE_REMOTE_ # - for each incremental backup, create a directory in the format: # $GHE_REMOTE_DATA_USER_DIR/tmp/incremental-restore-snapshot-dir/mysql.sql.gz # - upload the incremental backup file to the directory -is_full=$(is_full_backup "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT") -is_inc=$(is_incremental_backup_feature_on) +is_full=true +is_inc=false +if [ "$GHE_INCREMENTAL" ]; then + is_full=$(is_full_backup "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT") + is_inc=$(is_incremental_backup_feature_on) +fi if [ "$is_inc" = true ] && [ "$is_full" = false ]; then log_info "Uploading incremental backup directories to the remote host ..." 1>&3 full_backup_dir=$(get_full_backup) @@ -109,6 +113,7 @@ if [ "$is_inc" = true ] && [ "$is_full" = false ]; then echo "cat $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz | $IMPORT_MYSQL" | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- /bin/bash 1>&3 + else log_info "Uploading $GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mysql.sql.gz MySQL data to the remote host $GHE_RESTORE_HOST in $GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz ..." 1>&3 cat $snapshot_dir/mysql.sql.gz | ghe-ssh $ssh_config_file_opt "$GHE_RESTORE_HOST" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/tmp/mysql.sql.gz >/dev/null 2>&1" From 950846f460ad7b05f5d44fd47babff9b36866d41 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Wed, 2 Aug 2023 14:26:29 -0400 Subject: [PATCH 527/946] Add details about snapshot pruning --- docs/scheduling-backups.md | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/docs/scheduling-backups.md b/docs/scheduling-backups.md index 87eefc14c..2b581f968 100644 --- a/docs/scheduling-backups.md +++ b/docs/scheduling-backups.md @@ -4,7 +4,6 @@ Regular backups should be scheduled using `cron(8)` or similar command scheduling service on the backup host. The backup frequency will dictate the worst case [recovery point objective (RPO)][1] in your backup plan. We recommend hourly backups at the least. - ## Example scheduling usage The following examples assume the Backup Utilities are installed under @@ -17,30 +16,36 @@ based on the frequency of backups. The ten most recent snapshots are retained by default. The number should be adjusted based on backup frequency and available storage. -By default all expired and incomplete snapshots are deleted at the end of the main -backup process `ghe-backup`. If pruning these snapshots takes a long time you can -choose to disable the pruning process from the backup run and schedule it separately. -This can be achieved by enabling the `GHE_PRUNING_SCHEDULED` option in `backup.config`. -Please note if this option is enabled, you will need to schedule the pruning script `ghe-prune-snapshots` -using `cron` or similar command scheduling service on the backup host. - To schedule hourly backup snapshots with verbose informational output written to a log file and errors generating an email: +``` +MAILTO=admin@example.com - MAILTO=admin@example.com - - 0 * * * * /opt/backup-utils/bin/ghe-backup -v 1>>/opt/backup-utils/backup.log 2>&1 +0 * * * * /opt/backup-utils/bin/ghe-backup -v 1>>/opt/backup-utils/backup.log 2>&1 +``` To schedule nightly backup snapshots instead, use: - MAILTO=admin@example.com +``` +MAILTO=admin@example.com - 0 0 * * * /opt/backup-utils/bin/ghe-backup -v 1>>/opt/backup-utils/backup.log 2>&1 +0 0 * * * /opt/backup-utils/bin/ghe-backup -v 1>>/opt/backup-utils/backup.log 2>&1 +``` + +### Example snapshot pruning + +By default all expired and incomplete snapshots are deleted at the end of the main +backup process `ghe-backup`. If pruning these snapshots takes a long time you can +choose to disable the pruning process from the backup run and schedule it separately. +This can be achieved by enabling the `GHE_PRUNING_SCHEDULED` option in `backup.config`. +Please note that this option is only avilable for `backup-utils` >= v3.10.0, if this option is enabled you will need to schedule the pruning script `ghe-prune-snapshots` using `cron` or a similar command scheduling service on the backup host. To schedule daily snapshot pruning, use: - MAILTO=admin@example.com +``` +MAILTO=admin@example.com - 0 3 * * * /opt/backup-utils/share/github-backup-utils/ghe-prune-snapshots 1>>/opt/backup-utils/prune-snapshots.log 2>&1 +0 3 * * * /opt/backup-utils/share/github-backup-utils/ghe-prune-snapshots 1>>/opt/backup-utils/prune-snapshots.log 2>&1 +``` [1]: https://en.wikipedia.org/wiki/Recovery_point_objective From 12c2505b1299d576fea0312daee612ea473e8f4e Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 2 Aug 2023 18:50:20 +0000 Subject: [PATCH 528/946] Remove duplicate code --- share/github-backup-utils/ghe-backup-config | 25 --------------------- 1 file changed, 25 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 02a8df435..b61f5a8c0 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -191,31 +191,6 @@ PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # backup.config value when set. GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" -# Source in the backup config file from the copy specified in the environment -# first and then fall back to the backup-utils root, home directory and system. -config_found=false -for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ - "$HOME/.github-backup-utils/backup.config" "/etc/github-backup-utils/backup.config"; do - if [ -f "$f" ]; then - GHE_BACKUP_CONFIG="$f" - # shellcheck disable=SC1090 # This is a user-supplied value that can't be predicted - . "$GHE_BACKUP_CONFIG" - config_found=true - break - fi -done - -# If we don't have a readlink command, error out -! type readlink 1>/dev/null 2>&1 && { - echo "Error: readlink not found. Please install readlink and ensure it is in your PATH." 1>&2 - exit 1 -} - -GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore") -GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup") - -export GHE_RESTORE_IN_PROGRESS -export GHE_BACKUP_IN_PROGRESS ghe_restore_check() { if [ -h "$GHE_RESTORE_IN_PROGRESS" ]; then From 4210881c233efaf4dc9cdd71e6649e5eb8413647 Mon Sep 17 00:00:00 2001 From: David Daly Date: Wed, 2 Aug 2023 21:12:52 +0000 Subject: [PATCH 529/946] allow backups on gheboot for testing --- share/github-backup-utils/ghe-backup-config | 14 +++++++------- share/github-backup-utils/ghe-restore-actions | 10 ++++++++++ share/github-backup-utils/track-progress | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 31e9aff0a..00bcf716e 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -372,13 +372,13 @@ export GHE_DATA_DIR : "${GHE_RELEASE_FILE:="/etc/github/enterprise-release"}" # Check that utils are not being run directly on GHE appliance. -if [ -f "$GHE_RELEASE_FILE" ]; then - echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 - echo " The backup utilities should be run on a host dedicated to" 1>&2 - echo " long-term permanent storage and must have network connectivity" 1>&2 - echo " with the GitHub Enterprise appliance." 1>&2 - exit 1 -fi +# if [ -f "$GHE_RELEASE_FILE" ]; then +# echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 +# echo " The backup utilities should be run on a host dedicated to" 1>&2 +# echo " long-term permanent storage and must have network connectivity" 1>&2 +# echo " with the GitHub Enterprise appliance." 1>&2 +# exit 1 +# fi GHE_CREATE_DATA_DIR=${GHE_CREATE_DATA_DIR:-yes} diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 3db864c6f..a24997453 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -92,6 +92,16 @@ restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert if $RESTORE_SETTINGS; then restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" fi +# Restore storage container prefix, but only if the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings +# This value will only be present in backups from versions >= 3.10 so needs to be wrapped in version checks. +# if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then +# snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version) +# # shellcheck disable=SC2046 # Word splitting is required to populate the variables +# read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version $snapshot_version) +# if [ "$(version $snapshot_version_major.$snapshot_version_minor.0)" -a $RESTORE_SETTINGS ]; then +# restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" +# fi +# fi # Setup the database logins. ghe_verbose "* Restoring database logins and users to $host ..." diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 3f67ca9e8..1381cbbef 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -7,7 +7,7 @@ progress(){ PROGRESS=$(cat /tmp/backup-utils-progress) PROGRESS_TYPE=$(cat /tmp/backup-utils-progress-type) - PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) + PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100") echo $((PROGRESS +1)) > /tmp/backup-utils-progress echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress-info } From 54b7224298a660dbec688f5af7c15d7edac7d222 Mon Sep 17 00:00:00 2001 From: David Daly Date: Wed, 2 Aug 2023 21:49:04 +0000 Subject: [PATCH 530/946] add check for greater than 3.9 --- share/github-backup-utils/ghe-restore-actions | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index a24997453..4eb846f7d 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -85,23 +85,16 @@ restore-secret "Actions Launch service private key" "actions-launch-app-app-priv restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" "secrets.launch.token-oauth-key" restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert" -# Restore storage container prefix, but only if the `-c` option is used with ghe-restore -# `-c` should be used if restoring to an unconfigured appliance or when sif restoring to an unconfigured appliance or when -# specified manually. -# This is to avoid a staging instance using the same bucket prefix settings as production in the case of a staging instance restored from production -if $RESTORE_SETTINGS; then - restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" -fi # Restore storage container prefix, but only if the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings # This value will only be present in backups from versions >= 3.10 so needs to be wrapped in version checks. -# if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then -# snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version) -# # shellcheck disable=SC2046 # Word splitting is required to populate the variables -# read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version $snapshot_version) -# if [ "$(version $snapshot_version_major.$snapshot_version_minor.0)" -a $RESTORE_SETTINGS ]; then -# restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" -# fi -# fi +if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then + snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version) + # shellcheck disable=SC2046 # Word splitting is required to populate the variables + read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version $snapshot_version) + if [ "$snapshot_version_major" -eq "3" -a "$snapshot_version_minor" -ge "9" -a $RESTORE_SETTINGS ]; then + restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" + fi +fi # Setup the database logins. ghe_verbose "* Restoring database logins and users to $host ..." From dc95625544e4956c5898c1b8fde38a96e17b7e87 Mon Sep 17 00:00:00 2001 From: David Daly Date: Wed, 2 Aug 2023 22:16:57 +0000 Subject: [PATCH 531/946] update to check for 3.10 --- share/github-backup-utils/ghe-backup-config | 14 +++++++------- share/github-backup-utils/ghe-restore-actions | 2 +- share/github-backup-utils/track-progress | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 1203e346c..02a8df435 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -374,13 +374,13 @@ export GHE_DATA_DIR : "${GHE_RELEASE_FILE:="/etc/github/enterprise-release"}" # Check that utils are not being run directly on GHE appliance. -# if [ -f "$GHE_RELEASE_FILE" ]; then -# echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 -# echo " The backup utilities should be run on a host dedicated to" 1>&2 -# echo " long-term permanent storage and must have network connectivity" 1>&2 -# echo " with the GitHub Enterprise appliance." 1>&2 -# exit 1 -# fi +if [ -f "$GHE_RELEASE_FILE" ]; then + echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 + echo " The backup utilities should be run on a host dedicated to" 1>&2 + echo " long-term permanent storage and must have network connectivity" 1>&2 + echo " with the GitHub Enterprise appliance." 1>&2 + exit 1 +fi GHE_CREATE_DATA_DIR=${GHE_CREATE_DATA_DIR:-yes} diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 4eb846f7d..d5b493e3c 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -91,7 +91,7 @@ if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version) # shellcheck disable=SC2046 # Word splitting is required to populate the variables read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version $snapshot_version) - if [ "$snapshot_version_major" -eq "3" -a "$snapshot_version_minor" -ge "9" -a $RESTORE_SETTINGS ]; then + if [ "$snapshot_version_major" -eq "3" -a "$snapshot_version_minor" -ge "10" -a $RESTORE_SETTINGS ]; then restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" fi fi diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index 00a9d2c65..bf50c42aa 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -11,4 +11,4 @@ progress(){ PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) echo $((PROGRESS + 1)) > /tmp/backup-utils-progress echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress-info -} \ No newline at end of file +} From e05b21ff9fd315f2cc2bf3babcc220b934b255b5 Mon Sep 17 00:00:00 2001 From: David Daly Date: Wed, 2 Aug 2023 22:31:46 +0000 Subject: [PATCH 532/946] fix linting --- share/github-backup-utils/ghe-restore-actions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index d5b493e3c..78f75ab31 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -88,10 +88,10 @@ restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert # Restore storage container prefix, but only if the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings # This value will only be present in backups from versions >= 3.10 so needs to be wrapped in version checks. if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then - snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version) + snapshot_version=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/version") # shellcheck disable=SC2046 # Word splitting is required to populate the variables - read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version $snapshot_version) - if [ "$snapshot_version_major" -eq "3" -a "$snapshot_version_minor" -ge "10" -a $RESTORE_SETTINGS ]; then + read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version "$snapshot_version") + if [[ "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10" && $RESTORE_SETTINGS ]]; then restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" fi fi From 116350d6880f04fc5d345ab60a4869e3e3b1c523 Mon Sep 17 00:00:00 2001 From: David Daly Date: Wed, 2 Aug 2023 23:26:26 +0000 Subject: [PATCH 533/946] cleanup version check --- share/github-backup-utils/ghe-restore-actions | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 78f75ab31..8a67da02f 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -87,13 +87,11 @@ restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert # Restore storage container prefix, but only if the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings # This value will only be present in backups from versions >= 3.10 so needs to be wrapped in version checks. -if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then - snapshot_version=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/version") - # shellcheck disable=SC2046 # Word splitting is required to populate the variables - read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version "$snapshot_version") - if [[ "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10" && $RESTORE_SETTINGS ]]; then - restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" - fi +snapshot_version=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/version") +# shellcheck disable=SC2046 # Word splitting is required to populate the variables +read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version "$snapshot_version") +if [[ $RESTORE_SETTINGS && "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10"]]; then + restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" fi # Setup the database logins. From f210a47080b02473268dd340ed8de80cf182adb6 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 2 Aug 2023 23:29:25 +0000 Subject: [PATCH 534/946] check for file presence --- share/github-backup-utils/ghe-prune-snapshots | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-prune-snapshots b/share/github-backup-utils/ghe-prune-snapshots index b71c39f0b..84c64545f 100755 --- a/share/github-backup-utils/ghe-prune-snapshots +++ b/share/github-backup-utils/ghe-prune-snapshots @@ -17,9 +17,20 @@ prune_snapshot() { # ignore any directory that is included in inc_full_backup or inc_snapshot_data # the files should be filtered out earlier, but this is a safeguard to make sure. # inc_previous_* and prune_inc_previous are ignored by default - if grep -q "$prune_dir" "$GHE_DATA_DIR/inc_full_backup" || grep "$prune_dir" "$GHE_DATA_DIR/inc_snapshot_data"; then - continue + if [ -f "$GHE_DATA_DIR/inc_full_backup" ]; then + if grep -q "$prune_dir" "$GHE_DATA_DIR"/inc_full_backup; then + log_info "Skipping incremental backup directory: $prune_dir" 1>&3 + continue + fi + fi + + if [ -f "$GHE_DATA_DIR/inc_snapshot_data" ]; then + if grep -q "$prune_dir" "$GHE_DATA_DIR"/inc_snapshot_data; then + log_info "Skipping incremental backup directory: $prune_dir" 1>&3 + continue + fi fi + # skip if the directory is not a directory or blank if [ ! -d "$prune_dir" ] || [ -z "$prune_dir" ]; then log_info "Skipping blank or non-directory: $prune_dir" 1>&3 From 40dbc40df5b0d159ac8b977fa3260c1812603454 Mon Sep 17 00:00:00 2001 From: David Daly Date: Thu, 3 Aug 2023 00:39:05 +0000 Subject: [PATCH 535/946] fix test --- share/github-backup-utils/ghe-restore-actions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 8a67da02f..cdc5480b5 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -90,7 +90,7 @@ restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert snapshot_version=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/version") # shellcheck disable=SC2046 # Word splitting is required to populate the variables read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version "$snapshot_version") -if [[ $RESTORE_SETTINGS && "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10"]]; then +if [[ $RESTORE_SETTINGS && "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10" ]]; then restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" fi From acca07136c1ac90aefce6615ccafd81567ca0065 Mon Sep 17 00:00:00 2001 From: David Daly Date: Thu, 3 Aug 2023 00:54:14 +0000 Subject: [PATCH 536/946] fix restore settings check --- share/github-backup-utils/ghe-restore-actions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index cdc5480b5..d30d54488 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -90,7 +90,7 @@ restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert snapshot_version=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/version") # shellcheck disable=SC2046 # Word splitting is required to populate the variables read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version "$snapshot_version") -if [[ $RESTORE_SETTINGS && "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10" ]]; then +if [[ $RESTORE_SETTINGS == "true" && "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10" ]]; then restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" fi From c64f6fc6d0f25ed5ba60c4465826ff54cd519f7c Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 3 Aug 2023 19:20:58 +0000 Subject: [PATCH 537/946] add option for skipping checks --- backup.config-example | 4 ++++ bin/ghe-backup | 12 +++++++++--- bin/ghe-host-check | 8 +++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/backup.config-example b/backup.config-example index f20ec4e51..3119e2585 100644 --- a/backup.config-example +++ b/backup.config-example @@ -20,6 +20,10 @@ GHE_NUM_SNAPSHOTS=10 # ghe-pruning-snapshots will need to be invoked separately via cron #GHE_PRUNING_SCHEDULED=yes +# If set to true or when backup is run with `-s` or `--skip-checks` ghe-host-check +# disk space validation is disabled. +# GHE_SKIP_CHECKS=false + # The hostname of the GitHub appliance to restore. If you've set up a separate # GitHub appliance to act as a standby for recovery, specify its IP or hostname # here. The host to restore to may also be specified directly when running diff --git a/bin/ghe-backup b/bin/ghe-backup index d818c6be4..fbf7a395f 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -5,9 +5,11 @@ #/ the MySQL database, instance settings, GitHub Pages data, etc. #/ #/ OPTIONS: -#/ -v | --verbose Enable verbose output. -#/ -h | --help Show this message. -#/ --version Display version information. +#/ -v | --verbose Enable verbose output. +#/ -h | --help Show this message. +#/ --version Display version information. +#/ -i | --incremental Incremental backup +#/ -s | --skip-checks Skip storage/sw version checks #/ set -e @@ -31,6 +33,10 @@ while true; do export GHE_INCREMENTAL=true shift ;; + -s|--skip-checks) + export GHE_SKIP_CHECKS=true + shift + ;; -*) echo "Error: invalid argument: '$1'" 1>&2 exit 1 diff --git a/bin/ghe-host-check b/bin/ghe-host-check index e404d5447..a93c67cf8 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -144,7 +144,12 @@ if [ -z "$supported" ]; then exit 1 fi -if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then +if [[ "$CALLING_SCRIPT" == "ghe-backup" && "$GHE_SKIP_CHECKS" != "true" ]]; then + cat << SKIP_MSG 1>&2 +**You can disable the following storage & version checks by updating GHE_SKIP_CHECKS to 'true' in your backup.config file. + +SKIP_MSG + # Bring in the requirements file min_rsync="" min_openssh="" @@ -184,6 +189,7 @@ minio: $minio_disk_size MB mysql: $mysql_disk_size MB actions: $actions_disk_size MB mssql: $mssql_disk_size MB + DATA_TRANSFER_SIZE if [[ $((available_space / (1024 * 1024))) -lt $min_disk_req ]]; then From a0a1a9fbec22aa02e25084c49dcebbad60420278 Mon Sep 17 00:00:00 2001 From: Terrell Broomer Date: Fri, 4 Aug 2023 15:30:59 +0900 Subject: [PATCH 538/946] update mssl scripts to exit 1 on failure --- share/github-backup-utils/ghe-backup-mssql | 2 +- share/github-backup-utils/ghe-restore-mssql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 37b09ca9d..b22a4c2eb 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -62,7 +62,7 @@ fi if ! export_tool_available ; then log_error "ghe-export-mssql is not available" 1>&2 - exit + exit 1 fi add_minute() { diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index 3b62ce2c8..e7d48c61f 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -57,7 +57,7 @@ fi if ! import_tool_available; then ghe_verbose "ghe-import-mssql is not available" - exit + exit 1 fi # Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. From d4c7dd95570df6a9b712e9b995b4ebdd7e9fd573 Mon Sep 17 00:00:00 2001 From: Terrell Broomer Date: Mon, 7 Aug 2023 15:40:27 +0900 Subject: [PATCH 539/946] make super-linter happy --- .shellcheckrc | 1 + share/github-backup-utils/ghe-restore-mssql | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 .shellcheckrc diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 000000000..1135b65a4 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +disable=SC2002 #useless cat \ No newline at end of file diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index e7d48c61f..e6fbb58e8 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -22,11 +22,11 @@ import_tool_available() { } ghe_ssh_mssql() { - ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "$@" + ghe-ssh "$opts" "$ssh_config_file_opt" "$GHE_MSSQL_PRIMARY_HOST" "$@" } cleanup() { - rm -rf $tempdir + rm -rf "$tempdir" } trap 'cleanup' EXIT INT @@ -65,7 +65,7 @@ ghe_remote_version_required "$GHE_HOSTNAME" # The snapshot to restore should be set by the ghe-restore command but this lets # us run this script directly. -: ${GHE_RESTORE_SNAPSHOT:=current} +: "${GHE_RESTORE_SNAPSHOT:=current}" # The directory holding the snapshot to restore snapshot_dir_mssql="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql" @@ -79,13 +79,13 @@ do filename="${b##*/}" ghe_verbose "Transferring $filename to appliance host" - cat $snapshot_dir_mssql/$filename | ghe_ssh_mssql "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" + cat "$snapshot_dir_mssql/$filename" | ghe_ssh_mssql "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" done # Change owner to mssql:mssql to ready for restore ghe_ssh_mssql "sudo chown -R mssql:mssql $appliance_dir" # Invoke restore command -bm_start "$(basename $0)" +bm_start "$(basename "$0")" ghe_ssh_mssql -- "ghe-import-mssql" < "/dev/null" 1>&3 -bm_end "$(basename $0)" +bm_end "$(basename "$0")" From 3d81cf2c58a0d43ffe22df67b5db40489867fd5d Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 11:36:39 -0400 Subject: [PATCH 540/946] Update backup.config-example Co-authored-by: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> --- backup.config-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index 3119e2585..04d1b951b 100644 --- a/backup.config-example +++ b/backup.config-example @@ -21,7 +21,7 @@ GHE_NUM_SNAPSHOTS=10 #GHE_PRUNING_SCHEDULED=yes # If set to true or when backup is run with `-s` or `--skip-checks` ghe-host-check -# disk space validation is disabled. +# disk space validation and s/w version checks on the backup-host will be disabled. # GHE_SKIP_CHECKS=false # The hostname of the GitHub appliance to restore. If you've set up a separate From 8186e717cf5dd33e997b16ec789c923125c4e77a Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 11:37:52 -0400 Subject: [PATCH 541/946] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 153549d14..e84d313df 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,7 +6,7 @@ - **[GitHub Enterprise Server version requirements](requirements.md#github-enterprise-version-requirements)** - **[Getting started](getting-started.md)** - **[Using the backup and restore commands](usage.md)** -- **[Scheduling backups](scheduling-backups.md)** +- **[Scheduling backups & snapshot pruning](scheduling-backups.md)** - **[Backup snapshot file structure](backup-snapshot-file-structure.md)** - **[How does Backup Utilities differ from a High Availability replica?](faq.md)** - **[Docker](docker.md)** From 43020aebb6bb58613a4bdf5ad311aaf5fdb0df3b Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 11:45:46 -0400 Subject: [PATCH 542/946] Added details on how to skip disk and software preflight checks --- docs/usage.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index b4db45e73..a3d5ca5a8 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -73,13 +73,18 @@ appliance at IP "5.5.5.5": Restore of 5.5.5.5:122 from snapshot 20180326T020444 finished. To complete the restore process, please visit https://5.5.5.5/setup/settings to review and save the appliance configuration. -A different backup snapshot may be selected by passing the `-s` argument and the -datestamp-named directory from the backup location. +A different backup snapshot may be selected by passing the `-s` argument to `ghe-restore` and specifcying the +datestamp-named directory from the backup location as the value. The `ghe-backup` and `ghe-restore` commands also have a verbose output mode (`-v`) that lists files as they're being transferred. It's often useful to enable when output is logged to a file. +Every time you execute `ghe-backup` we verify the storage and software setup of the host +you [installed][1] Backup Utilities on, to make sure our [requirements][2] for the host are +met. You can disable this check using the `--skip-checks` argument or by +adding `GHE_SKIP_CHECKS=true` to your configuration file. + ### Restoring settings, TLS certificate, and license When restoring to a new GitHub Enterprise Server instance, settings, certificate, and @@ -107,3 +112,4 @@ GitHub Actions enabled, the following steps are required: Please refer to [GHES Documentation](https://docs.github.com/en/enterprise-server/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled) for more details. [1]: https://github.com/github/backup-utils/blob/master/docs/getting-started.md +[2]: requirements.md From c960d8cff9e9e46f79f2cc7f0361c93cb84430e6 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 7 Aug 2023 11:55:17 -0400 Subject: [PATCH 543/946] Don't run incremental backups or restores with versions < 3.10 (#471) --- bin/ghe-backup | 9 +++++++-- bin/ghe-restore | 8 ++++++++ test/test-ghe-backup.sh | 21 +++++++++++++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index d818c6be4..226c64be1 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -187,10 +187,15 @@ echo "$GHE_REMOTE_VERSION" > version is_inc=$(is_incremental_backup_feature_on) if [ "$is_inc" = true ]; then -if [ "$GHE_VERSION_MAJOR" -lt 3 ] && [ "$GHE_VERSION_MINOR" -lt 10 ]; then - log_error "Cannot only perform incremental backups on enterprise version 3.10 or higher" +if [ "$GHE_VERSION_MAJOR" -lt 3 ]; then + log_error "Can only perform incremental backups on enterprise version 3.10 or higher" exit 1 fi +if [ "$GHE_VERSION_MINOR" -lt 10 ]; then + log_error "Can only perform incremental backups on enterprise version 3.10 or higher" + exit 1 +fi + incremental_backup_check # If everything is ok, check if we have hit GHE_MAX_INCREMENTAL_BACKUPS, performing pruning actions if necessary check_for_incremental_max_backups diff --git a/bin/ghe-restore b/bin/ghe-restore index 67061265b..92ae72443 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -326,6 +326,14 @@ START_TIME=$(date +%s) log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" if [ "$GHE_INCREMENTAL" ]; then + if [ "$GHE_VERSION_MAJOR" -lt 3 ]; then + log_error "Can only perform incremental restores on enterprise version 3.10 or higher" + exit 1 +fi +if [ "$GHE_VERSION_MINOR" -lt 10 ]; then + log_error "Can only perform incremental restores on enterprise version 3.10 or higher" + exit 1 +fi log_info "Incremental restore from snapshot $GHE_RESTORE_SNAPSHOT" # If we see 'inc_previous' prepended to the snapshot name, then # we set $INC_FULL_BACKUP and $INC_SNAPSHOT_DATA to $INC_PREVIOUS_FULL_BACKUP and diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 46df090f8..745538264 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -62,7 +62,7 @@ begin_test "ghe-backup incremental" # run it # this time expect full backup - ghe-backup -i + GHE_TEST_REMOTE_VERSION=3.10.0 ghe-backup -i # check metadata files are created [ -e "$GHE_DATA_DIR/inc_full_backup" ] @@ -77,7 +77,7 @@ begin_test "ghe-backup incremental" # re-run # this time expect incremental backup - ghe-backup -i + GHE_TEST_REMOTE_VERSION=3.10.0 ghe-backup -i expected_full_backup=$(wc -l < "$GHE_DATA_DIR/inc_full_backup") expected_incremental_backup=$(wc -l < "$GHE_DATA_DIR/inc_snapshot_data") @@ -87,7 +87,7 @@ begin_test "ghe-backup incremental" # re-run # this time expect yet another incremental backup - ghe-backup -i + GHE_TEST_REMOTE_VERSION=3.10.0 ghe-backup -i expected_full_backup=$(wc -l < "$GHE_DATA_DIR/inc_full_backup") expected_incremental_backup=$(wc -l < "$GHE_DATA_DIR/inc_snapshot_data") @@ -107,10 +107,23 @@ begin_test "ghe-backup incremental without config" export GHE_INCREMENTAL_MAX_BACKUPS=1 # check ghe-backup fails - ! ghe-backup -i + ! GHE_TEST_REMOTE_VERSION=3.10.0 ghe-backup -i ) end_test +begin_test "ghe-backup performs proper version check" +( + set -e + sleep 1 + + setup_incremental_backup_config + + #check ghe-backup fails + ! GHE_TEST_REMOTE_VERSION=3.9.0 ghe-backup -i + ! GHE_TEST_REMOTE_VERSION=3.8.0 ghe-backup -i + ! GHE_TEST_REMOTE_VERSION=2.2.0 ghe_backup -i +) + begin_test "ghe-backup logs the benchmark" ( set -e From 4c2ecb0716533a774b1f0d3035cd717e968a3bd7 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 12:13:03 -0400 Subject: [PATCH 544/946] Update docs/usage.md Co-authored-by: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> --- docs/usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage.md b/docs/usage.md index a3d5ca5a8..c603c5e36 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -73,7 +73,7 @@ appliance at IP "5.5.5.5": Restore of 5.5.5.5:122 from snapshot 20180326T020444 finished. To complete the restore process, please visit https://5.5.5.5/setup/settings to review and save the appliance configuration. -A different backup snapshot may be selected by passing the `-s` argument to `ghe-restore` and specifcying the +A different backup snapshot may be selected by passing the `-s` argument to `ghe-restore` and specifying the datestamp-named directory from the backup location as the value. The `ghe-backup` and `ghe-restore` commands also have a verbose output mode From 411772cc0ca1d941aa629996f06b2ffbb39cb092 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Mon, 7 Aug 2023 16:33:46 +0000 Subject: [PATCH 545/946] remove flag --- backup.config-example | 4 ++-- bin/ghe-backup | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backup.config-example b/backup.config-example index 04d1b951b..8a8e2fd13 100644 --- a/backup.config-example +++ b/backup.config-example @@ -20,9 +20,9 @@ GHE_NUM_SNAPSHOTS=10 # ghe-pruning-snapshots will need to be invoked separately via cron #GHE_PRUNING_SCHEDULED=yes -# If set to true or when backup is run with `-s` or `--skip-checks` ghe-host-check +# If set to true or when backup is run with `--skip-checks` ghe-host-check # disk space validation and s/w version checks on the backup-host will be disabled. -# GHE_SKIP_CHECKS=false +#GHE_SKIP_CHECKS=false # The hostname of the GitHub appliance to restore. If you've set up a separate # GitHub appliance to act as a standby for recovery, specify its IP or hostname diff --git a/bin/ghe-backup b/bin/ghe-backup index fbf7a395f..3c7399ca7 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -9,7 +9,7 @@ #/ -h | --help Show this message. #/ --version Display version information. #/ -i | --incremental Incremental backup -#/ -s | --skip-checks Skip storage/sw version checks +#/ --skip-checks Skip storage/sw version checks #/ set -e @@ -33,7 +33,7 @@ while true; do export GHE_INCREMENTAL=true shift ;; - -s|--skip-checks) + --skip-checks) export GHE_SKIP_CHECKS=true shift ;; From 062b5656c6582c5139666cb94ec9d2da52566625 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Mon, 7 Aug 2023 17:29:26 +0000 Subject: [PATCH 546/946] additional clarity --- bin/ghe-host-check | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index a93c67cf8..6c22d2d15 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -146,7 +146,8 @@ fi if [[ "$CALLING_SCRIPT" == "ghe-backup" && "$GHE_SKIP_CHECKS" != "true" ]]; then cat << SKIP_MSG 1>&2 -**You can disable the following storage & version checks by updating GHE_SKIP_CHECKS to 'true' in your backup.config file. +**You can disable the following storage & version checks by running ghe-backup with option "--skip-checks" +OR updating GHE_SKIP_CHECKS to 'true' in your backup.config file. SKIP_MSG From 90fdc58a5139b1ce428a202a3bbce06e73686097 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:08:09 -0400 Subject: [PATCH 547/946] Update backup.config-example Co-authored-by: David Jarzebowski --- backup.config-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index 8a8e2fd13..1038e5f5b 100644 --- a/backup.config-example +++ b/backup.config-example @@ -21,7 +21,7 @@ GHE_NUM_SNAPSHOTS=10 #GHE_PRUNING_SCHEDULED=yes # If set to true or when backup is run with `--skip-checks` ghe-host-check -# disk space validation and s/w version checks on the backup-host will be disabled. +# disk space validation and software version checks on the backup-host will be disabled. #GHE_SKIP_CHECKS=false # The hostname of the GitHub appliance to restore. If you've set up a separate From 4d3209d04aac5dead9979c1e3faf41c2d23aae7c Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:47:19 -0400 Subject: [PATCH 548/946] Update backup.config-example Co-authored-by: David Jarzebowski --- backup.config-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index 1038e5f5b..e679d74eb 100644 --- a/backup.config-example +++ b/backup.config-example @@ -20,7 +20,7 @@ GHE_NUM_SNAPSHOTS=10 # ghe-pruning-snapshots will need to be invoked separately via cron #GHE_PRUNING_SCHEDULED=yes -# If set to true or when backup is run with `--skip-checks` ghe-host-check +# If GHE_SKIP_CHECKS is set to true (or if --skip-checks is used with ghe-backup) then ghe-host-check # disk space validation and software version checks on the backup-host will be disabled. #GHE_SKIP_CHECKS=false From f3426658e9ceab3f741025ea7f0a0dcd2d353619 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 20:18:25 -0400 Subject: [PATCH 549/946] Create incremental-mysql-backups-and-restores.md Creating markdown version of @gamefiend 's documentation --- .../incremental-mysql-backups-and-restores.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/incremental-mysql-backups-and-restores.md diff --git a/docs/incremental-mysql-backups-and-restores.md b/docs/incremental-mysql-backups-and-restores.md new file mode 100644 index 000000000..ab10e7880 --- /dev/null +++ b/docs/incremental-mysql-backups-and-restores.md @@ -0,0 +1,34 @@ +# Incremental MySQL Backups and Restores + +Customers who have large MySQL databases who wish to save storage space can use the `--incremental` flag with `ghe-backup` and `ghe-restore`. +Using this flag performs backups for other parts of GHES as normal, but only performs a MySQL backup of the changes to the database from the previous snapshot. +For larger databases this can conserve a lot of storage space for backups. + +## Configuring number of backups + +In your backup.config file you will need to set the variable `GHE_INCREMENTAL_BACKUP_MAX`. +This variable determines how many cycles of full and incremental backups will be performed before the next full backup is performed with another cycle of incremental backups. +If `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle. + +Incremental backups require the previous snapshot backups before them to work. +Because of this, they do not follow the pruning strategy based on `GHE_NUM_SNAPSHOTS`. + +## Performing incremental backups + +To perform incremental backups: + +`bin/ghe-backup --incremental` + +the program will detect whether it needs to performa full or incremental snapshot based on what is currently in `GHE_DATA_DIR`. + +To see what snapshots are part of your full and incremental backups, you can reference `GHE_DATA_DIR/inc_full_backup` and `GHE_DATA_DIR/inc_snapshot_data`, respectively. + +## Performing incremental restores +to perform incremental restores: +`bin/ghe-restore --incremental -s . +the program will use the mysql folders from each previous incremental backup and the full backup to restore the database. + +:warning: Incremental restores require the other snapshots in the cycle to complete a restore. Erasing snapshot directories that are part of a cycle corrupts the restore and makes it impossible to complete for the mySQL database. + +### Previous cycles +To ensure there is a rolling window of mySQL backups, incremental mySQL backups from the cycle before the current one are kept. Those snapshots are pre-pended with `inc_previous`. To perform a restore from there , just use the full directory name for the snapshot id. From b04aa6ea47c6ff3125c97f7895e6764edc99955c Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 20:22:37 -0400 Subject: [PATCH 550/946] Added a 'Incremental MySQL Backups and Restores' section --- docs/usage.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/usage.md b/docs/usage.md index c603c5e36..8f1a70131 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -111,5 +111,9 @@ GitHub Actions enabled, the following steps are required: Please refer to [GHES Documentation](https://docs.github.com/en/enterprise-server/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled) for more details. +## Incremental MySQL Backups and Restores + +If you are interested in performing incremental backups of the MySQL data in your GitHub Enterprise Server instance, see [Incremental MySQL Backups and Restores](incremental-mysql-backups-and-restores.md) for details. + [1]: https://github.com/github/backup-utils/blob/master/docs/getting-started.md [2]: requirements.md From 614d067b26afdfd7d081caa5aca33ab7f2370249 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 20:26:41 -0400 Subject: [PATCH 551/946] Cleaned up layout --- docs/scheduling-backups.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/scheduling-backups.md b/docs/scheduling-backups.md index 2b581f968..0e00a5d67 100644 --- a/docs/scheduling-backups.md +++ b/docs/scheduling-backups.md @@ -4,7 +4,8 @@ Regular backups should be scheduled using `cron(8)` or similar command scheduling service on the backup host. The backup frequency will dictate the worst case [recovery point objective (RPO)][1] in your backup plan. We recommend hourly backups at the least. -## Example scheduling usage + +## Example scheduling of backups The following examples assume the Backup Utilities are installed under `/opt/backup-utils`. The crontab entry should be made under the same user that @@ -32,13 +33,14 @@ MAILTO=admin@example.com 0 0 * * * /opt/backup-utils/bin/ghe-backup -v 1>>/opt/backup-utils/backup.log 2>&1 ``` -### Example snapshot pruning +## Example snapshot pruning By default all expired and incomplete snapshots are deleted at the end of the main backup process `ghe-backup`. If pruning these snapshots takes a long time you can choose to disable the pruning process from the backup run and schedule it separately. This can be achieved by enabling the `GHE_PRUNING_SCHEDULED` option in `backup.config`. -Please note that this option is only avilable for `backup-utils` >= v3.10.0, if this option is enabled you will need to schedule the pruning script `ghe-prune-snapshots` using `cron` or a similar command scheduling service on the backup host. +Please note that this option is only avilable for `backup-utils` >= `v3.10.0`. +If this option is enabled you will need to schedule the pruning script `ghe-prune-snapshots` using `cron` or a similar command scheduling service on the backup host. To schedule daily snapshot pruning, use: From 0c8236d991740ca7d1684e81e1532b0506efad52 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 20:28:27 -0400 Subject: [PATCH 552/946] Cleaned up comments around GHE_PRUNING_SCHEDULED --- backup.config-example | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backup.config-example b/backup.config-example index e679d74eb..927ba559f 100644 --- a/backup.config-example +++ b/backup.config-example @@ -16,8 +16,9 @@ GHE_DATA_DIR="data" # be available for the past N days ... GHE_NUM_SNAPSHOTS=10 -# Pruning snapshots can be scheduled outside of the backup process. If set to 'yes' -# ghe-pruning-snapshots will need to be invoked separately via cron +# Pruning snapshots can be scheduled outside of the backup process. +# If set to 'yes', snapshots will not be pruned by ghe-backup. +# Instead, ghe-pruning-snapshots will need to be invoked separately via cron #GHE_PRUNING_SCHEDULED=yes # If GHE_SKIP_CHECKS is set to true (or if --skip-checks is used with ghe-backup) then ghe-host-check From 746bd1316b784c0ad099f86758d427324e0c68fa Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 20:33:15 -0400 Subject: [PATCH 553/946] Added GHE_INCREMENTAL_BACKUP_MAX to sample config file. --- backup.config-example | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backup.config-example b/backup.config-example index 927ba559f..688cc374b 100644 --- a/backup.config-example +++ b/backup.config-example @@ -21,6 +21,13 @@ GHE_NUM_SNAPSHOTS=10 # Instead, ghe-pruning-snapshots will need to be invoked separately via cron #GHE_PRUNING_SCHEDULED=yes +# If --incremental is used to generate incremental MySQL backups with ghe-backup, +# then you need to specify how many cycles of full and incremental backups will be +# performed before the next full backup is created. +# For example, if `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will +# run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle. +#GHE_INCREMENTAL_BACKUP_MAX=14 + # If GHE_SKIP_CHECKS is set to true (or if --skip-checks is used with ghe-backup) then ghe-host-check # disk space validation and software version checks on the backup-host will be disabled. #GHE_SKIP_CHECKS=false From f6cd16de506a2675c76663453fccae0662b2859c Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Mon, 7 Aug 2023 20:33:39 -0400 Subject: [PATCH 554/946] Revised copy about GHE_INCREMENTAL_BACKUP_MAX --- .../incremental-mysql-backups-and-restores.md | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/incremental-mysql-backups-and-restores.md b/docs/incremental-mysql-backups-and-restores.md index ab10e7880..0bc5f8ef8 100644 --- a/docs/incremental-mysql-backups-and-restores.md +++ b/docs/incremental-mysql-backups-and-restores.md @@ -7,11 +7,11 @@ For larger databases this can conserve a lot of storage space for backups. ## Configuring number of backups In your backup.config file you will need to set the variable `GHE_INCREMENTAL_BACKUP_MAX`. -This variable determines how many cycles of full and incremental backups will be performed before the next full backup is performed with another cycle of incremental backups. -If `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle. +This variable determines how many cycles of full and incremental backups will be performed before the next full backup is created. +For example, if `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle. Incremental backups require the previous snapshot backups before them to work. -Because of this, they do not follow the pruning strategy based on `GHE_NUM_SNAPSHOTS`. +This means they do not follow the pruning strategy based on `GHE_NUM_SNAPSHOTS`. ## Performing incremental backups @@ -24,11 +24,15 @@ the program will detect whether it needs to performa full or incremental snapsho To see what snapshots are part of your full and incremental backups, you can reference `GHE_DATA_DIR/inc_full_backup` and `GHE_DATA_DIR/inc_snapshot_data`, respectively. ## Performing incremental restores -to perform incremental restores: -`bin/ghe-restore --incremental -s . -the program will use the mysql folders from each previous incremental backup and the full backup to restore the database. -:warning: Incremental restores require the other snapshots in the cycle to complete a restore. Erasing snapshot directories that are part of a cycle corrupts the restore and makes it impossible to complete for the mySQL database. +To perform incremental restores: + +`bin/ghe-restore --incremental -s ` + +The program will use the MySQL folders from each previous incremental backup and the full backup to restore the database. + +:warning: Incremental restores require the other snapshots in the cycle to complete a restore. Erasing snapshot directories that are part of a cycle corrupts the restore and makes it impossible to restore for the MySQL database. ### Previous cycles -To ensure there is a rolling window of mySQL backups, incremental mySQL backups from the cycle before the current one are kept. Those snapshots are pre-pended with `inc_previous`. To perform a restore from there , just use the full directory name for the snapshot id. + +To ensure there is a rolling window of mySQL backups, incremental MySQL backups from the cycle before the current one are kept. Those snapshots are pre-pended with `inc_previous`. To perform a restore from there, just use the full directory name for the snapshot id. From 35b90467a25b01ff6da7847689c401f22ec22c76 Mon Sep 17 00:00:00 2001 From: bonsohi Date: Tue, 8 Aug 2023 22:19:14 +0000 Subject: [PATCH 555/946] Updated the version to rc1 --- share/github-backup-utils/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 30291cba2..dc9c1d868 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.10.0 +3.10.0.rc1 From 41e6014c2d340be123da189e3d66eb733e4c8c00 Mon Sep 17 00:00:00 2001 From: bonsohi Date: Wed, 9 Aug 2023 19:37:10 +0000 Subject: [PATCH 556/946] Bump version: 3.10.0 [ci skip] --- bin/ghe-host-check | 2 +- debian/changelog | 11 +++++++++++ share/github-backup-utils/version | 2 +- test/testlib.sh | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 9f6ca2603..7dafe1c7f 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -131,7 +131,7 @@ fi # backup-utils 2.13 onwards limits support to the current and previous two releases # of GitHub Enterprise Server. -supported_minimum_version="3.7.0" +supported_minimum_version="3.8.0" if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then supported=1 diff --git a/debian/changelog b/debian/changelog index ee3c73176..f5caddb85 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +github-backup-utils (3.10.0) UNRELEASED; urgency=medium + + * Remove -o option from ps use #341 + * Switch to TMPDIR before initiating SSH multiplexing workaround to prevent locking the destination filesystem #348 + * Move check for git for ssh muxing into ghe-ssh #378 + * Check filesystem supports hardlinks #388 + * Remove check for git from ghe-ssh #393 + * Clean up stale HA nodes on restore #396 + + -- Balwinder Sohi Wed, 09 Aug 2023 19:37:10 +0000 + github-backup-utils (3.9.0) UNRELEASED; urgency=medium * Set restore status on all cluster nodes #274 diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index dc9c1d868..30291cba2 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.10.0.rc1 +3.10.0 diff --git a/test/testlib.sh b/test/testlib.sh index adfbc39d7..53b41dfe9 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -43,7 +43,7 @@ export GHE_BACKUP_CONFIG GHE_DATA_DIR GHE_REMOTE_DATA_DIR GHE_REMOTE_ROOT_DIR # The default remote appliance version. This may be set in the environment prior # to invoking tests to emulate a different remote vm version. -: ${GHE_TEST_REMOTE_VERSION:=3.9.0.rc1} +: ${GHE_TEST_REMOTE_VERSION:=3.10.0.rc1} export GHE_TEST_REMOTE_VERSION # Source in the backup config and set GHE_REMOTE_XXX variables based on the From 21ee95210333d6c3150af36b0aeddc7e50a4d91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Thu, 10 Aug 2023 17:15:32 +0200 Subject: [PATCH 557/946] Remove duplicate definitions in ghe-backup-config (#480) While investigating an unrelated issue, I noticed that some definitions in ghe-backup-config are present twice. The reason for this appears to be a faulty merge conflict resolution [1], as both parent commits [2, 3] only have a single copy of these definitions but the merge commit has duplicates. It seems that an unwieldy conflict came up while merging the progress-indicator with the master branch, as a result of which both the old and new locations of these definitions were accidentally kept, causing the duplication. This removes one copy of each definition to avoid confusion and potential future bugs. [1] 1eaf80941c84c21f148ea68783415a920d32ce15 [2] a8e7eca745a738c4c02cba4ce85f51bfb97bfe6b [3] 8aaccc3c8b6599d591239d22cb789572df05465a --- share/github-backup-utils/ghe-backup-config | 38 +-------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index b61f5a8c0..2e176b510 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -35,7 +35,7 @@ if [ -n "$GHE_SHOW_VERSION" ]; then fi # Check for "--help|-h" in args or GHE_SHOW_HELP=true and show usage -# shellcheck disable=SC2120 # the script name is always referenced +# shellcheck disable=SC2120 # Our arguments are optional and not meant to be the owning script's print_usage() { grep '^#/' <"$0" | cut -c 4- exit "${1:-1}" @@ -51,10 +51,6 @@ else done fi -# Add the bin and share/github-backup-utils dirs to PATH -PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" -# shellcheck source=share/github-backup-utils/bm.sh -. "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" # Save off GHE_HOSTNAME from the environment since we want it to override the # backup.config value when set. GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" @@ -150,35 +146,6 @@ log_ssh(){ log_level "ssh" "$1" } -# Assume this script lives in share/github-backup-utils/ when setting the root -GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" - -# Get the version from the version file. -BACKUP_UTILS_VERSION="$(cat "$GHE_BACKUP_ROOT/share/github-backup-utils/version")" - -# If a version check was requested, show the current version and exit -if [ -n "$GHE_SHOW_VERSION" ]; then - echo "GitHub backup-utils v$BACKUP_UTILS_VERSION" - exit 0 -fi - -# Check for "--help|-h" in args or GHE_SHOW_HELP=true and show usage -# shellcheck disable=SC2120 # Our arguments are optional and not meant to be the owning script's -print_usage() { - grep '^#/' <"$0" | cut -c 4- - exit "${1:-1}" -} - -if [ -n "$GHE_SHOW_HELP" ]; then - print_usage -else - for a in "$@"; do - if [ "$a" = "--help" ] || [ "$a" = "-h" ]; then - print_usage - fi - done -fi - # Add the bin and share/github-backup-utils dirs to PATH PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" # shellcheck source=share/github-backup-utils/bm.sh @@ -187,9 +154,6 @@ PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" . "$GHE_BACKUP_ROOT/share/github-backup-utils/ghe-incremental-backup-restore" # shellcheck source=share/github-backup-utils/track-progress . "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" -# Save off GHE_HOSTNAME from the environment since we want it to override the -# backup.config value when set. -GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" ghe_restore_check() { From 4df4edf4b9894145f6d1ae8bea485c12105e6819 Mon Sep 17 00:00:00 2001 From: ddivad195 Date: Thu, 10 Aug 2023 19:09:50 +0000 Subject: [PATCH 558/946] update restore to check data exists vs check version --- share/github-backup-utils/ghe-restore-actions | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index d30d54488..14cfd1007 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -85,13 +85,13 @@ restore-secret "Actions Launch service private key" "actions-launch-app-app-priv restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" "secrets.launch.token-oauth-key" restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert" -# Restore storage container prefix, but only if the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings -# This value will only be present in backups from versions >= 3.10 so needs to be wrapped in version checks. -snapshot_version=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/version") -# shellcheck disable=SC2046 # Word splitting is required to populate the variables -read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version "$snapshot_version") -if [[ $RESTORE_SETTINGS == "true" && "$snapshot_version_major" -eq "3" && "$snapshot_version_minor" -ge "10" ]]; then - restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" +# Restore storage container prefix, but only if it exists, and the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings +if [[ -e "$GHE_RESTORE_SNAPSHOT_PATH/actions-storage-container-prefix" ]]; then + if [[ $RESTORE_SETTINGS == "true" ]]; then + restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" + fi +else + log_warn "Actions storage container prefix not present in backup. Skipping ..." fi # Setup the database logins. From ad23aec7627e24b137763a52251c3a3d3d7a6744 Mon Sep 17 00:00:00 2001 From: David Daly Date: Thu, 10 Aug 2023 20:56:41 +0100 Subject: [PATCH 559/946] update logic to check if '-c' is set first Co-authored-by: boxofyellow <54955040+boxofyellow@users.noreply.github.com> --- share/github-backup-utils/ghe-restore-actions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 14cfd1007..303a2abd2 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -86,12 +86,12 @@ restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert" # Restore storage container prefix, but only if it exists, and the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings -if [[ -e "$GHE_RESTORE_SNAPSHOT_PATH/actions-storage-container-prefix" ]]; then - if [[ $RESTORE_SETTINGS == "true" ]]; then +if [[ $RESTORE_SETTINGS == "true" ]]; then + if [[ -e "$GHE_RESTORE_SNAPSHOT_PATH/actions-storage-container-prefix" ]]; then restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" + else + log_warn "Actions storage container prefix not present in backup. Skipping ..." fi -else - log_warn "Actions storage container prefix not present in backup. Skipping ..." fi # Setup the database logins. From f4fa25f3f8e0c66ee87dfeecee973c1b9761f7d9 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 10 Aug 2023 22:15:48 +0000 Subject: [PATCH 560/946] remove on-exit mode --- share/github-backup-utils/track-progress | 1 - 1 file changed, 1 deletion(-) diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index bf50c42aa..d88b3704f 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -1,6 +1,5 @@ #!/usr/bin/env bash #/ track-progress: track progress of backup or restore tasks -set -e # Current version is working solely with backups progress(){ From 6b6e1bfea8ca0b5494628190649fade68a70e34e Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 10 Aug 2023 23:04:46 +0000 Subject: [PATCH 561/946] add script to be excluded --- test/test-shellcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-shellcheck.sh b/test/test-shellcheck.sh index 92ac538cc..231d78edb 100755 --- a/test/test-shellcheck.sh +++ b/test/test-shellcheck.sh @@ -49,7 +49,7 @@ begin_test "shellopts: set -e set on all scripts" # Check all executable scripts checked into the repo, except bm.sh, ghe-backup-config, ghe-rsync and the dummy test scripts set +x cd $BASE_PATH - git ls-tree -r HEAD | grep -Ev 'bm.sh|ghe-backup-config|ghe-rsync|test/bin' | grep -E '^1007|.*\..*sh$' | awk '{print $4}' | while read -r script; do + git ls-tree -r HEAD | grep -Ev 'bm.sh|ghe-backup-config|ghe-rsync|track-progress|test/bin' | grep -E '^1007|.*\..*sh$' | awk '{print $4}' | while read -r script; do if head -n1 "$script" | grep -E -w "sh|bash" >/dev/null 2>&1; then grep -q "set -e" $script || echo $script >> $results || true fi From a44aa3d24cd15810021fc140fbf5a8d64289c614 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Sat, 12 Aug 2023 07:58:10 -0400 Subject: [PATCH 562/946] Bringing in a fix from the public repo Bringing in a fix from https://github.com/github/backup-utils/pull/1094 --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index f3f7d67f6..1320eb583 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,7 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), [jq][11] v1.5 or newer, and [bc][12] v1.07 or newer. +Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2], [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](#april-2023-update-of-rsync-requirements) for exceptions), [jq][11] v1.5 or newer, and [bc][12] v1.07 or newer. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From 5ace2f2b931ac26e8daf5e11be3338ac2c4e5659 Mon Sep 17 00:00:00 2001 From: boxofyellow <54955040+boxofyellow@users.noreply.github.com> Date: Mon, 14 Aug 2023 10:11:43 -0400 Subject: [PATCH 563/946] Get any backups that were created off the box even if we have a failure (#442) --- share/github-backup-utils/ghe-backup-mssql | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql index 37b09ca9d..f168b2cfe 100755 --- a/share/github-backup-utils/ghe-backup-mssql +++ b/share/github-backup-utils/ghe-backup-mssql @@ -335,9 +335,12 @@ if [ -n "$backup_type" ]; then elif [ "$backup_type" = "transaction" ]; then backup_command='ghe-export-mssql -t' fi - + + backup_failed= + bm_start "$(basename "$0")" - ghe_ssh_mssql -- "$backup_command" + # record if generating the backup failed, this will allow us to collect any backups that may have been produced, even if they are not complete they are better than nothing + ghe_ssh_mssql -- "$backup_command" || backup_failed='true' bm_end "$(basename "$0")" # Configure the backup cadence on the appliance, which is used for diagnostics @@ -352,4 +355,9 @@ if [ -n "$backup_type" ]; then ghe_verbose "Transferring to backup host $b" ghe_ssh_mssql "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" done + + if [ -n "$backup_failed" ]; then + log_error 'ghe-export-mssql failed to backup at least one mssql database' 1>&2 + exit 1 + fi fi From dff57d9267d48b4116c6cdaa0c04dbeb8fc5db3f Mon Sep 17 00:00:00 2001 From: Devin Dooley Date: Mon, 14 Aug 2023 16:27:46 -0700 Subject: [PATCH 564/946] Leave release in draft state by default --- script/release | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/script/release b/script/release index b7b61615e..42f2d0f46 100755 --- a/script/release +++ b/script/release @@ -34,6 +34,9 @@ DEB_PKG_NAME = 'github-backup-utils' GH_BASE_BRANCH = ENV['GH_BASE_BRANCH'] || 'master' # TODO: should we even allow a default or require all params get set explicitly? GH_STABLE_BRANCH = "" +# If PUBLISH is false, we leave the release in a draft state to be manually published later through the UI ++PUBLISH = ENV['PUBLISH'] == 'true' || false + CHANGELOG_TMPL = '''<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium <%- changes.each do |ch| -%> @@ -480,8 +483,10 @@ if $PROGRAM_NAME == __FILE__ attach_assets_to_release res['upload_url'], res['id'], ["#{base_dir}/dist/#{DEB_PKG_NAME}-v#{version}.tar.gz"] attach_assets_to_release res['upload_url'], res['id'], ["#{base_dir}/dist/#{DEB_PKG_NAME}_#{version}_all.deb"] - puts 'Publishing release...' - publish_release res['id'] + if PUBLISH do + puts 'Publishing release...' + publish_release res['id'] + end puts 'Cleaning up...' clean_up version @@ -489,6 +494,10 @@ if $PROGRAM_NAME == __FILE__ puts "Updating #{GH_STABLE_BRANCH} branch..." update_stable_branch + if !PUBLISH do + puts 'Release left in a "Draft" state. Go to the https://github.com/github/backup-utils/releases and publish when ready.' + end + puts 'Released!' rescue RuntimeError => e $stderr.puts "Error: #{e}" From 105ebb6b5a15c882fa28f79b1d291ebd5cdc6ef5 Mon Sep 17 00:00:00 2001 From: Devin Dooley Date: Mon, 14 Aug 2023 16:42:19 -0700 Subject: [PATCH 565/946] Fix conditional statement --- script/release | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/release b/script/release index 42f2d0f46..d8b1ee9b2 100755 --- a/script/release +++ b/script/release @@ -483,7 +483,7 @@ if $PROGRAM_NAME == __FILE__ attach_assets_to_release res['upload_url'], res['id'], ["#{base_dir}/dist/#{DEB_PKG_NAME}-v#{version}.tar.gz"] attach_assets_to_release res['upload_url'], res['id'], ["#{base_dir}/dist/#{DEB_PKG_NAME}_#{version}_all.deb"] - if PUBLISH do + if PUBLISH puts 'Publishing release...' publish_release res['id'] end @@ -494,7 +494,7 @@ if $PROGRAM_NAME == __FILE__ puts "Updating #{GH_STABLE_BRANCH} branch..." update_stable_branch - if !PUBLISH do + if !PUBLISH puts 'Release left in a "Draft" state. Go to the https://github.com/github/backup-utils/releases and publish when ready.' end From 4b434c20a0d6d7de6870ba73b8675a585e549c95 Mon Sep 17 00:00:00 2001 From: Devin Dooley Date: Mon, 14 Aug 2023 16:46:59 -0700 Subject: [PATCH 566/946] Remove accidental + sign --- script/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/release b/script/release index d8b1ee9b2..891cd9f60 100755 --- a/script/release +++ b/script/release @@ -35,7 +35,7 @@ GH_BASE_BRANCH = ENV['GH_BASE_BRANCH'] || 'master' # TODO: should we even allow GH_STABLE_BRANCH = "" # If PUBLISH is false, we leave the release in a draft state to be manually published later through the UI -+PUBLISH = ENV['PUBLISH'] == 'true' || false +PUBLISH = ENV['PUBLISH'] == 'true' || false CHANGELOG_TMPL = '''<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium From 550f3032f88cf16d31ddd421ebc79ba08917285f Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Tue, 15 Aug 2023 21:16:18 +0200 Subject: [PATCH 567/946] transfer_size are estimated data transfer sizes (#488) * Update bin/ghe-host-check --- bin/ghe-host-check | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 9f6ca2603..1c3252645 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -184,7 +184,8 @@ SKIP_MSG echo " - Recommended Disk requirement is $recommended_disk_req MB" 1>&2 echo "" 1>&2 - printf '### Data Transfer Sizes + printf '### Estimated Data Transfer Sizes + - repositories: %d MB - pages: %d MB - elasticsearch: %d MB @@ -192,7 +193,8 @@ SKIP_MSG - minio: %d MB - mysql: %d MB - actions: %d MB - - mssql: %d MB\n' \ + - mssql: %d MB +\n' \ "$repos_disk_size" "$pages_disk_size" "$es_disk_size" "$stor_disk_size" "$minio_disk_size" "$mysql_disk_size" "$actions_disk_size" "$mssql_disk_size" 1>&2 if [[ $((available_space / (1024 * 1024))) -lt $min_disk_req ]]; then From 826215c15fa25ef5af9d1432f5173241d3e2b69d Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 16 Aug 2023 12:31:06 -0400 Subject: [PATCH 568/946] Change shellcheck to use stable, not latest Shelcheck is using latest and a recent change broke all of our tests. Changing this so we use the stable version as we don't need the newest version of shellcheck for tests. --- .github/workflows/main.yml | 6 +++--- test/test-shellcheck.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 809e9df50..da7695ad1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,9 +17,9 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y devscripts debhelper moreutils fakeroot jq pigz help2man - wget "https://github.com/koalaman/shellcheck/releases/download/latest/shellcheck-latest.linux.x86_64.tar.xz" - tar --xz -xvf "shellcheck-latest.linux.x86_64.tar.xz" - sudo cp shellcheck-latest/shellcheck /usr/bin/shellcheck + wget "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" + tar --xz -xvf "shellcheck-stable.linux.x86_64.tar.xz" + sudo cp shellcheck-stable/shellcheck /usr/bin/shellcheck if: matrix.os != 'macos-latest' - name: Install Dependencies (macOS) run: | diff --git a/test/test-shellcheck.sh b/test/test-shellcheck.sh index 231d78edb..82c0fbb4f 100755 --- a/test/test-shellcheck.sh +++ b/test/test-shellcheck.sh @@ -11,8 +11,8 @@ begin_test "shellcheck: reports no errors or warnings" set -e # We manually install the latest Shellcheck on Linux builds as other options # are too old. - if [ -x "$BASE_PATH/shellcheck-latest/shellcheck" ]; then - shellcheck() { "$BASE_PATH/shellcheck-latest/shellcheck" "$@"; } + if [ -x "$BASE_PATH/shellcheck-stable/shellcheck" ]; then + shellcheck() { "$BASE_PATH/shellcheck-stable/shellcheck" "$@"; } fi if ! type shellcheck 1>/dev/null 2>&1; then From 3825fcbc25dadc67b37834f629320b5c49a38fd3 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Thu, 17 Aug 2023 11:19:09 +0200 Subject: [PATCH 569/946] Adding host online check (#492) * adding host online check * fix test --------- Co-authored-by: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> --- bin/ghe-host-check | 12 +++++++++--- test/bin/ghe-cluster-host-check | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100755 test/bin/ghe-cluster-host-check diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 1c3252645..104885114 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -91,13 +91,19 @@ if ghe-ssh "$host" -- \ CLUSTER=true fi -# ensure all nodes in the cluster are running the same version +# ensure all nodes in the cluster are online/reachable and running the same version if "$CLUSTER"; then + online_status=$(ghe-ssh "$host" ghe-cluster-host-check) + if [ "$online_status" != "Cluster is ready to configure." ]; then + echo "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2 + exit 1 + fi + node_version_list=$(ghe-ssh "$host" ghe-cluster-each -- ghe-version) distinct_versions=$(echo "$node_version_list" | awk '{split($0, a, ":"); print a[2]}' | awk '{print $4}' | uniq | wc -l) if [ "$distinct_versions" -ne 1 ]; then - echo "$node_version_list" 1>&2 - echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&3 + echo "Version mismatch: $node_version_list" 1>&2 + echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2 exit 1 fi fi diff --git a/test/bin/ghe-cluster-host-check b/test/bin/ghe-cluster-host-check new file mode 100755 index 000000000..3120d85de --- /dev/null +++ b/test/bin/ghe-cluster-host-check @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# Usage: ghe-cluster-host-check +# Emulates a cluster reachability check +set -e +echo "Cluster is ready to configure." From 6c8648da655d472e99390d786d99d79e17a6cd63 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Thu, 17 Aug 2023 15:03:00 +0200 Subject: [PATCH 570/946] fix typo (#508) --- bin/ghe-restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 92ae72443..19603ae47 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -469,13 +469,13 @@ fi # Always restore column encryption keys if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then - log_info "Always restore encrypted column encryption keys on GHES verions 3.7.0+" + log_info "Always restore encrypted column encryption keys on GHES versions 3.7.0+" fi ghe-restore-column-encryption-keys "$GHE_HOSTNAME" # Always restore secret scanning encryption keys if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then - log_info "Always restore secret scanning encryption keys on GHES verions 3.8.0+" + log_info "Always restore secret scanning encryption keys on GHES versions 3.8.0+" increment-progress-total-count 1 ghe-restore-secret-scanning-encryption-keys "$GHE_HOSTNAME" fi From 07162bd5882220d03d5d4edc73e4a2c97ab760cc Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 17 Aug 2023 17:40:09 -0400 Subject: [PATCH 571/946] Host key fix (#513) --- bin/ghe-backup | 66 ++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 2043e2fad..86ee33dd7 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -54,38 +54,7 @@ export CALLING_SCRIPT="ghe-backup" # shellcheck source=share/github-backup-utils/ghe-backup-config . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" -# Setup progress tracking -init-progress -export PROGRESS_TOTAL=14 # Minimum number of steps in backup is 14 -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total -export PROGRESS_TYPE="Backup" -echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type -export PROGRESS=0 # Used to track progress of backup -echo "$PROGRESS" > /tmp/backup-utils-progress - -OPTIONAL_STEPS=0 -# Backup actions+mssql -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 2)) -fi - -# Backup fsck -if [ "$GHE_BACKUP_FSCK" = "yes" ]; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi - -# Backup minio -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi -# Backup pages -if [ "$GHE_BACKUP_PAGES" != "no" ]; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi - -PROGRESS_TOTAL=$((OPTIONAL_STEPS + PROGRESS_TOTAL)) # Minimum number of steps in backup is 14 -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total # Check to make sure moreutils parallel is installed and working properly ghe_parallel_check @@ -186,9 +155,44 @@ fi # Perform a host connection check and establish the remote appliance version. # The version is available in the GHE_REMOTE_VERSION variable and also written # to a version file in the snapshot directory itself. +# ghe_remote_version_required should be run before any other instances of ghe-ssh +# to ensure that there are no problems with host key verification. ghe_remote_version_required echo "$GHE_REMOTE_VERSION" > version +# Setup progress tracking +init-progress +export PROGRESS_TOTAL=14 # Minimum number of steps in backup is 14 +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total +export PROGRESS_TYPE="Backup" +echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type +export PROGRESS=0 # Used to track progress of backup +echo "$PROGRESS" > /tmp/backup-utils-progress + +OPTIONAL_STEPS=0 +# Backup actions+mssql +if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 2)) +fi + +# Backup fsck +if [ "$GHE_BACKUP_FSCK" = "yes" ]; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi + +# Backup minio +if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi + +# Backup pages +if [ "$GHE_BACKUP_PAGES" != "no" ]; then + OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) +fi + +PROGRESS_TOTAL=$((OPTIONAL_STEPS + PROGRESS_TOTAL)) # Minimum number of steps in backup is 14 +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total + # check that incremental settings are valid if set is_inc=$(is_incremental_backup_feature_on) From 82b2e2a0a7149b8652ffa93b98e594714cccb1d4 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 18 Aug 2023 18:33:15 +0000 Subject: [PATCH 572/946] fix for cluster transfer sizes --- share/github-backup-utils/ghe-rsync-size | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) mode change 100755 => 100644 share/github-backup-utils/ghe-rsync-size diff --git a/share/github-backup-utils/ghe-rsync-size b/share/github-backup-utils/ghe-rsync-size old mode 100755 new mode 100644 index c61a80b3b..317c2f6cc --- a/share/github-backup-utils/ghe-rsync-size +++ b/share/github-backup-utils/ghe-rsync-size @@ -21,6 +21,7 @@ fi transfer_size() { + local host=$GHE_HOSTNAME local backup_data=$1 if [[ "$1" == "mssql" ]]; then data_user_dir="/data/user/$1/backups" @@ -58,20 +59,36 @@ transfer_size() ;; esac + ghe-ssh "$host" "[ -f /etc/github/cluster ]" + cluster_status=$? + + if [[ $cluster_status -eq 0 ]]; then + cluster_conf_out=$(ghe-ssh "$host" "cat /data/user/common/cluster.conf") + cluster_nodes_output=$(ghe-ssh "$host" "ghe-cluster-nodes -i") + if [[ ( "$1" == "elasticsearch" || "$1" == "storage" || "$1" == "pages" ) ]]; then + host_server=$(echo "$cluster_conf_out" | awk -v srv="$backup_data-server = true" '/cluster/ { prevA = $0 } $0 ~ srv { print prevA }' | head -1 | awk -F '"' '{print $2}') + elif [[ "$1" == "mysql" ]]; then + host_server=$(ghe-ssh "$host" "ghe-config cluster.mysql-master") + elif [[ "$1" == "repositories" ]]; then + host_server=$(echo "$cluster_conf_out" | awk '/git-server = true/ { print prevA } /cluster/ { prevA = $0 }' | head -1 | awk -F '"' '{print $2}') + fi + host=$(echo "$cluster_nodes_output" | grep "$host_server" | awk '{print $2}' | head -1) + fi + if [ -d "${GHE_DATA_DIR}/current/$1" ]; then total_file_size=$(ghe-rsync -arn --stats \ -e "ssh -q $GHE_EXTRA_SSH_OPTS -p 122 -l admin" \ --rsync-path="sudo -u $user rsync" \ "$link_dest"/"$1" \ --ignore-missing-args \ - "$GHE_HOSTNAME:$data_user_dir/" \ + "$host:$data_user_dir/" \ "$dest_dir/" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') else total_file_size=$(ghe-rsync -arn --stats \ -e "ssh -q $GHE_EXTRA_SSH_OPTS -p 122 -l admin" \ --rsync-path="sudo -u $user rsync" \ --ignore-missing-args \ - "$GHE_HOSTNAME:$data_user_dir/" \ + "$host:$data_user_dir/" \ "$dest_dir/" | grep "Total transferred file size" | sed 's/.*size: //; s/,//g') fi From fb5aa593c1282939c0fdc22b9a1efedca79b3a1c Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Mon, 21 Aug 2023 13:49:08 -0500 Subject: [PATCH 573/946] Restore content scanning keys --- .../ghe-restore-secret-scanning-encryption-keys | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys index aa225bc07..4785a6d77 100755 --- a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys +++ b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys @@ -36,4 +36,8 @@ log_info "Restoring secret scanning encrypted secrets transit keys" restore-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" restore-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" +# Restore secret scanning content scanning keys if present +log_info "Restoring secret scanning content scanning keys" +restore-secret "secret scanning user content delimited encryption root keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + bm_end "$(basename $0)" From 5a64931986a310c3634b0e461d5966e3fd2b4e7f Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Mon, 21 Aug 2023 15:11:18 -0700 Subject: [PATCH 574/946] Added test of backup --- test/test-ghe-backup.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 745538264..9184746e3 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -802,6 +802,30 @@ begin_test "ghe-backup takes backup of secret scanning encrypted secrets encrypt ) end_test +begin_test "ghe-backup takes backup of secret scanning encrypted content encryption keys" +( + set -e + + required_secrets=( + "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + ghe-backup + + required_files=( + "secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "foo" ] + done +) +end_test + begin_test "ghe-backup takes backup of Actions settings" ( set -e From 8dad53ef128fa622c8f4216a3f12bc275b64a1bd Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Mon, 21 Aug 2023 15:26:36 -0700 Subject: [PATCH 575/946] Added test for restoring encrypted content keys --- test/test-ghe-restore.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index ef13b7697..39d2bced6 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -454,6 +454,32 @@ begin_test "ghe-restore with secret scanning encrypted secrets encryption keys f ) end_test +begin_test "ghe-restore with secret scanning encrypted content encryption keys" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + required_files=( + "secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for file in "${required_files[@]}"; do + echo "foo" >"$GHE_DATA_DIR/current/$file" + done + + GHE_REMOTE_VERSION=3.11.0 ghe-restore -v -f localhost + + required_secrets=( + "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting these to not be set for versions below 3.8.0 + done +) +end_test + # Setup Actions data for the subsequent tests setup_actions_test_data "$GHE_DATA_DIR/1" From 5596eb8280263b9acc5b1a7420c54119d034b31e Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Mon, 21 Aug 2023 15:27:44 -0700 Subject: [PATCH 576/946] Added encrypted content key to backup-settings --- share/github-backup-utils/ghe-backup-settings | 1 + 1 file changed, 1 insertion(+) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 3a05feba7..362e230cf 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -90,6 +90,7 @@ backup-secret "secret scanning encrypted secrets current storage key" "secret-sc backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" +backup-secret "secret scanning encrypted content keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" # Backup argon secrets for multiuser from ghes version 3.8 onwards if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then From dd8e655bd24b5a510598073e2f522f545e327204 Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Mon, 21 Aug 2023 15:54:15 -0700 Subject: [PATCH 577/946] Fixed restore tests --- test/test-ghe-restore.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 39d2bced6..cf93baa96 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -454,7 +454,33 @@ begin_test "ghe-restore with secret scanning encrypted secrets encryption keys f ) end_test -begin_test "ghe-restore with secret scanning encrypted content encryption keys" +begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions below 3.11.0+" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + required_files=( + "secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for file in "${required_files[@]}"; do + echo "foo" >"$GHE_DATA_DIR/current/$file" + done + + GHE_REMOTE_VERSION=3.10.0 ghe-restore -v -f localhost + + required_secrets=( + "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting these to not be set for versions below 3.11.0 + done +) +end_test + +begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions 3.11.0+" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" @@ -475,7 +501,7 @@ begin_test "ghe-restore with secret scanning encrypted content encryption keys" ) for secret in "${required_secrets[@]}"; do - [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting these to not be set for versions below 3.8.0 + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] # expecting this to have been restored successfully for versions 3.11.0+ done ) end_test From 8bd786e011d6df7caea55ee652e8a072099b5b6a Mon Sep 17 00:00:00 2001 From: Robert Bolender Date: Mon, 21 Aug 2023 22:22:18 -0700 Subject: [PATCH 578/946] Only backup secret scanning secrets on GHES versions 3.8.0+ --- share/github-backup-utils/ghe-backup-settings | 11 +++--- test/test-ghe-backup.sh | 34 +++++++++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 3a05feba7..aac02dde7 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -86,10 +86,13 @@ if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then cat "$GHE_SNAPSHOT_DIR/encrypted-column-encryption-keying-material" | sed 's:.*;::' > "$GHE_SNAPSHOT_DIR/encrypted-column-current-encryption-key" fi -backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" -backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" -backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" -backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" +# secret scanning encrypted secrets keys were added in GHES 3.8.0 +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then + backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" + backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" + backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" + backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" +fi # Backup argon secrets for multiuser from ghes version 3.8 onwards if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 745538264..fb3f9db6a 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -772,7 +772,7 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi ) end_test -begin_test "ghe-backup takes backup of secret scanning encrypted secrets encryption keys" +begin_test "ghe-backup does not take backups of secret scanning encrypted secrets encryption keys on versions below 3.8.0" ( set -e @@ -787,7 +787,37 @@ begin_test "ghe-backup takes backup of secret scanning encrypted secrets encrypt ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" done - ghe-backup + GHE_REMOTE_VERSION=3.7.0 ghe-backup -v | grep -q "secret scanning encrypted secrets" && exit 1 + + required_files=( + "secret-scanning-encrypted-secrets-current-storage-key" + "secret-scanning-encrypted-secrets-delimited-storage-keys" + "secret-scanning-encrypted-secrets-current-shared-transit-key" + "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "" ] + done +) +end_test + +begin_test "ghe-backup takes backup of secret scanning encrypted secrets encryption keys on versions 3.8.0+" +( + set -e + + required_secrets=( + "secrets.secret-scanning.encrypted-secrets-current-storage-key" + "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" + "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" + "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + GHE_REMOTE_VERSION=3.8.0 ghe-backup required_files=( "secret-scanning-encrypted-secrets-current-storage-key" From a5e9b0e5c64c4baa38c7c226fb5a515907f64156 Mon Sep 17 00:00:00 2001 From: "github-service-catalog[bot]" <66641770+github-service-catalog[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:30:02 -0400 Subject: [PATCH 579/946] Update service ownership data (#519) * Update service ownership data Co-authored-by: gamefiend <410344+gamefiend@users.noreply.github.com> --------- Co-authored-by: github-service-catalog[bot] <66641770+github-service-catalog[bot]@users.noreply.github.com> Co-authored-by: gamefiend <410344+gamefiend@users.noreply.github.com> Co-authored-by: Quinn Murphy --- ownership.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ownership.yaml diff --git a/ownership.yaml b/ownership.yaml new file mode 100644 index 000000000..bde619edc --- /dev/null +++ b/ownership.yaml @@ -0,0 +1,29 @@ +--- +version: 1 +ownership: +- name: ghes-backup-utilities + long_name: GHES Backup Utilities + description: GitHub Enterprise Disaster Recover Solution + kind: logical + repo: https://github.com/github/backup-utils-private + qos: best_effort + team_slack: ghes-lifecycle-aor + team: github/ghes-lifecycle + maintainer: whitneyimura + exec_sponsor: jakuboleksy + tier: 3 + product_manager: davidjarzebowski + sev1: + slack: ghes-on-call + alert_slack: ghes-backup-utils + pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20 + tta: 30 minutes + sev2: + issue: https://github.com/github/ghes/issues/new + tta: 1 business day + sev3: + issue: https://github.com/github/ghes/issues + tta: 1 week + support_squad: + slack: support-squad-infrastructure + issue: https://github.com/github/support-squad-infrastructure/issues From b66db2af6b90f800da9c176867395f32305499de Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 22 Aug 2023 08:30:55 -0700 Subject: [PATCH 580/946] Only backup 3.11 and up --- share/github-backup-utils/ghe-backup-settings | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 362e230cf..28a251cec 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -90,7 +90,10 @@ backup-secret "secret scanning encrypted secrets current storage key" "secret-sc backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" -backup-secret "secret scanning encrypted content keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.11.0)" ]; then + backup-secret "secret scanning encrypted content keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" +fi # Backup argon secrets for multiuser from ghes version 3.8 onwards if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then From 6437469aca30ee4616e1f53bdf765871bae79ca7 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 22 Aug 2023 16:11:42 -0400 Subject: [PATCH 581/946] change super-linter repo and Bash linting level (#529) * change super-linter repo Changed super-linter link to conform with change: > NOTICE: If your use of the super-linter action failed around April 26th, 2023, we changed the organization name from github to super-linter so you will need to update your references to this action from github/super-linter to super-linter/super-linter. * Update .github/workflows/lint.yml add BASH_SEVERITY settings --- .github/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d15f123bb..0c6af658b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,8 @@ jobs: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - name: Lint Code Base - uses: github/super-linter@v5 + uses: super-linter/super-linter@v5 env: VALIDATE_ALL_CODEBASE: false + BASH_SEVERITY: error GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 534ff5e9d232303bcf833eb5f6881b476f6cb21c Mon Sep 17 00:00:00 2001 From: Terrell Broomer Date: Wed, 23 Aug 2023 09:55:38 +0900 Subject: [PATCH 582/946] revert unccessary changes --- share/github-backup-utils/ghe-restore-mssql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-mssql b/share/github-backup-utils/ghe-restore-mssql index e6fbb58e8..e7d48c61f 100755 --- a/share/github-backup-utils/ghe-restore-mssql +++ b/share/github-backup-utils/ghe-restore-mssql @@ -22,11 +22,11 @@ import_tool_available() { } ghe_ssh_mssql() { - ghe-ssh "$opts" "$ssh_config_file_opt" "$GHE_MSSQL_PRIMARY_HOST" "$@" + ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "$@" } cleanup() { - rm -rf "$tempdir" + rm -rf $tempdir } trap 'cleanup' EXIT INT @@ -65,7 +65,7 @@ ghe_remote_version_required "$GHE_HOSTNAME" # The snapshot to restore should be set by the ghe-restore command but this lets # us run this script directly. -: "${GHE_RESTORE_SNAPSHOT:=current}" +: ${GHE_RESTORE_SNAPSHOT:=current} # The directory holding the snapshot to restore snapshot_dir_mssql="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql" @@ -79,13 +79,13 @@ do filename="${b##*/}" ghe_verbose "Transferring $filename to appliance host" - cat "$snapshot_dir_mssql/$filename" | ghe_ssh_mssql "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" + cat $snapshot_dir_mssql/$filename | ghe_ssh_mssql "sudo tee -a $appliance_dir/$filename >/dev/null 2>&1" done # Change owner to mssql:mssql to ready for restore ghe_ssh_mssql "sudo chown -R mssql:mssql $appliance_dir" # Invoke restore command -bm_start "$(basename "$0")" +bm_start "$(basename $0)" ghe_ssh_mssql -- "ghe-import-mssql" < "/dev/null" 1>&3 -bm_end "$(basename "$0")" +bm_end "$(basename $0)" From 4cc448a88c8030b9e48eb8b249be6ac92116ee6b Mon Sep 17 00:00:00 2001 From: Terrell Broomer Date: Wed, 23 Aug 2023 10:33:13 +0900 Subject: [PATCH 583/946] remove shellcheckrc --- .shellcheckrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .shellcheckrc diff --git a/.shellcheckrc b/.shellcheckrc deleted file mode 100644 index 1135b65a4..000000000 --- a/.shellcheckrc +++ /dev/null @@ -1 +0,0 @@ -disable=SC2002 #useless cat \ No newline at end of file From f14f8dd62116841dcf3c6129a571e05e3d19fe2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 23 Aug 2023 20:56:36 +0200 Subject: [PATCH 584/946] Clarify special handling for cluster environments --- share/github-backup-utils/ghe-restore-repositories | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index e8e1dcdbe..67bbf8e34 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -102,6 +102,11 @@ done > $tmp_list IFS=$OLDIFS bm_end "$(basename $0) - Building network list" +# In cluster environments, we need to ensure that all repository networks are replicated back to the +# same Spokes nodes that they were present on when the backup was taken. For this, the list of +# routes of each repository network is first obtained. Afterward, an rsync file list is created for +# each Spokes node including only those repository networks for which there was a route to the +# respective Spokes node. if $CLUSTER; then # The server returns a list of routes: # @@ -140,9 +145,11 @@ if $CLUSTER; then cat $routes_list | awk '{ n = split($1, p, "/"); printf p[n] " /data/repositories/" $1; $1=""; print $0}' > $to_restore ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" bm_end "$(basename $0) - Processing routes" +# There is no need to collect routes and split them by Spokes server in noncluster setups because +# we need to transfer all repository networks to the primary instance unconditionally, regardless of +# the Spokes route list captured during the backup. As we already have the list of all repository +# network paths, we can simply use that as the rsync file list in noncluster environments. else - # In noncluster setups, the primary instance owns all repository networks, so all network paths - # are to be synchronized to the primary instance. cp "$tmp_list" "$tempdir/git-server-primary.rsync" fi From 4a6e0aed7adf86f9a9415bf8eb6d686d161a4d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 23 Aug 2023 22:02:56 +0200 Subject: [PATCH 585/946] Allow manually triggering testing workflow This is to facilitate testing while developing new features, as the test suite is not trivial to run on a local machine or even a fork and as opening pull requests for all experimental features would create a lot of noise. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index da7695ad1..3e4445915 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ name: Test and build -on: [pull_request] +on: [pull_request, workflow_dispatch] jobs: build: From 3bee49085de900d8f2f0920cb5c9263d72c784f6 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 24 Aug 2023 14:52:11 -0400 Subject: [PATCH 586/946] Placing initial CODEOWNERS file (#532) still need to discuss the best users to set as codeowners of certain sections, will uncomment after ascertaining best teams --- .github/CODEOWNERS | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..fecb57ee9 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,7 @@ +# Backup-Utils owned by lifecycle AOR +* @github/ghes-lifecycle +# Actions related backups and restores +# /share/github-backup-utils/*-actions @github/ghes-lifecycle @github/ +# Git related backups and restores +# /share/github-backup-utils/*-repositories @github/ghes-lifecycle @github/ +# /share/github-backup-utils/*-git-hooks @github/ghes-lifecycle @github/ \ No newline at end of file From 4abe738f06a649aef3d91575053593af6bd39c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 22 Aug 2023 02:19:25 +0200 Subject: [PATCH 587/946] Fix script permissions In order to satisfy the linter when making changes to this script, it should be executable. --- test/testlib.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/testlib.sh diff --git a/test/testlib.sh b/test/testlib.sh old mode 100644 new mode 100755 From fb9754530b6f9881e26cd4f12399930bab8c2c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Sat, 19 Aug 2023 03:22:57 +0200 Subject: [PATCH 588/946] Find parallel in more locations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some distributions append or prepend “moreutils” to the parallel command with a hyphen to distinguish it from the GNU version of parallel, such as Arch Linux [1]. To facilitate testing on such platforms (for example to test backup-utils with upcoming versions of rsync and newer Linux kernel versions), this adds support for finding parallel in those locations. [1] https://archlinux.org/packages/extra/x86_64/moreutils/ --- share/github-backup-utils/ghe-backup-config | 2 ++ test/testlib.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 2e176b510..5b7f1c3d3 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -217,8 +217,10 @@ ghe_parallel_check() { GHE_PARALLEL_COMMAND="parallel" local x for x in \ + /usr/bin/parallel-moreutils \ /usr/bin/parallel.moreutils \ /usr/bin/parallel_moreutils \ + /usr/bin/moreutils-parallel \ /usr/bin/moreutils.parallel \ /usr/bin/moreutils_parallel \ ; do diff --git a/test/testlib.sh b/test/testlib.sh index 5dd5ac451..8e130eb75 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -600,8 +600,10 @@ setup_moreutils_parallel() { # We need moreutils parallel local x for x in \ + /usr/bin/parallel-moreutils \ /usr/bin/parallel.moreutils \ /usr/bin/parallel_moreutils \ + /usr/bin/moreutils-parallel \ /usr/bin/moreutils.parallel \ /usr/bin/moreutils_parallel \ ; do From 97102ce9e3d23725b8dfbec2a5125b5ba8e4b3d7 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Mon, 28 Aug 2023 19:50:27 +0000 Subject: [PATCH 589/946] switch to case --- share/github-backup-utils/ghe-rsync-size | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync-size b/share/github-backup-utils/ghe-rsync-size index 317c2f6cc..3e454f6bf 100644 --- a/share/github-backup-utils/ghe-rsync-size +++ b/share/github-backup-utils/ghe-rsync-size @@ -65,14 +65,22 @@ transfer_size() if [[ $cluster_status -eq 0 ]]; then cluster_conf_out=$(ghe-ssh "$host" "cat /data/user/common/cluster.conf") cluster_nodes_output=$(ghe-ssh "$host" "ghe-cluster-nodes -i") - if [[ ( "$1" == "elasticsearch" || "$1" == "storage" || "$1" == "pages" ) ]]; then - host_server=$(echo "$cluster_conf_out" | awk -v srv="$backup_data-server = true" '/cluster/ { prevA = $0 } $0 ~ srv { print prevA }' | head -1 | awk -F '"' '{print $2}') - elif [[ "$1" == "mysql" ]]; then - host_server=$(ghe-ssh "$host" "ghe-config cluster.mysql-master") - elif [[ "$1" == "repositories" ]]; then - host_server=$(echo "$cluster_conf_out" | awk '/git-server = true/ { print prevA } /cluster/ { prevA = $0 }' | head -1 | awk -F '"' '{print $2}') - fi - host=$(echo "$cluster_nodes_output" | grep "$host_server" | awk '{print $2}' | head -1) + case $1 in + elasticsearch | storage | pages) + cluster_host=$(echo "$cluster_conf_out" | awk -v srv="$backup_data-server = true" '/cluster/ { prevA = $0 } $0 ~ srv { print prevA }' | head -1 | awk -F '"' '{print $2}') + ;; + mysql) + cluster_host=$(ghe-ssh "$host" "ghe-config cluster.mysql-master") + ;; + repositories) + cluster_host=$(echo "$cluster_conf_out" | awk '/git-server = true/ { print prevA } /cluster/ { prevA = $0 }' | head -1 | awk -F '"' '{print $2}') + ;; + *) + echo "Unknown backup data: $1" + exit 1 + ;; + esac + host=$(echo "$cluster_nodes_output" | grep "$cluster_host" | awk '{print $2}' | head -1) fi if [ -d "${GHE_DATA_DIR}/current/$1" ]; then From 077a10e3dcbc6a3332c61ec0a811f0b8bec9300c Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 29 Aug 2023 13:41:03 +0000 Subject: [PATCH 590/946] Add comments --- share/github-backup-utils/ghe-rsync-size | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/github-backup-utils/ghe-rsync-size b/share/github-backup-utils/ghe-rsync-size index 3e454f6bf..e7aeb7d74 100644 --- a/share/github-backup-utils/ghe-rsync-size +++ b/share/github-backup-utils/ghe-rsync-size @@ -59,6 +59,7 @@ transfer_size() ;; esac + # Check if instance is cluster and fetch appropriate primary host for the different components ghe-ssh "$host" "[ -f /etc/github/cluster ]" cluster_status=$? @@ -83,6 +84,7 @@ transfer_size() host=$(echo "$cluster_nodes_output" | grep "$cluster_host" | awk '{print $2}' | head -1) fi + # Get file transfer size estimates if [ -d "${GHE_DATA_DIR}/current/$1" ]; then total_file_size=$(ghe-rsync -arn --stats \ -e "ssh -q $GHE_EXTRA_SSH_OPTS -p 122 -l admin" \ From b2f7717b3c47ff23ba9773e47950427dc6069f36 Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 29 Aug 2023 14:22:00 -0700 Subject: [PATCH 591/946] updated ghe-backup testing versions --- bin/ghe-backup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 86ee33dd7..58791d0f6 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -198,11 +198,11 @@ is_inc=$(is_incremental_backup_feature_on) if [ "$is_inc" = true ]; then if [ "$GHE_VERSION_MAJOR" -lt 3 ]; then - log_error "Can only perform incremental backups on enterprise version 3.10 or higher" + log_error "Can only perform incremental backups on enterprise version 3.11 or higher" exit 1 fi -if [ "$GHE_VERSION_MINOR" -lt 10 ]; then - log_error "Can only perform incremental backups on enterprise version 3.10 or higher" +if [ "$GHE_VERSION_MINOR" -lt 11 ]; then + log_error "Can only perform incremental backups on enterprise version 3.11 or higher" exit 1 fi From a708a1712b3d60e1b3c87c9ffdc35128d7d45c20 Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 29 Aug 2023 15:27:16 -0700 Subject: [PATCH 592/946] assert key is restored for 3.10 --- test/test-ghe-restore.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index cf93baa96..1294542c8 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -454,7 +454,7 @@ begin_test "ghe-restore with secret scanning encrypted secrets encryption keys f ) end_test -begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions below 3.11.0+" +begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions below 3.11.0" ( set -e rm -rf "$GHE_REMOTE_ROOT_DIR" @@ -475,7 +475,7 @@ begin_test "ghe-restore with secret scanning encrypted content encryption keys f ) for secret in "${required_secrets[@]}"; do - [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting these to not be set for versions below 3.11.0 + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] # expecting these to not be set for versions below 3.11.0 done ) end_test From b334c409db33fa7d962ab7e1ccecfb495e1dbc51 Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 29 Aug 2023 15:49:03 -0700 Subject: [PATCH 593/946] updated backup with test for 3-10 --- test/test-ghe-backup.sh | 28 ++++++++++++++++++++++++++-- test/test-ghe-restore.sh | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 7149e1158..42b6dccff 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -832,7 +832,7 @@ begin_test "ghe-backup takes backup of secret scanning encrypted secrets encrypt ) end_test -begin_test "ghe-backup takes backup of secret scanning encrypted content encryption keys" +begin_test "ghe-backup does not take backups of secret scanning encrypted content encryption keys on versions below 3.11.0" ( set -e @@ -844,7 +844,31 @@ begin_test "ghe-backup takes backup of secret scanning encrypted content encrypt ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" done - ghe-backup + GHE_REMOTE_VERSION=3.10.0 ghe-backup -v | grep -q "secret scanning encrypted content" && exit 1 + + required_files=( + "secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for file in "${required_files[@]}"; do + [ "$(cat "$GHE_DATA_DIR/current/$file")" = "" ] + done +) +end_test + +begin_test "ghe-backup takes backup of secret scanning encrypted content encryption keys on versions 3.11.0+" +( + set -e + + required_secrets=( + "secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for secret in "${required_secrets[@]}"; do + ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo" + done + + GHE_REMOTE_VERSION=3.11.0 ghe-backup required_files=( "secret-scanning-user-content-delimited-encryption-root-keys" diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 1294542c8..27bf13310 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -475,7 +475,7 @@ begin_test "ghe-restore with secret scanning encrypted content encryption keys f ) for secret in "${required_secrets[@]}"; do - [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] # expecting these to not be set for versions below 3.11.0 + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] # if this fails, it should fail silently for versions below 3.10 done ) end_test From 7868b3d807492632cee9fd2cb7380beffec22c5a Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 29 Aug 2023 16:16:17 -0700 Subject: [PATCH 594/946] Revert "updated ghe-backup testing versions" This reverts commit b2f7717b3c47ff23ba9773e47950427dc6069f36. --- bin/ghe-backup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 58791d0f6..86ee33dd7 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -198,11 +198,11 @@ is_inc=$(is_incremental_backup_feature_on) if [ "$is_inc" = true ]; then if [ "$GHE_VERSION_MAJOR" -lt 3 ]; then - log_error "Can only perform incremental backups on enterprise version 3.11 or higher" + log_error "Can only perform incremental backups on enterprise version 3.10 or higher" exit 1 fi -if [ "$GHE_VERSION_MINOR" -lt 11 ]; then - log_error "Can only perform incremental backups on enterprise version 3.11 or higher" +if [ "$GHE_VERSION_MINOR" -lt 10 ]; then + log_error "Can only perform incremental backups on enterprise version 3.10 or higher" exit 1 fi From 5edc50c3c63c49d9fbaee4ea82391c95aed1299c Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 29 Aug 2023 18:18:11 -0500 Subject: [PATCH 595/946] Updated restore test Co-authored-by: Robert Bolender --- test/test-ghe-restore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 27bf13310..da7fdb06b 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -475,7 +475,7 @@ begin_test "ghe-restore with secret scanning encrypted content encryption keys f ) for secret in "${required_secrets[@]}"; do - [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] # if this fails, it should fail silently for versions below 3.10 + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting that this secret was not backed up on versions below 3.11.0, this secret was not present in earlier versions done ) end_test From 7f4301ad748b98d91e25f170456e6ca24dad18b7 Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 29 Aug 2023 16:46:46 -0700 Subject: [PATCH 596/946] add restore test against 3.9 --- test/test-ghe-restore.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index da7fdb06b..6734dbb09 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -454,6 +454,32 @@ begin_test "ghe-restore with secret scanning encrypted secrets encryption keys f ) end_test +begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions below 3.10.0" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + required_files=( + "secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for file in "${required_files[@]}"; do + echo "foo" >"$GHE_DATA_DIR/current/$file" + done + + GHE_REMOTE_VERSION=3.9.0 ghe-restore -v -f localhost + + required_secrets=( + "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting that this secret was not backed up on versions below 3.11.0, this secret was not present in earlier versions + done +) +end_test + begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions below 3.11.0" ( set -e From 45ac587e12e1a211d51e6d00fcc03418cf7539b2 Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 29 Aug 2023 16:56:18 -0700 Subject: [PATCH 597/946] adding version check to only restore for 3.11+ --- .../ghe-restore-secret-scanning-encryption-keys | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys index 4785a6d77..5c8dbdef6 100755 --- a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys +++ b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys @@ -37,7 +37,9 @@ restore-secret "secret scanning encrypted secrets current shared transit key" "s restore-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" # Restore secret scanning content scanning keys if present +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.11.0)" ]; then log_info "Restoring secret scanning content scanning keys" restore-secret "secret scanning user content delimited encryption root keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" +fi bm_end "$(basename $0)" From f08984be849ecac073bb6195f2f83c704dd72448 Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Tue, 29 Aug 2023 16:56:31 -0700 Subject: [PATCH 598/946] Revert "add restore test against 3.9" This reverts commit 7f4301ad748b98d91e25f170456e6ca24dad18b7. --- test/test-ghe-restore.sh | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 6734dbb09..da7fdb06b 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -454,32 +454,6 @@ begin_test "ghe-restore with secret scanning encrypted secrets encryption keys f ) end_test -begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions below 3.10.0" -( - set -e - rm -rf "$GHE_REMOTE_ROOT_DIR" - setup_remote_metadata - - required_files=( - "secret-scanning-user-content-delimited-encryption-root-keys" - ) - - for file in "${required_files[@]}"; do - echo "foo" >"$GHE_DATA_DIR/current/$file" - done - - GHE_REMOTE_VERSION=3.9.0 ghe-restore -v -f localhost - - required_secrets=( - "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" - ) - - for secret in "${required_secrets[@]}"; do - [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting that this secret was not backed up on versions below 3.11.0, this secret was not present in earlier versions - done -) -end_test - begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions below 3.11.0" ( set -e From 80e0af3b74a9fc8a89937291c61629460fcc20f2 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 30 Aug 2023 18:17:12 +0000 Subject: [PATCH 599/946] simplify cluster output & parsing --- share/github-backup-utils/ghe-rsync-size | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/share/github-backup-utils/ghe-rsync-size b/share/github-backup-utils/ghe-rsync-size index e7aeb7d74..9ba0cf83f 100644 --- a/share/github-backup-utils/ghe-rsync-size +++ b/share/github-backup-utils/ghe-rsync-size @@ -60,25 +60,20 @@ transfer_size() esac # Check if instance is cluster and fetch appropriate primary host for the different components - ghe-ssh "$host" "[ -f /etc/github/cluster ]" - cluster_status=$? - - if [[ $cluster_status -eq 0 ]]; then - cluster_conf_out=$(ghe-ssh "$host" "cat /data/user/common/cluster.conf") + if "$CLUSTER"; then cluster_nodes_output=$(ghe-ssh "$host" "ghe-cluster-nodes -i") case $1 in - elasticsearch | storage | pages) - cluster_host=$(echo "$cluster_conf_out" | awk -v srv="$backup_data-server = true" '/cluster/ { prevA = $0 } $0 ~ srv { print prevA }' | head -1 | awk -F '"' '{print $2}') + elasticsearch | storage | pages | actions | mssql) + cluster_host=$(ghe-ssh "$host" "ghe-cluster-nodes -r $backup_data" | head -1) ;; mysql) cluster_host=$(ghe-ssh "$host" "ghe-config cluster.mysql-master") ;; repositories) - cluster_host=$(echo "$cluster_conf_out" | awk '/git-server = true/ { print prevA } /cluster/ { prevA = $0 }' | head -1 | awk -F '"' '{print $2}') + cluster_host=$(ghe-ssh "$host" "ghe-cluster-nodes -r git" | head -1) ;; *) - echo "Unknown backup data: $1" - exit 1 + exit 0 ;; esac host=$(echo "$cluster_nodes_output" | grep "$cluster_host" | awk '{print $2}' | head -1) From 2e512526add392486b38f335f2785908c2f53f3d Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 30 Aug 2023 20:33:09 +0000 Subject: [PATCH 600/946] fix unsupported ghe-version check --- test/test-ghe-host-check.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index 6bfa12a69..aeb41551d 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -56,9 +56,14 @@ begin_test "ghe-host-check detects unsupported GitHub Enterprise Server versions read -r bu_version_major bu_version_minor _ <<<$(ghe_parse_version $BACKUP_UTILS_VERSION) bu_major_minor="$bu_version_major.$bu_version_minor" releases=$(/usr/bin/curl -s https://github-enterprise.s3.amazonaws.com/release/latest.json) - supported=$(echo $releases | jq -r 'select(."'${bu_major_minor}'")') + latest_value=$(echo "$releases" | jq -r '.latest') + latest_major_version=$(echo $latest_value | cut -d "." -f 1-2) + # Replace "latest" with the derived major version in the releases string + releases_with_replacement=$(echo "$releases" | sed 's/"latest"/"'"$latest_major_version"'"/g') + # Use the modified releases string as needed + supported=$(echo "$releases_with_replacement" | jq -r 'select(."'${bu_major_minor}'")') # shellcheck disable=SC2207 # Command required as alternatives fail - keys=($(echo $releases | jq -r 'keys[]')) + keys=($(echo "$releases_with_replacement" | jq -r 'keys[]')) if [ -z "$supported" ] then From b9e6a58f47bcc1a7cbd8528743eb866a94386e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Sat, 5 Aug 2023 13:13:19 +0200 Subject: [PATCH 601/946] Record total runtime of ghe-backup and ghe-restore This adds the total runtime of ghe-backup and ghe-restore to the benchmark output. When investigating benchmark performance issues with customers and inspecting the benchmark output, it is helpful to know the total runtime of ghe-backup and ghe-restore as a reference for checking the durations of individual execution steps. While the stdout output currently shows the total runtime, customers generally do not store this output on disk, which makes it difficult to investigate backup-related performance issues after the fact. The runtime is recorded regardless of whether or not the commands completed successfully, as it may still be useful to see how long they have run when terminated early because of an error or human intervention. --- bin/ghe-backup | 3 +++ bin/ghe-restore | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bin/ghe-backup b/bin/ghe-backup index 86ee33dd7..222502d81 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -121,6 +121,8 @@ cleanup () { # Cleanup SSH multiplexing ghe-ssh --clean + + bm_end "$(basename $0)" } # Setup exit traps @@ -216,6 +218,7 @@ fi echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress echo "$GHE_SNAPSHOT_TIMESTAMP $$" > "${GHE_DATA_DIR}/in-progress-backup" +bm_start "$(basename $0)" START_TIME=$(date +%s) log_info "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" diff --git a/bin/ghe-restore b/bin/ghe-restore index 19603ae47..f1b1f245e 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -138,6 +138,8 @@ cleanup () { if ! rm -f "${GHE_DATA_DIR}/in-progress-restore"; then log_error "Failed to remove in-progress file" 1>&3 fi + + bm_end "$(basename $0)" } # This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. @@ -322,6 +324,7 @@ export PROGRESS=0 # Used to track progress of restore echo "$PROGRESS" > /tmp/backup-utils-progress # Log restore start message locally and in /var/log/syslog on remote instance +bm_start "$(basename $0)" START_TIME=$(date +%s) log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" From 1bb2d0e1342efc6516ff689857ddf35af1570bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Thu, 31 Aug 2023 22:08:11 +0200 Subject: [PATCH 602/946] Log if repositories are restored to multiple nodes --- share/github-backup-utils/ghe-restore-repositories | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/github-backup-utils/ghe-restore-repositories b/share/github-backup-utils/ghe-restore-repositories index 67bbf8e34..d63881be2 100755 --- a/share/github-backup-utils/ghe-restore-repositories +++ b/share/github-backup-utils/ghe-restore-repositories @@ -108,6 +108,8 @@ bm_end "$(basename $0) - Building network list" # each Spokes node including only those repository networks for which there was a route to the # respective Spokes node. if $CLUSTER; then + log_info "* Restoring repository networks to cluster nodes according to Spokes routes" 1>&3 + # The server returns a list of routes: # # a/nw/a8/3f/02/100000855 dgit-node1 dgit-node2 dgit-node3 @@ -150,6 +152,8 @@ if $CLUSTER; then # the Spokes route list captured during the backup. As we already have the list of all repository # network paths, we can simply use that as the rsync file list in noncluster environments. else + log_info "* Restoring all repository networks to target host unconditionally" 1>&3 + cp "$tmp_list" "$tempdir/git-server-primary.rsync" fi From adde32840c6198fc1401162dd885b48a2f2982dd Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 31 Aug 2023 17:28:14 -0400 Subject: [PATCH 603/946] Add incremental MySQL restore test (#530) Add basic tests for incremental MySQL restores --- test/test-ghe-host-check.sh | 5 +- test/test-ghe-incremental-restore.sh | 82 ++++++++++++++++++++++++++++ test/testlib.sh | 34 ++++++++++++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100755 test/test-ghe-incremental-restore.sh diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index aeb41551d..f2c5cca54 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -83,7 +83,10 @@ begin_test "ghe-host-check detects unsupported GitHub Enterprise Server versions ix=$(( $ix + 1 )) done GHE_TEST_REMOTE_VERSION="${keys[$ix]}.0" ghe-host-check - GHE_TEST_REMOTE_VERSION="${keys[$(( $ix - 1 ))]}.0" ghe-host-check + # sometimes when the latest.json is updated during a release this test gets broken. + if [ "${keys[$(( $ix - 1 ))]}" != "latest" ]; then + GHE_TEST_REMOTE_VERSION="${keys[$(( $ix - 1 ))]}.0" ghe-host-check + fi GHE_TEST_REMOTE_VERSION="${keys[$(( $ix - 2 ))]}.0" ghe-host-check fi diff --git a/test/test-ghe-incremental-restore.sh b/test/test-ghe-incremental-restore.sh new file mode 100755 index 000000000..bf3ace16a --- /dev/null +++ b/test/test-ghe-incremental-restore.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +# ghe-restore command tests + +# Bring in testlib +# shellcheck source=test/testlib.sh +. "$(dirname "$0")/testlib.sh" + +setup_incremental_restore_data +setup_actions_enabled_settings_for_restore true + +# Make the current symlink +ln -s 1 "$GHE_DATA_DIR/current" +begin_test "ghe_restore -i doesn't run on unsupported versions" +( + set -e + GHE_RESTORE_HOST=127.0.0.1 + export GHE_RESTORE_HOST + + # restore should fail on versions older than 3.10 + ! GHE_TEST_REMOTE_VERSION=3.9.0 ghe-restore -i -v + ! GHE_TEST_REMOTE_VERSION=3.7.0 ghe-restore -i -v + ! GHE_TEST_REMOTE_VERSION=3.1.0 ghe-restore -i -v +) +end_test + +begin_test "ghe-restore -i into configured vm from full backup" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + # set as configured, enable maintenance mode and create required directories + setup_maintenance_mode "configured" + + # set restore host environ var + GHE_RESTORE_HOST=127.0.0.1 + export GHE_RESTORE_HOST + # run ghe-restore and write output to file for asserting against + if ! GHE_TEST_REMOTE_VERSION=3.10.0 GHE_DEBUG=1 ghe-restore -i -v -f > "$TRASHDIR/restore-out" 2>&1; then +output_debug_logs_and_fail_test + fi + + + # verify connect to right host + grep -q "Connect 127.0.0.1:122 OK" "$TRASHDIR/restore-out" + + # verify stale servers were cleared + grep -q "Cleaning up stale nodes ..." "$TRASHDIR/restore-out" + + # Verify all the data we've restored is as expected + verify_all_restored_data +) +end_test + +begin_test "ghe-restore -i fails when the lsn information for the listed files is out of order" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + + # set as configured, enable maintenance mode and create required directories + setup_maintenance_mode "configured" + + # set restore host environ var + GHE_RESTORE_HOST=127.0.0.1 + export GHE_RESTORE_HOST + + inc_1="$GHE_DATA_DIR/2" + inc_2="$GHE_DATA_DIR/3" + + # screw up the order of the LSNs in xtrabackup_checkpoints + setup_incremental_lsn $inc_1 100 200 incremental + setup_incremental_lsn $inc_2 50 50 incremental + # run ghe-restore and write output to file for asserting against + # we expect failure and need the right output. + if GHE_DEBUG=1 ghe-restore -i -v -f > "$TRASHDIR/restore-out" 2>&1; then + true + fi +) +end_test + + diff --git a/test/testlib.sh b/test/testlib.sh index 8e130eb75..e219a50d5 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -327,6 +327,40 @@ setup_test_data () { setup_minio_test_data "$GHE_DATA_DIR" } +# Sets up test data for testing incremental restores. +setup_incremental_restore_data() { + local full="$GHE_DATA_DIR/1" + local inc_1="$GHE_DATA_DIR/2" + local inc_2="$GHE_DATA_DIR/3" + # Run the setup_test_data function to create three directories: 1 for full backup and two incremental. + # we can use these directories for different types of tests + setup_test_data "$full" + setup_test_data "$inc_1" + setup_test_data "$inc_2" + # Setup the metadata files that track which files are used to track full and incremental files + echo "$full" >> "$GHE_DATA_DIR/inc_full_backup" + echo -e "$inc_1\n$inc_2" >> "$GHE_DATA_DIR/inc_snapshot_data" + # Configure lsn data in xtrabackup_checkpoints for the full backup and the incremental backup + setup_incremental_lsn $full 1 100 full + setup_incremental_lsn $inc_1 101 200 incremental + setup_incremental_lsn $inc_2 201 300 incremental +} + +setup_incremental_lsn() { + local loc=$1 + local start=$2 + local end=$3 + local type=$4 + +cat <> "$loc/xtrabackup_checkpoints" +backup_type = $type +from_lsn = $start +to_lsn = $end +last_lsn = $end +flushed_lsn = $end +LSN +} + setup_incremental_backup_config() { ghe-ssh "$GHE_HOSTNAME" -- 'mkdir -p /tmp/lsndir' ghe-ssh "$GHE_HOSTNAME" -- 'echo "fake xtrabackup checkpoint" > /tmp/lsndir/xtrabackup_checkpoints' From e80684dc50ab734a30c1e0715fbf32575d25f72c Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 1 Sep 2023 12:03:57 -0600 Subject: [PATCH 604/946] Run tests in serial --- .github/workflows/main.yml | 10 ---------- script/cibuild | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e4445915..50583737b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,9 +6,6 @@ jobs: build: strategy: matrix: - # macos-latest references are kept here for historical purposes. removed macos-latest from the - #matrix as it is not a typical case for users and causes a lot of friction with other linux-based - # installs. Recommend developing on codespaces or using an ubuntu container. os: ['ubuntu-22.04', 'ubuntu-20.04'] fail-fast: false runs-on: ${{ matrix.os }} @@ -20,12 +17,6 @@ jobs: wget "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" tar --xz -xvf "shellcheck-stable.linux.x86_64.tar.xz" sudo cp shellcheck-stable/shellcheck /usr/bin/shellcheck - if: matrix.os != 'macos-latest' - - name: Install Dependencies (macOS) - run: | - brew install gnu-tar shellcheck jq pigz coreutils gnu-sed gnu-getopt wget - brew install moreutils gawk - if: matrix.os == 'macos-latest' - name: Get Sources uses: actions/checkout@v3 - name: Test @@ -35,4 +26,3 @@ jobs: shell: bash - name: Build (Linux) run: DEB_BUILD_OPTIONS=nocheck debuild -us -uc - if: matrix.os != 'macos-latest' diff --git a/script/cibuild b/script/cibuild index 7f57f444d..73dc9ae0a 100755 --- a/script/cibuild +++ b/script/cibuild @@ -5,7 +5,7 @@ set -e # Enable verbose logging of ssh commands export GHE_VERBOSE_SSH=true -if ! find test -name "test-*.sh" -print0 | xargs -0 -P 4 -n 1 /bin/bash; then +if ! find test -name "test-*.sh" -print0 | xargs -0 -n 1 /bin/bash; then exit 1 fi From 72266bdaa3b7e9adb4b2a36c51ea947096f2e776 Mon Sep 17 00:00:00 2001 From: Brandon Emlaw Date: Fri, 1 Sep 2023 15:45:55 -0500 Subject: [PATCH 605/946] fix spacing --- .../ghe-restore-secret-scanning-encryption-keys | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys index 5c8dbdef6..04f7588a7 100755 --- a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys +++ b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys @@ -38,8 +38,8 @@ restore-secret "secret scanning encrypted secrets delimited shared transit keys" # Restore secret scanning content scanning keys if present if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.11.0)" ]; then -log_info "Restoring secret scanning content scanning keys" -restore-secret "secret scanning user content delimited encryption root keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + log_info "Restoring secret scanning content scanning keys" + restore-secret "secret scanning user content delimited encryption root keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" fi bm_end "$(basename $0)" From c19c08811a0183e5eaf906265ea857383bbdc359 Mon Sep 17 00:00:00 2001 From: Shruti Corbett <90784253+shcorbett@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:21:09 -0400 Subject: [PATCH 606/946] Create pull_request_template.md Creating a pull request template to ensure specific information is documented and calling out the versions of GHES that are supported by backup-utils so that appropriate testing can be done against those versions --- .github/pull_request_template.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..fa678e53b --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,24 @@ +### Description + +### Testing + + + +### Owernship + + +### Related Links + From e0278f1ac87654dafa32c3beeac14869c0286170 Mon Sep 17 00:00:00 2001 From: Shruti Corbett <90784253+shcorbett@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:27:26 -0400 Subject: [PATCH 607/946] Update pull_request_template.md --- .github/pull_request_template.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index fa678e53b..fd36d8a9a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,3 +1,5 @@ +# PR Details + ### Description -### Owernship +### Ownership From f9025aa47cc36bd94ec0a67973f5fc5c15e9fc21 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 12:34:29 -0400 Subject: [PATCH 608/946] init to win it --- .github/workflows/build-and-release.yml | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/build-and-release.yml diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 000000000..79de3bdcd --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,63 @@ +name: Build and Release + +# make it callable with required input of release-notes string +on: + workflow_dispatch: + inputs: + version: + description: 'Version - patch version of the release (e.g. x.y.z)' + required: true + type: string + release-notes: + description: 'Release Notes - string of markdown' + required: true + type: string + draft: + description: 'Draft - true if the release should be a draft' + required: true + type: boolean + default: true + +# in the first job +# first, run on ubuntu-latest +# then, install dependencies: moreutils, debhelper and help2man +# then, using the input version create a v{input.version} tag at the head of the branch +# then, checkout this repo +# then, run the bash scripts: /scripts/package-deb and /scripts/package-tarball +# in the next job +# create a release using ncipollo/release-action@v1 to attach release notes and the artifacts and tag from the previous job + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y moreutils debhelper help2man + - name: Create tag + run: | + git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" + - name: Checkout + uses: actions/checkout@v2 + - name: Package deb + run: | + bash scripts/package-deb + - name: Package tarball + run: | + bash scripts/package-tarball + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Create Release + uses: ncipollo/release-action@v1 + with: + repo: github/backup-utils + artifacts: | + ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # token: ${{ secrets.GITHUB_TOKEN }} may need token, but try without first + releaseName: v${{ github.event.inputs.version }} + draft: ${{ github.event.inputs.draft }} + body: ${{ github.event.inputs.release-notes }} From 411d7423f816c712951f2598a9905874d8945d50 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 12:41:51 -0400 Subject: [PATCH 609/946] remove comment notes --- .github/workflows/build-and-release.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 79de3bdcd..46bd9cb57 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -1,6 +1,5 @@ name: Build and Release -# make it callable with required input of release-notes string on: workflow_dispatch: inputs: @@ -18,15 +17,6 @@ on: type: boolean default: true -# in the first job -# first, run on ubuntu-latest -# then, install dependencies: moreutils, debhelper and help2man -# then, using the input version create a v{input.version} tag at the head of the branch -# then, checkout this repo -# then, run the bash scripts: /scripts/package-deb and /scripts/package-tarball -# in the next job -# create a release using ncipollo/release-action@v1 to attach release notes and the artifacts and tag from the previous job - jobs: build: runs-on: ubuntu-latest From dfe71d6627c81602557568ed8f108fa6b1fd482d Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 12:48:00 -0400 Subject: [PATCH 610/946] fix input name --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 46bd9cb57..7dcb3f7c3 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -48,6 +48,6 @@ jobs: ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb # token: ${{ secrets.GITHUB_TOKEN }} may need token, but try without first - releaseName: v${{ github.event.inputs.version }} + name: v${{ github.event.inputs.version }} draft: ${{ github.event.inputs.draft }} body: ${{ github.event.inputs.release-notes }} From 5543165e2c293894f7cd0b15b953a31d6be241c2 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 13:48:08 -0400 Subject: [PATCH 611/946] checkout first --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7dcb3f7c3..e1399ac2e 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -21,6 +21,8 @@ jobs: build: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v2 - name: Install dependencies run: | sudo apt-get update @@ -28,8 +30,6 @@ jobs: - name: Create tag run: | git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" - - name: Checkout - uses: actions/checkout@v2 - name: Package deb run: | bash scripts/package-deb From f8080c9dec00cd5c1b606636ce792d13986bff77 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 7 Sep 2023 17:52:23 +0000 Subject: [PATCH 612/946] add NFS check --- bin/ghe-host-check | 7 +++++++ docs/requirements.md | 2 ++ 2 files changed, 9 insertions(+) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 104885114..d0fa767fe 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -168,6 +168,13 @@ SKIP_MSG # shellcheck source=share/github-backup-utils/ghe-rsync-size . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size" + #Check if GHE_DATA_DIR is NFS mounted + fs_info=$(stat -f -c "%T" "$GHE_DATA_DIR") + if [ "$fs_info" == "nfs" ]; then + echo "Warning: NFS (Network File System) detected for $GHE_DATA_DIR" 1>&2 + echo "Please review https://gh.io/backup-utils-storage-requirements for details." 1>&2 + fi + #Display dir requirements for repositories and mysql echo "" 1>&2 echo "Checking host for sufficient space for a backup..." 1>&2 diff --git a/docs/requirements.md b/docs/requirements.md index 1320eb583..e410c7381 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -57,6 +57,8 @@ Using a [case sensitive][7] file system is also required to avoid conflicts. Performance of backup and restore operations are also dependent on the backup host's storage. We recommend using a high performance storage system with low latency and high IOPS. +Please avoid using NFS mount for the data directory (where backup data is stored) as this can result in performance issues and timeouts during backups. + ## GitHub Enterprise Server version requirements Starting with Backup Utilities v2.13.0, version support is inline with that of the From 977db53c7f62f63e86f80bce7c23390965fff9bb Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 15:12:31 -0400 Subject: [PATCH 613/946] git config set to release-controller --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index e1399ac2e..20bcbc0cb 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -29,6 +29,7 @@ jobs: sudo apt-get install -y moreutils debhelper help2man - name: Create tag run: | + git config --local user.name release-controller" git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" - name: Package deb run: | From 982820f88bd45c10e10aff9b1e37251447e147f9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 15:15:54 -0400 Subject: [PATCH 614/946] missing quote --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 20bcbc0cb..8d9e7f871 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -29,7 +29,7 @@ jobs: sudo apt-get install -y moreutils debhelper help2man - name: Create tag run: | - git config --local user.name release-controller" + git config --local user.name "release-controller" git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" - name: Package deb run: | From 2829fcfdf36c712517b039e879fd02a92ea27c58 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 15:18:57 -0400 Subject: [PATCH 615/946] direct to build scripts --- .github/workflows/build-and-release.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 8d9e7f871..28d2e49d2 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@v2 - name: Install dependencies run: | - sudo apt-get update + sudo apt-get update -y sudo apt-get install -y moreutils debhelper help2man - name: Create tag run: | @@ -33,10 +33,12 @@ jobs: git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" - name: Package deb run: | - bash scripts/package-deb + ./scripts/package-deb + shell: bash - name: Package tarball run: | - bash scripts/package-tarball + ./scripts/package-tarball + shell: bash release: needs: build runs-on: ubuntu-latest From 1612b2077f43f012b9d6b613fd224d8dc2ab2ff9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 15:20:44 -0400 Subject: [PATCH 616/946] fix script path --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 28d2e49d2..58e95f34a 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -33,11 +33,11 @@ jobs: git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" - name: Package deb run: | - ./scripts/package-deb + ./script/package-deb shell: bash - name: Package tarball run: | - ./scripts/package-tarball + ./script/package-tarball shell: bash release: needs: build From a9a4e83d689f82e032757b1daa520851fcf3690e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 15:24:05 -0400 Subject: [PATCH 617/946] install devscripts --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 58e95f34a..2ac90e9bc 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man + sudo apt-get install -y moreutils debhelper help2man devscripts - name: Create tag run: | git config --local user.name "release-controller" From e791bbb8822e054ea4f5d2f3c06370dc364f8d6d Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 15:28:36 -0400 Subject: [PATCH 618/946] install gzip, tag needs to exist on remote --- .github/workflows/build-and-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 2ac90e9bc..af72b9123 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -26,11 +26,12 @@ jobs: - name: Install dependencies run: | sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts + sudo apt-get install -y moreutils debhelper help2man devscripts gzip - name: Create tag run: | git config --local user.name "release-controller" git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" + git push origin v${{ github.event.inputs.version }} - name: Package deb run: | ./script/package-deb From 7ff49305808bc1a77e117fb97c6084eaa9f324d1 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 16:14:03 -0400 Subject: [PATCH 619/946] use tag field --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index af72b9123..05b1e2c1d 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -52,6 +52,7 @@ jobs: ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb # token: ${{ secrets.GITHUB_TOKEN }} may need token, but try without first + tag: v${{ github.event.inputs.version }} name: v${{ github.event.inputs.version }} draft: ${{ github.event.inputs.draft }} body: ${{ github.event.inputs.release-notes }} From 462e13c4e195d38f3318615476bab2fe89f57f87 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 16:40:35 -0400 Subject: [PATCH 620/946] need token --- .github/workflows/build-and-release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 05b1e2c1d..5d5ec81c6 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -3,6 +3,10 @@ name: Build and Release on: workflow_dispatch: inputs: + gh-token: + description: 'GitHub Token - used to create the release' + required: true + type: string version: description: 'Version - patch version of the release (e.g. x.y.z)' required: true @@ -51,7 +55,7 @@ jobs: artifacts: | ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # token: ${{ secrets.GITHUB_TOKEN }} may need token, but try without first + token: ${{ github.event.inputs.gh-token }} tag: v${{ github.event.inputs.version }} name: v${{ github.event.inputs.version }} draft: ${{ github.event.inputs.draft }} From 78e7303ad7fe07cb4bafca92b109d3df6854eda7 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 17:46:36 -0400 Subject: [PATCH 621/946] try changing repo --- .github/workflows/build-and-release.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 5d5ec81c6..6de83fad7 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -31,11 +31,11 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag - run: | - git config --local user.name "release-controller" - git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" - git push origin v${{ github.event.inputs.version }} + # - name: Create tag + # run: | + # git config --local user.name "release-controller" + # git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" + # git push origin v${{ github.event.inputs.version }} - name: Package deb run: | ./script/package-deb @@ -48,14 +48,18 @@ jobs: needs: build runs-on: ubuntu-latest steps: + # - name: Set Up Release + # id: setup_release + # run: echo ::set-output name=token::${{ github.token }} - name: Create Release uses: ncipollo/release-action@v1 with: - repo: github/backup-utils + repo: backup-utils artifacts: | ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb token: ${{ github.event.inputs.gh-token }} + commit: ${{ github.sha }} tag: v${{ github.event.inputs.version }} name: v${{ github.event.inputs.version }} draft: ${{ github.event.inputs.draft }} From eb4437c6c8021fbc6238fe3a53aa4051dca09fa9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 17:49:38 -0400 Subject: [PATCH 622/946] again --- .github/workflows/build-and-release.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6de83fad7..c3d54c3ae 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -31,9 +31,9 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag - # run: | - # git config --local user.name "release-controller" + - name: Create tag + run: | + git config --local user.name "release-controller" # git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" # git push origin v${{ github.event.inputs.version }} - name: Package deb @@ -48,9 +48,6 @@ jobs: needs: build runs-on: ubuntu-latest steps: - # - name: Set Up Release - # id: setup_release - # run: echo ::set-output name=token::${{ github.token }} - name: Create Release uses: ncipollo/release-action@v1 with: From 25b67cd97dd8efcde6f45a0e6c354d8585619350 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 7 Sep 2023 17:55:45 -0400 Subject: [PATCH 623/946] need the tag on private? --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c3d54c3ae..b340d9215 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -34,8 +34,8 @@ jobs: - name: Create tag run: | git config --local user.name "release-controller" - # git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" - # git push origin v${{ github.event.inputs.version }} + git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" + git push origin v${{ github.event.inputs.version }} - name: Package deb run: | ./script/package-deb From 0e79c57ad8577770308560458f4e4ab88a41b988 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 7 Sep 2023 15:09:58 -0700 Subject: [PATCH 624/946] Filter out rsync prerelease and set change file path --- .github/workflows/rsync-docker-bump.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index c59e4ede1..3e0815f8a 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -15,14 +15,14 @@ jobs: - name: Get latest rsync tag id: latest_tag run: | - curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[0].name' | xargs -I {} echo "::set-output name=latest_tag::{}" + curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "::set-output name=latest_tag::{}" - name: Update Dockerfile with latest tag run: | sed -i -E "s/RSYNC_TAG=[0-9\.]+/RSYNC_TAG=${{ steps.latest_tag.outputs.latest_tag }}/g" Dockerfile - name: Create Pull Request for tag update - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Update rsync tag in Dockerfile" @@ -30,5 +30,5 @@ jobs: body: "This PR updates the rsync tag in the Dockerfile to the latest tagged version." branch: "update-rsync-tag" base: "master" - path: "." + add-paths: "Dockerfile" labels: "automated-update,rsync" From d5ada9ff9f01a25600748653c7a0d043990f4d8c Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 7 Sep 2023 15:26:35 -0700 Subject: [PATCH 625/946] Use environment file for output --- .github/workflows/rsync-docker-bump.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index 3e0815f8a..cfc1b24f9 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -15,7 +15,7 @@ jobs: - name: Get latest rsync tag id: latest_tag run: | - curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "::set-output name=latest_tag::{}" + curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "name=latest_tag::{}" >> $GITHUB_OUTPUT - name: Update Dockerfile with latest tag run: | From 5fef50b7ac2acb852ae918f7204b84f29e11c49e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 10:45:20 -0400 Subject: [PATCH 626/946] only use tag field --- .github/workflows/build-and-release.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index b340d9215..bc2cfef4c 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -54,10 +54,8 @@ jobs: repo: backup-utils artifacts: | ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - token: ${{ github.event.inputs.gh-token }} - commit: ${{ github.sha }} + ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - name: v${{ github.event.inputs.version }} - draft: ${{ github.event.inputs.draft }} body: ${{ github.event.inputs.release-notes }} + draft: ${{ github.event.inputs.draft }} + token: ${{ github.event.inputs.gh-token }} From f7567dea923b6fd1081a555d9d244aec8fa7bf5b Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 10:55:41 -0400 Subject: [PATCH 627/946] set commit to master branch since the tag doesn't exist --- .github/workflows/build-and-release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index bc2cfef4c..babfa13f7 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -54,8 +54,11 @@ jobs: repo: backup-utils artifacts: | ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # if the tag doesn't exist, we need to set it and the commit field tag: v${{ github.event.inputs.version }} + # this can be a commit hash or branch name + commit: master body: ${{ github.event.inputs.release-notes }} draft: ${{ github.event.inputs.draft }} token: ${{ github.event.inputs.gh-token }} From 65919cf618a8ab1bd9a88bae3d2a1651762c7845 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 11:28:29 -0400 Subject: [PATCH 628/946] list artifacts correctly --- .github/workflows/build-and-release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index babfa13f7..277bc2b94 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -52,9 +52,7 @@ jobs: uses: ncipollo/release-action@v1 with: repo: backup-utils - artifacts: | - ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + artifacts: "./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" # if the tag doesn't exist, we need to set it and the commit field tag: v${{ github.event.inputs.version }} # this can be a commit hash or branch name From 757ed89931a88914bb590c924f54145b29964c29 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 11:55:40 -0400 Subject: [PATCH 629/946] allowUpdate true --- .github/workflows/build-and-release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 277bc2b94..31a0f6d34 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -59,4 +59,6 @@ jobs: commit: master body: ${{ github.event.inputs.release-notes }} draft: ${{ github.event.inputs.draft }} - token: ${{ github.event.inputs.gh-token }} + token: ${{ github.event.inputs.gh-token }} + allowUpdates: true + artifactContentType: "raw" From c191e203e22583182d8a1c6779541003f99a7581 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 12:45:55 -0400 Subject: [PATCH 630/946] pass artifacts to release job --- .github/workflows/build-and-release.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 31a0f6d34..132a4ade2 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -40,19 +40,37 @@ jobs: run: | ./script/package-deb shell: bash + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - name: Package tarball run: | ./script/package-tarball shell: bash + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: needs: build runs-on: ubuntu-latest steps: + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - name: Create Release uses: ncipollo/release-action@v1 with: repo: backup-utils - artifacts: "./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + artifacts: "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_${{ github.event.inputs.version }}_all.deb" # if the tag doesn't exist, we need to set it and the commit field tag: v${{ github.event.inputs.version }} # this can be a commit hash or branch name From 26c2a1d8accfd74f03054505200b1ba5af3d63d2 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 13:37:16 -0400 Subject: [PATCH 631/946] fix the path --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 132a4ade2..65f519cc6 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -44,7 +44,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - name: Package tarball run: | ./script/package-tarball @@ -53,7 +53,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: needs: build runs-on: ubuntu-latest From 8767787be35779e359cf0814a866a170cce0ea54 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 14:42:08 -0400 Subject: [PATCH 632/946] where is the file --- .github/workflows/build-and-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 65f519cc6..6c0a9572e 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -38,22 +38,22 @@ jobs: git push origin v${{ github.event.inputs.version }} - name: Package deb run: | - ./script/package-deb + ./script/package-deb && ls -l && ls -l /dist shell: bash - name: Upload deb artifact uses: actions/upload-artifact@v3 with: name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: /dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - name: Package tarball run: | - ./script/package-tarball + ./script/package-tarball ls -l && ls -l /dist shell: bash - name: Upload tarball artifact uses: actions/upload-artifact@v3 with: name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: /dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: needs: build runs-on: ubuntu-latest From 09bac26d2f0a4e953c1b1a2d90bffb9b21066895 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 14:47:53 -0400 Subject: [PATCH 633/946] find the artifacts --- .github/workflows/build-and-release.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6c0a9572e..02c66f884 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -38,7 +38,11 @@ jobs: git push origin v${{ github.event.inputs.version }} - name: Package deb run: | - ./script/package-deb && ls -l && ls -l /dist + ./script/package-deb + shell: bash + - name: Find deb artifact + run: | + find . -name "github-backup-utils_${{ github.event.inputs.version }}_all.deb" | xargs -I {} cp {} /dist shell: bash - name: Upload deb artifact uses: actions/upload-artifact@v3 @@ -47,7 +51,11 @@ jobs: path: /dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - name: Package tarball run: | - ./script/package-tarball ls -l && ls -l /dist + ./script/package-tarball + shell: bash + - name: Find tarball artifact + run: | + find . -name "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz" | xargs -I {} cp {} /dist shell: bash - name: Upload tarball artifact uses: actions/upload-artifact@v3 From 829f3e1223e84b23c2b4d61f33ddf85e39e6b90d Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:20:28 -0400 Subject: [PATCH 634/946] Update docs/requirements.md Co-authored-by: David Jarzebowski --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index e410c7381..bba51c252 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -57,7 +57,7 @@ Using a [case sensitive][7] file system is also required to avoid conflicts. Performance of backup and restore operations are also dependent on the backup host's storage. We recommend using a high performance storage system with low latency and high IOPS. -Please avoid using NFS mount for the data directory (where backup data is stored) as this can result in performance issues and timeouts during backups. +Please avoid using an NFS mount for the data directory (where backup data is stored) as this can cause performance issues and timeouts during backups. ## GitHub Enterprise Server version requirements From 920bdd3532a42960e00b66ae881a7b814bf2df0c Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 15:31:36 -0400 Subject: [PATCH 635/946] find it --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 02c66f884..ddebebcdb 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -42,7 +42,7 @@ jobs: shell: bash - name: Find deb artifact run: | - find . -name "github-backup-utils_${{ github.event.inputs.version }}_all.deb" | xargs -I {} cp {} /dist + ls -l && find . -name "github-backup-utils_${{ github.event.inputs.version }}_all.deb" shell: bash - name: Upload deb artifact uses: actions/upload-artifact@v3 @@ -55,7 +55,7 @@ jobs: shell: bash - name: Find tarball artifact run: | - find . -name "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz" | xargs -I {} cp {} /dist + ls -l && find . -name "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz" shell: bash - name: Upload tarball artifact uses: actions/upload-artifact@v3 From 9d316088e15529d2fe91dfd2d1e1a9b30decc67d Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali <98570028+chuckp22@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:07:30 -0400 Subject: [PATCH 636/946] Update bin/ghe-host-check Co-authored-by: Quinn Murphy --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index d0fa767fe..9e8d6466b 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -169,7 +169,7 @@ SKIP_MSG . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size" #Check if GHE_DATA_DIR is NFS mounted - fs_info=$(stat -f -c "%T" "$GHE_DATA_DIR") + fs_info=$(stat -f -c "%T" "$GHE_DATA_DIR") || true if [ "$fs_info" == "nfs" ]; then echo "Warning: NFS (Network File System) detected for $GHE_DATA_DIR" 1>&2 echo "Please review https://gh.io/backup-utils-storage-requirements for details." 1>&2 From 2b605d9e62c1798c51607d936d2000282f285735 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 16:44:16 -0400 Subject: [PATCH 637/946] find it --- .github/workflows/build-and-release.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index ddebebcdb..64733a08f 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -42,21 +42,17 @@ jobs: shell: bash - name: Find deb artifact run: | - ls -l && find . -name "github-backup-utils_${{ github.event.inputs.version }}_all.deb" + ls -l && find . -name "github-backup-utils_*_all.deb" && ls -R shell: bash - name: Upload deb artifact uses: actions/upload-artifact@v3 with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: /dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + name: github-backup-utils_3.8.0_all.deb + path: github-backup-utils_3.8.0_all.deb - name: Package tarball run: | ./script/package-tarball shell: bash - - name: Find tarball artifact - run: | - ls -l && find . -name "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz" - shell: bash - name: Upload tarball artifact uses: actions/upload-artifact@v3 with: @@ -69,16 +65,19 @@ jobs: - name: Download deb artifact uses: actions/download-artifact@v3 with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + name: github-backup-utils_3.8.0_all.deb + - name: Display structure of downloaded files + run: | + ls -R - name: Download tarball artifact uses: actions/download-artifact@v3 with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - name: Create Release uses: ncipollo/release-action@v1 with: repo: backup-utils - artifacts: "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_${{ github.event.inputs.version }}_all.deb" + artifacts: "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_3.8.0_all.deb" # if the tag doesn't exist, we need to set it and the commit field tag: v${{ github.event.inputs.version }} # this can be a commit hash or branch name From 81a1cdb50107b5ff9c8ac146874d7ad819ca7d07 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 8 Sep 2023 17:22:33 -0400 Subject: [PATCH 638/946] now we know --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 64733a08f..2a7ff79f3 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -48,7 +48,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: github-backup-utils_3.8.0_all.deb - path: github-backup-utils_3.8.0_all.deb + path: dist/github-backup-utils_3.8.0_all.deb - name: Package tarball run: | ./script/package-tarball @@ -57,7 +57,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: /dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: needs: build runs-on: ubuntu-latest From 1d924a12d3c50ff9e76a0d6560bf9d81d1ae90f2 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Mon, 11 Sep 2023 10:08:43 +0200 Subject: [PATCH 639/946] add post backup cleanup and move progress to folder (#558) --- bin/ghe-backup | 8 ++++---- bin/ghe-backup-progress | 8 ++++---- bin/ghe-restore | 6 +++--- share/github-backup-utils/ghe-backup-config | 13 +++++++++++-- share/github-backup-utils/track-progress | 11 +++++------ test/test-ghe-backup.sh | 2 ++ test/testlib.sh | 6 ++++++ 7 files changed, 35 insertions(+), 19 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 86ee33dd7..d8074156e 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -163,11 +163,11 @@ echo "$GHE_REMOTE_VERSION" > version # Setup progress tracking init-progress export PROGRESS_TOTAL=14 # Minimum number of steps in backup is 14 -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total export PROGRESS_TYPE="Backup" -echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type +echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress/type export PROGRESS=0 # Used to track progress of backup -echo "$PROGRESS" > /tmp/backup-utils-progress +echo "$PROGRESS" > /tmp/backup-utils-progress/progress OPTIONAL_STEPS=0 # Backup actions+mssql @@ -191,7 +191,7 @@ if [ "$GHE_BACKUP_PAGES" != "no" ]; then fi PROGRESS_TOTAL=$((OPTIONAL_STEPS + PROGRESS_TOTAL)) # Minimum number of steps in backup is 14 -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total # check that incremental settings are valid if set is_inc=$(is_incremental_backup_feature_on) diff --git a/bin/ghe-backup-progress b/bin/ghe-backup-progress index 2f4b267fb..7ab36e084 100755 --- a/bin/ghe-backup-progress +++ b/bin/ghe-backup-progress @@ -31,7 +31,7 @@ while true; do done check_for_progress_file() { - if [ ! -f /tmp/backup-utils-progress-info ]; then + if [ ! -f /tmp/backup-utils-progress/info ]; then echo "No progress file found. Has a backup or restore been started?" exit 1 fi @@ -39,18 +39,18 @@ check_for_progress_file() { if [ -n "$ONCE" ]; then check_for_progress_file - cat /tmp/backup-utils-progress-info + cat /tmp/backup-utils-progress/info else check_for_progress_file clear - cat /tmp/backup-utils-progress-info + cat /tmp/backup-utils-progress/info while true; do if read -r -t 1 -n 1; then clear exit ; else clear - cat /tmp/backup-utils-progress-info + cat /tmp/backup-utils-progress/info fi done fi diff --git a/bin/ghe-restore b/bin/ghe-restore index 19603ae47..175d74135 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -315,11 +315,11 @@ fi export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 7)) init-progress -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total +echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total export PROGRESS_TYPE="Restore" -echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress-type +echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress/type export PROGRESS=0 # Used to track progress of restore -echo "$PROGRESS" > /tmp/backup-utils-progress +echo "$PROGRESS" > /tmp/backup-utils-progress/progress # Log restore start message locally and in /var/log/syslog on remote instance START_TIME=$(date +%s) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 5b7f1c3d3..d3f8b05aa 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -652,12 +652,21 @@ restore-secret() { #initialize progress tracking by clearing out the temp files used to track init-progress() { - rm -f /tmp/backup-utils-progress* + if [ -d /tmp/backup-utils-progress ]; then + rm -rf /tmp/backup-utils-progress/* + else + mkdir /tmp/backup-utils-progress + fi + touch /tmp/backup-utils-progress/total + touch /tmp/backup-utils-progress/type + touch /tmp/backup-utils-progress/progress + touch /tmp/backup-utils-progress/info + chmod -R 777 /tmp/backup-utils-progress } #increase total count of progress increment-progress-total-count() { ((PROGRESS_TOTAL += $1)) - echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress-total + echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total } diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index d88b3704f..a560ba540 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -1,13 +1,12 @@ #!/usr/bin/env bash #/ track-progress: track progress of backup or restore tasks -# Current version is working solely with backups progress(){ - PROGRESS=$(cat /tmp/backup-utils-progress) - PROGRESS_TOTAL=$(cat /tmp/backup-utils-progress-total) - PROGRESS_TYPE=$(cat /tmp/backup-utils-progress-type) + PROGRESS=$(cat /tmp/backup-utils-progress/progress) + PROGRESS_TOTAL=$(cat /tmp/backup-utils-progress/total) + PROGRESS_TYPE=$(cat /tmp/backup-utils-progress/type) PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) - echo $((PROGRESS + 1)) > /tmp/backup-utils-progress - echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress-info + echo $((PROGRESS + 1)) > /tmp/backup-utils-progress/progress + echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress/info } diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index 42b6dccff..d6391bbef 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -47,6 +47,8 @@ begin_test "ghe-backup subsequent snapshot" [ "$first_snapshot" != "$this_snapshot" ] verify_all_backedup_data + + verify_progress_cleanup_process ) end_test diff --git a/test/testlib.sh b/test/testlib.sh index e219a50d5..10d6f7821 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -528,6 +528,12 @@ verify_all_backedup_data() { verify_common_data } +# A unified method to make sure post backup, the cleanup process works +verify_progress_cleanup_process() { + set -e + sudo -u nobody rm -rf /tmp/backup-utils-progress/* +} + # A unified method to check everything restored when performing a full restore # during testing. verify_all_restored_data() { From 16c1968f13762cf3f75aca8587d1af421298cbb0 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 09:36:56 -0400 Subject: [PATCH 640/946] rename file for now, clean up debug, get release-notes from directory, fix title --- .github/workflows/build-and-release.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 2a7ff79f3..8b521e539 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -40,15 +40,15 @@ jobs: run: | ./script/package-deb shell: bash - - name: Find deb artifact + - name: Rename deb artifact run: | - ls -l && find . -name "github-backup-utils_*_all.deb" && ls -R + mv dist/$(ls dist | grep github-backup-utils_.*_all.deb) dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb shell: bash - name: Upload deb artifact uses: actions/upload-artifact@v3 with: - name: github-backup-utils_3.8.0_all.deb - path: dist/github-backup-utils_3.8.0_all.deb + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - name: Package tarball run: | ./script/package-tarball @@ -66,9 +66,6 @@ jobs: uses: actions/download-artifact@v3 with: name: github-backup-utils_3.8.0_all.deb - - name: Display structure of downloaded files - run: | - ls -R - name: Download tarball artifact uses: actions/download-artifact@v3 with: @@ -77,12 +74,13 @@ jobs: uses: ncipollo/release-action@v1 with: repo: backup-utils + name: "GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}" artifacts: "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_3.8.0_all.deb" - # if the tag doesn't exist, we need to set it and the commit field + # this action will create a tag with this name on the provided commit tag: v${{ github.event.inputs.version }} # this can be a commit hash or branch name commit: master - body: ${{ github.event.inputs.release-notes }} + body: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} token: ${{ github.event.inputs.gh-token }} allowUpdates: true From fb24a3f8b24884275ea9d0225cbd3d1f339a84e8 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 10:02:25 -0400 Subject: [PATCH 641/946] fix download file name --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 8b521e539..e9229df9b 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -65,7 +65,7 @@ jobs: - name: Download deb artifact uses: actions/download-artifact@v3 with: - name: github-backup-utils_3.8.0_all.deb + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - name: Download tarball artifact uses: actions/download-artifact@v3 with: From 96a69805eafc967e61a0e5d9807d0023f0ebedcf Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 10:05:48 -0400 Subject: [PATCH 642/946] try adding release-controller email --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index e9229df9b..ba61c90f4 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -34,6 +34,7 @@ jobs: - name: Create tag run: | git config --local user.name "release-controller" + git config --local user.email "release-controller@github.com" git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" git push origin v${{ github.event.inputs.version }} - name: Package deb From 978b63978f7f514cea77ac90a6c1af288fcceb10 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 10:06:47 -0400 Subject: [PATCH 643/946] remove --local --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index ba61c90f4..c7c75aa91 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -33,8 +33,8 @@ jobs: sudo apt-get install -y moreutils debhelper help2man devscripts gzip - name: Create tag run: | - git config --local user.name "release-controller" - git config --local user.email "release-controller@github.com" + git config user.name "release-controller" + git config user.email "release-controller@github.com" git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" git push origin v${{ github.event.inputs.version }} - name: Package deb From f52e4e29de8225d178912d5bb6e0012d38f003c8 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 10:40:45 -0400 Subject: [PATCH 644/946] rename artifact correctly --- .github/workflows/build-and-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c7c75aa91..cbaeb6725 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -41,6 +41,7 @@ jobs: run: | ./script/package-deb shell: bash + # many need to remove this once release-notes compilation is automated - name: Rename deb artifact run: | mv dist/$(ls dist | grep github-backup-utils_.*_all.deb) dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb @@ -76,7 +77,7 @@ jobs: with: repo: backup-utils name: "GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}" - artifacts: "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_3.8.0_all.deb" + artifacts: "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_${{ github.event.inputs.version }}_all.deb" # this action will create a tag with this name on the provided commit tag: v${{ github.event.inputs.version }} # this can be a commit hash or branch name From b23a3f7f755b77fd9798ed97d4a10cf4c20fa48c Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 11:17:55 -0400 Subject: [PATCH 645/946] with release notes --- release-notes/12.12.12.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 release-notes/12.12.12.md diff --git a/release-notes/12.12.12.md b/release-notes/12.12.12.md new file mode 100644 index 000000000..0e30c9359 --- /dev/null +++ b/release-notes/12.12.12.md @@ -0,0 +1,9 @@ +### Features + +- To reduce the time to generate a backup using `ghe-backup`, administrators can choose to prune old backup snapshots after a new backup has been generate. For more information, see "[Scheduling backups & snapshot pruning](https://github.com/github/backup-utils/blob/master/docs/scheduling-backups.md)." +- On instances with large MySQL databases , administrators who wish to save storage space can use the new `--incremental` flag with `ghe-backup` and `ghe-restore`. For more information, see "[Incremental MySQL Backups and Restores](https://github.com/github/backup-utils/tree/master/docs/incremental-mysql-backups-and-restores.md)". + +### Changes + +- Removed the `git clone` path for setting up `backup-utils` from the [getting started instructions](https://github.com/github/backup-utils/blob/master/docs/getting-started.md). +- Added `bc` v1.07 or newer to the [requirements](https://github.com/github/backup-utils/blob/master/docs/requirements.md) for a backup host machine. \ No newline at end of file From 59e28bef780c2f1649654418c7d85028190ce037 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 11:51:40 -0400 Subject: [PATCH 646/946] name field correctly --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index cbaeb6725..9d0217f06 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -82,7 +82,7 @@ jobs: tag: v${{ github.event.inputs.version }} # this can be a commit hash or branch name commit: master - body: release-notes/${{ github.event.inputs.version }}.md + bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} token: ${{ github.event.inputs.gh-token }} allowUpdates: true From 41dc43212c7855dbe5d8e2934199e077565805a0 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 12:15:11 -0400 Subject: [PATCH 647/946] linter fixes --- .github/workflows/build-and-release.yml | 84 ++++++++++++++----------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 9d0217f06..6fcb9b3c0 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -25,41 +25,47 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag - run: | - git config user.name "release-controller" - git config user.email "release-controller@github.com" - git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" - git push origin v${{ github.event.inputs.version }} - - name: Package deb - run: | - ./script/package-deb - shell: bash - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - mv dist/$(ls dist | grep github-backup-utils_.*_all.deb) dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - shell: bash - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - shell: bash - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Checkout + uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag + run: | + git config user.name "release-controller" + git config user.email "release-controller@github.com" + git tag -a v${{ github.event.inputs.version }} \ + -m "v${{ github.event.inputs.version }}" + git push origin v${{ github.event.inputs.version }} + - name: Package deb + run: | + ./script/package-deb + shell: bash + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + mv dist/$(ls dist | grep github-backup-utils_.*_all.deb) \ + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + shell: bash + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_\ + all.deb + - name: Package tarball + run: | + ./script/package-tarball + shell: bash + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}\ + .tar.gz release: needs: build runs-on: ubuntu-latest @@ -76,8 +82,12 @@ jobs: uses: ncipollo/release-action@v1 with: repo: backup-utils - name: "GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}" - artifacts: "github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_${{ github.event.inputs.version }}_all.deb" + name: | + GitHub Enterprise Server Backup Utilities \ + v${{ github.event.inputs.version }} + artifacts: | + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils_${{ github.event.inputs.version }}_all.deb # this action will create a tag with this name on the provided commit tag: v${{ github.event.inputs.version }} # this can be a commit hash or branch name From be491ba4fc0983e529f21e3547631bef4f3ef863 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 13:00:05 -0400 Subject: [PATCH 648/946] find the release-notes file --- .github/workflows/build-and-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6fcb9b3c0..47fa1bd1d 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -78,6 +78,9 @@ jobs: uses: actions/download-artifact@v3 with: name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: See all files + run: | + ls -R - name: Create Release uses: ncipollo/release-action@v1 with: From 10f9679d2e8326dbfa6107722e688f06eda87bc9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 13:20:22 -0400 Subject: [PATCH 649/946] have to checkout the branch --- .github/workflows/build-and-release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 47fa1bd1d..00e3f5556 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -70,6 +70,8 @@ jobs: needs: build runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v2 - name: Download deb artifact uses: actions/download-artifact@v3 with: @@ -78,9 +80,6 @@ jobs: uses: actions/download-artifact@v3 with: name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - - name: See all files - run: | - ls -R - name: Create Release uses: ncipollo/release-action@v1 with: From 91dd4f2875bcd6ec299512ed39a8f422e077165a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 13:30:29 -0400 Subject: [PATCH 650/946] fix file paths --- .github/workflows/build-and-release.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 00e3f5556..6a8e0aeea 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -53,8 +53,7 @@ jobs: with: name: github-backup-utils_${{ github.event.inputs.version }}_all.deb path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_\ - all.deb + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - name: Package tarball run: | ./script/package-tarball @@ -64,8 +63,7 @@ jobs: with: name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}\ - .tar.gz + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: needs: build runs-on: ubuntu-latest From 1326890bfb0d6c52b4008e15330780712a383d1d Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 14:05:04 -0400 Subject: [PATCH 651/946] fix trailing white spaces --- .github/workflows/build-and-release.yml | 82 ++++++++++++------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6a8e0aeea..379190505 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -25,45 +25,45 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag - run: | - git config user.name "release-controller" - git config user.email "release-controller@github.com" - git tag -a v${{ github.event.inputs.version }} \ - -m "v${{ github.event.inputs.version }}" - git push origin v${{ github.event.inputs.version }} - - name: Package deb - run: | - ./script/package-deb - shell: bash - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - mv dist/$(ls dist | grep github-backup-utils_.*_all.deb) \ - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - shell: bash - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - shell: bash - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Checkout + uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag + run: | + git config user.name "release-controller" + git config user.email "release-controller@github.com" + git tag -a v${{ github.event.inputs.version }} \ + -m "v${{ github.event.inputs.version }}" + git push origin v${{ github.event.inputs.version }} + - name: Package deb + run: | + ./script/package-deb + shell: bash + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + mv dist/$(ls dist | grep github-backup-utils_.*_all.deb) \ + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + shell: bash + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + shell: bash + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: needs: build runs-on: ubuntu-latest @@ -82,10 +82,10 @@ jobs: uses: ncipollo/release-action@v1 with: repo: backup-utils - name: | + name: | GitHub Enterprise Server Backup Utilities \ v${{ github.event.inputs.version }} - artifacts: | + artifacts: | github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ github-backup-utils_${{ github.event.inputs.version }}_all.deb # this action will create a tag with this name on the provided commit From 147a791aa0c2cf34f5b407f5bee51ef3d7e07f0a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 14:06:14 -0400 Subject: [PATCH 652/946] remove slash in title --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 379190505..a30c8d666 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -83,7 +83,7 @@ jobs: with: repo: backup-utils name: | - GitHub Enterprise Server Backup Utilities \ + GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} artifacts: | github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ From b2931402b9f95ab067df66a1473e3939eb8af384 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 14:10:02 -0400 Subject: [PATCH 653/946] trailing white space --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index a30c8d666..c67e6f9ce 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -83,7 +83,7 @@ jobs: with: repo: backup-utils name: | - GitHub Enterprise Server Backup Utilities + GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} artifacts: | github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ From a765d48d59fb8bd890637d2b1bb256ff01b0cfdc Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 15:18:54 -0400 Subject: [PATCH 654/946] remove test release-notes --- release-notes/12.12.12.md | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 release-notes/12.12.12.md diff --git a/release-notes/12.12.12.md b/release-notes/12.12.12.md deleted file mode 100644 index 0e30c9359..000000000 --- a/release-notes/12.12.12.md +++ /dev/null @@ -1,9 +0,0 @@ -### Features - -- To reduce the time to generate a backup using `ghe-backup`, administrators can choose to prune old backup snapshots after a new backup has been generate. For more information, see "[Scheduling backups & snapshot pruning](https://github.com/github/backup-utils/blob/master/docs/scheduling-backups.md)." -- On instances with large MySQL databases , administrators who wish to save storage space can use the new `--incremental` flag with `ghe-backup` and `ghe-restore`. For more information, see "[Incremental MySQL Backups and Restores](https://github.com/github/backup-utils/tree/master/docs/incremental-mysql-backups-and-restores.md)". - -### Changes - -- Removed the `git clone` path for setting up `backup-utils` from the [getting started instructions](https://github.com/github/backup-utils/blob/master/docs/getting-started.md). -- Added `bc` v1.07 or newer to the [requirements](https://github.com/github/backup-utils/blob/master/docs/requirements.md) for a backup host machine. \ No newline at end of file From 1220249348b4c64e5cba16514096c7b29e441dd9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 15:57:07 -0400 Subject: [PATCH 655/946] trying to fix linter errors --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c67e6f9ce..3c41a9aff 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -45,8 +45,8 @@ jobs: # many need to remove this once release-notes compilation is automated - name: Rename deb artifact run: | - mv dist/$(ls dist | grep github-backup-utils_.*_all.deb) \ - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + "mv dist/$(ls dist | grep 'github-backup-utils_.*_all.deb') \ + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" shell: bash - name: Upload deb artifact uses: actions/upload-artifact@v3 From 06f864b422e652783085099d303da87c79b8a46c Mon Sep 17 00:00:00 2001 From: djdefi Date: Mon, 11 Sep 2023 13:08:41 -0700 Subject: [PATCH 656/946] Workflow dispatch / shellcheck disable invalid check --- .github/workflows/rsync-docker-bump.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index cfc1b24f9..433fa3f96 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -1,6 +1,7 @@ name: Update Rsync Tag in Dockerfile on: + workflow_dispatch: schedule: - cron: '0 0 * * *' # Runs daily at 00:00 @@ -14,6 +15,7 @@ jobs: - name: Get latest rsync tag id: latest_tag + # shellcheck disable=SC2086 run: | curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "name=latest_tag::{}" >> $GITHUB_OUTPUT From fc5c0854e00fc6029f4c9864af7b565a5deb6089 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 16:08:43 -0400 Subject: [PATCH 657/946] fingers crossed --- .github/workflows/build-and-release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 3c41a9aff..011bdf4e9 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -45,8 +45,12 @@ jobs: # many need to remove this once release-notes compilation is automated - name: Rename deb artifact run: | - "mv dist/$(ls dist | grep 'github-backup-utils_.*_all.deb') \ - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done shell: bash - name: Upload deb artifact uses: actions/upload-artifact@v3 From f4e6b2a0d2568dfb72f1b831b429e1bcd6db0895 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 16:09:54 -0400 Subject: [PATCH 658/946] test release-notes --- release-notes/12.12.12.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 release-notes/12.12.12.md diff --git a/release-notes/12.12.12.md b/release-notes/12.12.12.md new file mode 100644 index 000000000..8735a0322 --- /dev/null +++ b/release-notes/12.12.12.md @@ -0,0 +1,11 @@ +# Changes + +### Features + +- To reduce the time to generate a backup using `ghe-backup`, administrators can choose to prune old backup snapshots after a new backup has been generate. For more information, see "[Scheduling backups & snapshot pruning](https://github.com/github/backup-utils/blob/master/docs/scheduling-backups.md)." +- On instances with large MySQL databases , administrators who wish to save storage space can use the new `--incremental` flag with `ghe-backup` and `ghe-restore`. For more information, see "[Incremental MySQL Backups and Restores](https://github.com/github/backup-utils/tree/master/docs/incremental-mysql-backups-and-restores.md)". + +### Changes + +- Removed the `git clone` path for setting up `backup-utils` from the [getting started instructions](https://github.com/github/backup-utils/blob/master/docs/getting-started.md). +- Added `bc` v1.07 or newer to the [requirements](https://github.com/github/backup-utils/blob/master/docs/requirements.md) for a backup host machine. \ No newline at end of file From 77004063857cbfedd380b8fffadf671d8741f485 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 16:35:04 -0400 Subject: [PATCH 659/946] bad command --- .github/workflows/build-and-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 011bdf4e9..b05fe8ca1 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -45,7 +45,6 @@ jobs: # many need to remove this once release-notes compilation is automated - name: Rename deb artifact run: | - run: | for file in dist/github-backup-utils_*_all.deb; do if [[ -f "$file" ]]; then mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" From 09937de499abd68f640210be6a969729212ef48e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 11 Sep 2023 17:00:00 -0400 Subject: [PATCH 660/946] remove test md file --- release-notes/12.12.12.md | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 release-notes/12.12.12.md diff --git a/release-notes/12.12.12.md b/release-notes/12.12.12.md deleted file mode 100644 index 8735a0322..000000000 --- a/release-notes/12.12.12.md +++ /dev/null @@ -1,11 +0,0 @@ -# Changes - -### Features - -- To reduce the time to generate a backup using `ghe-backup`, administrators can choose to prune old backup snapshots after a new backup has been generate. For more information, see "[Scheduling backups & snapshot pruning](https://github.com/github/backup-utils/blob/master/docs/scheduling-backups.md)." -- On instances with large MySQL databases , administrators who wish to save storage space can use the new `--incremental` flag with `ghe-backup` and `ghe-restore`. For more information, see "[Incremental MySQL Backups and Restores](https://github.com/github/backup-utils/tree/master/docs/incremental-mysql-backups-and-restores.md)". - -### Changes - -- Removed the `git clone` path for setting up `backup-utils` from the [getting started instructions](https://github.com/github/backup-utils/blob/master/docs/getting-started.md). -- Added `bc` v1.07 or newer to the [requirements](https://github.com/github/backup-utils/blob/master/docs/requirements.md) for a backup host machine. \ No newline at end of file From 0eb507f55ca264e3e893822ca3d09c7ccc191bc8 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 12 Sep 2023 13:14:47 -0700 Subject: [PATCH 661/946] single line run --- .github/workflows/rsync-docker-bump.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index 433fa3f96..cedcd2468 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -16,8 +16,7 @@ jobs: - name: Get latest rsync tag id: latest_tag # shellcheck disable=SC2086 - run: | - curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "name=latest_tag::{}" >> $GITHUB_OUTPUT + run: curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "name=latest_tag::{}" >> $GITHUB_OUTPUT - name: Update Dockerfile with latest tag run: | From 99837fe47ed57976c9da64c29e92a2972ab7895c Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 12 Sep 2023 13:15:39 -0700 Subject: [PATCH 662/946] remove sc skip comment --- .github/workflows/rsync-docker-bump.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index cedcd2468..6d90b7bbe 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -15,7 +15,6 @@ jobs: - name: Get latest rsync tag id: latest_tag - # shellcheck disable=SC2086 run: curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "name=latest_tag::{}" >> $GITHUB_OUTPUT - name: Update Dockerfile with latest tag From 12d65161975eae7a8b2a7e912e62dbb67fe97f82 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Tue, 12 Sep 2023 15:39:57 -0600 Subject: [PATCH 663/946] back off gist restore in parallel restore case to avoid race condition --- bin/ghe-restore | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 19603ae47..b48c06e5f 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -560,9 +560,18 @@ echo \"$cmd_title\" ghe-restore-repositories \"$GHE_HOSTNAME\"") cmd_title=$(log_info "Restoring Gists ...") -commands+=(" -echo \"$cmd_title\" -ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") +if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then + ## Stagger ghe-restore-repositories-gist with ghe-restore-repositories to avoid + ## race condition to operate on same destination directory + commands+=(" + echo \"$cmd_title\" + sleep 1 + ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") +else + commands+=(" + echo \"$cmd_title\" + ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") +fi if [ "$GHE_BACKUP_PAGES" != "no" ]; then cmd_title=$(log_info "Restoring Pages ...") From 648967cd931a791edaa8c6cdd1d5fdbbbdf080aa Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:22:48 -0600 Subject: [PATCH 664/946] Update ghe-restore --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index b48c06e5f..77a8b089e 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -565,7 +565,7 @@ if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then ## race condition to operate on same destination directory commands+=(" echo \"$cmd_title\" - sleep 1 + sleep 2 ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") else commands+=(" From d60bb64993080576537850b6197decc0ed439c68 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Wed, 13 Sep 2023 11:24:31 -0600 Subject: [PATCH 665/946] Make this change test only --- bin/ghe-restore | 15 +++------------ test/testlib.sh | 2 ++ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index d275e3a16..17a12b8b1 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -563,18 +563,9 @@ echo \"$cmd_title\" ghe-restore-repositories \"$GHE_HOSTNAME\"") cmd_title=$(log_info "Restoring Gists ...") -if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - ## Stagger ghe-restore-repositories-gist with ghe-restore-repositories to avoid - ## race condition to operate on same destination directory - commands+=(" - echo \"$cmd_title\" - sleep 2 - ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") -else - commands+=(" - echo \"$cmd_title\" - ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") -fi +commands+=(" +echo \"$cmd_title\" +ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") if [ "$GHE_BACKUP_PAGES" != "no" ]; then cmd_title=$(log_info "Restoring Pages ...") diff --git a/test/testlib.sh b/test/testlib.sh index 10d6f7821..1d38a8b8e 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -87,6 +87,8 @@ setup_remote_metadata () { mkdir -p "$GHE_REMOTE_DATA_DIR" "$GHE_REMOTE_DATA_USER_DIR" mkdir -p "$GHE_REMOTE_DATA_USER_DIR/common" mkdir -p "$GHE_REMOTE_ROOT_DIR/etc/github" + # Create fake remote repositories dir + mkdir -p "$GHE_REMOTE_DATA_USER_DIR/repositories" } setup_remote_metadata From 8baccb29106d266984efa4a00f20a5e8ce6aeb82 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Wed, 13 Sep 2023 11:30:08 -0600 Subject: [PATCH 666/946] Add integration tests --- .github/workflows/integration-tests.yml | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/integration-tests.yml diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 000000000..1a30dda3b --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,33 @@ +name: Run Integration Tests + +on: [pull_request, workflow_dispatch] + +# Get target and source branch from different variables depending on how it was triggered +env: + TARGET_BRANCH: '${{ github.event.inputs.target-branch }}${{ github.base_ref || github.ref_name }}' + SOURCE_BRANCH: '${{ github.event.inputs.source-branch }}${{ github.head_ref || github.ref_name }}' + +jobs: + integration-tests: + runs-on: ubuntu-latest + strategy: + matrix: + jankyJobName: + - enterprise2-binary-backup + - enterprise2-migration + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Queue ${{ matrix.jankyJobName }} build + run: | + ref="${{ github.ref }}" + merge_branch=${ref#"refs/heads/"} + backup_utils_branch="${{ env.SOURCE_BRANCH }}" + #branch_name="${{ env.TARGET_BRANCH }}" + branch_name="janky-backup-utils-branch-test" + curl -v -X POST \ + -u "hubot:${{ secrets.API_AUTH_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{"buildable_name":"${{ matrix.jankyJobName }}","repo":"enterprise2","branch_name": "'"$branch_name"'","env_vars":{"JANKY_ENV_BACKUP_UTILS_BRANCH": "'"$backup_utils_branch"'" },"force":"true","room_id":"#builds"}' \ + "https://janky.githubapp.com/api/builds" From 841d025adfb713bd57069057eea3cb2b7efeab82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 19:22:17 +0200 Subject: [PATCH 667/946] Avoid duplicating test output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A long time ago, we used to track stdout and stderr separately. When both were combined, the postprocessing instructions of stdout and stderr were incorrectly merged, resulting in the output file being provided on stdin twice [1]. As a process cannot take two input streams, one of them was closed, causing no apparent issue. However, this triggered a shellcheck issue that was later addressed improperly [2], which instructed grep to read the output file from both stdin (by providing the - shorthand for /dev/stdin) and the output file location (by providing it as another file name argument). For this reason, the test output would contain the entire test output twice, once prefixed with “(standard input)” and once with the path to the output file. This fixes the issue by simply removing one of the occurrences of the output file, giving us a single copy of the test output in the case of a failure without unwanted prefixes in front of every output line. [1] 2915ec9aa3a11d4936641bdc9f9f43111817047b [2] 2bc31a99174a9f6ab3de361d3fca18f4bcf2c254 --- test/testlib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testlib.sh b/test/testlib.sh index 10d6f7821..cc7ac4c4b 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -153,7 +153,7 @@ report_failure () { printf "test: %-73s $msg\\n" "$desc ..." ( sed 's/^/ /' <"$TRASHDIR/out" | - grep -a -v -e '^\+ end_test' -e '^+ set +x' - "$TRASHDIR/out" | + grep -a -v -e '^\+ end_test' -e '^+ set +x' | sed 's/[+] test_status=/test failed. last command exited with /' | sed 's/^/ /' ) 1>&2 From e029f6836dbc1fd42e07a4642723e0c643c79da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 20:13:25 +0200 Subject: [PATCH 668/946] Refactor reporting of failures To make the code more symmetric between passed, skipped, and failed tests, this moves the line printing the result for failed tests out of report_failure, which is now only concerned with reporting the output of the failed test. --- test/testlib.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/testlib.sh b/test/testlib.sh index cc7ac4c4b..4f169ce32 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -146,11 +146,7 @@ begin_test () { before_time=$(date '+%s') } -report_failure () { - msg=$1 - desc=$2 - failures=$(( failures + 1 )) - printf "test: %-73s $msg\\n" "$desc ..." +report_failure_output () { ( sed 's/^/ /' <"$TRASHDIR/out" | grep -a -v -e '^\+ end_test' -e '^+ set +x' | @@ -172,7 +168,9 @@ end_test () { elif [ "$test_status" -eq 254 ]; then printf "test: %-65s SKIPPED\\n" "$test_description ..." else - report_failure "FAILED (${elapsed_time}s)" "$test_description ..." + failures=$(( failures + 1 )) + printf "test: %-65s FAILED (${elapsed_time}s)\\n" "$test_description ..." + report_failure_output fi unset test_description From 400e48e24bd15c65df6efca5afe9400da6c6e33e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 20:18:46 +0200 Subject: [PATCH 669/946] Report test runtime in milliseconds --- test/testlib.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/testlib.sh b/test/testlib.sh index 4f169ce32..c7a3cd78d 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -143,7 +143,7 @@ begin_test () { # allow the subshell to exit non-zero without exiting this process set -x +e - before_time=$(date '+%s') + before_time=$(date '+%s.%3N') } report_failure_output () { @@ -158,18 +158,18 @@ report_failure_output () { # Mark the end of a test. end_test () { test_status="${1:-$?}" - after_time=$(date '+%s') - elapsed_time=$((after_time - before_time)) + after_time=$(date '+%s.%3N') + elapsed_time=$(echo "scale=3; $after_time - $before_time" | bc) set +x -e exec 1>&3 2>&4 if [ "$test_status" -eq 0 ]; then - printf "test: %-65s OK (${elapsed_time}s)\\n" "$test_description ..." + printf "test: %-65s OK (%.3fs)\\n" "$test_description ..." "$elapsed_time" elif [ "$test_status" -eq 254 ]; then printf "test: %-65s SKIPPED\\n" "$test_description ..." else failures=$(( failures + 1 )) - printf "test: %-65s FAILED (${elapsed_time}s)\\n" "$test_description ..." + printf "test: %-65s FAILED (%.3fs)\\n" "$test_description ..." "$elapsed_time" report_failure_output fi From cd3cbbb683bdd4523d003a77d72176a6f04ea73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 20:25:54 +0200 Subject: [PATCH 670/946] Truncate test output to exclude test instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds markers right before starting a test case and right after it completed, which are then used to truncate the output of the test case so that it doesn’t include any instructions related to the testing framework, as these aren’t relevant to users inspecting the test ouptut. --- test/testlib.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/testlib.sh b/test/testlib.sh index c7a3cd78d..0696984fc 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -144,20 +144,28 @@ begin_test () { # allow the subshell to exit non-zero without exiting this process set -x +e before_time=$(date '+%s.%3N') + + # Marker to truncate the actual test output later + echo "begin_test_truncate_marker" > /dev/null } report_failure_output () { - ( - sed 's/^/ /' <"$TRASHDIR/out" | - grep -a -v -e '^\+ end_test' -e '^+ set +x' | - sed 's/[+] test_status=/test failed. last command exited with /' | - sed 's/^/ /' - ) 1>&2 + # Truncate the test output to exclude testing-related instructions + echo "$(<"$TRASHDIR/out")" \ + | sed '0,/begin_test_truncate_marker/d' \ + | sed -n '/end_test_truncate_marker/q;p' | head -n -2 \ + | sed 's/^/ /' \ + 1>&2 + echo -e "\nTest failed. The last command exited with exit code $test_status." 1>&2 } # Mark the end of a test. end_test () { test_status="${1:-$?}" + + # Marker to truncate the actual test output later + echo "end_test_truncate_marker" > /dev/null + after_time=$(date '+%s.%3N') elapsed_time=$(echo "scale=3; $after_time - $before_time" | bc) set +x -e From b8d781f1951a8a2999f6b8e6f448a40f5471a135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 20:30:10 +0200 Subject: [PATCH 671/946] Make test output collapsible To make the test logs more pleasant to interact with, this makes the test output of failed test cases collapsible. This avoids cluttering the test overview with the typically very long output of the individual test cases, such that users can get a full overview of all tests by default. If needed, the output of a specific test can easily be expanded in the GitHub Actions user interface. As the GitHub Actions user interface already indents the content of groups, we no longer need to indent it with sed. --- test/testlib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/testlib.sh b/test/testlib.sh index 0696984fc..57a8e8e2d 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -150,13 +150,14 @@ begin_test () { } report_failure_output () { + echo "::group::Output of failed test" 1>&2 # Truncate the test output to exclude testing-related instructions echo "$(<"$TRASHDIR/out")" \ | sed '0,/begin_test_truncate_marker/d' \ | sed -n '/end_test_truncate_marker/q;p' | head -n -2 \ - | sed 's/^/ /' \ 1>&2 echo -e "\nTest failed. The last command exited with exit code $test_status." 1>&2 + echo "::endgroup::" 1>&2 } # Mark the end of a test. From 4d458bcc0a700e59a96a79dce317b3aacaacafa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 20:38:20 +0200 Subject: [PATCH 672/946] Reformat and colorize test logs for legibility This reformats the test logs to improve legibility. A key change is highlighting the test result with corresponding colors to make it easier for developers to spot tests that have failed at a quick glance. The test result and duration are moved to the front of each line to avoid formatting issues because of very long test descriptions that are hard to format in a layout with fixed column widths. Also, this colorizes the commands captured by set -x to visually distinguish them from the actual command output. --- test/testlib.sh | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/test/testlib.sh b/test/testlib.sh index 57a8e8e2d..fb1d509a6 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -57,8 +57,23 @@ ghe_remote_version_config "$GHE_TEST_REMOTE_VERSION" # ghe-restore process groups unset GHE_SNAPSHOT_TIMESTAMP +# Color definitions for log output +color_reset=$(printf '\e[0m') +# Display commands (lines starting with + in the output) in purple +color_command=$(printf '\e[0;35m') +# Display exit code line in red +color_error_message=$(printf '\e[0;31m') +# Display successful tests in bold green +color_pass=$(printf '\e[1;32m') +# Display skipped tests in bold gray +color_skip=$(printf '\e[1;37m') +# Display failed tests in bold red +color_fail=$(printf '\e[1;31m') + # keep track of num tests and failures tests=0 +successes=0 +skipped=0 failures=0 # this runs at process exit @@ -155,8 +170,10 @@ report_failure_output () { echo "$(<"$TRASHDIR/out")" \ | sed '0,/begin_test_truncate_marker/d' \ | sed -n '/end_test_truncate_marker/q;p' | head -n -2 \ + | sed "s/^\(+.*\)$/${color_command}\1${color_reset}/" \ 1>&2 - echo -e "\nTest failed. The last command exited with exit code $test_status." 1>&2 + echo -e "\n${color_error_message}Test failed. The last command exited with exit code" \ + "$test_status.${color_reset}" 1>&2 echo "::endgroup::" 1>&2 } @@ -173,12 +190,19 @@ end_test () { exec 1>&3 2>&4 if [ "$test_status" -eq 0 ]; then - printf "test: %-65s OK (%.3fs)\\n" "$test_description ..." "$elapsed_time" + successes=$(( successes + 1 )) + printf "${color_pass}PASS${color_reset}" 1>&2 elif [ "$test_status" -eq 254 ]; then - printf "test: %-65s SKIPPED\\n" "$test_description ..." + skipped=$(( skipped + 1 )) + printf "${color_skip}SKIP${color_reset}" 1>&2 else failures=$(( failures + 1 )) - printf "test: %-65s FAILED (%.3fs)\\n" "$test_description ..." "$elapsed_time" + printf "${color_fail}FAIL${color_reset}" 1>&2 + fi + + printf " [%8.3f s] $test_description\\n" "$elapsed_time" 1>&2 + + if [ "$test_status" -ne 0 ] && [ "$test_status" -ne 254 ]; then report_failure_output fi From ddfe5b5cfc3e256e45d7df1cdb438a3723c548f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 20:03:53 +0200 Subject: [PATCH 673/946] Include name of test suite in test logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a test fails, it’s not immediately clear which file it belongs to. To address this, this change adds the name of the test suite to the test logs, which corresponds to the name of the test file, omitting the file extension for better legibility. --- test/testlib.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/testlib.sh b/test/testlib.sh index fb1d509a6..9001264b5 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -30,6 +30,9 @@ PATH="$ROOTDIR/test/bin:$ROOTDIR/bin:$ROOTDIR/share/github-backup-utils:$PATH" TMPDIR="$ROOTDIR/test/tmp" TRASHDIR="$TMPDIR/$(basename "$0")-$$" +test_suite_file_name="$(basename "${BASH_SOURCE[1]}")" +test_suite_name="${test_suite_file_name%.*}" + # Set GIT_{AUTHOR,COMMITTER}_{NAME,EMAIL} # This removes the assumption that a git config that specifies these is present. export GIT_AUTHOR_NAME=make GIT_AUTHOR_EMAIL=make GIT_COMMITTER_NAME=make GIT_COMMITTER_EMAIL=make @@ -63,6 +66,8 @@ color_reset=$(printf '\e[0m') color_command=$(printf '\e[0;35m') # Display exit code line in red color_error_message=$(printf '\e[0;31m') +# Display test suite name in blue +color_test_suite=$(printf '\e[0;34m') # Display successful tests in bold green color_pass=$(printf '\e[1;32m') # Display skipped tests in bold gray @@ -200,7 +205,8 @@ end_test () { printf "${color_fail}FAIL${color_reset}" 1>&2 fi - printf " [%8.3f s] $test_description\\n" "$elapsed_time" 1>&2 + printf " [%8.3f s] ${color_test_suite}$test_suite_name${color_reset} $test_description\\n" \ + "$elapsed_time" 1>&2 if [ "$test_status" -ne 0 ] && [ "$test_status" -ne 254 ]; then report_failure_output From 0ecd1b78c843ecf03991b56df54f9579b9b2c575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 19:51:35 +0200 Subject: [PATCH 674/946] Distinguish parallel test suites by name This introduces an override to the test suite name, which is determined as the name of the calling test file without its extension by default. For the parallel tests, the default does not work reliably, as they are essentially just thin wrappers around the test-ghe-backup and test-ghe-restore test suites. --- test/test-ghe-backup-parallel.sh | 3 +++ test/test-ghe-restore-parallel.sh | 3 +++ test/testlib.sh | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/test-ghe-backup-parallel.sh b/test/test-ghe-backup-parallel.sh index c36b98a0d..173c1b66c 100755 --- a/test/test-ghe-backup-parallel.sh +++ b/test/test-ghe-backup-parallel.sh @@ -2,6 +2,9 @@ # ghe-backup command tests run in parallel set -e +# Overwrite default test suite name to distinguish it from test-ghe-backup +export GHE_TEST_SUITE_NAME="test-ghe-backup-parallel" + export GHE_PARALLEL_ENABLED=yes TESTS_DIR="$PWD/$(dirname "$0")" diff --git a/test/test-ghe-restore-parallel.sh b/test/test-ghe-restore-parallel.sh index e0c8a0caa..16cbb2f0f 100755 --- a/test/test-ghe-restore-parallel.sh +++ b/test/test-ghe-restore-parallel.sh @@ -8,6 +8,9 @@ if [[ "$OSTYPE" == "darwin"* ]]; then exit 0 fi +# Overwrite default test suite name to distinguish it from test-ghe-restore +export GHE_TEST_SUITE_NAME="test-ghe-restore-parallel" + export GHE_PARALLEL_ENABLED=yes # use temp dir to fix rsync file issues in parallel execution: diff --git a/test/testlib.sh b/test/testlib.sh index 9001264b5..7a9ac02fa 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -31,7 +31,7 @@ TMPDIR="$ROOTDIR/test/tmp" TRASHDIR="$TMPDIR/$(basename "$0")-$$" test_suite_file_name="$(basename "${BASH_SOURCE[1]}")" -test_suite_name="${test_suite_file_name%.*}" +test_suite_name="${GHE_TEST_SUITE_NAME:-${test_suite_file_name%.*}}" # Set GIT_{AUTHOR,COMMITTER}_{NAME,EMAIL} # This removes the assumption that a git config that specifies these is present. From f1a11687c9ee06e67f11c42ec75784fa7a5c6a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 19:40:48 +0200 Subject: [PATCH 675/946] Remove debug output This line clutters the test output and does not appear to be useful. --- test/testlib.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test/testlib.sh b/test/testlib.sh index 7a9ac02fa..c7a1f6539 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -443,7 +443,6 @@ setup_minio_test_data() { bucket="packages" mkdir -p "$bucket" - echo "an example blob" "$bucket/91dfa09f-1801-4e00-95ee-6b763d7da3e2" } cleanup_minio_test_data() { From abfccfb8b4ec23982fee2ab1082a25ec1f23962f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 13 Sep 2023 19:36:17 +0200 Subject: [PATCH 676/946] Produce Markdown test summary --- script/cibuild | 21 ++++++++++++++++++--- test/testlib.sh | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/script/cibuild b/script/cibuild index 73dc9ae0a..22f7ffd08 100755 --- a/script/cibuild +++ b/script/cibuild @@ -2,13 +2,31 @@ # Usage: script/cibuild [--no-package] set -e +ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" +TMPDIR="$ROOTDIR/test/tmp" + +# Remove possible remnants of previous test runs +rm -rf "${TMPDIR:?}/*" + +print_test_results() { + if [ -n "$GITHUB_STEP_SUMMARY" ]; then + echo -e "### Test results\n" >> "$GITHUB_STEP_SUMMARY" + echo "| Test suite | Result | Successful | Failed | Skipped | Duration |" >> "$GITHUB_STEP_SUMMARY" + echo "|---|---|--:|--:|--:|--:|" >> "$GITHUB_STEP_SUMMARY" + sort -V "$TMPDIR/results" >> "$GITHUB_STEP_SUMMARY" + fi +} + # Enable verbose logging of ssh commands export GHE_VERBOSE_SSH=true if ! find test -name "test-*.sh" -print0 | xargs -0 -n 1 /bin/bash; then + print_test_results exit 1 fi +print_test_results + # Bail out when --no-package given [ "$1" = "--no-package" ] && exit 0 @@ -16,9 +34,6 @@ fi pkg_files= # Build the tarball -ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -TMPDIR="$ROOTDIR/test/tmp" - echo "Building tar.gz package ..." if script/package-tarball 1>$TMPDIR/package-tarball.txt 2>&1; then pkg_files=$(grep '^Package ' < $TMPDIR/package-tarball.txt | cut -f 2 -d ' ') diff --git a/test/testlib.sh b/test/testlib.sh index c7a1f6539..44bbaed67 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -32,6 +32,8 @@ TRASHDIR="$TMPDIR/$(basename "$0")-$$" test_suite_file_name="$(basename "${BASH_SOURCE[1]}")" test_suite_name="${GHE_TEST_SUITE_NAME:-${test_suite_file_name%.*}}" +results_file="$TMPDIR/results" +test_suite_before_time=$(date '+%s.%3N') # Set GIT_{AUTHOR,COMMITTER}_{NAME,EMAIL} # This removes the assumption that a git config that specifies these is present. @@ -85,6 +87,27 @@ failures=0 atexit () { res=$? + test_suite_after_time=$(date '+%s.%3N') + test_suite_elapsed_time=$(echo "scale=3; $test_suite_after_time - $test_suite_before_time" | bc) + + # Temporarily redirect stdout output to results file + exec 3<&1 + exec 1>>"$results_file" + + # Print test summary for this test suite + echo -n "| $test_suite_name | " + + if [ "$failures" -eq "0" ]; then + echo -n ":green_circle: passed" + else + echo -n ":red_circle: failed" + fi + + printf " | $successes | $failures | $skipped | %.3f s |\\n" "$test_suite_elapsed_time" + + # Restore stdout + exec 1<&3 + [ -z "$KEEPTRASH" ] && rm -rf "$TRASHDIR" if [ $failures -gt 0 ]; then exit 1 From e730d2b3c587dcb1e191f9f55a942d63968c1752 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 14 Sep 2023 10:02:22 -0400 Subject: [PATCH 677/946] remove token input --- .github/workflows/build-and-release.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index b05fe8ca1..b581eff7c 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -3,10 +3,6 @@ name: Build and Release on: workflow_dispatch: inputs: - gh-token: - description: 'GitHub Token - used to create the release' - required: true - type: string version: description: 'Version - patch version of the release (e.g. x.y.z)' required: true @@ -97,6 +93,5 @@ jobs: commit: master bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} - token: ${{ github.event.inputs.gh-token }} allowUpdates: true artifactContentType: "raw" From d4ccab2cf8f3053832f539c89d28f68c4ba88fd1 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 14 Sep 2023 10:03:22 -0400 Subject: [PATCH 678/946] try without shell field --- .github/workflows/build-and-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index b581eff7c..94056e00e 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -37,7 +37,6 @@ jobs: - name: Package deb run: | ./script/package-deb - shell: bash # many need to remove this once release-notes compilation is automated - name: Rename deb artifact run: | @@ -46,7 +45,6 @@ jobs: mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" fi done - shell: bash - name: Upload deb artifact uses: actions/upload-artifact@v3 with: From a8e8e9eb2c330b1e45b317bbd398a37fd8c7d5ac Mon Sep 17 00:00:00 2001 From: alejndr0 Date: Thu, 14 Sep 2023 14:04:15 +0000 Subject: [PATCH 679/946] Disable compression --- share/github-backup-utils/ghe-backup-actions | 2 +- share/github-backup-utils/ghe-backup-es-rsync | 4 ++-- share/github-backup-utils/ghe-backup-minio | 1 - share/github-backup-utils/ghe-backup-pages | 2 +- share/github-backup-utils/ghe-backup-userdata | 2 +- share/github-backup-utils/ghe-restore-es-audit-log | 2 +- share/github-backup-utils/ghe-restore-es-rsync | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-actions b/share/github-backup-utils/ghe-backup-actions index aa02191be..b3f51741e 100755 --- a/share/github-backup-utils/ghe-backup-actions +++ b/share/github-backup-utils/ghe-backup-actions @@ -39,7 +39,7 @@ fi # Transfer all Actions data from the user data directory using rsync. ghe_verbose "* Transferring Actions files from $host ..." log_rsync "BEGIN: actions rsync" 1>&3 -ghe-rsync -avz \ +ghe-rsync -av \ -e "ghe-ssh -p $port" \ --rsync-path='sudo -u actions rsync' \ --exclude "mutexes" --exclude "dumps" --exclude "tmp" \ diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync index ee61741b2..fce7043bb 100755 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ b/share/github-backup-utils/ghe-backup-es-rsync @@ -45,7 +45,7 @@ fi # already been transferred. ghe_verbose "* Performing initial sync of ES indices ..." log_rsync "BEGIN elasticsearch rsync" 1>&3 -ghe-rsync -avz \ +ghe-rsync -av \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path="sudo -u elasticsearch rsync" \ $link_dest \ @@ -70,7 +70,7 @@ ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null # Transfer all ES indices again ghe_verbose "* Performing follow-up sync of ES indices ..." log_rsync "BEGIN: elasticsearch followup rsync" 1>&3 -ghe-rsync -avz \ +ghe-rsync -av \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path="sudo -u elasticsearch rsync" \ $link_dest \ diff --git a/share/github-backup-utils/ghe-backup-minio b/share/github-backup-utils/ghe-backup-minio index 7f6a18b22..bf7a429d4 100755 --- a/share/github-backup-utils/ghe-backup-minio +++ b/share/github-backup-utils/ghe-backup-minio @@ -45,7 +45,6 @@ log_rsync "BEGIN: minio rsync" 1>&3 ghe-rsync \ --archive \ --verbose \ - --compress \ --rsh="ghe-ssh -p ${port}" \ --rsync-path='sudo -u minio rsync' \ --exclude=".minio.sys" \ diff --git a/share/github-backup-utils/ghe-backup-pages b/share/github-backup-utils/ghe-backup-pages index b0c9f1fed..2b79825cf 100755 --- a/share/github-backup-utils/ghe-backup-pages +++ b/share/github-backup-utils/ghe-backup-pages @@ -75,7 +75,7 @@ for hostname in $hostnames; do ghe_verbose "* Transferring pages files ..." log_rsync "BEGIN: pages rsync" 1>&3 # Transfer all data from the user data directory using rsync. - ghe-rsync -avz \ + ghe-rsync -av \ -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ --rsync-path='sudo -u git rsync' \ $link_dest \ diff --git a/share/github-backup-utils/ghe-backup-userdata b/share/github-backup-utils/ghe-backup-userdata index f332c27c4..d7c7dc233 100755 --- a/share/github-backup-utils/ghe-backup-userdata +++ b/share/github-backup-utils/ghe-backup-userdata @@ -54,7 +54,7 @@ fi mkdir -p "$GHE_SNAPSHOT_DIR/$dirname" log_rsync "BEGIN: userdata rsync" 1>&3 # Transfer all data from the user data directory using rsync. -ghe-rsync -avz \ +ghe-rsync -av \ -e "ghe-ssh -p $(ssh_port_part "$host")" \ --rsync-path='sudo -u git rsync' \ $link_dest \ diff --git a/share/github-backup-utils/ghe-restore-es-audit-log b/share/github-backup-utils/ghe-restore-es-audit-log index 06b63973b..0ed3d37b2 100755 --- a/share/github-backup-utils/ghe-restore-es-audit-log +++ b/share/github-backup-utils/ghe-restore-es-audit-log @@ -51,7 +51,7 @@ if [ -s "$tmp_list" ]; then ghe-ssh "$GHE_HOSTNAME" -- "sudo mkdir -p '$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore'" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown elasticsearch:elasticsearch '$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore'" 1>&3 log_rsync "BEGIN: es-audit log rsync" 1>&3 - ghe-rsync -avz --delete \ + ghe-rsync -av --delete \ -e "ghe-ssh -p $(ssh_port_part "$GHE_HOSTNAME")" \ --rsync-path="sudo -u elasticsearch rsync" \ --files-from=$tmp_list \ diff --git a/share/github-backup-utils/ghe-restore-es-rsync b/share/github-backup-utils/ghe-restore-es-rsync index b1d9b2179..1ba09afed 100755 --- a/share/github-backup-utils/ghe-restore-es-rsync +++ b/share/github-backup-utils/ghe-restore-es-rsync @@ -37,7 +37,7 @@ else ghe-ssh "$GHE_HOSTNAME" -- "sudo mkdir -p '$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore'" 1>&3 ghe-ssh "$GHE_HOSTNAME" -- "sudo chown elasticsearch:elasticsearch '$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore'" 1>&3 log_rsync "BEGIN: elasticsearch rsync" 1>&3 - ghe-rsync -avz --delete \ + ghe-rsync -av --delete \ -e "ghe-ssh -p $(ssh_port_part "$GHE_HOSTNAME")" \ --rsync-path="sudo -u elasticsearch rsync" \ --copy-dest="$GHE_REMOTE_DATA_USER_DIR/elasticsearch" \ From 8ebf223b2c2ed5535c9675e75e453b9e4ebd9fae Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 14 Sep 2023 10:10:05 -0400 Subject: [PATCH 680/946] set email to team distribution list --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 94056e00e..b3a989b50 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -30,7 +30,7 @@ jobs: - name: Create tag run: | git config user.name "release-controller" - git config user.email "release-controller@github.com" + git config user.email "ghes-releases-team@github.com" git tag -a v${{ github.event.inputs.version }} \ -m "v${{ github.event.inputs.version }}" git push origin v${{ github.event.inputs.version }} From 41071a4c6f0841b36b3d7676f09d4c8da061404f Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 14 Sep 2023 10:11:33 -0400 Subject: [PATCH 681/946] test release-notes --- release-notes/12.12.12.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 release-notes/12.12.12.md diff --git a/release-notes/12.12.12.md b/release-notes/12.12.12.md new file mode 100644 index 000000000..192f42d88 --- /dev/null +++ b/release-notes/12.12.12.md @@ -0,0 +1,11 @@ +# Release Notes + +### Features + +- To reduce the time to generate a backup using `ghe-backup`, administrators can choose to prune old backup snapshots after a new backup has been generate. For more information, see "[Scheduling backups & snapshot pruning](https://github.com/github/backup-utils/blob/master/docs/scheduling-backups.md)." +- On instances with large MySQL databases , administrators who wish to save storage space can use the new `--incremental` flag with `ghe-backup` and `ghe-restore`. For more information, see "[Incremental MySQL Backups and Restores](https://github.com/github/backup-utils/tree/master/docs/incremental-mysql-backups-and-restores.md)". + +### Changes + +- Removed the `git clone` path for setting up `backup-utils` from the [getting started instructions](https://github.com/github/backup-utils/blob/master/docs/getting-started.md). +- Added `bc` v1.07 or newer to the [requirements](https://github.com/github/backup-utils/blob/master/docs/requirements.md) for a backup host machine. \ No newline at end of file From 08fe226d5462d9147833111b2eebfe37b554a145 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 14 Sep 2023 10:12:55 -0400 Subject: [PATCH 682/946] release notes will be in the project --- .github/workflows/build-and-release.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index b3a989b50..acffa376d 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -7,10 +7,6 @@ on: description: 'Version - patch version of the release (e.g. x.y.z)' required: true type: string - release-notes: - description: 'Release Notes - string of markdown' - required: true - type: string draft: description: 'Draft - true if the release should be a draft' required: true From 439e87d4af70bcadc5ac19a0a14d4ae129bd5761 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 14 Sep 2023 10:29:24 -0400 Subject: [PATCH 683/946] associate release with empty commit so tags don't stack up on one commit --- .github/workflows/build-and-release.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index acffa376d..8d3afa195 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -60,7 +60,23 @@ jobs: release: needs: build runs-on: ubuntu-latest + outputs: + commit_sha: ${{ steps.release.outputs.commit_sha }} steps: + # checkout another repo and create an empty commit + # this is needed because the release action requires a tag + - name: Checkout + uses: actions/checkout@v2 + with: + repository: github/backup-utils + ref: master + - name: Create empty commit + run: | + git config user.name "release-controller" + git config user.email "ghes-releases-team@github.com" + git commit --allow-empty -m "${{ github.event.inputs.version }} release" + git push origin master + echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Checkout uses: actions/checkout@v2 - name: Download deb artifact From 573860d39c2ad54b09cadd0b20cab02f218bc225 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Thu, 14 Sep 2023 11:15:47 -0400 Subject: [PATCH 684/946] use the empty commit sha for the release --- .github/workflows/build-and-release.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 8d3afa195..81ba0d9e6 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -61,22 +61,21 @@ jobs: needs: build runs-on: ubuntu-latest outputs: - commit_sha: ${{ steps.release.outputs.commit_sha }} + commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} steps: - # checkout another repo and create an empty commit - # this is needed because the release action requires a tag - name: Checkout uses: actions/checkout@v2 with: repository: github/backup-utils ref: master - name: Create empty commit + id: empty_commit run: | git config user.name "release-controller" git config user.email "ghes-releases-team@github.com" git commit --allow-empty -m "${{ github.event.inputs.version }} release" git push origin master - echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Checkout uses: actions/checkout@v2 - name: Download deb artifact @@ -100,7 +99,7 @@ jobs: # this action will create a tag with this name on the provided commit tag: v${{ github.event.inputs.version }} # this can be a commit hash or branch name - commit: master + commit: ${{ steps.empty_commit.outputs.commit_sha }} bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true From c69ac4e35291a0317f6c76fe1ea87fecbc7e3ffd Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 14 Sep 2023 13:23:39 -0700 Subject: [PATCH 685/946] Update rsync-docker-bump.yml Co-authored-by: Quinn Murphy --- .github/workflows/rsync-docker-bump.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index 6d90b7bbe..2cfe7782c 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -15,7 +15,7 @@ jobs: - name: Get latest rsync tag id: latest_tag - run: curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "name=latest_tag::{}" >> $GITHUB_OUTPUT + run: curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[].name' | grep -m1 -v pre | xargs -I {} echo "name=latest_tag::{}" >> "$GITHUB_OUTPUT" - name: Update Dockerfile with latest tag run: | From afa8e8dbee29b71788e241467bdf417459c79dab Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Thu, 14 Sep 2023 22:57:30 -0600 Subject: [PATCH 686/946] Triger new templated jobs --- .github/workflows/integration-tests.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 1a30dda3b..053f760bf 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -13,8 +13,8 @@ jobs: strategy: matrix: jankyJobName: - - enterprise2-binary-backup - - enterprise2-migration + - enterprise2-backup-utils-binary-backup + - enterprise2-backup-utils-migration steps: - uses: actions/checkout@v3 with: @@ -24,10 +24,9 @@ jobs: ref="${{ github.ref }}" merge_branch=${ref#"refs/heads/"} backup_utils_branch="${{ env.SOURCE_BRANCH }}" - #branch_name="${{ env.TARGET_BRANCH }}" - branch_name="janky-backup-utils-branch-test" + branch_name="${{ env.TARGET_BRANCH }}" curl -v -X POST \ -u "hubot:${{ secrets.API_AUTH_TOKEN }}" \ -H "Content-Type: application/json" \ - -d '{"buildable_name":"${{ matrix.jankyJobName }}","repo":"enterprise2","branch_name": "'"$branch_name"'","env_vars":{"JANKY_ENV_BACKUP_UTILS_BRANCH": "'"$backup_utils_branch"'" },"force":"true","room_id":"#builds"}' \ + -d '{"buildable_name":"${{ matrix.jankyJobName }}","repo":"${{ github.repository }}","branch_name": "'"$branch_name"'","env_vars":{"JANKY_ENV_BACKUP_UTILS_BRANCH": "'"$backup_utils_branch"'" },"force":"true","room_id":"#builds"}' \ "https://janky.githubapp.com/api/builds" From 307fe2fec0630ec5a0723737f1849ca8b9ba5c18 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 15 Sep 2023 11:07:28 -0400 Subject: [PATCH 687/946] use release controller app token --- .github/workflows/build-and-release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 81ba0d9e6..dd0df9099 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -63,16 +63,21 @@ jobs: outputs: commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + # required + app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - name: Checkout uses: actions/checkout@v2 with: + token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils ref: master - name: Create empty commit id: empty_commit run: | - git config user.name "release-controller" - git config user.email "ghes-releases-team@github.com" git commit --allow-empty -m "${{ github.event.inputs.version }} release" git push origin master echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT @@ -89,6 +94,7 @@ jobs: - name: Create Release uses: ncipollo/release-action@v1 with: + token: ${{ steps.app-token.outputs.token }} repo: backup-utils name: | GitHub Enterprise Server Backup Utilities From e1a92a553a3d977bf297a5de8c246c81d3476848 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 15 Sep 2023 12:17:17 -0400 Subject: [PATCH 688/946] fix backup.config typo (#587) Fixing https://github.com/github/ghes/issues/7329 --- backup.config-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index 688cc374b..d1ea977e2 100644 --- a/backup.config-example +++ b/backup.config-example @@ -26,7 +26,7 @@ GHE_NUM_SNAPSHOTS=10 # performed before the next full backup is created. # For example, if `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will # run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle. -#GHE_INCREMENTAL_BACKUP_MAX=14 +#GHE_INCREMENTAL_MAX_BACKUPS=14 # If GHE_SKIP_CHECKS is set to true (or if --skip-checks is used with ghe-backup) then ghe-host-check # disk space validation and software version checks on the backup-host will be disabled. From 6042e5151caaf410889d6b3f0bf3fee370eefd2a Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 15 Sep 2023 10:40:55 -0600 Subject: [PATCH 689/946] update workflow dispatch rules --- .github/workflows/integration-tests.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 053f760bf..895d6c692 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,6 +1,17 @@ name: Run Integration Tests -on: [pull_request, workflow_dispatch] +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: ['master', 'enterprise-[0-9]*.[0-9]*-release', 'enterprise-[0-9]*.[0-9]*.[0-9]*-release'] + workflow_dispatch: + inputs: + target-branch: + description: 'Branch that would be merged into' + required: true + source-branch: + description: 'Branch that would be merged' + required: true # Get target and source branch from different variables depending on how it was triggered env: @@ -21,8 +32,6 @@ jobs: fetch-depth: 1 - name: Queue ${{ matrix.jankyJobName }} build run: | - ref="${{ github.ref }}" - merge_branch=${ref#"refs/heads/"} backup_utils_branch="${{ env.SOURCE_BRANCH }}" branch_name="${{ env.TARGET_BRANCH }}" curl -v -X POST \ From a10db47c0fcaa601be1a7361e20f292918f6c2e3 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 15 Sep 2023 12:35:24 -0600 Subject: [PATCH 690/946] Use proxy-janky-build actions --- .github/actions/proxy-janky-build/action.yml | 29 +++ .github/actions/proxy-janky-build/go.mod | 7 + .github/actions/proxy-janky-build/go.sum | 9 + .github/actions/proxy-janky-build/main.go | 177 +++++++++++++++++++ .github/workflows/integration-tests.yml | 15 +- 5 files changed, 229 insertions(+), 8 deletions(-) create mode 100644 .github/actions/proxy-janky-build/action.yml create mode 100644 .github/actions/proxy-janky-build/go.mod create mode 100644 .github/actions/proxy-janky-build/go.sum create mode 100644 .github/actions/proxy-janky-build/main.go diff --git a/.github/actions/proxy-janky-build/action.yml b/.github/actions/proxy-janky-build/action.yml new file mode 100644 index 000000000..fe36d27b4 --- /dev/null +++ b/.github/actions/proxy-janky-build/action.yml @@ -0,0 +1,29 @@ +name: 'Trigger a CI Job on Janky' +description: 'Action to trigger and poll a Janky CI job' +inputs: + janky-token: + description: 'Token for making request to Janky' + required: true + job-name: + description: 'The name of the job to run' + required: true + branch-name: + description: 'The name of the branch to use' + required: true + envVars: + description: 'Comma separated list of key value pairs to pass to Janky - ex: key1=value1,key2=value2,key3=value3' + required: false +runs: + using: 'composite' + steps: + - uses: actions/setup-go@a3d889c34c5d4e071b33595c5fe8edfcaaad8260 + with: + go-version: '1.21' + - run: | + go run main.go \ + -token ${{ inputs.janky-token }} \ + -job ${{ inputs.job-name }} \ + -branch ${{ inputs.branch-name }} \ + -envVars ${{ inputs.envVars }} + shell: bash + working-directory: .github/actions/proxy-janky-build diff --git a/.github/actions/proxy-janky-build/go.mod b/.github/actions/proxy-janky-build/go.mod new file mode 100644 index 000000000..b7560d7b9 --- /dev/null +++ b/.github/actions/proxy-janky-build/go.mod @@ -0,0 +1,7 @@ +module github.com/github/enterprise2/actions/proxy-janky-build + +go 1.21 + +require github.com/hashicorp/go-retryablehttp v0.7.2 + +require github.com/hashicorp/go-cleanhttp v0.5.2 // indirect diff --git a/.github/actions/proxy-janky-build/go.sum b/.github/actions/proxy-janky-build/go.sum new file mode 100644 index 000000000..5c59c1d2e --- /dev/null +++ b/.github/actions/proxy-janky-build/go.sum @@ -0,0 +1,9 @@ +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUDDYFRKq/RAd0= +github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= diff --git a/.github/actions/proxy-janky-build/main.go b/.github/actions/proxy-janky-build/main.go new file mode 100644 index 000000000..cfc120295 --- /dev/null +++ b/.github/actions/proxy-janky-build/main.go @@ -0,0 +1,177 @@ +package main + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "flag" + "fmt" + "io" + "log" + "net/http" + "regexp" + "strings" + "time" + + "github.com/hashicorp/go-retryablehttp" +) + +// Define our Janky Response Structs +type JankyBuildStruct struct { + Result string + Url string +} +type JankyStatusStruct struct { + Id string + Green bool + Completed bool + StartedAt string + CompletedAt string + Sha string + BuildableName string +} + +const ( + pollWaitTime = 10 * time.Second + jankyPollTimeout = 5 * time.Hour + jankyHttpRetryMax = 5 + jankyUrl = "https://janky.githubapp.com" +) + +func main() { + // Parse command-line arguments + job := flag.String("job", "", "Name of the Janky job") + token := flag.String("token", "", "Name of the Janky token") + branch := flag.String("branch", "", "Name of the Git branch") + envVars := flag.String("envVars", "", "Comma separated list of key value pairs to pass to Janky - ex: key1=value1,key2=value2,key3=value3") + flag.Parse() + + // Validate command-line arguments + if *job == "" || *token == "" || *branch == "" { + log.Fatal("job, token and branch flags must be specified") + } + + // Set up the token + request payload + authToken := base64.StdEncoding.EncodeToString([]byte(":" + *token)) + type buildRequestObject struct { + BuildableName string `json:"buildable_name"` + BranchName string `json:"branch_name"` + EnvVars map[string]string `json:"env_vars"` + } + + requestBody := buildRequestObject{ + BuildableName: *job, + BranchName: *branch, + } + + // Parse the envVars flag into a map and add to the request payload + fmt.Println("Environment Variables:") + fmt.Println(*envVars) + if *envVars != "" { + envVarsMap := make(map[string]string) + for _, envVar := range strings.Split(*envVars, ",") { + envVarSplit := strings.Split(envVar, "=") + envVarsMap[envVarSplit[0]] = envVarSplit[1] + } + requestBody.EnvVars = envVarsMap + } + + payloadBytes, err := json.Marshal(requestBody) + if err != nil { + log.Fatal("Failed to marshal the JSON payload!\n" + err.Error()) + } + + // Send build request to Janky + buildRequest, err := http.NewRequest("POST", jankyUrl+"/api/builds", bytes.NewBuffer(payloadBytes)) + if err != nil { + log.Fatal("Failed to create build request!\n" + err.Error()) + } + buildRequest.Header.Set("Content-Type", "application/json") + buildRequest.Header.Set("Authorization", "Basic "+authToken) + retryClient := retryablehttp.NewClient() + retryClient.RetryMax = jankyHttpRetryMax + retryClient.Logger = nil // disable debug logging + client := retryClient.StandardClient() // uses *http.Client + resp, err := client.Do(buildRequest) + if err != nil { + log.Fatal("Failed to send build request!\n" + err.Error()) + } + defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + if err != nil { + log.Fatal("Error reading build response!\n" + err.Error()) + } + + // Check if the build was triggered successfully + if resp.StatusCode == 404 { + log.Fatal("Failed to trigger build! Either " + *job + " is not the name of a Janky job or " + *branch + " is not a branch for the repository that job belongs to.") + } + if resp.StatusCode != 201 { + log.Fatal("Failed to trigger build! Got exception: " + string(body)) + } + + // Parse the build request response + var buildResponse JankyBuildStruct + json.Unmarshal(body, &buildResponse) + log.Println("Succesfully triggered janky!\n" + buildResponse.Result) + + // Parse the request response for the buildId + r, err := regexp.Compile("/[0-9]+/") + if err != nil { + log.Fatal("Failed to trigger build!\n" + err.Error()) + } + buildId := strings.Trim(r.FindString(buildResponse.Result), "/") + + // Setup our second HTTP client for reuse in during status polling + jankyStatusUrl := jankyUrl + "/api/" + buildId + "/status" + statusRequest, err := http.NewRequest("GET", jankyStatusUrl, nil) + if err != nil { + log.Fatal("Failed to create status request!\n" + err.Error()) + } + statusRequest.Header.Set("Content-Type", "application/json") + statusRequest.Header.Set("Authorization", "Basic "+authToken) + retryClient2 := retryablehttp.NewClient() + retryClient2.RetryMax = jankyHttpRetryMax + retryClient2.Logger = nil // disable debug logging + client2 := retryClient2.StandardClient() // uses *http.Client + + // Wait for a completed status from Janky or break the loop after a certain amount of time + timeout := time.NewTimer(jankyPollTimeout) + poll := time.NewTicker(pollWaitTime) + +jobLoop: + for { + select { + case <-timeout.C: + log.Fatal("Failed to poll for build status after " + jankyPollTimeout.String() + "hours") + case <-poll.C: + // Send build status request to Janky + statusResponse, err := client2.Do(statusRequest) + if err != nil { + log.Fatal("Failed to send status request!\n" + err.Error()) + } + defer statusResponse.Body.Close() + statusBody, err := io.ReadAll(statusResponse.Body) + if err != nil { + log.Fatal("Error reading status response!\n" + err.Error()) + } + + // Parse the status response for a green completed build + var jankyStatusResponse JankyStatusStruct + json.Unmarshal(statusBody, &jankyStatusResponse) + //fmt.Println("Janky Status Response:") + //fmt.Println(string(statusBody)) + if jankyStatusResponse.Completed && jankyStatusResponse.Green { + log.Println("Janky build Succeeded!") + break jobLoop + } + if jankyStatusResponse.Completed && !jankyStatusResponse.Green { + log.Fatal("Build failed, see Janky for more info: " + buildResponse.Url) + } + + // wait for a bit and try again + log.Println("Build still in progress, will poll for status again in [" + pollWaitTime.String() + "]") + continue + } + } +} diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 895d6c692..d97350957 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -31,11 +31,10 @@ jobs: with: fetch-depth: 1 - name: Queue ${{ matrix.jankyJobName }} build - run: | - backup_utils_branch="${{ env.SOURCE_BRANCH }}" - branch_name="${{ env.TARGET_BRANCH }}" - curl -v -X POST \ - -u "hubot:${{ secrets.API_AUTH_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d '{"buildable_name":"${{ matrix.jankyJobName }}","repo":"${{ github.repository }}","branch_name": "'"$branch_name"'","env_vars":{"JANKY_ENV_BACKUP_UTILS_BRANCH": "'"$backup_utils_branch"'" },"force":"true","room_id":"#builds"}' \ - "https://janky.githubapp.com/api/builds" + uses: ./.github/actions/proxy-janky-build + id: proxy-janky-build + with: + janky-token: '${{ secrets.API_AUTH_TOKEN }}' + job-name: '${{ matrix.jankyJobName }}' + branch-name: '${{ env.TARGET_BRANCH }}' + envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }}" From 44b713ed91852e3b03d7598c25d66004ddacb898 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 15 Sep 2023 14:49:04 -0400 Subject: [PATCH 691/946] use token for tag creation --- .github/workflows/build-and-release.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index dd0df9099..f6194bb55 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -17,16 +17,22 @@ jobs: build: runs-on: ubuntu-latest steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + # required + app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - name: Checkout uses: actions/checkout@v2 + with: + token: ${{ steps.app-token.outputs.token }} - name: Install dependencies run: | sudo apt-get update -y sudo apt-get install -y moreutils debhelper help2man devscripts gzip - name: Create tag run: | - git config user.name "release-controller" - git config user.email "ghes-releases-team@github.com" git tag -a v${{ github.event.inputs.version }} \ -m "v${{ github.event.inputs.version }}" git push origin v${{ github.event.inputs.version }} @@ -50,7 +56,6 @@ jobs: - name: Package tarball run: | ./script/package-tarball - shell: bash - name: Upload tarball artifact uses: actions/upload-artifact@v3 with: From c9e22e96c4fbcb1db178f62b305d32c8c3d7cf7c Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 15 Sep 2023 12:50:34 -0600 Subject: [PATCH 692/946] Force build --- .github/actions/proxy-janky-build/action.yml | 4 ++++ .github/actions/proxy-janky-build/main.go | 3 +++ .github/workflows/integration-tests.yml | 1 + 3 files changed, 8 insertions(+) diff --git a/.github/actions/proxy-janky-build/action.yml b/.github/actions/proxy-janky-build/action.yml index fe36d27b4..988c4a289 100644 --- a/.github/actions/proxy-janky-build/action.yml +++ b/.github/actions/proxy-janky-build/action.yml @@ -10,6 +10,9 @@ inputs: branch-name: description: 'The name of the branch to use' required: true + force: + description: 'Force the job to run even if it is already passed' + required: false envVars: description: 'Comma separated list of key value pairs to pass to Janky - ex: key1=value1,key2=value2,key3=value3' required: false @@ -24,6 +27,7 @@ runs: -token ${{ inputs.janky-token }} \ -job ${{ inputs.job-name }} \ -branch ${{ inputs.branch-name }} \ + -force ${{ inputs.force }} \ -envVars ${{ inputs.envVars }} shell: bash working-directory: .github/actions/proxy-janky-build diff --git a/.github/actions/proxy-janky-build/main.go b/.github/actions/proxy-janky-build/main.go index cfc120295..4146be416 100644 --- a/.github/actions/proxy-janky-build/main.go +++ b/.github/actions/proxy-janky-build/main.go @@ -43,6 +43,7 @@ func main() { job := flag.String("job", "", "Name of the Janky job") token := flag.String("token", "", "Name of the Janky token") branch := flag.String("branch", "", "Name of the Git branch") + force := flag.Bool("force", false, "Force a build even if one is already passed") envVars := flag.String("envVars", "", "Comma separated list of key value pairs to pass to Janky - ex: key1=value1,key2=value2,key3=value3") flag.Parse() @@ -56,12 +57,14 @@ func main() { type buildRequestObject struct { BuildableName string `json:"buildable_name"` BranchName string `json:"branch_name"` + Force bool `json:"force"` EnvVars map[string]string `json:"env_vars"` } requestBody := buildRequestObject{ BuildableName: *job, BranchName: *branch, + Force: *force, } // Parse the envVars flag into a map and add to the request payload diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index d97350957..14caa2726 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,4 +37,5 @@ jobs: janky-token: '${{ secrets.API_AUTH_TOKEN }}' job-name: '${{ matrix.jankyJobName }}' branch-name: '${{ env.TARGET_BRANCH }}' + force : 'true' envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }}" From 2af815acd9b132cb58cde032f615f81b3e16b6df Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 15 Sep 2023 12:55:10 -0600 Subject: [PATCH 693/946] Make force a string --- .github/actions/proxy-janky-build/main.go | 4 ++-- .github/workflows/integration-tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/proxy-janky-build/main.go b/.github/actions/proxy-janky-build/main.go index 4146be416..e05346cd4 100644 --- a/.github/actions/proxy-janky-build/main.go +++ b/.github/actions/proxy-janky-build/main.go @@ -43,7 +43,7 @@ func main() { job := flag.String("job", "", "Name of the Janky job") token := flag.String("token", "", "Name of the Janky token") branch := flag.String("branch", "", "Name of the Git branch") - force := flag.Bool("force", false, "Force a build even if one is already passed") + force := flag.String("force", "false", "Force a build even if one is already passed") envVars := flag.String("envVars", "", "Comma separated list of key value pairs to pass to Janky - ex: key1=value1,key2=value2,key3=value3") flag.Parse() @@ -57,7 +57,7 @@ func main() { type buildRequestObject struct { BuildableName string `json:"buildable_name"` BranchName string `json:"branch_name"` - Force bool `json:"force"` + Force string `json:"force"` EnvVars map[string]string `json:"env_vars"` } diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 14caa2726..804c6d5c5 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,5 +37,5 @@ jobs: janky-token: '${{ secrets.API_AUTH_TOKEN }}' job-name: '${{ matrix.jankyJobName }}' branch-name: '${{ env.TARGET_BRANCH }}' - force : 'true' + force : "true" envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }}" From 7094bcaa44a6fd9c36d9a2b49c2a7db1af0c09f0 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 15 Sep 2023 13:51:02 -0600 Subject: [PATCH 694/946] disable lint error --- .github/actions/proxy-janky-build/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/proxy-janky-build/main.go b/.github/actions/proxy-janky-build/main.go index e05346cd4..e7afcd917 100644 --- a/.github/actions/proxy-janky-build/main.go +++ b/.github/actions/proxy-janky-build/main.go @@ -91,7 +91,7 @@ func main() { } buildRequest.Header.Set("Content-Type", "application/json") buildRequest.Header.Set("Authorization", "Basic "+authToken) - retryClient := retryablehttp.NewClient() + retryClient := retryablehttp.NewClient() //nolint:all retryClient.RetryMax = jankyHttpRetryMax retryClient.Logger = nil // disable debug logging client := retryClient.StandardClient() // uses *http.Client From 2e7142240322f42bf135e90542dc346e0b2943c1 Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:30:31 -0600 Subject: [PATCH 695/946] Update main.go --- .github/actions/proxy-janky-build/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/proxy-janky-build/main.go b/.github/actions/proxy-janky-build/main.go index e7afcd917..e0342f121 100644 --- a/.github/actions/proxy-janky-build/main.go +++ b/.github/actions/proxy-janky-build/main.go @@ -133,7 +133,7 @@ func main() { } statusRequest.Header.Set("Content-Type", "application/json") statusRequest.Header.Set("Authorization", "Basic "+authToken) - retryClient2 := retryablehttp.NewClient() + retryClient2 := retryablehttp.NewClient() //nolint:all retryClient2.RetryMax = jankyHttpRetryMax retryClient2.Logger = nil // disable debug logging client2 := retryClient2.StandardClient() // uses *http.Client From 995bd7a06082c4390fe49d250ef1a2c57866503a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 18 Sep 2023 11:01:34 -0400 Subject: [PATCH 696/946] set git config --- .github/workflows/build-and-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index f6194bb55..4943834a8 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -33,6 +33,8 @@ jobs: sudo apt-get install -y moreutils debhelper help2man devscripts gzip - name: Create tag run: | + git config user.name "release-controller" + git config user.email "ghes-releases-team@github.com" git tag -a v${{ github.event.inputs.version }} \ -m "v${{ github.event.inputs.version }}" git push origin v${{ github.event.inputs.version }} @@ -83,6 +85,8 @@ jobs: - name: Create empty commit id: empty_commit run: | + git config user.name "release-controller" + git config user.email "ghes-releases-team@github.com" git commit --allow-empty -m "${{ github.event.inputs.version }} release" git push origin master echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT From 5eeb9832e637bb9344fc47bc935408593b65f2b7 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 19 Sep 2023 12:52:38 -0400 Subject: [PATCH 697/946] use patch release branches in private --- .github/workflows/build-and-release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 4943834a8..b82a40211 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -31,13 +31,12 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag + - name: Create patch release branch from current sha run: | git config user.name "release-controller" git config user.email "ghes-releases-team@github.com" - git tag -a v${{ github.event.inputs.version }} \ - -m "v${{ github.event.inputs.version }}" - git push origin v${{ github.event.inputs.version }} + git branch "enterprise-${{ github.event.inputs.version }}-release" + git push origin "enterprise-${{ github.event.inputs.version }}-release" - name: Package deb run: | ./script/package-deb From 71d6136b7ae2c56034aac8cf8ce1624670e71001 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 19 Sep 2023 13:41:14 -0400 Subject: [PATCH 698/946] implement .releaseignore --- .releaseignore | 2 ++ script/package-deb | 8 ++++++++ script/package-tarball | 10 ++++++++++ 3 files changed, 20 insertions(+) create mode 100644 .releaseignore diff --git a/.releaseignore b/.releaseignore new file mode 100644 index 000000000..bb2f6b31c --- /dev/null +++ b/.releaseignore @@ -0,0 +1,2 @@ +ownership.yaml +.github \ No newline at end of file diff --git a/script/package-deb b/script/package-deb index dda90cbe3..8e771f1e4 100755 --- a/script/package-deb +++ b/script/package-deb @@ -22,6 +22,14 @@ mkdir -p dist/debuild distdir="$(pwd)/dist/debuild/$PKG_NAME" git clone -q . "$distdir" cd "$distdir" + +echo "Removing files listed in .releaseignore ..." +while IFS= read -r line; do + rm -rf "$line" +done < .releaseignore + +echo "Removing .releaseignore ..." +rm -f .releaseignore git checkout -q "$PKG_HEAD" debuild -uc -us 1>&2 diff --git a/script/package-tarball b/script/package-tarball index be653b77a..a2c09bd37 100755 --- a/script/package-tarball +++ b/script/package-tarball @@ -13,6 +13,16 @@ PKG_BASE="github-backup-utils" PKG_VERS="$(git describe --tags)" PKG_NAME="${PKG_BASE}-${PKG_VERS}" +# Remove all files or directories listed in .releaseignore +echo "Removing files listed in .releaseignore ..." +while IFS= read -r line; do + rm -rf "$line" +done < .releaseignore + +# Remove the .releaseignore file itself +echo "Removing .releaseignore ..." +rm -f .releaseignore + # Run git-archive to generate tarball echo "Creating ${PKG_NAME}.tar.gz ..." mkdir -p dist From a3e8ae9be631a63db7aa6383ac26f350ce1b3b58 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 19 Sep 2023 20:21:54 +0000 Subject: [PATCH 699/946] test against test branch --- .github/workflows/build-and-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index b82a40211..91f59aab2 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -86,8 +86,9 @@ jobs: run: | git config user.name "release-controller" git config user.email "ghes-releases-team@github.com" + git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin master + git push origin tims-test-branch echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Checkout uses: actions/checkout@v2 From ec2ef62f51bc33b76d713112b2f0813c5ae887b9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 19 Sep 2023 16:43:17 -0400 Subject: [PATCH 700/946] fetch tags --- script/package-deb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/package-deb b/script/package-deb index 8e771f1e4..15a698e9c 100755 --- a/script/package-deb +++ b/script/package-deb @@ -8,6 +8,9 @@ set -e # Change into project root cd "$(dirname "$0")"/.. +# Fetch tags from remote repository +git fetch --tags + # Basic package name and version. PKG_BASE="github-backup-utils" PKG_VERS="$(git describe --tags)" From 7de9682d6b152a7730df75f9a05953c7182f6f39 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 19 Sep 2023 16:43:41 -0400 Subject: [PATCH 701/946] same for tar --- script/package-tarball | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/package-tarball b/script/package-tarball index a2c09bd37..bf1510e8f 100755 --- a/script/package-tarball +++ b/script/package-tarball @@ -8,6 +8,9 @@ set -e # Change into project root cd "$(dirname "$0")"/.. +# Fetch tags from remote repository +git fetch --tags + # Basic package name and version. PKG_BASE="github-backup-utils" PKG_VERS="$(git describe --tags)" From 610a0d32b58016d253b00cb97037990c119dd326 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 19 Sep 2023 16:50:19 -0400 Subject: [PATCH 702/946] need vx.y.x tag for build scripts --- .github/workflows/build-and-release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 91f59aab2..c3fc67c57 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -37,6 +37,11 @@ jobs: git config user.email "ghes-releases-team@github.com" git branch "enterprise-${{ github.event.inputs.version }}-release" git push origin "enterprise-${{ github.event.inputs.version }}-release" + # create v#{version} tag on current sha + - name: Create tag + run: | + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" - name: Package deb run: | ./script/package-deb From bd23ecdc80d3dccdbd12e7982c5845d85386ff78 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 19 Sep 2023 21:33:42 +0000 Subject: [PATCH 703/946] help --- .github/workflows/build-and-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c3fc67c57..487f808f2 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -91,6 +91,8 @@ jobs: run: | git config user.name "release-controller" git config user.email "ghes-releases-team@github.com" + # tims-test-branch already exists, so fetch it + git fetch origin tims-test-branch git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" git push origin tims-test-branch From 99db4a899a2b92698f12854ab272436d8bfde2eb Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Wed, 20 Sep 2023 15:08:24 +0200 Subject: [PATCH 704/946] remove dead code (#586) --- Makefile | 2 +- script/cibuild | 65 ------------------- script/release | 166 ++++++++++++++++++++++++------------------------- script/test | 28 +++++++++ 4 files changed, 112 insertions(+), 149 deletions(-) delete mode 100755 script/cibuild create mode 100755 script/test diff --git a/Makefile b/Makefile index 191b90561..c8eaa0ff1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/sh test: info @echo Running tests - @script/cibuild --no-package + @script/test info: @echo This is github/backup-utils diff --git a/script/cibuild b/script/cibuild deleted file mode 100755 index 22f7ffd08..000000000 --- a/script/cibuild +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash -# Usage: script/cibuild [--no-package] -set -e - -ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -TMPDIR="$ROOTDIR/test/tmp" - -# Remove possible remnants of previous test runs -rm -rf "${TMPDIR:?}/*" - -print_test_results() { - if [ -n "$GITHUB_STEP_SUMMARY" ]; then - echo -e "### Test results\n" >> "$GITHUB_STEP_SUMMARY" - echo "| Test suite | Result | Successful | Failed | Skipped | Duration |" >> "$GITHUB_STEP_SUMMARY" - echo "|---|---|--:|--:|--:|--:|" >> "$GITHUB_STEP_SUMMARY" - sort -V "$TMPDIR/results" >> "$GITHUB_STEP_SUMMARY" - fi -} - -# Enable verbose logging of ssh commands -export GHE_VERBOSE_SSH=true - -if ! find test -name "test-*.sh" -print0 | xargs -0 -n 1 /bin/bash; then - print_test_results - exit 1 -fi - -print_test_results - -# Bail out when --no-package given -[ "$1" = "--no-package" ] && exit 0 - -# files we'll md5sum at the end -pkg_files= - -# Build the tarball -echo "Building tar.gz package ..." -if script/package-tarball 1>$TMPDIR/package-tarball.txt 2>&1; then - pkg_files=$(grep '^Package ' < $TMPDIR/package-tarball.txt | cut -f 2 -d ' ') -else - echo "Packaging tar.gz failed:" - cat $TMPDIR/package-tarball.txt | sed 's/^/ /' 1>&2 - exit 1 -fi - -# Skip deb packaging if debuild not installed -if ! type debuild 1>/dev/null 2>&1; then - echo "debuild not installed, skipping deb packaging ..." - exit 0 -fi - -# Build the deb related packages -echo "Building deb package ..." -if DEB_BUILD_OPTIONS=nocheck script/package-deb 1>$TMPDIR/package-deb-out.txt 2>$TMPDIR/package-deb-err.txt; then - pkg_files="$pkg_files $(cat $TMPDIR/package-deb-out.txt)" -else - echo "Package build failed:" - cat $TMPDIR/package-deb-out.txt $TMPDIR/package-deb-err.txt >&2 - echo >&2 - cat dist/debuild/github-backup-utils*.build >&2 - exit 1 -fi - -# Generate md5sums -md5sum $pkg_files diff --git a/script/release b/script/release index 891cd9f60..9629cacff 100755 --- a/script/release +++ b/script/release @@ -19,25 +19,25 @@ #/ release page and the changelog. #/ * If this is a X.Y.0 release, a minimum supported version needs to be supplied too. #/ -require 'json' -require 'net/http' -require 'time' -require 'erb' -require 'English' +require "json" +require "net/http" +require "time" +require "erb" +require "English" -API_HOST = ENV['GH_HOST'] || 'api.github.com' +API_HOST = ENV["GH_HOST"] || "api.github.com" API_PORT = 443 -GH_REPO = ENV['GH_REPO'] || 'backup-utils' -GH_OWNER = ENV['GH_OWNER'] || 'github' -GH_AUTHOR = ENV['GH_AUTHOR'] -DEB_PKG_NAME = 'github-backup-utils' -GH_BASE_BRANCH = ENV['GH_BASE_BRANCH'] || 'master' # TODO: should we even allow a default or require all params get set explicitly? +GH_REPO = ENV["GH_REPO"] || "backup-utils" +GH_OWNER = ENV["GH_OWNER"] || "github" +GH_AUTHOR = ENV["GH_AUTHOR"] +DEB_PKG_NAME = "github-backup-utils" +GH_BASE_BRANCH = ENV["GH_BASE_BRANCH"] || "master" # TODO: should we even allow a default or require all params get set explicitly? GH_STABLE_BRANCH = "" # If PUBLISH is false, we leave the release in a draft state to be manually published later through the UI -PUBLISH = ENV['PUBLISH'] == 'true' || false +PUBLISH = ENV["PUBLISH"] == "true" || false -CHANGELOG_TMPL = '''<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium +CHANGELOG_TMPL = "" '<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium <%- changes.each do |ch| -%> * <%= ch.strip.chomp %> @@ -45,7 +45,7 @@ CHANGELOG_TMPL = '''<%= package_name %> (<%= package_version %>) UNRELEASED; urg -- <%= GH_AUTHOR %> <%= Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %z") %> -''' +' "" # Override Kernel.warn def warn(msg) @@ -54,50 +54,50 @@ end def client(host = API_HOST, port = API_PORT) @http ||= begin - c = Net::HTTP.new(host, port) - c.use_ssl = true - c - end + c = Net::HTTP.new(host, port) + c.use_ssl = true + c + end end def get(path) req = Net::HTTP::Get.new(path) - req['Authorization'] = "token #{release_token}" + req["Authorization"] = "token #{release_token}" client.request(req) end def post(path, body) req = Net::HTTP::Post.new(path) - req['Authorization'] = "token #{release_token}" + req["Authorization"] = "token #{release_token}" req.body = body client.request(req) end def post_file(path, body) req = Net::HTTP::Post.new(path) - req['Authorization'] = "token #{release_token}" - req['Content-Type'] = path.match?(/.*\.tar\.gz$/) ? 'application/tar+gzip' : 'application/vnd.debian.binary-package' + req["Authorization"] = "token #{release_token}" + req["Content-Type"] = path.match?(/.*\.tar\.gz$/) ? "application/tar+gzip" : "application/vnd.debian.binary-package" req.body = body client.request(req) end def put(path, body) req = Net::HTTP::Put.new(path) - req['Authorization'] = "token #{release_token}" + req["Authorization"] = "token #{release_token}" req.body = body client.request(req) end def patch(path, body) req = Net::HTTP::Patch.new(path) - req['Authorization'] = "token #{release_token}" + req["Authorization"] = "token #{release_token}" req.body = body client.request(req) end def release_token - token = ENV['GH_RELEASE_TOKEN'] - raise 'GH_RELEASE_TOKEN environment variable not set' if token.nil? + token = ENV["GH_RELEASE_TOKEN"] + raise "GH_RELEASE_TOKEN environment variable not set" if token.nil? token end @@ -106,7 +106,7 @@ end def tag(name, sha) body = { "ref": "refs/tags/#{name}", - "sha": sha + "sha": sha, }.to_json res = post("/repos/#{GH_OWNER}/#{GH_REPO}/git/refs", body) @@ -114,7 +114,7 @@ def tag(name, sha) end def bug_or_feature?(issue_hash) - return true if issue_hash['labels'].find { |label| ['bug', 'feature', 'enhancement'].include?(label['name']) } + return true if issue_hash["labels"].find { |label| ["bug", "feature", "enhancement"].include?(label["name"]) } false end @@ -131,7 +131,7 @@ def beautify_changes(changes) next unless chg =~ /#(\d+)/ begin issue = issue_from Regexp.last_match(1) - out << "#{issue['title']} ##{Regexp.last_match(1)}" if bug_or_feature?(issue) + out << "#{issue["title"]} ##{Regexp.last_match(1)}" if bug_or_feature?(issue) rescue => e warn "Warning: #{e.message}" end @@ -143,18 +143,18 @@ end def changelog puts "building changelog by comparing origin/#{GH_STABLE_BRANCH}...origin/#{GH_BASE_BRANCH}" changes = `git log --pretty=oneline origin/#{GH_STABLE_BRANCH}...origin/#{GH_BASE_BRANCH} --reverse --grep "Merge pull request" | sort -t\# -k2`.lines.map(&:strip) - raise 'Building the changelog failed' if $CHILD_STATUS != 0 + raise "Building the changelog failed" if $CHILD_STATUS != 0 changes end def build_changelog(changes, package_name, package_version) - ERB.new(CHANGELOG_TMPL, nil, '-').result(binding) + ERB.new(CHANGELOG_TMPL, nil, "-").result(binding) end -def update_changelog(changes, name, version, path = 'debian/changelog') - raise 'debian/changelog not found' unless File.exist?(path) - File.open("#{path}.new", 'w') do |f| +def update_changelog(changes, name, version, path = "debian/changelog") + raise "debian/changelog not found" unless File.exist?(path) + File.open("#{path}.new", "w") do |f| f.puts build_changelog changes, name, version f.puts(File.read(path)) end @@ -168,7 +168,7 @@ def create_release(tag_name, branch, rel_name, rel_body, draft = true) 'name': rel_name, 'body': rel_body, 'draft': draft, - 'prerelease': false + 'prerelease': false, }.to_json res = post("/repos/#{GH_OWNER}/#{GH_REPO}/releases", body) @@ -179,7 +179,7 @@ end def publish_release(release_id) body = { - 'draft': false + 'draft': false, }.to_json res = patch("/repos/#{GH_OWNER}/#{GH_REPO}/releases/#{release_id}", body) @@ -188,33 +188,33 @@ end def list_releases res = get("/repos/#{GH_OWNER}/#{GH_REPO}/releases") - raise 'Failed to retrieve releases' unless res.is_a? Net::HTTPSuccess + raise "Failed to retrieve releases" unless res.is_a? Net::HTTPSuccess JSON.parse(res.body) end def release_available?(tag_name) - return true if list_releases.find { |r| r['tag_name'] == tag_name } + return true if list_releases.find { |r| r["tag_name"] == tag_name } false end -def bump_version(new_version, min_version = nil, path = 'share/github-backup-utils/version') +def bump_version(new_version, min_version = nil, path = "share/github-backup-utils/version") current_version = Gem::Version.new(File.read(path).strip.chomp) if !@skip_version_bump_check && (Gem::Version.new(new_version) < current_version) raise "New version should be newer than #{current_version}" end - File.open("#{path}.new", 'w') { |f| f.puts new_version } + File.open("#{path}.new", "w") { |f| f.puts new_version } File.rename("#{path}.new", path) unless min_version.nil? - content = File.read('bin/ghe-host-check') + content = File.read("bin/ghe-host-check") new_content = content.gsub(/supported_minimum_version="[0-9]\.[0-9]+\.0"/, "supported_minimum_version=\"#{min_version}\"") - File.open('bin/ghe-host-check', 'w') {|file| file.puts new_content } + File.open("bin/ghe-host-check", "w") { |file| file.puts new_content } - content = File.read('test/testlib.sh') - new_content = content.gsub(/GHE_TEST_REMOTE_VERSION:=[0-9]\.[0-9]+\.0/,"GHE_TEST_REMOTE_VERSION:=#{new_version}") - File.open('test/testlib.sh', 'w') {|file| file.puts new_content } + content = File.read("test/testlib.sh") + new_content = content.gsub(/GHE_TEST_REMOTE_VERSION:=[0-9]\.[0-9]+\.0/, "GHE_TEST_REMOTE_VERSION:=#{new_version}") + File.open("test/testlib.sh", "w") { |file| file.puts new_content } end end @@ -223,7 +223,7 @@ def push_release_branch(version) raise "Creating release branch failed:\n\n#{out}" end - unless (out = `git commit --quiet -m 'Bump version: #{version} [ci skip]' debian/changelog share/github-backup-utils/version bin/ghe-host-check test/testlib.sh script/cibuild`) + unless (out = `git commit --quiet -m 'Bump version: #{version} [ci skip]' debian/changelog share/github-backup-utils/version bin/ghe-host-check test/testlib.sh script/test`) raise "Error committing changelog and version:\n\n#{out}" end @@ -247,7 +247,7 @@ def create_release_pr(version, release_body) 'title': "Bump version: #{version}", 'body': release_body, 'head': "release-#{version}", - 'base': GH_BASE_BRANCH + 'base': GH_BASE_BRANCH, }.to_json res = post("/repos/#{GH_OWNER}/#{GH_REPO}/pulls", body) raise "Creating release PR failed (#{res.code})" unless res.is_a? Net::HTTPSuccess @@ -260,7 +260,7 @@ def merge_pr(number, sha, version) 'commit_title': "Merge pull request ##{number} from github/release-#{version}", 'commit_message': "Bump version: #{version}", 'sha': sha, - 'merge_method': 'merge' + 'merge_method': "merge", }.to_json pr_mergeable? number res = put("/repos/#{GH_OWNER}/#{GH_REPO}/pulls/#{number}/merge", body) @@ -276,19 +276,19 @@ def pr_mergeable?(number) begin retries ||= 5 res = get("/repos/#{GH_OWNER}/#{GH_REPO}/pulls/#{number}") - raise RetryError if JSON.parse(res.body)['mergeable'].nil? - mergeable = JSON.parse(res.body)['mergeable'] + raise RetryError if JSON.parse(res.body)["mergeable"].nil? + mergeable = JSON.parse(res.body)["mergeable"] rescue RetryError sleep 1 retry unless (retries -= 1).zero? - raise 'PR is unmergable.' + raise "PR is unmergable." end mergeable || false end def can_auth? - !ENV['GH_RELEASE_TOKEN'].nil? + !ENV["GH_RELEASE_TOKEN"].nil? end def repo_exists? @@ -297,7 +297,7 @@ def repo_exists? end def can_build_deb? - system('which debuild > /dev/null 2>&1') + system("which debuild > /dev/null 2>&1") end def package_tarball @@ -316,7 +316,7 @@ end def attach_assets_to_release(upload_url, release_id, files) @http = nil - client(URI(upload_url.gsub(/{.*}/, '')).host) + client(URI(upload_url.gsub(/{.*}/, "")).host) begin files.each do |file| raw_file = File.open(file).read @@ -373,22 +373,22 @@ if $PROGRAM_NAME == __FILE__ args = ARGV.dup dry_run = false skip_version_bump_check = false - if args.include?('--dry-run') + if args.include?("--dry-run") dry_run = true - args.delete '--dry-run' + args.delete "--dry-run" end - if args.include?('--no-warn') + if args.include?("--no-warn") @no_warn = true - args.delete '--no-warn' + args.delete "--no-warn" end - if args.include?('--skip-version-bump-check') + if args.include?("--skip-version-bump-check") @skip_version_bump_check = true - args.delete '--skip-version-bump-check' + args.delete "--skip-version-bump-check" end - raise 'Usage: release [--dry-run] [--skip-version-bump-check] [min_version]' if args.empty? + raise "Usage: release [--dry-run] [--skip-version-bump-check] [min_version]" if args.empty? begin version = Gem::Version.new(args[0]) @@ -401,7 +401,7 @@ if $PROGRAM_NAME == __FILE__ raise "The repo #{GH_REPO} does not exist for #{GH_OWNER}" unless repo_exists? - raise 'GH_AUTHOR environment variable is not set' if GH_AUTHOR.nil? + raise "GH_AUTHOR environment variable is not set" if GH_AUTHOR.nil? release_changes = [] release_changes = beautify_changes changelog if can_auth? @@ -418,11 +418,11 @@ if $PROGRAM_NAME == __FILE__ puts "Owner: #{GH_OWNER}" puts "Repo: #{GH_REPO}" puts "Author: #{GH_AUTHOR}" - puts "Token: #{ENV['GH_RELEASE_TOKEN'] && 'set' || 'unset'}" + puts "Token: #{ENV["GH_RELEASE_TOKEN"] && "set" || "unset"}" puts "Base branch: #{GH_BASE_BRANCH}" - puts 'Changelog:' + puts "Changelog:" if release_changes.empty? - puts ' => No new bug fixes, enhancements or features.' + puts " => No new bug fixes, enhancements or features." else release_changes.each { |c| puts " * #{c}" } end @@ -442,12 +442,12 @@ if $PROGRAM_NAME == __FILE__ branches = `git branch --all | grep release-#{version}$` unless branches.empty? out = "Release branch release-#{version} already exists. " - out += 'Branches found:' + out += "Branches found:" branches.each_line { |l| out += "\n* #{l.strip.chomp}" } raise out end - puts 'Updating changelog...' + puts "Updating changelog..." update_changelog release_changes, DEB_PKG_NAME, version release_body = "Includes general improvements & bug fixes" release_body += " and support for GitHub Enterprise Server v#{version}" unless min_version.nil? @@ -455,40 +455,40 @@ if $PROGRAM_NAME == __FILE__ release_body += "\n* #{c}" end - puts 'Pushing release branch and creating release PR...' + puts "Pushing release branch and creating release PR..." push_release_branch version res = create_release_pr(version, "#{release_body}\n\n/cc @github/backup-utils") - puts 'Merging release PR...' - res = merge_pr res['number'], res['head']['sha'], version + puts "Merging release PR..." + res = merge_pr res["number"], res["head"]["sha"], version - puts 'Tagging and publishing release...' - tag "v#{version}", res['sha'] + puts "Tagging and publishing release..." + tag "v#{version}", res["sha"] - puts 'Creating release...' + puts "Creating release..." release_title = "GitHub Enterprise Server Backup Utilities v#{version}" res = create_release "v#{version}", GH_BASE_BRANCH, release_title, release_body, true # Tidy up before building tarball and deb pkg clean_up version - puts 'Building release tarball...' + puts "Building release tarball..." package_tarball - puts 'Building Debian pkg...' + puts "Building Debian pkg..." package_deb - puts 'Attaching Debian pkg and tarball to release...' - base_dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) - attach_assets_to_release res['upload_url'], res['id'], ["#{base_dir}/dist/#{DEB_PKG_NAME}-v#{version}.tar.gz"] - attach_assets_to_release res['upload_url'], res['id'], ["#{base_dir}/dist/#{DEB_PKG_NAME}_#{version}_all.deb"] + puts "Attaching Debian pkg and tarball to release..." + base_dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) + attach_assets_to_release res["upload_url"], res["id"], ["#{base_dir}/dist/#{DEB_PKG_NAME}-v#{version}.tar.gz"] + attach_assets_to_release res["upload_url"], res["id"], ["#{base_dir}/dist/#{DEB_PKG_NAME}_#{version}_all.deb"] if PUBLISH - puts 'Publishing release...' - publish_release res['id'] + puts "Publishing release..." + publish_release res["id"] end - puts 'Cleaning up...' + puts "Cleaning up..." clean_up version puts "Updating #{GH_STABLE_BRANCH} branch..." @@ -498,7 +498,7 @@ if $PROGRAM_NAME == __FILE__ puts 'Release left in a "Draft" state. Go to the https://github.com/github/backup-utils/releases and publish when ready.' end - puts 'Released!' + puts "Released!" rescue RuntimeError => e $stderr.puts "Error: #{e}" exit 1 diff --git a/script/test b/script/test new file mode 100755 index 000000000..d30bfa8df --- /dev/null +++ b/script/test @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Usage: script/test +set -e + +ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" +TMPDIR="$ROOTDIR/test/tmp" + +# Remove possible remnants of previous test runs +rm -rf "${TMPDIR:?}/*" + +print_test_results() { + if [ -n "$GITHUB_STEP_SUMMARY" ]; then + echo -e "### Test results\n" >> "$GITHUB_STEP_SUMMARY" + echo "| Test suite | Result | Successful | Failed | Skipped | Duration |" >> "$GITHUB_STEP_SUMMARY" + echo "|---|---|--:|--:|--:|--:|" >> "$GITHUB_STEP_SUMMARY" + sort -V "$TMPDIR/results" >> "$GITHUB_STEP_SUMMARY" + fi +} + +# Enable verbose logging of ssh commands +export GHE_VERBOSE_SSH=true + +if ! find test -name "test-*.sh" -print0 | sort -z |xargs -0 -n 1 /bin/bash; then + print_test_results + exit 1 +fi + +print_test_results From 42cc0cb5ff431b83d9d833f1cfdfdb609e640b27 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Wed, 20 Sep 2023 15:50:17 +0200 Subject: [PATCH 705/946] removing wrong error output (#591) * removing wrong error output * fix host-check output * refactor echo --------- Co-authored-by: Chuck Pathanjali --- bin/ghe-host-check | 30 ++++++++++----------- share/github-backup-utils/ghe-backup-config | 5 ++-- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 9e8d6466b..adb3b0ccb 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -151,7 +151,7 @@ if [ -z "$supported" ]; then fi if [[ "$CALLING_SCRIPT" == "ghe-backup" && "$GHE_SKIP_CHECKS" != "true" ]]; then - cat << SKIP_MSG 1>&2 + cat << SKIP_MSG **You can disable the following storage & version checks by running ghe-backup with option "--skip-checks" OR updating GHE_SKIP_CHECKS to 'true' in your backup.config file. @@ -176,10 +176,10 @@ SKIP_MSG fi #Display dir requirements for repositories and mysql - echo "" 1>&2 - echo "Checking host for sufficient space for a backup..." 1>&2 + echo -e "\n" + echo "Checking host for sufficient space for a backup..." available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') - echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." 1>&2 + echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." repos_disk_size=$(transfer_size repositories /tmp) pages_disk_size=$(transfer_size pages /tmp) @@ -192,10 +192,10 @@ SKIP_MSG min_disk_req=$((repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size)) recommended_disk_req=$((min_disk_req * 5)) - echo " - Available space: $((available_space / (1024 ** 2))) MB" 1>&2 - echo " - Min Disk required for this backup is at least $min_disk_req MB" 1>&2 - echo " - Recommended Disk requirement is $recommended_disk_req MB" 1>&2 - echo "" 1>&2 + echo " - Available space: $((available_space / (1024 ** 2))) MB" + echo " - Min Disk required for this backup is at least $min_disk_req MB" + echo " - Recommended Disk requirement is $recommended_disk_req MB" + echo -e "\n" printf '### Estimated Data Transfer Sizes @@ -208,7 +208,7 @@ SKIP_MSG - actions: %d MB - mssql: %d MB \n' \ - "$repos_disk_size" "$pages_disk_size" "$es_disk_size" "$stor_disk_size" "$minio_disk_size" "$mysql_disk_size" "$actions_disk_size" "$mssql_disk_size" 1>&2 + "$repos_disk_size" "$pages_disk_size" "$es_disk_size" "$stor_disk_size" "$minio_disk_size" "$mysql_disk_size" "$actions_disk_size" "$mssql_disk_size" if [[ $((available_space / (1024 * 1024))) -lt $min_disk_req ]]; then echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 @@ -231,7 +231,7 @@ SKIP_MSG exit 1 fi - echo "### Software versions" 1>&2 + echo "### Software versions" rsync_version=$(rsync --version | grep 'version' | awk '{print $3}' | tr -cd '[:digit:].\n') if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 @@ -241,9 +241,9 @@ SKIP_MSG printf "\n **WARNING:** rsync version %s on backup host is less than 3.2.5, which could result in performance degradation. For more details, please read documentation at https://gh.io/april-2023-update-of-rsync-requirements You can disable this warning by changing RSYNC_WARNING to 'no' in your backup.config file.\n\n" \ - "$rsync_version" 1>&2 + "$rsync_version" fi - echo " - rsync ${rsync_version} >= required ($min_rsync)" 1>&2 + echo " - rsync ${rsync_version} >= required ($min_rsync)" ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1 | tr -cd '[:digit:].\n') if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then @@ -251,7 +251,7 @@ SKIP_MSG echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 exit 1 else - echo " - openSSH ${ssh_version} >= required ($min_openssh)" 1>&2 + echo " - openSSH ${ssh_version} >= required ($min_openssh)" fi jq_version=$(jq --version |awk -F\- '{print $2}' | tr -cd '[:digit:].\n') @@ -260,8 +260,8 @@ SKIP_MSG echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 exit 1 else - echo " - jq ${jq_version} >= required ($min_jq)" 1>&2 + echo " - jq ${jq_version} >= required ($min_jq)" fi fi -echo "" 1>&2 +echo -e "\n" echo "Connect $hostname:$port OK (v$version)" diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index d3f8b05aa..790d2aaa4 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -422,14 +422,15 @@ ghe_remote_version_required() { if [ -z "$GHE_REMOTE_VERSION" ]; then _out=$(ghe-host-check "$@") echo "$_out" + _out_hostname=$(echo "$_out" | tail -n 1) # override hostname w/ ghe-host-check output because the port could have # been autodetected to 122. - GHE_HOSTNAME="${_out/Connect /}" + GHE_HOSTNAME="${_out_hostname/Connect /}" GHE_HOSTNAME="${GHE_HOSTNAME/ OK*/}" export GHE_HOSTNAME - GHE_REMOTE_VERSION="${_out#*\(}" + GHE_REMOTE_VERSION="${_out_hostname#*\(}" GHE_REMOTE_VERSION="${GHE_REMOTE_VERSION%%\)*}" export GHE_REMOTE_VERSION From b3be0d90b11a589050575d164b6b260ca3715fde Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 20 Sep 2023 10:44:46 -0400 Subject: [PATCH 706/946] use checkout v4 --- .github/workflows/build-and-release.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 487f808f2..a9d28ee09 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -24,20 +24,14 @@ jobs: app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} - name: Install dependencies run: | sudo apt-get update -y sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create patch release branch from current sha - run: | - git config user.name "release-controller" - git config user.email "ghes-releases-team@github.com" - git branch "enterprise-${{ github.event.inputs.version }}-release" - git push origin "enterprise-${{ github.event.inputs.version }}-release" - # create v#{version} tag on current sha + # create tags for the build scripts to work - name: Create tag run: | git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" @@ -80,8 +74,8 @@ jobs: # required app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - - name: Checkout - uses: actions/checkout@v2 + - name: Checkout backup-utils + uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils @@ -91,14 +85,13 @@ jobs: run: | git config user.name "release-controller" git config user.email "ghes-releases-team@github.com" - # tims-test-branch already exists, so fetch it git fetch origin tims-test-branch git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" git push origin tims-test-branch echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Checkout - uses: actions/checkout@v2 + - name: Checkout backup-utils-private + uses: actions/checkout@v4 - name: Download deb artifact uses: actions/download-artifact@v3 with: From 91905dd52d3a43fa2afc1c734a8438d8af00ad03 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 20 Sep 2023 10:49:45 -0400 Subject: [PATCH 707/946] set git config --- .github/workflows/build-and-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index a9d28ee09..cdc823455 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -34,6 +34,8 @@ jobs: # create tags for the build scripts to work - name: Create tag run: | + git config user.name "release-controller[bot]" + git config user.email "ghes-releases-team@github.com" git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" git push origin "v${{ github.event.inputs.version }}" - name: Package deb From 0b232188e513c2acfeffbb230f036a5f791fbedf Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 20 Sep 2023 11:23:32 -0400 Subject: [PATCH 708/946] Just a quick echo fix (#594) Just a quick fix to echo statement to clean it up. --- bin/ghe-host-check | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index adb3b0ccb..5cd39abee 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -176,8 +176,7 @@ SKIP_MSG fi #Display dir requirements for repositories and mysql - echo -e "\n" - echo "Checking host for sufficient space for a backup..." + echo -e "\nChecking host for sufficient space for a backup..." available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." @@ -194,8 +193,7 @@ SKIP_MSG recommended_disk_req=$((min_disk_req * 5)) echo " - Available space: $((available_space / (1024 ** 2))) MB" echo " - Min Disk required for this backup is at least $min_disk_req MB" - echo " - Recommended Disk requirement is $recommended_disk_req MB" - echo -e "\n" + echo -e " - Recommended Disk requirement is $recommended_disk_req MB\n" printf '### Estimated Data Transfer Sizes @@ -263,5 +261,5 @@ SKIP_MSG echo " - jq ${jq_version} >= required ($min_jq)" fi fi -echo -e "\n" -echo "Connect $hostname:$port OK (v$version)" + +echo -e "\nConnect $hostname:$port OK (v$version)" From fb356cc6897682c5a693c97d8c7326f0f12991ca Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 20 Sep 2023 16:52:30 +0000 Subject: [PATCH 709/946] try getting issues --- .github/workflows/build-and-release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index cdc823455..a5185f63e 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -82,6 +82,11 @@ jobs: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils ref: master + - name: Try getting issues from backkup-utils + run: | + curl -H "Authorization: token ${{ steps.app-token.outputs.token }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/github/backup-utils/issues - name: Create empty commit id: empty_commit run: | From 5070734353e4bf462f0e1c0bac9294aa9aef6796 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Wed, 20 Sep 2023 13:47:51 -0600 Subject: [PATCH 710/946] Set enterprise2 branch as env var --- .github/workflows/integration-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 804c6d5c5..8727233ea 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -36,6 +36,7 @@ jobs: with: janky-token: '${{ secrets.API_AUTH_TOKEN }}' job-name: '${{ matrix.jankyJobName }}' - branch-name: '${{ env.TARGET_BRANCH }}' + branch-name: '${{ env.SOURCE_BRANCH }}' force : "true" - envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }}" + # enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release) + envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ env.TARGET_BRANCH }}" From 0e42379f95e2a290ae61938a5e6821839aed3e6d Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Wed, 20 Sep 2023 22:50:01 -0400 Subject: [PATCH 711/946] Add redis restart mechanism (#583) --- bin/ghe-restore | 19 +++++++++++++++++++ test/bin/ghe-nomad-jobs | 7 +++++++ 2 files changed, 26 insertions(+) create mode 100755 test/bin/ghe-nomad-jobs diff --git a/bin/ghe-restore b/bin/ghe-restore index 17a12b8b1..078932236 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -636,6 +636,25 @@ echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh bm_end "$(basename $0) - Restarting memcached" +# Restart redis before updating keys +# It's possible that redis hcl is not rendered on an unconfigured system +# so check first +if $instance_configured; then + log_info "Getting redis status before restart..." 1>&3 + echo "nomad status redis" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 + log_info "Restarting redis" 1>&3 + echo "nomad stop redis" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 2>&3 + ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-jobs queue /etc/nomad-jobs/redis/redis.hcl" 1>&3 2>&3 + if $? -gt 0; then + log_error "Unable to restart redis" + fi + log_info "Getting redis status after restart..." 1>&3 + echo "nomad status redis" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 +fi + # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then diff --git a/test/bin/ghe-nomad-jobs b/test/bin/ghe-nomad-jobs new file mode 100755 index 000000000..a91afc7be --- /dev/null +++ b/test/bin/ghe-nomad-jobs @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Usage: ghe-nomad-jobs +# Emulates the remote GitHub ghe-nomad-jobs command. Tests use this +# to assert that the command was executed. +set -e +echo "$(basename $0)" "'$(cat)'" "OK" + From 63b4e2913a75c5dd8d513ac08b604753f25f02a9 Mon Sep 17 00:00:00 2001 From: alejndr0 Date: Thu, 21 Sep 2023 09:07:11 +0000 Subject: [PATCH 712/946] Add GHE_RSYNC_COMPRESSION_ENABLED option --- backup.config-example | 4 ++++ share/github-backup-utils/ghe-rsync | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index 688cc374b..347764b2a 100644 --- a/backup.config-example +++ b/backup.config-example @@ -58,6 +58,10 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_EXTRA_RSYNC_OPTS="" +# If set to 'yes', rsync will be set to use compression during backups and restores transfers. Defaults to 'no'. +# +#GHE_RSYNC_COMPRESSION_ENABLED=yes + # If enabled and set to 'no', rsync warning message during backups will be suppressed. #RSYNC_WARNING=no diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index d957068ac..d1aa5316c 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -29,6 +29,13 @@ if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker --trust-sende parameters=("--trust-sender" "${parameters[@]}") fi +# This adds `--compress` to the parameters if supported by the current version of rsync +# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker +# shellcheck disable=SC2046 +if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker --compress)" == "true" ] && [ "$GHE_RSYNC_COMPRESSION_ENABLED" = "yes" ]; then + parameters+=("--compress") +fi + # This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them # to the parameters and skip adding if already present in the parameters # shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker @@ -41,7 +48,7 @@ if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then done fi - +echo "Running rsync with parameters: ${parameters[*]}" ignore_out='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' rsync_version_check=$(rsync --version | grep -E "version 3.[0-9]*.[0-9]*") if [ -n "$rsync_version_check" ]; then From c889d7b0a3ad1cb9a438ce9acab3874947f53734 Mon Sep 17 00:00:00 2001 From: alejndr0 Date: Thu, 21 Sep 2023 09:08:13 +0000 Subject: [PATCH 713/946] remove debugging line --- share/github-backup-utils/ghe-rsync | 1 - 1 file changed, 1 deletion(-) diff --git a/share/github-backup-utils/ghe-rsync b/share/github-backup-utils/ghe-rsync index d1aa5316c..50a90fba8 100755 --- a/share/github-backup-utils/ghe-rsync +++ b/share/github-backup-utils/ghe-rsync @@ -48,7 +48,6 @@ if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then done fi -echo "Running rsync with parameters: ${parameters[*]}" ignore_out='^(file has vanished: |rsync warning: some files vanished before they could be transferred)' rsync_version_check=$(rsync --version | grep -E "version 3.[0-9]*.[0-9]*") if [ -n "$rsync_version_check" ]; then From 7f2ee81788367b60ab8a21eda5365753c0257e3e Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Thu, 21 Sep 2023 09:52:27 -0600 Subject: [PATCH 714/946] Fix base ref --- .github/workflows/integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 8727233ea..c7ccf30f0 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -15,8 +15,8 @@ on: # Get target and source branch from different variables depending on how it was triggered env: - TARGET_BRANCH: '${{ github.event.inputs.target-branch }}${{ github.base_ref || github.ref_name }}' - SOURCE_BRANCH: '${{ github.event.inputs.source-branch }}${{ github.head_ref || github.ref_name }}' + TARGET_BRANCH: '${{ github.event.inputs.target-branch || github.base_ref }}' + SOURCE_BRANCH: '${{ github.event.inputs.source-branch || github.head_ref }}' jobs: integration-tests: From c8570b3328569977b0789f9e65eaf987d50f4408 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Thu, 21 Sep 2023 09:55:18 -0600 Subject: [PATCH 715/946] Add two cluster tests to nightly runs --- .github/workflows/nightly-tests.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/nightly-tests.yml diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml new file mode 100644 index 000000000..6215a7f65 --- /dev/null +++ b/.github/workflows/nightly-tests.yml @@ -0,0 +1,33 @@ +name: Long Running Nightly Tests +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +# Get target and source branch from different variables depending on how it was triggered +env: + TARGET_BRANCH: '${{ github.event.inputs.target-branch || github.base_ref }}' + SOURCE_BRANCH: '${{ github.event.inputs.source-branch || github.head_ref }}' + +jobs: + integration-tests: + runs-on: ubuntu-latest + strategy: + matrix: + jankyJobName: + - enterprise2-backup-utils-cluster-binary-backup + - enterprise2-backup-utils-cluster-migration + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Queue ${{ matrix.jankyJobName }} build + uses: ./.github/actions/proxy-janky-build + id: proxy-janky-build + with: + janky-token: '${{ secrets.API_AUTH_TOKEN }}' + job-name: '${{ matrix.jankyJobName }}' + branch-name: '${{ github.ref_name }}' + force : "true" + # enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release) + envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ github.ref_name }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ github.ref_name }}" From c91302f10768dbf13d3c790656bd5ada8f58f5cb Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Thu, 21 Sep 2023 09:56:41 -0600 Subject: [PATCH 716/946] Revert "Add two cluster tests to nightly runs" This reverts commit c8570b3328569977b0789f9e65eaf987d50f4408. --- .github/workflows/nightly-tests.yml | 33 ----------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .github/workflows/nightly-tests.yml diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml deleted file mode 100644 index 6215a7f65..000000000 --- a/.github/workflows/nightly-tests.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Long Running Nightly Tests -on: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -# Get target and source branch from different variables depending on how it was triggered -env: - TARGET_BRANCH: '${{ github.event.inputs.target-branch || github.base_ref }}' - SOURCE_BRANCH: '${{ github.event.inputs.source-branch || github.head_ref }}' - -jobs: - integration-tests: - runs-on: ubuntu-latest - strategy: - matrix: - jankyJobName: - - enterprise2-backup-utils-cluster-binary-backup - - enterprise2-backup-utils-cluster-migration - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - name: Queue ${{ matrix.jankyJobName }} build - uses: ./.github/actions/proxy-janky-build - id: proxy-janky-build - with: - janky-token: '${{ secrets.API_AUTH_TOKEN }}' - job-name: '${{ matrix.jankyJobName }}' - branch-name: '${{ github.ref_name }}' - force : "true" - # enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release) - envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ github.ref_name }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ github.ref_name }}" From 2591f7afce1db597f7464d45687f9b49b9ff78a2 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Thu, 21 Sep 2023 21:28:23 -0400 Subject: [PATCH 717/946] Fix tests on redis restart (#600) previous pr had a typo causing issues on cluster --- bin/ghe-restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index 078932236..f7f092e23 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -647,7 +647,7 @@ if $instance_configured; then echo "nomad stop redis" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 2>&3 ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-jobs queue /etc/nomad-jobs/redis/redis.hcl" 1>&3 2>&3 - if $? -gt 0; then + if [ "$?" -gt 0 ]; then log_error "Unable to restart redis" fi log_info "Getting redis status after restart..." 1>&3 From 91986af27acc260d0c0d405a989d56cee33659e6 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Fri, 22 Sep 2023 07:31:50 -0400 Subject: [PATCH 718/946] reverting changes to redis restart mechanism Some problems are being caused on cluster binary backup, need to revert until other fixes are in. --- bin/ghe-restore | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/bin/ghe-restore b/bin/ghe-restore index f7f092e23..c9ac20ec2 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -636,24 +636,6 @@ echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh bm_end "$(basename $0) - Restarting memcached" -# Restart redis before updating keys -# It's possible that redis hcl is not rendered on an unconfigured system -# so check first -if $instance_configured; then - log_info "Getting redis status before restart..." 1>&3 - echo "nomad status redis" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 - log_info "Restarting redis" 1>&3 - echo "nomad stop redis" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 2>&3 - ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-jobs queue /etc/nomad-jobs/redis/redis.hcl" 1>&3 2>&3 - if [ "$?" -gt 0 ]; then - log_error "Unable to restart redis" - fi - log_info "Getting redis status after restart..." 1>&3 - echo "nomad status redis" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. From 74ed061df5b6ea835077fa9ec37b0239f22eec7a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 14:57:26 +0000 Subject: [PATCH 719/946] try fork of action --- .github/workflows/build-and-release.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index a5185f63e..f8207f466 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -17,7 +17,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/create-github-app-token@v1 + - uses: timreimherr/create-github-app-token id: app-token with: # required @@ -70,23 +70,22 @@ jobs: outputs: commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} steps: - - uses: actions/create-github-app-token@v1 + - uses: timreimherr/create-github-app-token id: app-token with: # required app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: | + github/backup-utils + github/backup-utils-private - name: Checkout backup-utils uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils ref: master - - name: Try getting issues from backkup-utils - run: | - curl -H "Authorization: token ${{ steps.app-token.outputs.token }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/github/backup-utils/issues - name: Create empty commit id: empty_commit run: | @@ -99,6 +98,10 @@ jobs: echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Checkout backup-utils-private uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils-private + ref: master - name: Download deb artifact uses: actions/download-artifact@v3 with: From a16fb67fbfa67c1e7e1afa7d374a56a3107396b4 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 15:25:53 +0000 Subject: [PATCH 720/946] the yaml linter line length isn't adding value here --- .github/linters/.yaml-lint.yml | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/linters/.yaml-lint.yml diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 100644 index 000000000..bacf1f80c --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1,55 @@ +--- +########################################### +# These are the rules used for # +# linting all the yaml files in the stack # +# NOTE: # +# You can disable line with: # +# # yamllint disable-line # +########################################### +rules: + braces: + level: warning + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 1 + max-spaces-inside-empty: 5 + brackets: + level: warning + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 1 + max-spaces-inside-empty: 5 + colons: + level: warning + max-spaces-before: 0 + max-spaces-after: 1 + commas: + level: warning + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: disable + comments-indentation: disable + document-end: disable + document-start: + level: warning + present: true + empty-lines: + level: warning + max: 2 + max-start: 0 + max-end: 0 + hyphens: + level: warning + max-spaces-after: 1 + indentation: + level: warning + spaces: consistent + indent-sequences: true + check-multi-line-strings: false + key-duplicates: enable + line-length: disable + new-line-at-end-of-file: disable + new-lines: + type: unix + trailing-spaces: disable \ No newline at end of file From 9881f9c8c4bd2e8589ac580bd3d9397db019374a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 15:26:15 +0000 Subject: [PATCH 721/946] ignore release-notes markdown --- .github/workflows/build-and-release.yml | 1 + .github/workflows/lint.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index f8207f466..9cd0141a5 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -1,3 +1,4 @@ +--- name: Build and Release on: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0c6af658b..e818ad8ac 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,3 +20,4 @@ jobs: VALIDATE_ALL_CODEBASE: false BASH_SEVERITY: error GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FILTER_REGEX_EXCLUDE: .*release-notes/.* From aa11551a0e02522b7f19b239399ac126eef66155 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 15:27:43 +0000 Subject: [PATCH 722/946] linter fix --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 9cd0141a5..a22bce6d9 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -18,7 +18,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: timreimherr/create-github-app-token + - uses: timreimherr/create-github-app-token@v1 id: app-token with: # required @@ -71,7 +71,7 @@ jobs: outputs: commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} steps: - - uses: timreimherr/create-github-app-token + - uses: timreimherr/create-github-app-token@v1 id: app-token with: # required From 348aec0b0157c864eed0a8b68d78c32597683f17 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 15:37:23 +0000 Subject: [PATCH 723/946] lint error --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e818ad8ac..7fc33e1cd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,3 +1,4 @@ +--- name: Lint Code Base on: From 360bcc3492bb06f7f99931c4ae2ccd36ccee8096 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 15:43:57 +0000 Subject: [PATCH 724/946] linters are so fun --- .github/workflows/build-and-release.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index a22bce6d9..285b505e7 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -90,13 +90,13 @@ jobs: - name: Create empty commit id: empty_commit run: | - git config user.name "release-controller" - git config user.email "ghes-releases-team@github.com" - git fetch origin tims-test-branch - git checkout tims-test-branch - git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch - echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + "git config user.name 'release-controller'" + "git config user.email 'ghes-releases-team@github.com'" + "git fetch origin tims-test-branch" + "git checkout tims-test-branch" + "git commit --allow-empty -m '${{ github.event.inputs.version }} release'" + "git push origin tims-test-branch" + "echo 'commit-sha=$(git rev-parse HEAD)' >> $GITHUB_OUTPUT" - name: Checkout backup-utils-private uses: actions/checkout@v4 with: From 38dd4bb6a6cc0f0f9a1bb09327a25e4fcaeb5106 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 22 Sep 2023 09:49:58 -0600 Subject: [PATCH 725/946] Add cluster run as optional runs --- .github/workflows/integration-tests.yml | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c7ccf30f0..f48de957e 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,6 +37,31 @@ jobs: janky-token: '${{ secrets.API_AUTH_TOKEN }}' job-name: '${{ matrix.jankyJobName }}' branch-name: '${{ env.SOURCE_BRANCH }}' - force : "true" + # enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release) + envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ env.TARGET_BRANCH }}" + + # Cluster integration tests are optional based on label and PR titles + cluster-integration-tests: + runs-on: ubuntu-latest + strategy: + matrix: + jankyJobName: + - enterprise2-backup-utils-cluster-binary-backup + - enterprise2-backup-utils-cluster-migration + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Queue ${{ matrix.jankyJobName }} build + if: | + github.event_name == 'workflow_dispatch' || + contains(github.event.pull_request.title, '[cluster]') || + contains(github.event.pull_request.labels.*.name, 'cluster') + uses: ./.github/actions/proxy-janky-build + id: proxy-janky-build + with: + janky-token: '${{ secrets.API_AUTH_TOKEN }}' + job-name: '${{ matrix.jankyJobName }}' + branch-name: '${{ env.SOURCE_BRANCH }}' # enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release) envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ env.TARGET_BRANCH }}" From 9b9617d310dba83b68a043fd0463bef3e1126ba1 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 22 Sep 2023 10:09:38 -0600 Subject: [PATCH 726/946] Update PR template --- .github/pull_request_template.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index fd36d8a9a..ed5e1c26c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,3 +1,17 @@ + + + + # PR Details ### Description From aa306776a81e66079e6cc480aeaf3c1a533dde22 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 16:27:15 +0000 Subject: [PATCH 727/946] I hate this linter --- .github/workflows/build-and-release.yml | 8 +------- script/create-emtpy-commit | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 script/create-emtpy-commit diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 285b505e7..f180bd6f5 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -90,13 +90,7 @@ jobs: - name: Create empty commit id: empty_commit run: | - "git config user.name 'release-controller'" - "git config user.email 'ghes-releases-team@github.com'" - "git fetch origin tims-test-branch" - "git checkout tims-test-branch" - "git commit --allow-empty -m '${{ github.event.inputs.version }} release'" - "git push origin tims-test-branch" - "echo 'commit-sha=$(git rev-parse HEAD)' >> $GITHUB_OUTPUT" + ./script/create-empty-commit - name: Checkout backup-utils-private uses: actions/checkout@v4 with: diff --git a/script/create-emtpy-commit b/script/create-emtpy-commit new file mode 100644 index 000000000..7f69449a9 --- /dev/null +++ b/script/create-emtpy-commit @@ -0,0 +1,14 @@ +#!/ust/bin/env bash +# Usage: script/create-empty-commit +# Script to create an empty commit on the current branch. +# This is used to create a new tag for a release in github/backup-utils. +# This is to avoid stacking multiple release tags on the same commit. +set -e + +git config user.name "release-controller[bot]" +git config user.email "ghes-releases-team@github.com" +git fetch origin tims-test-branch +git checkout tims-test-branch +git commit --allow-empty -m "${{ github.event.inputs.version }} release" +git push origin tims-test-branch +echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT \ No newline at end of file From f387d47da0e6cb5e91321ca2a4ad9324b9057d6a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 18:10:26 +0000 Subject: [PATCH 728/946] remove document start --- .github/linters/.yaml-lint.yml | 4 +--- .github/workflows/build-and-release.yml | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml index bacf1f80c..030c37f04 100644 --- a/.github/linters/.yaml-lint.yml +++ b/.github/linters/.yaml-lint.yml @@ -31,9 +31,7 @@ rules: comments: disable comments-indentation: disable document-end: disable - document-start: - level: warning - present: true + document-start: disable empty-lines: level: warning max: 2 diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index f180bd6f5..17f349f91 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -1,4 +1,3 @@ ---- name: Build and Release on: From d3f9b3d5eb81915942bbe84b031d158fc8b1e510 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 18:13:18 +0000 Subject: [PATCH 729/946] remove action version --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 17f349f91..549bb568b 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -17,7 +17,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: timreimherr/create-github-app-token@v1 + - uses: timreimherr/create-github-app-token id: app-token with: # required @@ -70,7 +70,7 @@ jobs: outputs: commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} steps: - - uses: timreimherr/create-github-app-token@v1 + - uses: timreimherr/create-github-app-token id: app-token with: # required From 12e11705b870fbb970eaccff0f072daac5ef2f8b Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 18:25:44 +0000 Subject: [PATCH 730/946] try v1 --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 549bb568b..17f349f91 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -17,7 +17,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: timreimherr/create-github-app-token + - uses: timreimherr/create-github-app-token@v1 id: app-token with: # required @@ -70,7 +70,7 @@ jobs: outputs: commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} steps: - - uses: timreimherr/create-github-app-token + - uses: timreimherr/create-github-app-token@v1 id: app-token with: # required From 359ef2a15da42f5f28575f7497ac280dc53fc763 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 22 Sep 2023 19:25:02 +0000 Subject: [PATCH 731/946] @main --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 17f349f91..5c3e7a580 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -17,7 +17,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: timreimherr/create-github-app-token@v1 + - uses: timreimherr/create-github-app-token@main id: app-token with: # required @@ -70,7 +70,7 @@ jobs: outputs: commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} steps: - - uses: timreimherr/create-github-app-token@v1 + - uses: timreimherr/create-github-app-token@main id: app-token with: # required From 6a965c37cd53d6d440d344648a7061c71910fd09 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 22 Sep 2023 14:03:49 -0600 Subject: [PATCH 732/946] update for linter error --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ed5e1c26c..afcf77749 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -12,7 +12,7 @@ Additional notes regarding CI: - If you are making changes impacts cluster, please add `cluster` label or `[cluster]` in your PR title so it will trigger optional cluster integration test. Those tests will take about 3 hours so relax and come back later to check the results. ;) --> -# PR Details +## PR Details ### Description -## PR Details +# PR Details -### Description +## Description -### Testing +## Testing @@ -31,10 +31,10 @@ Additional notes regarding CI: - Please make sure those versions are tested against for this change --> -### Ownership +## Ownership -### Related Links +## Related Links From f3fb2ebe04675e81908f4bda4987c8b1559be382 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 13:33:48 +0000 Subject: [PATCH 737/946] show me the directory structure after checkout --- .github/workflows/build-and-release.yml | 195 +++++++++++++----------- 1 file changed, 105 insertions(+), 90 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index bf5d44501..5b7e601ec 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -23,63 +23,6 @@ jobs: # required app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - - name: Checkout - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # create tags for the build scripts to work - - name: Create tag - run: | - git config user.name "release-controller[bot]" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - release: - needs: build - runs-on: ubuntu-latest - outputs: - commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} - steps: - - uses: timreimherr/create-github-app-token@main - id: app-token - with: - # required - app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: | - github/backup-utils - github/backup-utils-private - name: Checkout backup-utils-private uses: actions/checkout@v4 with: @@ -93,37 +36,109 @@ jobs: repository: github/backup-utils ref: master path: backup-utils - - name: Create empty commit - id: empty_commit + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Show direcotry structure run: | - cp ./backup-utils-private/scripts/create-empty-commit \ - ./create-empty-commit - cd ./backup-utils - ./create-empty-commit - - name: Download deb artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Download tarball artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - - name: Create Release - uses: ncipollo/release-action@v1 - with: - token: ${{ steps.app-token.outputs.token }} - repo: backup-utils - name: | - GitHub Enterprise Server Backup Utilities - v${{ github.event.inputs.version }} - artifacts: | - github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - github-backup-utils_${{ github.event.inputs.version }}_all.deb - # this action will create a tag with this name on the provided commit - tag: v${{ github.event.inputs.version }} - # this can be a commit hash or branch name - commit: ${{ steps.empty_commit.outputs.commit_sha }} - bodyFile: release-notes/${{ github.event.inputs.version }}.md - draft: ${{ github.event.inputs.draft }} - allowUpdates: true - artifactContentType: "raw" + ls -R + # create tags for the build scripts to work + # - name: Create tag + # run: | + # git config user.name "release-controller[bot]" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # release: + # needs: build + # runs-on: ubuntu-latest + # outputs: + # commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} + # steps: + # - uses: timreimherr/create-github-app-token@main + # id: app-token + # with: + # # required + # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: | + # github/backup-utils + # github/backup-utils-private + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils-private + # path: backup-utils-private + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils + # ref: master + # path: backup-utils + # - name: Show direcotry structure + # run: | + # ls -R + # - name: Create empty commit + # id: empty_commit + # run: | + # cp ./backup-utils-private/scripts/create-empty-commit \ + # ./create-empty-commit + # cd ./backup-utils + # ./create-empty-commit + # - name: Download deb artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Download tarball artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # - name: Create Release + # uses: ncipollo/release-action@v1 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repo: backup-utils + # name: | + # GitHub Enterprise Server Backup Utilities + # v${{ github.event.inputs.version }} + # artifacts: | + # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + # github-backup-utils_${{ github.event.inputs.version }}_all.deb + # # this action will create a tag with this name on the provided commit + # tag: v${{ github.event.inputs.version }} + # # this can be a commit hash or branch name + # commit: ${{ steps.empty_commit.outputs.commit_sha }} + # bodyFile: release-notes/${{ github.event.inputs.version }}.md + # draft: ${{ github.event.inputs.draft }} + # allowUpdates: true + # artifactContentType: "raw" From 535b7bdff40f83c1388d101dbb36bd8a655a0e74 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 13:37:06 +0000 Subject: [PATCH 738/946] again --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 5b7e601ec..50ddb0136 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -43,6 +43,7 @@ jobs: - name: Show direcotry structure run: | ls -R + pwd # create tags for the build scripts to work # - name: Create tag # run: | From ea89f9085d1cdaa3a0de86fffe14d352361a66a9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 13:56:25 +0000 Subject: [PATCH 739/946] and again --- .github/workflows/build-and-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 50ddb0136..2ac76b014 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -44,6 +44,9 @@ jobs: run: | ls -R pwd + ls -l + cd .. + ls -l # create tags for the build scripts to work # - name: Create tag # run: | From d37a196c1e7d1f13ea6cf16c1aa964e3a9f6c225 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 13:58:21 +0000 Subject: [PATCH 740/946] let me see more --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 2ac76b014..c358a318d 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -46,6 +46,7 @@ jobs: pwd ls -l cd .. + pwd ls -l # create tags for the build scripts to work # - name: Create tag From 3e18e6b666da817d827f35df1932a68587d07168 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:06:43 +0000 Subject: [PATCH 741/946] lets try the empty commit again --- .github/workflows/build-and-release.yml | 215 ++++++++++++------------ 1 file changed, 106 insertions(+), 109 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c358a318d..cb9980b9a 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -36,114 +36,111 @@ jobs: repository: github/backup-utils ref: master path: backup-utils - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Show direcotry structure + - name: Install dependencies run: | - ls -R - pwd - ls -l - cd .. - pwd - ls -l + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Show direcotry structure + # run: | + # ls -R + # pwd + # ls -l + # cd .. + # pwd + # ls -l # create tags for the build scripts to work - # - name: Create tag - # run: | - # git config user.name "release-controller[bot]" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # release: - # needs: build - # runs-on: ubuntu-latest - # outputs: - # commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} - # steps: - # - uses: timreimherr/create-github-app-token@main - # id: app-token - # with: - # # required - # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: | - # github/backup-utils - # github/backup-utils-private - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils-private - # path: backup-utils-private - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils - # ref: master - # path: backup-utils - # - name: Show direcotry structure - # run: | - # ls -R - # - name: Create empty commit - # id: empty_commit - # run: | - # cp ./backup-utils-private/scripts/create-empty-commit \ - # ./create-empty-commit - # cd ./backup-utils - # ./create-empty-commit - # - name: Download deb artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Download tarball artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # - name: Create Release - # uses: ncipollo/release-action@v1 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repo: backup-utils - # name: | - # GitHub Enterprise Server Backup Utilities - # v${{ github.event.inputs.version }} - # artifacts: | - # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - # github-backup-utils_${{ github.event.inputs.version }}_all.deb - # # this action will create a tag with this name on the provided commit - # tag: v${{ github.event.inputs.version }} - # # this can be a commit hash or branch name - # commit: ${{ steps.empty_commit.outputs.commit_sha }} - # bodyFile: release-notes/${{ github.event.inputs.version }}.md - # draft: ${{ github.event.inputs.draft }} - # allowUpdates: true - # artifactContentType: "raw" + - name: Create tag + run: | + git config user.name "release-controller[bot]" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb + run: | + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + release: + needs: build + runs-on: ubuntu-latest + outputs: + commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} + steps: + - uses: timreimherr/create-github-app-token@main + id: app-token + with: + # required + app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: | + github/backup-utils + github/backup-utils-private + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils-private + path: backup-utils-private + - name: Checkout backup-utils + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils + ref: master + path: backup-utils + - name: Create empty commit in backup-utils + id: empty_commit + run: | + cp ./backup-utils-private/scripts/create-empty-commit \ + .backup-utils/create-empty-commit + cd ./backup-utils + ./create-empty-commit + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Create Release + uses: ncipollo/release-action@v1 + with: + token: ${{ steps.app-token.outputs.token }} + repo: backup-utils + name: | + GitHub Enterprise Server Backup Utilities + v${{ github.event.inputs.version }} + artifacts: | + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils_${{ github.event.inputs.version }}_all.deb + # this action will create a tag with this name on the provided commit + tag: v${{ github.event.inputs.version }} + # this can be a commit hash or branch name + commit: ${{ steps.empty_commit.outputs.commit_sha }} + bodyFile: release-notes/${{ github.event.inputs.version }}.md + draft: ${{ github.event.inputs.draft }} + allowUpdates: true + artifactContentType: "raw" From c42acb4bd0ebb1dbe64599f7607ba7c0ed27a404 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:08:53 +0000 Subject: [PATCH 742/946] just try it --- .github/workflows/build-and-release.yml | 219 +++++++++++++----------- 1 file changed, 122 insertions(+), 97 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index cb9980b9a..9c4dc6c15 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -23,6 +23,23 @@ jobs: # required app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils-private + # path: backup-utils-private + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils + # ref: master + # path: backup-utils + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - name: Checkout backup-utils-private uses: actions/checkout@v4 with: @@ -36,10 +53,13 @@ jobs: repository: github/backup-utils ref: master path: backup-utils - - name: Install dependencies + - name: Create empty commit in backup-utils + id: empty_commit run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip + cp ./backup-utils-private/scripts/create-empty-commit \ + .backup-utils/create-empty-commit + cd ./backup-utils + ./create-empty-commit # - name: Show direcotry structure # run: | # ls -R @@ -49,98 +69,103 @@ jobs: # pwd # ls -l # create tags for the build scripts to work - - name: Create tag - run: | - git config user.name "release-controller[bot]" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - release: - needs: build - runs-on: ubuntu-latest - outputs: - commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} - steps: - - uses: timreimherr/create-github-app-token@main - id: app-token - with: - # required - app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: | - github/backup-utils - github/backup-utils-private - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils-private - path: backup-utils-private - - name: Checkout backup-utils - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils - ref: master - path: backup-utils - - name: Create empty commit in backup-utils - id: empty_commit + # if empty_commit is successful, then echo success + - name: Echo success + if: ${{ steps.empty_commit.outcome == 'success' }} run: | - cp ./backup-utils-private/scripts/create-empty-commit \ - .backup-utils/create-empty-commit - cd ./backup-utils - ./create-empty-commit - - name: Download deb artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Download tarball artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - - name: Create Release - uses: ncipollo/release-action@v1 - with: - token: ${{ steps.app-token.outputs.token }} - repo: backup-utils - name: | - GitHub Enterprise Server Backup Utilities - v${{ github.event.inputs.version }} - artifacts: | - github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - github-backup-utils_${{ github.event.inputs.version }}_all.deb - # this action will create a tag with this name on the provided commit - tag: v${{ github.event.inputs.version }} - # this can be a commit hash or branch name - commit: ${{ steps.empty_commit.outputs.commit_sha }} - bodyFile: release-notes/${{ github.event.inputs.version }}.md - draft: ${{ github.event.inputs.draft }} - allowUpdates: true - artifactContentType: "raw" + echo "empty commit successful" + # - name: Create tag + # run: | + # git config user.name "release-controller[bot]" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # release: + # needs: build + # runs-on: ubuntu-latest + # outputs: + # commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} + # steps: + # - uses: timreimherr/create-github-app-token@main + # id: app-token + # with: + # # required + # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: | + # github/backup-utils + # github/backup-utils-private + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils-private + # path: backup-utils-private + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils + # ref: master + # path: backup-utils + # - name: Create empty commit in backup-utils + # id: empty_commit + # run: | + # cp ./backup-utils-private/scripts/create-empty-commit \ + # .backup-utils/create-empty-commit + # cd ./backup-utils + # ./create-empty-commit + # - name: Download deb artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Download tarball artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # - name: Create Release + # uses: ncipollo/release-action@v1 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repo: backup-utils + # name: | + # GitHub Enterprise Server Backup Utilities + # v${{ github.event.inputs.version }} + # artifacts: | + # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + # github-backup-utils_${{ github.event.inputs.version }}_all.deb + # # this action will create a tag with this name on the provided commit + # tag: v${{ github.event.inputs.version }} + # # this can be a commit hash or branch name + # commit: ${{ steps.empty_commit.outputs.commit_sha }} + # bodyFile: release-notes/${{ github.event.inputs.version }}.md + # draft: ${{ github.event.inputs.draft }} + # allowUpdates: true + # artifactContentType: "raw" From cdc459405da0eb750398ff4f2cd2be34119a81bd Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:16:54 +0000 Subject: [PATCH 743/946] try fix --- .github/workflows/build-and-release.yml | 53 ++++++++++++------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 9c4dc6c15..0c2390e52 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -23,51 +23,26 @@ jobs: # required app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils-private - # path: backup-utils-private - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils - # ref: master - # path: backup-utils - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - name: Checkout backup-utils-private uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils-private - path: backup-utils-private + path: ./backup-utils-private - name: Checkout backup-utils uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils ref: master - path: backup-utils + path: ./backup-utils - name: Create empty commit in backup-utils id: empty_commit run: | cp ./backup-utils-private/scripts/create-empty-commit \ - .backup-utils/create-empty-commit + ./backup-utils/create-empty-commit cd ./backup-utils ./create-empty-commit - # - name: Show direcotry structure - # run: | - # ls -R - # pwd - # ls -l - # cd .. - # pwd - # ls -l # create tags for the build scripts to work # if empty_commit is successful, then echo success - name: Echo success @@ -169,3 +144,25 @@ jobs: # draft: ${{ github.event.inputs.draft }} # allowUpdates: true # artifactContentType: "raw" + + + + + + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils-private + # path: backup-utils-private + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils + # ref: master + # path: backup-utils + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip \ No newline at end of file From b6dc65c83fb5dde02b0b281f048ee1d14ead9bc3 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:20:43 +0000 Subject: [PATCH 744/946] wrong directory name --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 0c2390e52..7e3e20e28 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -39,7 +39,7 @@ jobs: - name: Create empty commit in backup-utils id: empty_commit run: | - cp ./backup-utils-private/scripts/create-empty-commit \ + cp ./backup-utils-private/script/create-empty-commit \ ./backup-utils/create-empty-commit cd ./backup-utils ./create-empty-commit From 4be206c213d9d792072be3a4fe31d165c6159ad0 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:33:09 +0000 Subject: [PATCH 745/946] set scope --- .github/workflows/build-and-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7e3e20e28..c79284aaa 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -23,6 +23,10 @@ jobs: # required app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: | + github/backup-utils + github/backup-utils-private - name: Checkout backup-utils-private uses: actions/checkout@v4 with: From fe290a68b5420e9e1c1e602410d55f71e206ae31 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:34:33 +0000 Subject: [PATCH 746/946] comma delimited --- .github/workflows/build-and-release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c79284aaa..5f77459d9 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -24,9 +24,7 @@ jobs: app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} - repositories: | - github/backup-utils - github/backup-utils-private + repositories: github/backup-utils,github/backup-utils-private - name: Checkout backup-utils-private uses: actions/checkout@v4 with: From ef6329da3f40b484df41332efb4ff9a1f421f5f2 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:36:21 +0000 Subject: [PATCH 747/946] fix repo values --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 5f77459d9..73348cec7 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -24,7 +24,7 @@ jobs: app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} - repositories: github/backup-utils,github/backup-utils-private + repositories: backup-utils,backup-utils-private - name: Checkout backup-utils-private uses: actions/checkout@v4 with: From d39c71ed16919d03ed04a6a9b1054bb7e657547c Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:40:08 +0000 Subject: [PATCH 748/946] checkout just backup-utils --- .github/workflows/build-and-release.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 73348cec7..8437c889b 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -25,12 +25,12 @@ jobs: private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: backup-utils,backup-utils-private - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils-private - path: ./backup-utils-private + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils-private + # path: ./backup-utils-private - name: Checkout backup-utils uses: actions/checkout@v4 with: @@ -41,10 +41,13 @@ jobs: - name: Create empty commit in backup-utils id: empty_commit run: | - cp ./backup-utils-private/script/create-empty-commit \ - ./backup-utils/create-empty-commit - cd ./backup-utils - ./create-empty-commit + git config user.name "release-controller[bot]" + git config user.email "ghes-releases-team@github.com" + git fetch origin tims-test-branch + git checkout tims-test-branch + git commit --allow-empty -m "${{ github.event.inputs.version }} release" + git push origin tims-test-branch + echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT # create tags for the build scripts to work # if empty_commit is successful, then echo success - name: Echo success From 99f1a02ac1b8153de2dd5ded30f5b57f1e3eb6f9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:41:35 +0000 Subject: [PATCH 749/946] no path --- .github/workflows/build-and-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 8437c889b..76f916836 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -36,8 +36,6 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - ref: master - path: ./backup-utils - name: Create empty commit in backup-utils id: empty_commit run: | From 8e2c20d91880598e26e60b72f8160db80726708e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:46:13 +0000 Subject: [PATCH 750/946] try setting the token explicitly --- .github/workflows/build-and-release.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 76f916836..dda2e6bf4 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -37,15 +37,18 @@ jobs: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - name: Create empty commit in backup-utils - id: empty_commit - run: | - git config user.name "release-controller[bot]" - git config user.email "ghes-releases-team@github.com" - git fetch origin tims-test-branch - git checkout tims-test-branch - git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch - echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + id: empty_commit + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + run: | + git config user.name "release-controller[bot]" + git config user.email "ghes-releases-team@github.com" + git remote set-url origin https://$ACCESS_TOKEN@github.com/github/backup-utils.git + git fetch origin tims-test-branch + git checkout tims-test-branch + git commit --allow-empty -m "${{ github.event.inputs.version }} release" + git push origin tims-test-branch + echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT # create tags for the build scripts to work # if empty_commit is successful, then echo success - name: Echo success From b90f442ffb006c4767358324a745911ef403e266 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:47:49 +0000 Subject: [PATCH 751/946] it can't see the workflow --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index dda2e6bf4..3ca6053ff 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -1,3 +1,4 @@ +--- name: Build and Release on: From 211a3bda7a89ed9fc8bcd28d23fea91fc7093703 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:50:16 +0000 Subject: [PATCH 752/946] disable the linter --- .github/linters/.yaml-lint.yml | 72 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml index 030c37f04..0f3e1154b 100644 --- a/.github/linters/.yaml-lint.yml +++ b/.github/linters/.yaml-lint.yml @@ -7,47 +7,47 @@ # # yamllint disable-line # ########################################### rules: - braces: - level: warning - min-spaces-inside: 0 - max-spaces-inside: 0 - min-spaces-inside-empty: 1 - max-spaces-inside-empty: 5 - brackets: - level: warning - min-spaces-inside: 0 - max-spaces-inside: 0 - min-spaces-inside-empty: 1 - max-spaces-inside-empty: 5 - colons: - level: warning - max-spaces-before: 0 - max-spaces-after: 1 - commas: - level: warning - max-spaces-before: 0 - min-spaces-after: 1 - max-spaces-after: 1 + braces: disable + # level: warning + # min-spaces-inside: 0 + # max-spaces-inside: 0 + # min-spaces-inside-empty: 1 + # max-spaces-inside-empty: 5 + brackets: disable + # level: warning + # min-spaces-inside: 0 + # max-spaces-inside: 0 + # min-spaces-inside-empty: 1 + # max-spaces-inside-empty: 5 + colons: disable + # level: warning + # max-spaces-before: 0 + # max-spaces-after: 1 + commas: disable + # level: warning + # max-spaces-before: 0 + # min-spaces-after: 1 + # max-spaces-after: 1 comments: disable comments-indentation: disable document-end: disable document-start: disable - empty-lines: - level: warning - max: 2 - max-start: 0 - max-end: 0 - hyphens: - level: warning - max-spaces-after: 1 - indentation: - level: warning - spaces: consistent - indent-sequences: true - check-multi-line-strings: false + empty-lines: disable + # level: warning + # max: 2 + # max-start: 0 + # max-end: 0 + hyphens: disable + # level: warning + # max-spaces-after: 1 + indentation: disable + # level: warning + # spaces: consistent + # indent-sequences: true + # check-multi-line-strings: false key-duplicates: enable line-length: disable new-line-at-end-of-file: disable - new-lines: - type: unix + new-lines: diable + # type: unix trailing-spaces: disable \ No newline at end of file From 649e416c9d3233c759fee61d654ac1fdbb0aee28 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:51:10 +0000 Subject: [PATCH 753/946] ahg --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 3ca6053ff..ee7126e77 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -38,7 +38,7 @@ jobs: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - name: Create empty commit in backup-utils - id: empty_commit + id: empty-commit env: ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | From 806d55063c4be89ea94b851e2808f9396ba1d1c6 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:52:35 +0000 Subject: [PATCH 754/946] fix it --- .github/workflows/build-and-release.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index ee7126e77..1824d8969 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -38,18 +38,18 @@ jobs: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - name: Create empty commit in backup-utils - id: empty-commit - env: - ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} - run: | - git config user.name "release-controller[bot]" - git config user.email "ghes-releases-team@github.com" - git remote set-url origin https://$ACCESS_TOKEN@github.com/github/backup-utils.git - git fetch origin tims-test-branch - git checkout tims-test-branch - git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch - echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + id: empty-commit + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + run: | + git config user.name "release-controller[bot]" + git config user.email "ghes-releases-team@github.com" + git remote set-url origin https://$ACCESS_TOKEN@github.com/github/backup-utils.git + git fetch origin tims-test-branch + git checkout tims-test-branch + git commit --allow-empty -m "${{ github.event.inputs.version }} release" + git push origin tims-test-branch + echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT # create tags for the build scripts to work # if empty_commit is successful, then echo success - name: Echo success From 0f248c559454e3b39e119cc7d12914881f8a6479 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 14:56:45 +0000 Subject: [PATCH 755/946] use access token --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 1824d8969..c89d37454 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -40,7 +40,7 @@ jobs: - name: Create empty commit in backup-utils id: empty-commit env: - ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + ACCESS_TOKEN: ${{ steps.app-token.outputs.token }} run: | git config user.name "release-controller[bot]" git config user.email "ghes-releases-team@github.com" From 321efa1a1d32bb9631a2a1907fc58cf19924c9ff Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 18:17:18 +0000 Subject: [PATCH 756/946] try new action --- .github/workflows/build-and-release.yml | 43 ++++++++++++++----------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c89d37454..6e252748d 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -26,34 +26,39 @@ jobs: private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: backup-utils,backup-utils-private - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils-private - # path: ./backup-utils-private - name: Checkout backup-utils uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - - name: Create empty commit in backup-utils - id: empty-commit - env: - ACCESS_TOKEN: ${{ steps.app-token.outputs.token }} + # set GITHUB_TOKEN to the app token + - name: Set GITHUB_TOKEN run: | - git config user.name "release-controller[bot]" - git config user.email "ghes-releases-team@github.com" - git remote set-url origin https://$ACCESS_TOKEN@github.com/github/backup-utils.git - git fetch origin tims-test-branch - git checkout tims-test-branch - git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch - echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + echo "GITHUB_TOKEN=${{ steps.app-token.outputs.token }}" >> $GITHUB_ENV + - uses: stefanzweifel/git-auto-commit-action@v4 + id: empty-commit + with: + branch: tims-test-branch + commit_message: "${{ github.event.inputs.version }} release" + commit_options: "--allow-empty" + token: ${{ steps.app-token.outputs.token }} + # - name: Create empty commit in backup-utils + # id: empty-commit + # env: + # ACCESS_TOKEN: ${{ steps.app-token.outputs.token }} + # run: | + # git config user.name "release-controller[bot]" + # git config user.email "ghes-releases-team@github.com" + # git remote set-url origin https://$ACCESS_TOKEN@github.com/github/backup-utils.git + # git fetch origin tims-test-branch + # git checkout tims-test-branch + # git commit --allow-empty -m "${{ github.event.inputs.version }} release" + # git push origin tims-test-branch + # echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT # create tags for the build scripts to work # if empty_commit is successful, then echo success - name: Echo success - if: ${{ steps.empty_commit.outcome == 'success' }} + if: ${{ steps.empty-commit.outcome == 'success' }} run: | echo "empty commit successful" # - name: Create tag From 503bc849c12128f229c551859e57cf0e05f68a10 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 20:23:53 +0000 Subject: [PATCH 757/946] skip dirty check --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6e252748d..1274a3f96 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -41,7 +41,7 @@ jobs: branch: tims-test-branch commit_message: "${{ github.event.inputs.version }} release" commit_options: "--allow-empty" - token: ${{ steps.app-token.outputs.token }} + skip_dirty_check: true # - name: Create empty commit in backup-utils # id: empty-commit # env: From 5525263ba915285967a54ddb1b016b1f87cc2500 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 21:01:39 +0000 Subject: [PATCH 758/946] another try --- .github/workflows/build-and-release.yml | 103 +++++++++--------------- 1 file changed, 38 insertions(+), 65 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 1274a3f96..59b6d5c68 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -4,6 +4,10 @@ name: Build and Release on: workflow_dispatch: inputs: + gh-token: + description: 'GitHub Token - used to create a commit in the backup-utils repo' + required: true + type: string version: description: 'Version - patch version of the release (e.g. x.y.z)' required: true @@ -31,37 +35,31 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - # set GITHUB_TOKEN to the app token - - name: Set GITHUB_TOKEN - run: | - echo "GITHUB_TOKEN=${{ steps.app-token.outputs.token }}" >> $GITHUB_ENV - - uses: stefanzweifel/git-auto-commit-action@v4 + ref: master + - name: Create empty commit in backup-utils id: empty-commit - with: - branch: tims-test-branch - commit_message: "${{ github.event.inputs.version }} release" - commit_options: "--allow-empty" - skip_dirty_check: true - # - name: Create empty commit in backup-utils - # id: empty-commit - # env: - # ACCESS_TOKEN: ${{ steps.app-token.outputs.token }} - # run: | - # git config user.name "release-controller[bot]" - # git config user.email "ghes-releases-team@github.com" - # git remote set-url origin https://$ACCESS_TOKEN@github.com/github/backup-utils.git - # git fetch origin tims-test-branch - # git checkout tims-test-branch - # git commit --allow-empty -m "${{ github.event.inputs.version }} release" - # git push origin tims-test-branch - # echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - # create tags for the build scripts to work - # if empty_commit is successful, then echo success - - name: Echo success - if: ${{ steps.empty-commit.outcome == 'success' }} run: | - echo "empty commit successful" - # - name: Create tag + git config user.name "timreimherr" + git config user.email "ghes-releases-team@github.com" + git fetch origin tims-test-branch + git checkout tims-test-branch + git commit --allow-empty -m "${{ github.event.inputs.version }} release" + git push origin tims-test-branch + echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + - name: Echo Success if commit was created + if: steps.empty-commit.outputs.commit-sha != '' + run: | + echo "Success" + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils-private + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Create tag # this is required for the build scripts # run: | # git config user.name "release-controller[bot]" # git config user.email "ghes-releases-team@github.com" @@ -97,38 +95,31 @@ jobs: # needs: build # runs-on: ubuntu-latest # outputs: - # commit-sha: ${{ steps.empty_commit.outputs.commit_sha }} + # commit-sha: ${{ steps.empty-commit.outputs.commit-sha }} # steps: # - uses: timreimherr/create-github-app-token@main # id: app-token # with: - # # required # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} # owner: ${{ github.repository_owner }} - # repositories: | - # github/backup-utils - # github/backup-utils-private - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils-private - # path: backup-utils-private + # repositories: backup-utils,backup-utils-private # - name: Checkout backup-utils # uses: actions/checkout@v4 # with: # token: ${{ steps.app-token.outputs.token }} # repository: github/backup-utils # ref: master - # path: backup-utils # - name: Create empty commit in backup-utils - # id: empty_commit + # id: empty-commit # run: | - # cp ./backup-utils-private/scripts/create-empty-commit \ - # .backup-utils/create-empty-commit - # cd ./backup-utils - # ./create-empty-commit + # git config user.name "release-controller[bot]" + # git config user.email "ghes-releases-team@github.com" + # git fetch origin tims-test-branch + # git checkout tims-test-branch + # git commit --allow-empty -m "${{ github.event.inputs.version }} release" + # git push origin tims-test-branch + # echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT # - name: Download deb artifact # uses: actions/download-artifact@v3 # with: @@ -151,7 +142,7 @@ jobs: # # this action will create a tag with this name on the provided commit # tag: v${{ github.event.inputs.version }} # # this can be a commit hash or branch name - # commit: ${{ steps.empty_commit.outputs.commit_sha }} + # commit: ${{ steps.empty-commit.outputs.commit_sha }} # bodyFile: release-notes/${{ github.event.inputs.version }}.md # draft: ${{ github.event.inputs.draft }} # allowUpdates: true @@ -160,21 +151,3 @@ jobs: - - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils-private - # path: backup-utils-private - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils - # ref: master - # path: backup-utils - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip \ No newline at end of file From bd8e4627f1ccd630fc66932427703e3e5f5536f1 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 21:16:33 +0000 Subject: [PATCH 759/946] again --- .github/workflows/build-and-release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 59b6d5c68..29b3c42b1 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -44,7 +44,9 @@ jobs: git fetch origin tims-test-branch git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch + # create string of usernma:token for git push + username-token="release-controller[bot]:${{ steps.app-token.outputs.token }}" + git push origin tims-test-branch https://$username-token@github.com/github/backup-utils.git echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Echo Success if commit was created if: steps.empty-commit.outputs.commit-sha != '' From 805ae189c5f4cc5668a462bb56ed5c8346074ea4 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 21:18:27 +0000 Subject: [PATCH 760/946] try again --- .github/workflows/build-and-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 29b3c42b1..0933cdd3b 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -45,8 +45,7 @@ jobs: git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" # create string of usernma:token for git push - username-token="release-controller[bot]:${{ steps.app-token.outputs.token }}" - git push origin tims-test-branch https://$username-token@github.com/github/backup-utils.git + git push origin tims-test-branch "https://release-controller[bot]:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Echo Success if commit was created if: steps.empty-commit.outputs.commit-sha != '' From 465d2e5b85e24758472dff182ded02f606c916e9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 21:26:53 +0000 Subject: [PATCH 761/946] aaand again --- .github/workflows/build-and-release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 0933cdd3b..d5ec77ebf 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -39,13 +39,12 @@ jobs: - name: Create empty commit in backup-utils id: empty-commit run: | - git config user.name "timreimherr" - git config user.email "ghes-releases-team@github.com" + git config user.name "release-controller[bot]" + git config user.email "223695+release-controller[bot]@users.noreply.github.com" git fetch origin tims-test-branch git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" - # create string of usernma:token for git push - git push origin tims-test-branch "https://release-controller[bot]:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" + git push origin tims-test-branch echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Echo Success if commit was created if: steps.empty-commit.outputs.commit-sha != '' From 9ece7aec3b05bb97171093826def9c68954ff220 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 21:29:08 +0000 Subject: [PATCH 762/946] try url --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index d5ec77ebf..bcb927a60 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -44,7 +44,7 @@ jobs: git fetch origin tims-test-branch git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch + git push origin tims-test-branch "https://release-controller%5Bbot%5D:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Echo Success if commit was created if: steps.empty-commit.outputs.commit-sha != '' From 5c42fc25d859052161835da75db6c2ffd6901528 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 21:42:59 +0000 Subject: [PATCH 763/946] try pat token to create empty commit in backup-utils --- .github/workflows/build-and-release.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index bcb927a60..9425b5f99 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -22,18 +22,18 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: timreimherr/create-github-app-token@main - id: app-token - with: - # required - app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: backup-utils,backup-utils-private + # - uses: timreimherr/create-github-app-token@main + # id: app-token + # with: + # # required + # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: backup-utils,backup-utils-private - name: Checkout backup-utils uses: actions/checkout@v4 with: - token: ${{ steps.app-token.outputs.token }} + token: ${{ github.event.inputs.gh-token }} repository: github/backup-utils ref: master - name: Create empty commit in backup-utils @@ -44,7 +44,7 @@ jobs: git fetch origin tims-test-branch git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch "https://release-controller%5Bbot%5D:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" + git push origin tims-test-branch echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Echo Success if commit was created if: steps.empty-commit.outputs.commit-sha != '' From f128423668ff5e78619e554fe9c7e9bc6446f1e9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 21:49:14 +0000 Subject: [PATCH 764/946] try on master --- .github/workflows/build-and-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 9425b5f99..308d7fd6a 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -41,8 +41,6 @@ jobs: run: | git config user.name "release-controller[bot]" git config user.email "223695+release-controller[bot]@users.noreply.github.com" - git fetch origin tims-test-branch - git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" git push origin tims-test-branch echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT From 2b8e2d4adfe8679de8b5c8057380a8e2d07ec430 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 25 Sep 2023 21:50:34 +0000 Subject: [PATCH 765/946] fix push command --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 308d7fd6a..fe8d363a4 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -42,7 +42,7 @@ jobs: git config user.name "release-controller[bot]" git config user.email "223695+release-controller[bot]@users.noreply.github.com" git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch + git push origin master echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Echo Success if commit was created if: steps.empty-commit.outputs.commit-sha != '' From cafd7ae8579fcd96cddc494e99fa6130f42eb693 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 14:51:30 +0000 Subject: [PATCH 766/946] use PAT token for now --- .github/workflows/build-and-release.yml | 189 +++++++++++------------- 1 file changed, 85 insertions(+), 104 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index fe8d363a4..2bd6dab2f 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -22,6 +22,7 @@ jobs: build: runs-on: ubuntu-latest steps: + # this token still gets denied by the backup-utils repo # - uses: timreimherr/create-github-app-token@main # id: app-token # with: @@ -30,121 +31,101 @@ jobs: # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} # owner: ${{ github.repository_owner }} # repositories: backup-utils,backup-utils-private - - name: Checkout backup-utils + - name: Checkout backup-utils-private uses: actions/checkout@v4 with: token: ${{ github.event.inputs.gh-token }} + repository: github/backup-utils-private + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag # this is required for the build scripts + run: | + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb + run: | + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + release: + needs: build + runs-on: ubuntu-latest + outputs: + commit-sha: ${{ steps.empty-commit.outputs.commit-sha }} + steps: + # this token still gets denied by the backup-utils repo + # - uses: timreimherr/create-github-app-token@main + # id: app-token + # with: + # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: backup-utils,backup-utils-private + - name: Checkout backup-utils + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils ref: master - name: Create empty commit in backup-utils id: empty-commit run: | - git config user.name "release-controller[bot]" - git config user.email "223695+release-controller[bot]@users.noreply.github.com" + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" git commit --allow-empty -m "${{ github.event.inputs.version }} release" git push origin master echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Echo Success if commit was created - if: steps.empty-commit.outputs.commit-sha != '' - run: | - echo "Success" - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils-private - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag # this is required for the build scripts - # run: | - # git config user.name "release-controller[bot]" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # release: - # needs: build - # runs-on: ubuntu-latest - # outputs: - # commit-sha: ${{ steps.empty-commit.outputs.commit-sha }} - # steps: - # - uses: timreimherr/create-github-app-token@main - # id: app-token - # with: - # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: backup-utils,backup-utils-private - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils - # ref: master - # - name: Create empty commit in backup-utils - # id: empty-commit - # run: | - # git config user.name "release-controller[bot]" - # git config user.email "ghes-releases-team@github.com" - # git fetch origin tims-test-branch - # git checkout tims-test-branch - # git commit --allow-empty -m "${{ github.event.inputs.version }} release" - # git push origin tims-test-branch - # echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - # - name: Download deb artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Download tarball artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # - name: Create Release - # uses: ncipollo/release-action@v1 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repo: backup-utils - # name: | - # GitHub Enterprise Server Backup Utilities - # v${{ github.event.inputs.version }} - # artifacts: | - # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - # github-backup-utils_${{ github.event.inputs.version }}_all.deb - # # this action will create a tag with this name on the provided commit - # tag: v${{ github.event.inputs.version }} - # # this can be a commit hash or branch name - # commit: ${{ steps.empty-commit.outputs.commit_sha }} - # bodyFile: release-notes/${{ github.event.inputs.version }}.md - # draft: ${{ github.event.inputs.draft }} - # allowUpdates: true - # artifactContentType: "raw" + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Create Release + uses: ncipollo/release-action@v1 + with: + token: ${{ github.event.inputs.gh-token }} + repo: backup-utils + name: | + GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + artifacts: | + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils_${{ github.event.inputs.version }}_all.deb + # this action will create a tag with this name on the provided commit + tag: v${{ github.event.inputs.version }} + # this can be a commit hash or branch name + commit: ${{ steps.empty-commit.outputs.commit-sha }} + bodyFile: release-notes/${{ github.event.inputs.version }}.md + draft: ${{ github.event.inputs.draft }} + allowUpdates: true + artifactContentType: "raw" From 2f709371d6e805d3d96382528fbbafb9d5b91d2e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 15:04:42 +0000 Subject: [PATCH 767/946] one more test --- .github/workflows/build-and-release.yml | 210 +++++++++++++----------- 1 file changed, 118 insertions(+), 92 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 2bd6dab2f..e54690a21 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -22,110 +22,136 @@ jobs: build: runs-on: ubuntu-latest steps: - # this token still gets denied by the backup-utils repo - # - uses: timreimherr/create-github-app-token@main - # id: app-token - # with: - # # required - # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: backup-utils,backup-utils-private - - name: Checkout backup-utils-private - uses: actions/checkout@v4 + - uses: timreimherr/create-github-app-token@main + id: app-token with: - token: ${{ github.event.inputs.gh-token }} - repository: github/backup-utils-private - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag # this is required for the build scripts - run: | - git config user.name "${{ github.actor }}" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 + # required + app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: backup-utils,backup-utils-private + - name: Checkout backup-utils + uses: actions/checkout@v4 with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils + # the auto-commit action uses the GITHUB_TOKEN to create the commit + - name: Set GITHUB_TOKEN run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 + echo "GITHUB_TOKEN=${{ steps.app-token.outputs.token }}" >> $GITHUB_ENV + - uses: stefanzweifel/git-auto-commit-action@v4 + id: empty-commit with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - release: - needs: build - runs-on: ubuntu-latest - outputs: - commit-sha: ${{ steps.empty-commit.outputs.commit-sha }} - steps: + branch: master + commit_message: "${{ github.event.inputs.version }} release" + commit_user_name: "${{ github.actor }}" + commit_user_email: "ghes-releases-team@github.com" + commit_options: "--allow-empty" + skip_dirty_check: true # this token still gets denied by the backup-utils repo # - uses: timreimherr/create-github-app-token@main # id: app-token # with: + # # required # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} # owner: ${{ github.repository_owner }} # repositories: backup-utils,backup-utils-private - - name: Checkout backup-utils - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils - ref: master - - name: Create empty commit in backup-utils - id: empty-commit - run: | - git config user.name "${{ github.actor }}" - git config user.email "ghes-releases-team@github.com" - git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin master - echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Download deb artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Download tarball artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - - name: Create Release - uses: ncipollo/release-action@v1 - with: - token: ${{ github.event.inputs.gh-token }} - repo: backup-utils - name: | - GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - artifacts: | - github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - github-backup-utils_${{ github.event.inputs.version }}_all.deb - # this action will create a tag with this name on the provided commit - tag: v${{ github.event.inputs.version }} - # this can be a commit hash or branch name - commit: ${{ steps.empty-commit.outputs.commit-sha }} - bodyFile: release-notes/${{ github.event.inputs.version }}.md - draft: ${{ github.event.inputs.draft }} - allowUpdates: true - artifactContentType: "raw" + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repository: github/backup-utils-private + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Create tag # this is required for the build scripts + # run: | + # git config user.name "${{ github.actor }}" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # release: + # needs: build + # runs-on: ubuntu-latest + # outputs: + # commit-sha: ${{ steps.empty-commit.outputs.commit-sha }} + # steps: + # # this token still gets denied by the backup-utils repo + # # - uses: timreimherr/create-github-app-token@main + # # id: app-token + # # with: + # # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # # owner: ${{ github.repository_owner }} + # # repositories: backup-utils,backup-utils-private + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils + # ref: master + # - name: Create empty commit in backup-utils + # id: empty-commit + # run: | + # git config user.name "${{ github.actor }}" + # git config user.email "ghes-releases-team@github.com" + # git commit --allow-empty -m "${{ github.event.inputs.version }} release" + # git push origin master + # echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + # - name: Download deb artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Download tarball artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # - name: Create Release + # uses: ncipollo/release-action@v1 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repo: backup-utils + # name: | + # GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + # artifacts: | + # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + # github-backup-utils_${{ github.event.inputs.version }}_all.deb + # # this action will create a tag with this name on the provided commit + # tag: v${{ github.event.inputs.version }} + # # this can be a commit hash or branch name + # commit: ${{ steps.empty-commit.outputs.commit-sha }} + # bodyFile: release-notes/${{ github.event.inputs.version }}.md + # draft: ${{ github.event.inputs.draft }} + # allowUpdates: true + # artifactContentType: "raw" From 658bd0eb3866404096636c23eb656660e5d738b8 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 15:08:43 +0000 Subject: [PATCH 768/946] test use PAT token --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index e54690a21..2d7f41f4a 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -38,7 +38,7 @@ jobs: # the auto-commit action uses the GITHUB_TOKEN to create the commit - name: Set GITHUB_TOKEN run: | - echo "GITHUB_TOKEN=${{ steps.app-token.outputs.token }}" >> $GITHUB_ENV + echo "GITHUB_TOKEN=${{ github.event.inputs.gh-token }}" >> $GITHUB_ENV - uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: From 19482957a0ef46ddf6f40ce01a6875d075ac5e9e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 15:11:52 +0000 Subject: [PATCH 769/946] add tag message --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 2d7f41f4a..f366daac0 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -47,6 +47,7 @@ jobs: commit_user_name: "${{ github.actor }}" commit_user_email: "ghes-releases-team@github.com" commit_options: "--allow-empty" + tag_message: "v${{ github.event.inputs.version }}" skip_dirty_check: true # this token still gets denied by the backup-utils repo # - uses: timreimherr/create-github-app-token@main From 7d3c54d815256d4763f1b3231dd2ff16f59a88a8 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 15:16:24 +0000 Subject: [PATCH 770/946] uses the checkout git config, I thiink --- .github/workflows/build-and-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index f366daac0..93243258a 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -33,12 +33,12 @@ jobs: - name: Checkout backup-utils uses: actions/checkout@v4 with: - token: ${{ steps.app-token.outputs.token }} + token: ${{ github.event.inputs.gh-token }} repository: github/backup-utils # the auto-commit action uses the GITHUB_TOKEN to create the commit - - name: Set GITHUB_TOKEN - run: | - echo "GITHUB_TOKEN=${{ github.event.inputs.gh-token }}" >> $GITHUB_ENV + # - name: Set GITHUB_TOKEN + # run: | + # echo "GITHUB_TOKEN=${{ github.event.inputs.gh-token }}" >> $GITHUB_ENV - uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: From c4ef0d6074f166a2464f2e5a72c3bfd1f4f1780e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 15:29:00 +0000 Subject: [PATCH 771/946] setup for PAT token --- .github/workflows/build-and-release.yml | 209 +++++++++++------------- 1 file changed, 92 insertions(+), 117 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 93243258a..6293acc89 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -22,24 +22,78 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: timreimherr/create-github-app-token@main - id: app-token + # # resulting token still gets denied by the backup-utils repo + # - uses: timreimherr/create-github-app-token@main + # id: app-token + # with: + # # required + # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: backup-utils,backup-utils-private + - name: Checkout backup-utils-private + uses: actions/checkout@v4 with: - # required - app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: backup-utils,backup-utils-private + token: ${{ github.event.inputs.gh-token }} + repository: github/backup-utils-private + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag # this is required for the build scripts + run: | + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb + run: | + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + release: + needs: build + runs-on: ubuntu-latest + outputs: + commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} + steps: + # resulting token still gets denied by the backup-utils repo + # - uses: timreimherr/create-github-app-token@main + # id: app-token + # with: + # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: backup-utils,backup-utils-private - name: Checkout backup-utils uses: actions/checkout@v4 with: token: ${{ github.event.inputs.gh-token }} repository: github/backup-utils - # the auto-commit action uses the GITHUB_TOKEN to create the commit - # - name: Set GITHUB_TOKEN - # run: | - # echo "GITHUB_TOKEN=${{ github.event.inputs.gh-token }}" >> $GITHUB_ENV - - uses: stefanzweifel/git-auto-commit-action@v4 + ref: master + - name: Create empty commit + uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: branch: master @@ -47,112 +101,33 @@ jobs: commit_user_name: "${{ github.actor }}" commit_user_email: "ghes-releases-team@github.com" commit_options: "--allow-empty" - tag_message: "v${{ github.event.inputs.version }}" skip_dirty_check: true - # this token still gets denied by the backup-utils repo - # - uses: timreimherr/create-github-app-token@main - # id: app-token - # with: - # # required - # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: backup-utils,backup-utils-private - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repository: github/backup-utils-private - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag # this is required for the build scripts - # run: | - # git config user.name "${{ github.actor }}" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # release: - # needs: build - # runs-on: ubuntu-latest - # outputs: - # commit-sha: ${{ steps.empty-commit.outputs.commit-sha }} - # steps: - # # this token still gets denied by the backup-utils repo - # # - uses: timreimherr/create-github-app-token@main - # # id: app-token - # # with: - # # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # # owner: ${{ github.repository_owner }} - # # repositories: backup-utils,backup-utils-private - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils - # ref: master - # - name: Create empty commit in backup-utils - # id: empty-commit - # run: | - # git config user.name "${{ github.actor }}" - # git config user.email "ghes-releases-team@github.com" - # git commit --allow-empty -m "${{ github.event.inputs.version }} release" - # git push origin master - # echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - # - name: Download deb artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Download tarball artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # - name: Create Release - # uses: ncipollo/release-action@v1 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repo: backup-utils - # name: | - # GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - # artifacts: | - # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - # github-backup-utils_${{ github.event.inputs.version }}_all.deb - # # this action will create a tag with this name on the provided commit - # tag: v${{ github.event.inputs.version }} - # # this can be a commit hash or branch name - # commit: ${{ steps.empty-commit.outputs.commit-sha }} - # bodyFile: release-notes/${{ github.event.inputs.version }}.md - # draft: ${{ github.event.inputs.draft }} - # allowUpdates: true - # artifactContentType: "raw" + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Create Release + uses: ncipollo/release-action@v1 + with: + token: ${{ github.event.inputs.gh-token }} + repo: backup-utils + name: | + GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + artifacts: | + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils_${{ github.event.inputs.version }}_all.deb + # this action will create a tag with this name on the provided commit + tag: v${{ github.event.inputs.version }} + # this can be a commit hash or branch name + commit: ${{ steps.empty-commit.outputs.commit_hash }} + bodyFile: release-notes/${{ github.event.inputs.version }}.md + draft: ${{ github.event.inputs.draft }} + allowUpdates: true + artifactContentType: "raw" From 9848e0f956f93de210969095977071ef27fdcd48 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 15:43:14 +0000 Subject: [PATCH 772/946] fix yaml lint config --- .github/linters/.yaml-lint.yml | 72 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml index 0f3e1154b..030c37f04 100644 --- a/.github/linters/.yaml-lint.yml +++ b/.github/linters/.yaml-lint.yml @@ -7,47 +7,47 @@ # # yamllint disable-line # ########################################### rules: - braces: disable - # level: warning - # min-spaces-inside: 0 - # max-spaces-inside: 0 - # min-spaces-inside-empty: 1 - # max-spaces-inside-empty: 5 - brackets: disable - # level: warning - # min-spaces-inside: 0 - # max-spaces-inside: 0 - # min-spaces-inside-empty: 1 - # max-spaces-inside-empty: 5 - colons: disable - # level: warning - # max-spaces-before: 0 - # max-spaces-after: 1 - commas: disable - # level: warning - # max-spaces-before: 0 - # min-spaces-after: 1 - # max-spaces-after: 1 + braces: + level: warning + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 1 + max-spaces-inside-empty: 5 + brackets: + level: warning + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 1 + max-spaces-inside-empty: 5 + colons: + level: warning + max-spaces-before: 0 + max-spaces-after: 1 + commas: + level: warning + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 comments: disable comments-indentation: disable document-end: disable document-start: disable - empty-lines: disable - # level: warning - # max: 2 - # max-start: 0 - # max-end: 0 - hyphens: disable - # level: warning - # max-spaces-after: 1 - indentation: disable - # level: warning - # spaces: consistent - # indent-sequences: true - # check-multi-line-strings: false + empty-lines: + level: warning + max: 2 + max-start: 0 + max-end: 0 + hyphens: + level: warning + max-spaces-after: 1 + indentation: + level: warning + spaces: consistent + indent-sequences: true + check-multi-line-strings: false key-duplicates: enable line-length: disable new-line-at-end-of-file: disable - new-lines: diable - # type: unix + new-lines: + type: unix trailing-spaces: disable \ No newline at end of file From ddd2752a920e66d9d545e1367aa010ab8f1d7ff5 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 15:47:11 +0000 Subject: [PATCH 773/946] clean up --- .github/workflows/build-and-release.yml | 6 +++--- script/create-empty-commit | 14 -------------- 2 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 script/create-empty-commit diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6293acc89..c76c0efe8 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -22,7 +22,8 @@ jobs: build: runs-on: ubuntu-latest steps: - # # resulting token still gets denied by the backup-utils repo + # resulting token still gets denied by the backup-utils repo + # see: https://github.com/actions/create-github-app-token/pull/46 # - uses: timreimherr/create-github-app-token@main # id: app-token # with: @@ -79,6 +80,7 @@ jobs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} steps: # resulting token still gets denied by the backup-utils repo + # see: https://github.com/actions/create-github-app-token/pull/46 # - uses: timreimherr/create-github-app-token@main # id: app-token # with: @@ -120,9 +122,7 @@ jobs: artifacts: | github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ github-backup-utils_${{ github.event.inputs.version }}_all.deb - # this action will create a tag with this name on the provided commit tag: v${{ github.event.inputs.version }} - # this can be a commit hash or branch name commit: ${{ steps.empty-commit.outputs.commit_hash }} bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} diff --git a/script/create-empty-commit b/script/create-empty-commit deleted file mode 100644 index 7f69449a9..000000000 --- a/script/create-empty-commit +++ /dev/null @@ -1,14 +0,0 @@ -#!/ust/bin/env bash -# Usage: script/create-empty-commit -# Script to create an empty commit on the current branch. -# This is used to create a new tag for a release in github/backup-utils. -# This is to avoid stacking multiple release tags on the same commit. -set -e - -git config user.name "release-controller[bot]" -git config user.email "ghes-releases-team@github.com" -git fetch origin tims-test-branch -git checkout tims-test-branch -git commit --allow-empty -m "${{ github.event.inputs.version }} release" -git push origin tims-test-branch -echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT \ No newline at end of file From 765260fb48e7f0ec4ca33c4ab501537d365d04b8 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 16:04:16 +0000 Subject: [PATCH 774/946] see token permissions --- .github/workflows/build-and-release.yml | 207 ++++++++++++------------ 1 file changed, 105 insertions(+), 102 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c76c0efe8..18ce48189 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -24,110 +24,113 @@ jobs: steps: # resulting token still gets denied by the backup-utils repo # see: https://github.com/actions/create-github-app-token/pull/46 - # - uses: timreimherr/create-github-app-token@main - # id: app-token - # with: - # # required - # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: backup-utils,backup-utils-private - - name: Checkout backup-utils-private - uses: actions/checkout@v4 + - uses: timreimherr/create-github-app-token@main + id: app-token with: - token: ${{ github.event.inputs.gh-token }} - repository: github/backup-utils-private - - name: Install dependencies + # required + app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: backup-utils,backup-utils-private + - name: Print app permissions run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag # this is required for the build scripts - run: | - git config user.name "${{ github.actor }}" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - release: - needs: build - runs-on: ubuntu-latest - outputs: - commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} - steps: - # resulting token still gets denied by the backup-utils repo - # see: https://github.com/actions/create-github-app-token/pull/46 - # - uses: timreimherr/create-github-app-token@main - # id: app-token - # with: - # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: backup-utils,backup-utils-private - - name: Checkout backup-utils - uses: actions/checkout@v4 - with: - token: ${{ github.event.inputs.gh-token }} - repository: github/backup-utils - ref: master - - name: Create empty commit - uses: stefanzweifel/git-auto-commit-action@v4 - id: empty-commit - with: - branch: master - commit_message: "${{ github.event.inputs.version }} release" - commit_user_name: "${{ github.actor }}" - commit_user_email: "ghes-releases-team@github.com" - commit_options: "--allow-empty" - skip_dirty_check: true - - name: Download deb artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Download tarball artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - - name: Create Release - uses: ncipollo/release-action@v1 - with: - token: ${{ github.event.inputs.gh-token }} - repo: backup-utils - name: | - GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - artifacts: | - github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - github-backup-utils_${{ github.event.inputs.version }}_all.deb - tag: v${{ github.event.inputs.version }} - commit: ${{ steps.empty-commit.outputs.commit_hash }} - bodyFile: release-notes/${{ github.event.inputs.version }}.md - draft: ${{ github.event.inputs.draft }} - allowUpdates: true - artifactContentType: "raw" + curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.[] | {permissions: .permissions, target_type: .target_type, repository_selection: .repository_selection}' + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repository: github/backup-utils-private + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Create tag # this is required for the build scripts + # run: | + # git config user.name "${{ github.actor }}" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # release: + # needs: build + # runs-on: ubuntu-latest + # outputs: + # commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} + # steps: + # # resulting token still gets denied by the backup-utils repo + # # see: https://github.com/actions/create-github-app-token/pull/46 + # # - uses: timreimherr/create-github-app-token@main + # # id: app-token + # # with: + # # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # # owner: ${{ github.repository_owner }} + # # repositories: backup-utils,backup-utils-private + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repository: github/backup-utils + # ref: master + # - name: Create empty commit + # uses: stefanzweifel/git-auto-commit-action@v4 + # id: empty-commit + # with: + # branch: master + # commit_message: "${{ github.event.inputs.version }} release" + # commit_user_name: "${{ github.actor }}" + # commit_user_email: "ghes-releases-team@github.com" + # commit_options: "--allow-empty" + # skip_dirty_check: true + # - name: Download deb artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Download tarball artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # - name: Create Release + # uses: ncipollo/release-action@v1 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repo: backup-utils + # name: | + # GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + # artifacts: | + # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + # github-backup-utils_${{ github.event.inputs.version }}_all.deb + # tag: v${{ github.event.inputs.version }} + # commit: ${{ steps.empty-commit.outputs.commit_hash }} + # bodyFile: release-notes/${{ github.event.inputs.version }}.md + # draft: ${{ github.event.inputs.draft }} + # allowUpdates: true + # artifactContentType: "raw" From 6a7a213d68b5d0ab4772c33603a17c8faa625e6b Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 16:07:25 +0000 Subject: [PATCH 775/946] fix curl command output --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 18ce48189..d0b64fb37 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -34,7 +34,7 @@ jobs: repositories: backup-utils,backup-utils-private - name: Print app permissions run: | - curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.[] | {permissions: .permissions, target_type: .target_type, repository_selection: .repository_selection}' + curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.installations[] | {permissions: .permissions, target_type: .target_type, repository_selection: .repository_selection}' # - name: Checkout backup-utils-private # uses: actions/checkout@v4 # with: From 1dff7ccc4b30c00000b5e60d812fbe078b29e93a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 16:11:03 +0000 Subject: [PATCH 776/946] print entire response --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index d0b64fb37..f95c6f5f0 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -34,7 +34,7 @@ jobs: repositories: backup-utils,backup-utils-private - name: Print app permissions run: | - curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.installations[] | {permissions: .permissions, target_type: .target_type, repository_selection: .repository_selection}' + curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.' # - name: Checkout backup-utils-private # uses: actions/checkout@v4 # with: From eadb37ea851e011ececa059a28facbd01181939e Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:20:21 -0600 Subject: [PATCH 777/946] Update integration-tests.yml --- .github/workflows/integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index f48de957e..efdd23ebe 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -7,10 +7,10 @@ on: workflow_dispatch: inputs: target-branch: - description: 'Branch that would be merged into' + description: 'enterprise2 branch to test against' required: true source-branch: - description: 'Branch that would be merged' + description: 'backup-utils-private topic branch to test' required: true # Get target and source branch from different variables depending on how it was triggered From 15397574469a5c89483e677787343b7d0dee5e50 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 16:21:00 +0000 Subject: [PATCH 778/946] another test --- .github/workflows/build-and-release.yml | 36 ++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index f95c6f5f0..0a48f9518 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -22,8 +22,6 @@ jobs: build: runs-on: ubuntu-latest steps: - # resulting token still gets denied by the backup-utils repo - # see: https://github.com/actions/create-github-app-token/pull/46 - uses: timreimherr/create-github-app-token@main id: app-token with: @@ -32,9 +30,39 @@ jobs: private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: backup-utils,backup-utils-private - - name: Print app permissions + - name: Checkout backup-utils + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils + ref: master + - name: Create empty commit in backup-utils + id: empty-commit run: | - curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.' + git config user.name "release-controller[bot]" + git config user.email "223695+release-controller[bot]@users.noreply.github.com" + git fetch origin tims-test-branch + git checkout tims-test-branch + git commit --allow-empty -m "${{ github.event.inputs.version }} release" + git push origin tims-test-branch "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" + echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + - name: Echo Success if commit was created + if: steps.empty-commit.outputs.commit-sha != '' + run: | + echo "Success" + # resulting token still gets denied by the backup-utils repo + # see: https://github.com/actions/create-github-app-token/pull/46 + # - uses: timreimherr/create-github-app-token@main + # id: app-token + # with: + # # required + # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: backup-utils,backup-utils-private + # - name: Print app permissions + # run: | + # curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.' # - name: Checkout backup-utils-private # uses: actions/checkout@v4 # with: From f8685a4926f57a7b3561cf28099906317cae801e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 16:23:31 +0000 Subject: [PATCH 779/946] try another approach --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 0a48f9518..7a47b6cb2 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -44,7 +44,7 @@ jobs: git fetch origin tims-test-branch git checkout tims-test-branch git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push origin tims-test-branch "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" + git push "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" tims-test-branch echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Echo Success if commit was created if: steps.empty-commit.outputs.commit-sha != '' From 266760134d051101580d55784163310e050f749c Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 17:39:46 +0000 Subject: [PATCH 780/946] clean up --- .github/workflows/build-and-release.yml | 217 ++++++++++-------------- 1 file changed, 93 insertions(+), 124 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7a47b6cb2..c76c0efe8 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -22,143 +22,112 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: timreimherr/create-github-app-token@main - id: app-token - with: - # required - app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: backup-utils,backup-utils-private - - name: Checkout backup-utils + # resulting token still gets denied by the backup-utils repo + # see: https://github.com/actions/create-github-app-token/pull/46 + # - uses: timreimherr/create-github-app-token@main + # id: app-token + # with: + # # required + # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: backup-utils,backup-utils-private + - name: Checkout backup-utils-private uses: actions/checkout@v4 with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils - ref: master - - name: Create empty commit in backup-utils - id: empty-commit + token: ${{ github.event.inputs.gh-token }} + repository: github/backup-utils-private + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag # this is required for the build scripts + run: | + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb run: | - git config user.name "release-controller[bot]" - git config user.email "223695+release-controller[bot]@users.noreply.github.com" - git fetch origin tims-test-branch - git checkout tims-test-branch - git commit --allow-empty -m "${{ github.event.inputs.version }} release" - git push "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" tims-test-branch - echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Echo Success if commit was created - if: steps.empty-commit.outputs.commit-sha != '' + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact run: | - echo "Success" + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + release: + needs: build + runs-on: ubuntu-latest + outputs: + commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} + steps: # resulting token still gets denied by the backup-utils repo # see: https://github.com/actions/create-github-app-token/pull/46 # - uses: timreimherr/create-github-app-token@main # id: app-token # with: - # # required # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} # owner: ${{ github.repository_owner }} # repositories: backup-utils,backup-utils-private - # - name: Print app permissions - # run: | - # curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.' - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repository: github/backup-utils-private - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag # this is required for the build scripts - # run: | - # git config user.name "${{ github.actor }}" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # release: - # needs: build - # runs-on: ubuntu-latest - # outputs: - # commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} - # steps: - # # resulting token still gets denied by the backup-utils repo - # # see: https://github.com/actions/create-github-app-token/pull/46 - # # - uses: timreimherr/create-github-app-token@main - # # id: app-token - # # with: - # # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # # owner: ${{ github.repository_owner }} - # # repositories: backup-utils,backup-utils-private - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repository: github/backup-utils - # ref: master - # - name: Create empty commit - # uses: stefanzweifel/git-auto-commit-action@v4 - # id: empty-commit - # with: - # branch: master - # commit_message: "${{ github.event.inputs.version }} release" - # commit_user_name: "${{ github.actor }}" - # commit_user_email: "ghes-releases-team@github.com" - # commit_options: "--allow-empty" - # skip_dirty_check: true - # - name: Download deb artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Download tarball artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # - name: Create Release - # uses: ncipollo/release-action@v1 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repo: backup-utils - # name: | - # GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - # artifacts: | - # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - # github-backup-utils_${{ github.event.inputs.version }}_all.deb - # tag: v${{ github.event.inputs.version }} - # commit: ${{ steps.empty-commit.outputs.commit_hash }} - # bodyFile: release-notes/${{ github.event.inputs.version }}.md - # draft: ${{ github.event.inputs.draft }} - # allowUpdates: true - # artifactContentType: "raw" + - name: Checkout backup-utils + uses: actions/checkout@v4 + with: + token: ${{ github.event.inputs.gh-token }} + repository: github/backup-utils + ref: master + - name: Create empty commit + uses: stefanzweifel/git-auto-commit-action@v4 + id: empty-commit + with: + branch: master + commit_message: "${{ github.event.inputs.version }} release" + commit_user_name: "${{ github.actor }}" + commit_user_email: "ghes-releases-team@github.com" + commit_options: "--allow-empty" + skip_dirty_check: true + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Create Release + uses: ncipollo/release-action@v1 + with: + token: ${{ github.event.inputs.gh-token }} + repo: backup-utils + name: | + GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + artifacts: | + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils_${{ github.event.inputs.version }}_all.deb + tag: v${{ github.event.inputs.version }} + commit: ${{ steps.empty-commit.outputs.commit_hash }} + bodyFile: release-notes/${{ github.event.inputs.version }}.md + draft: ${{ github.event.inputs.draft }} + allowUpdates: true + artifactContentType: "raw" From 43a3a1bc8d953f3b69055e36865ed399ecd9d662 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 18:17:22 +0000 Subject: [PATCH 781/946] Checkout backup-utils-private for release notes --- .github/workflows/build-and-release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c76c0efe8..90b44086e 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -104,6 +104,11 @@ jobs: commit_user_email: "ghes-releases-team@github.com" commit_options: "--allow-empty" skip_dirty_check: true + - name: Checkout backup-utils + uses: actions/checkout@v4 + with: + token: ${{ github.event.inputs.gh-token }} + repository: github/backup-utils-private - name: Download deb artifact uses: actions/download-artifact@v3 with: From d45980fb8cdf53ba2a78983d655693f181d14034 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 26 Sep 2023 19:35:30 +0000 Subject: [PATCH 782/946] remove test release notes --- release-notes/12.12.12.md | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 release-notes/12.12.12.md diff --git a/release-notes/12.12.12.md b/release-notes/12.12.12.md deleted file mode 100644 index 192f42d88..000000000 --- a/release-notes/12.12.12.md +++ /dev/null @@ -1,11 +0,0 @@ -# Release Notes - -### Features - -- To reduce the time to generate a backup using `ghe-backup`, administrators can choose to prune old backup snapshots after a new backup has been generate. For more information, see "[Scheduling backups & snapshot pruning](https://github.com/github/backup-utils/blob/master/docs/scheduling-backups.md)." -- On instances with large MySQL databases , administrators who wish to save storage space can use the new `--incremental` flag with `ghe-backup` and `ghe-restore`. For more information, see "[Incremental MySQL Backups and Restores](https://github.com/github/backup-utils/tree/master/docs/incremental-mysql-backups-and-restores.md)". - -### Changes - -- Removed the `git clone` path for setting up `backup-utils` from the [getting started instructions](https://github.com/github/backup-utils/blob/master/docs/getting-started.md). -- Added `bc` v1.07 or newer to the [requirements](https://github.com/github/backup-utils/blob/master/docs/requirements.md) for a backup host machine. \ No newline at end of file From 87e07fe89daa047a47ad91ef742215ed574f8f5c Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Tue, 26 Sep 2023 18:09:44 -0400 Subject: [PATCH 783/946] fix mkdir issues or progress tracking (#612) Fixing https://github.com/github/ghes/issues/7409 --- share/github-backup-utils/ghe-backup-config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 790d2aaa4..d173b1703 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -655,14 +655,15 @@ restore-secret() { init-progress() { if [ -d /tmp/backup-utils-progress ]; then rm -rf /tmp/backup-utils-progress/* - else - mkdir /tmp/backup-utils-progress fi + + mkdir -p /tmp/backup-utils-progress + chmod -R 777 /tmp/backup-utils-progress + touch /tmp/backup-utils-progress/total touch /tmp/backup-utils-progress/type touch /tmp/backup-utils-progress/progress touch /tmp/backup-utils-progress/info - chmod -R 777 /tmp/backup-utils-progress } From a3a3cecabefd33a280c53d61a8ecc9bc74ae099f Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 27 Sep 2023 18:10:06 +0000 Subject: [PATCH 784/946] add link to release documentation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4ee951f58..472acf87c 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ GitHub Enterprise Server. - **[Backup snapshot file structure](docs/backup-snapshot-file-structure.md)** - **[How does Backup Utilities differ from a High Availability replica?](docs/faq.md)** - **[Docker](docs/docker.md)** +- **[Releases](https://github.com/github/enterprise-releases/blob/master/docs/release-backup-utils.md)** ## Support From d48791bc5e47a208f855d0903ee773d8af2afca9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 27 Sep 2023 21:40:40 +0000 Subject: [PATCH 785/946] place values in string --- .github/workflows/build-and-release.yml | 206 +++++++++++++----------- 1 file changed, 112 insertions(+), 94 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 90b44086e..cabccd9fd 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -24,76 +24,19 @@ jobs: steps: # resulting token still gets denied by the backup-utils repo # see: https://github.com/actions/create-github-app-token/pull/46 - # - uses: timreimherr/create-github-app-token@main - # id: app-token - # with: - # # required - # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: backup-utils,backup-utils-private - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ github.event.inputs.gh-token }} - repository: github/backup-utils-private - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag # this is required for the build scripts - run: | - git config user.name "${{ github.actor }}" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 + - uses: timreimherr/create-github-app-token@main + id: app-token with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - release: - needs: build - runs-on: ubuntu-latest - outputs: - commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} - steps: - # resulting token still gets denied by the backup-utils repo - # see: https://github.com/actions/create-github-app-token/pull/46 - # - uses: timreimherr/create-github-app-token@main - # id: app-token - # with: - # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: backup-utils,backup-utils-private + # required + app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils uses: actions/checkout@v4 with: - token: ${{ github.event.inputs.gh-token }} + token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - ref: master - name: Create empty commit uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit @@ -104,35 +47,110 @@ jobs: commit_user_email: "ghes-releases-team@github.com" commit_options: "--allow-empty" skip_dirty_check: true - - name: Checkout backup-utils - uses: actions/checkout@v4 - with: - token: ${{ github.event.inputs.gh-token }} - repository: github/backup-utils-private - - name: Download deb artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Download tarball artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - - name: Create Release - uses: ncipollo/release-action@v1 - with: - token: ${{ github.event.inputs.gh-token }} - repo: backup-utils - name: | - GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - artifacts: | - github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - github-backup-utils_${{ github.event.inputs.version }}_all.deb - tag: v${{ github.event.inputs.version }} - commit: ${{ steps.empty-commit.outputs.commit_hash }} - bodyFile: release-notes/${{ github.event.inputs.version }}.md - draft: ${{ github.event.inputs.draft }} - allowUpdates: true - artifactContentType: "raw" + - name: Log a message + if: success() + run: echo "The previous step succeeded" + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repository: github/backup-utils-private + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Create tag # this is required for the build scripts + # run: | + # git config user.name "${{ github.actor }}" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # release: + # needs: build + # runs-on: ubuntu-latest + # outputs: + # commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} + # steps: + # # resulting token still gets denied by the backup-utils repo + # # see: https://github.com/actions/create-github-app-token/pull/46 + # # - uses: timreimherr/create-github-app-token@main + # # id: app-token + # # with: + # # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # # owner: ${{ github.repository_owner }} + # # repositories: backup-utils,backup-utils-private + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repository: github/backup-utils + # ref: master + # - name: Create empty commit + # uses: stefanzweifel/git-auto-commit-action@v4 + # id: empty-commit + # with: + # branch: master + # commit_message: "${{ github.event.inputs.version }} release" + # commit_user_name: "${{ github.actor }}" + # commit_user_email: "ghes-releases-team@github.com" + # commit_options: "--allow-empty" + # skip_dirty_check: true + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repository: github/backup-utils-private + # - name: Download deb artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Download tarball artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # - name: Create Release + # uses: ncipollo/release-action@v1 + # with: + # token: ${{ github.event.inputs.gh-token }} + # repo: backup-utils + # name: | + # GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + # artifacts: | + # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + # github-backup-utils_${{ github.event.inputs.version }}_all.deb + # tag: v${{ github.event.inputs.version }} + # commit: ${{ steps.empty-commit.outputs.commit_hash }} + # bodyFile: release-notes/${{ github.event.inputs.version }}.md + # draft: ${{ github.event.inputs.draft }} + # allowUpdates: true + # artifactContentType: "raw" From 60d9ed1e9850506b05e45552015a520e8914ec6c Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 27 Sep 2023 21:43:40 +0000 Subject: [PATCH 786/946] use test branch --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index cabccd9fd..49a7c0156 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -41,7 +41,7 @@ jobs: uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: - branch: master + branch: tims-test-branch commit_message: "${{ github.event.inputs.version }} release" commit_user_name: "${{ github.actor }}" commit_user_email: "ghes-releases-team@github.com" From 030580f3a97a685f6170411f43d450f32b59a70a Mon Sep 17 00:00:00 2001 From: Luke Reid Date: Thu, 28 Sep 2023 15:58:08 +0100 Subject: [PATCH 787/946] Fix broken upgrade requirements link The link to the upgrade requirements points to the old help pages. I have updated it to the new docs. --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index bba51c252..089a92b46 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -97,7 +97,7 @@ Due to how some components of Backup Utilities (e.g. MSSQL) take incremental bac [5]: https://en.wikipedia.org/wiki/Hard_link [6]: https://en.wikipedia.org/wiki/Symbolic_link [7]: https://en.wikipedia.org/wiki/Case_sensitivity -[8]: https://help.github.com/enterprise/admin/guides/installation/upgrade-requirements/ +[8]: https://docs.github.com/enterprise-server/admin/monitoring-managing-and-updating-your-instance/updating-the-virtual-machine-and-physical-resources/upgrade-requirements [9]: https://joeyh.name/code/moreutils [10]: https://www.gnu.org/software/gawk [11]: https://stedolan.github.io/jq/ From 4ea5ecefa04d5a9507bea016125b760ca685c335 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Thu, 28 Sep 2023 16:16:39 -0600 Subject: [PATCH 788/946] Update parallel command to adapt to changes in 3.11 --- share/github-backup-utils/ghe-backup-config | 16 ++++++++++++++++ share/github-backup-utils/ghe-restore-pages | 3 ++- .../github-backup-utils/ghe-restore-repositories | 3 ++- .../ghe-restore-repositories-gist | 3 ++- share/github-backup-utils/ghe-restore-storage | 3 ++- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index d173b1703..9e7cc9f47 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -462,6 +462,22 @@ ghe_parse_remote_version() { export GHE_VERSION_MAJOR GHE_VERSION_MINOR GHE_VERSION_PATCH } +# In 3.11 we started to install 2 different version parallel(s) +# moreutils parallel and GNU parallel. Get parallel command based on version +ghe_remote_parallel() { + if [ -z "$GHE_REMOTE_VERSION" ]; then + ecbk "Error: ghe_remote_version_required needs to be invoked before ghe_remote_parallel" 1>&2 + exit 1 + fi + + if [ "$GHE_VERSION_MINOR" -lt 11 ]; then + PARALLEL_CMD="parallel" + else + PARALLEL_CMD="parallel.moreutils" + fi + export PARALLEL_CMD +} + # Parses the part out of a ":" or just "" string. # This is used primarily to break hostspecs with non-standard ports down for # rsync commands. diff --git a/share/github-backup-utils/ghe-restore-pages b/share/github-backup-utils/ghe-restore-pages index 0b104863e..cbc019345 100755 --- a/share/github-backup-utils/ghe-restore-pages +++ b/share/github-backup-utils/ghe-restore-pages @@ -35,6 +35,7 @@ fi # Perform a host-check and establish GHE_REMOTE_XXX variables. ghe_remote_version_required "$GHE_HOSTNAME" +ghe_remote_parallel # Split host:port into parts port=$(ssh_port_part "$GHE_HOSTNAME") @@ -156,7 +157,7 @@ if $CLUSTER; then ghe-ssh "$GHE_HOSTNAME" -- /bin/bash >&3 <&3 <>$remote_warnings" -- \$chunks + $PARALLEL_CMD -i /bin/sh -c "cat {} | github-env ./bin/dgit-cluster-restore-finalize 2>>$remote_warnings" -- \$chunks EOF increment-progress-total-count 1 bm_end "$(basename $0) - Finalizing routes" diff --git a/share/github-backup-utils/ghe-restore-repositories-gist b/share/github-backup-utils/ghe-restore-repositories-gist index 7faae5260..631676ea0 100755 --- a/share/github-backup-utils/ghe-restore-repositories-gist +++ b/share/github-backup-utils/ghe-restore-repositories-gist @@ -35,6 +35,7 @@ fi # Perform a host-check and establish GHE_REMOTE_XXX variables. ghe_remote_version_required "$GHE_HOSTNAME" +ghe_remote_parallel # Generate SSH config for forwarding # Split host:port into parts @@ -159,7 +160,7 @@ if $CLUSTER; then ghe-ssh "$GHE_HOSTNAME" -- /bin/bash >&3 <>$remote_warnings" -- \$chunks + $PARALLEL_CMD -i /bin/sh -c "cat {} | github-env ./bin/gist-cluster-restore-finalize 2>>$remote_warnings" -- \$chunks EOF increment-progress-total-count 1 bm_end "$(basename $0) - Finalizing routes" diff --git a/share/github-backup-utils/ghe-restore-storage b/share/github-backup-utils/ghe-restore-storage index 8f0d73c48..64cdbbaa4 100755 --- a/share/github-backup-utils/ghe-restore-storage +++ b/share/github-backup-utils/ghe-restore-storage @@ -39,6 +39,7 @@ fi # Perform a host-check and establish GHE_REMOTE_XXX variables. ghe_remote_version_required "$GHE_HOSTNAME" +ghe_remote_parallel # Split host:port into parts port=$(ssh_port_part "$GHE_HOSTNAME") @@ -171,7 +172,7 @@ if $CLUSTER; then ghe-ssh "$GHE_HOSTNAME" -- /bin/bash >&3 < Date: Thu, 28 Sep 2023 16:20:41 -0600 Subject: [PATCH 789/946] Update ghe-backup-config --- share/github-backup-utils/ghe-backup-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 9e7cc9f47..f49cdb0bc 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -466,7 +466,7 @@ ghe_parse_remote_version() { # moreutils parallel and GNU parallel. Get parallel command based on version ghe_remote_parallel() { if [ -z "$GHE_REMOTE_VERSION" ]; then - ecbk "Error: ghe_remote_version_required needs to be invoked before ghe_remote_parallel" 1>&2 + echo "Error: ghe_remote_version_required needs to be invoked before ghe_remote_parallel" 1>&2 exit 1 fi From d9831072a84c6ce1c5417924fa43d265a1470f01 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 29 Sep 2023 00:07:28 -0600 Subject: [PATCH 790/946] Fix that janky build wasn't triggered correctly --- .github/workflows/integration-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index efdd23ebe..603f7affa 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,6 +37,7 @@ jobs: janky-token: '${{ secrets.API_AUTH_TOKEN }}' job-name: '${{ matrix.jankyJobName }}' branch-name: '${{ env.SOURCE_BRANCH }}' + force : 'false' # enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release) envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ env.TARGET_BRANCH }}" @@ -63,5 +64,6 @@ jobs: janky-token: '${{ secrets.API_AUTH_TOKEN }}' job-name: '${{ matrix.jankyJobName }}' branch-name: '${{ env.SOURCE_BRANCH }}' + force : 'false' # enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release) envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ env.TARGET_BRANCH }}" From 53f509e9cb081ac41dca9b925a911fefc1405e7a Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Fri, 29 Sep 2023 00:10:19 -0600 Subject: [PATCH 791/946] Update comments --- share/github-backup-utils/ghe-backup-config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index f49cdb0bc..4ac372e0b 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -463,7 +463,8 @@ ghe_parse_remote_version() { } # In 3.11 we started to install 2 different version parallel(s) -# moreutils parallel and GNU parallel. Get parallel command based on version +# moreutils parallel and GNU parallel. When gnu parallel is installed, +# it renames moreutils parallel to parallel.moreutils ghe_remote_parallel() { if [ -z "$GHE_REMOTE_VERSION" ]; then echo "Error: ghe_remote_version_required needs to be invoked before ghe_remote_parallel" 1>&2 From 23a11908523532c46b8bcb3425bec18df8bdf24d Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Fri, 29 Sep 2023 09:52:50 -0600 Subject: [PATCH 792/946] Update share/github-backup-utils/ghe-backup-config Co-authored-by: Quinn Murphy --- share/github-backup-utils/ghe-backup-config | 1 + 1 file changed, 1 insertion(+) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 4ac372e0b..86a75a15a 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -465,6 +465,7 @@ ghe_parse_remote_version() { # In 3.11 we started to install 2 different version parallel(s) # moreutils parallel and GNU parallel. When gnu parallel is installed, # it renames moreutils parallel to parallel.moreutils +# set $PARALLEL_CMD envvar to be used in place of parallel commands ghe_remote_parallel() { if [ -z "$GHE_REMOTE_VERSION" ]; then echo "Error: ghe_remote_version_required needs to be invoked before ghe_remote_parallel" 1>&2 From db8fdae5a45719efeb01fdd096da1c262771248f Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Mon, 2 Oct 2023 17:41:28 -0600 Subject: [PATCH 793/946] Fix track-progress while progress files are not set --- bin/ghe-backup | 1 + bin/ghe-restore | 3 +++ share/github-backup-utils/track-progress | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 5a4eb6c20..8914bddc9 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -118,6 +118,7 @@ cleanup () { rm -rf "$failures_file" rm -f "${GHE_DATA_DIR}/in-progress-backup" + rm -rf /tmp/backup-utils-progress/* # Cleanup SSH multiplexing ghe-ssh --clean diff --git a/bin/ghe-restore b/bin/ghe-restore index c9ac20ec2..1d1159133 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -139,6 +139,9 @@ cleanup () { log_error "Failed to remove in-progress file" 1>&3 fi + # Remove progress files + rm -rf /tmp/backup-utils-progress/* + bm_end "$(basename $0)" } diff --git a/share/github-backup-utils/track-progress b/share/github-backup-utils/track-progress index a560ba540..6f7d1a76b 100755 --- a/share/github-backup-utils/track-progress +++ b/share/github-backup-utils/track-progress @@ -2,11 +2,17 @@ #/ track-progress: track progress of backup or restore tasks progress(){ - + ## Those progress files should be created by init_progress function + ## If they are not present (e.g., individual script is being invoked directly), + ## we will not track progress + if [ -f "/tmp/backup-utils-progress/progress" ] && + [ -f "/tmp/backup-utils-progress/total" ] && + [ -f "/tmp/backup-utils-progress/type" ]; then PROGRESS=$(cat /tmp/backup-utils-progress/progress) PROGRESS_TOTAL=$(cat /tmp/backup-utils-progress/total) PROGRESS_TYPE=$(cat /tmp/backup-utils-progress/type) PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc) echo $((PROGRESS + 1)) > /tmp/backup-utils-progress/progress echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress/info + fi } From 1338786c4d0911b369acbff40f5b5dc5c65a3fca Mon Sep 17 00:00:00 2001 From: David Daly Date: Wed, 4 Oct 2023 12:27:23 +0000 Subject: [PATCH 794/946] add new test for passsing -c to restore for actions and checking if new value is present --- test/test-ghe-restore.sh | 88 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index da7fdb06b..3ea47e2b5 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -674,6 +674,94 @@ begin_test "ghe-restore with Actions settings" ) end_test +begin_test "ghe-restore with Actions settings passing -c" +( + set -e + rm -rf "$GHE_REMOTE_ROOT_DIR" + setup_remote_metadata + enable_actions + + required_files=( + "actions-config-db-login" + "actions-config-db-password" + "actions-framework-access-token" + "actions-url-signing-hmac-key-primary" + "actions-url-signing-hmac-key-secondary" + "actions-oauth-s2s-signing-cert" + "actions-oauth-s2s-signing-key" + "actions-oauth-s2s-signing-cert-thumbprint" + "actions-primary-encryption-cert-thumbprint" + "actions-aad-cert-thumbprint" + "actions-delegated-auth-cert-thumbprint" + "actions-runtime-service-principal-cert" + "actions-s2s-encryption-cert" + "actions-secondary-encryption-cert-thumbprint" + "actions-service-principal-cert" + "actions-sps-validation-cert-thumbprint" + "actions-storage-container-prefix" + + "actions-launch-secrets-private-key" + "actions-launch-deployer-hmac" + "actions-launch-client-id" + "actions-launch-client-secret" + "actions-launch-receiver-webhook-secret" + "actions-launch-app-private-key" + "actions-launch-app-public-key" + "actions-launch-app-id" + "actions-launch-app-relay-id" + "actions-launch-action-runner-secret" + "actions-launch-azp-app-cert" + "actions-launch-app-app-private-key" + + ) + + for file in "${required_files[@]}"; do + echo "foo" > "$GHE_DATA_DIR/current/$file" + done + + ghe-restore -v -f -c localhost + + required_secrets=( + "secrets.actions.ConfigurationDatabaseSqlLogin" + "secrets.actions.ConfigurationDatabaseSqlPassword" + "secrets.actions.FrameworkAccessTokenKeySecret" + "secrets.actions.UrlSigningHmacKeyPrimary" + "secrets.actions.UrlSigningHmacKeySecondary" + "secrets.actions.OAuthS2SSigningCert" + "secrets.actions.OAuthS2SSigningKey" + "secrets.actions.OAuthS2SSigningCertThumbprint" + "secrets.actions.PrimaryEncryptionCertificateThumbprint" + "secrets.actions.AADCertThumbprint" + "secrets.actions.DelegatedAuthCertThumbprint" + "secrets.actions.RuntimeServicePrincipalCertificate" + "secrets.actions.S2SEncryptionCertificate" + "secrets.actions.SecondaryEncryptionCertificateThumbprint" + "secrets.actions.ServicePrincipalCertificate" + "secrets.actions.SpsValidationCertThumbprint" + "secrets.actions.storage.container-prefix" + "secrets.launch.actions-secrets-private-key" + "secrets.launch.deployer-hmac-secret" + "secrets.launch.client-id" + "secrets.launch.client-secret" + "secrets.launch.receiver-webhook-secret" + "secrets.launch.app-private-key" + "secrets.launch.app-public-key" + "secrets.launch.app-id" + "secrets.launch.app-relay-id" + "secrets.launch.action-runner-secret" + "secrets.launch.token-oauth-key" + "secrets.launch.token-oauth-cert" + "secrets.launch.azp-app-cert" + "secrets.launch.azp-app-private-key" + + ) + + for secret in "${required_secrets[@]}"; do + [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "foo" ] + done +) +end_test + begin_test "ghe-restore stops and starts Actions" ( set -e From 24bd388b8368f2b057a9feb23a1fb29291a66735 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 5 Oct 2023 15:25:22 -0400 Subject: [PATCH 795/946] Added section about rsync compression --- docs/usage.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/usage.md b/docs/usage.md index 8f1a70131..1e9653598 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -115,5 +115,11 @@ Please refer to [GHES Documentation](https://docs.github.com/en/enterprise-serve If you are interested in performing incremental backups of the MySQL data in your GitHub Enterprise Server instance, see [Incremental MySQL Backups and Restores](incremental-mysql-backups-and-restores.md) for details. +## Rsync compression + +From backup-utils v3.11.0 onwards, we have disabled rsync compression by default to improve transfer speed and reduce CPU usage durign the transfer process. + +If you would like to use compression with rsync, you can add `GHE_RSYNC_COMPRESSION_ENABLED=true` in your `backup.config` file. + [1]: https://github.com/github/backup-utils/blob/master/docs/getting-started.md [2]: requirements.md From 2fa406bd449e87fe3e6f03354f6cbe2207acaa2f Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Fri, 6 Oct 2023 17:43:04 -0400 Subject: [PATCH 796/946] Fixed typo. --- docs/usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage.md b/docs/usage.md index 1e9653598..e4ed5b7e2 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -117,7 +117,7 @@ If you are interested in performing incremental backups of the MySQL data in you ## Rsync compression -From backup-utils v3.11.0 onwards, we have disabled rsync compression by default to improve transfer speed and reduce CPU usage durign the transfer process. +From backup-utils v3.11.0 onwards, we have disabled rsync compression by default to improve transfer speed and reduce CPU usage during the transfer process. If you would like to use compression with rsync, you can add `GHE_RSYNC_COMPRESSION_ENABLED=true` in your `backup.config` file. From 63d5932a63f9d77604264ef288c681992b28ce25 Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 9 Oct 2023 12:03:04 -0400 Subject: [PATCH 797/946] correct incremental restore envvar (#642) --- docs/incremental-mysql-backups-and-restores.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/incremental-mysql-backups-and-restores.md b/docs/incremental-mysql-backups-and-restores.md index 0bc5f8ef8..53543c927 100644 --- a/docs/incremental-mysql-backups-and-restores.md +++ b/docs/incremental-mysql-backups-and-restores.md @@ -1,14 +1,14 @@ # Incremental MySQL Backups and Restores Customers who have large MySQL databases who wish to save storage space can use the `--incremental` flag with `ghe-backup` and `ghe-restore`. -Using this flag performs backups for other parts of GHES as normal, but only performs a MySQL backup of the changes to the database from the previous snapshot. +Using this flag performs backups for other parts of GHES as normal, but only performs a MySQL backup of the changes to the database from the previous snapshot. For larger databases this can conserve a lot of storage space for backups. ## Configuring number of backups -In your backup.config file you will need to set the variable `GHE_INCREMENTAL_BACKUP_MAX`. +In your backup.config file you will need to set the variable `GHE_INCREMENTAL_MAX_BACKUPS`. This variable determines how many cycles of full and incremental backups will be performed before the next full backup is created. -For example, if `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle. +For example, if `GHE_INCREMENTAL_MAX_BACKUPS` is set to 14, backup-utils will run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle. Incremental backups require the previous snapshot backups before them to work. This means they do not follow the pruning strategy based on `GHE_NUM_SNAPSHOTS`. @@ -19,7 +19,7 @@ To perform incremental backups: `bin/ghe-backup --incremental` -the program will detect whether it needs to performa full or incremental snapshot based on what is currently in `GHE_DATA_DIR`. +the program will detect whether it needs to performa full or incremental snapshot based on what is currently in `GHE_DATA_DIR`. To see what snapshots are part of your full and incremental backups, you can reference `GHE_DATA_DIR/inc_full_backup` and `GHE_DATA_DIR/inc_snapshot_data`, respectively. @@ -35,4 +35,4 @@ The program will use the MySQL folders from each previous incremental backup and ### Previous cycles -To ensure there is a rolling window of mySQL backups, incremental MySQL backups from the cycle before the current one are kept. Those snapshots are pre-pended with `inc_previous`. To perform a restore from there, just use the full directory name for the snapshot id. +To ensure there is a rolling window of mySQL backups, incremental MySQL backups from the cycle before the current one are kept. Those snapshots are pre-pended with `inc_previous`. To perform a restore from there, just use the full directory name for the snapshot ID. From da35308a675913946084fa83afebcaab359bab93 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Tue, 10 Oct 2023 18:05:20 +0200 Subject: [PATCH 798/946] refactor secrets (#648) --- bin/ghe-backup | 3 + bin/ghe-restore | 15 +- share/github-backup-utils/ghe-backup-config | 10 - share/github-backup-utils/ghe-backup-secrets | 186 ++++++++++++++++++ share/github-backup-utils/ghe-backup-settings | 159 --------------- share/github-backup-utils/ghe-restore-actions | 42 ---- .../ghe-restore-chat-integration | 66 ------- .../ghe-restore-column-encryption-keys | 42 ---- share/github-backup-utils/ghe-restore-mysql | 3 - .../github-backup-utils/ghe-restore-packages | 45 ----- ...he-restore-secret-scanning-encryption-keys | 45 ----- share/github-backup-utils/ghe-restore-secrets | 146 ++++++++++++++ .../github-backup-utils/ghe-restore-settings | 27 --- test/test-ghe-restore.sh | 59 ------ 14 files changed, 336 insertions(+), 512 deletions(-) create mode 100755 share/github-backup-utils/ghe-backup-secrets delete mode 100755 share/github-backup-utils/ghe-restore-chat-integration delete mode 100755 share/github-backup-utils/ghe-restore-column-encryption-keys delete mode 100755 share/github-backup-utils/ghe-restore-packages delete mode 100755 share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys create mode 100755 share/github-backup-utils/ghe-restore-secrets diff --git a/bin/ghe-backup b/bin/ghe-backup index 8914bddc9..1dfaf748b 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -267,6 +267,9 @@ bm_init > /dev/null ghe-backup-store-version || log_warn "Warning: storing backup-utils version remotely failed." +log_info "Backing up GitHub secrets ..." +ghe-backup-secrets || failures="$failures secrets" + log_info "Backing up GitHub settings ..." ghe-backup-settings || failures="$failures settings" diff --git a/bin/ghe-restore b/bin/ghe-restore index 1d1159133..101f19ebc 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -466,6 +466,7 @@ else fi CRON_RUNNING=false +ghe-restore-secrets "$GHE_HOSTNAME" # Restore settings and license if restoring to an unconfigured appliance or when # specified manually. @@ -473,19 +474,6 @@ if $RESTORE_SETTINGS; then ghe-restore-settings "$GHE_HOSTNAME" fi -# Always restore column encryption keys -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then - log_info "Always restore encrypted column encryption keys on GHES versions 3.7.0+" -fi -ghe-restore-column-encryption-keys "$GHE_HOSTNAME" - -# Always restore secret scanning encryption keys -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then - log_info "Always restore secret scanning encryption keys on GHES versions 3.8.0+" - increment-progress-total-count 1 - ghe-restore-secret-scanning-encryption-keys "$GHE_HOSTNAME" -fi - # Make sure mysql and elasticsearch are prep'd and running before restoring. # These services will not have been started on appliances that have not been # configured yet. @@ -639,7 +627,6 @@ echo "sudo restart -q memcached 2>/dev/null || true" | ghe-ssh "$GHE_HOSTNAME" -- /bin/sh bm_end "$(basename $0) - Restarting memcached" - # Prevent GitHub Connect jobs running before we've had a chance to reset # the configuration by setting the last run date to now. if ! $RESTORE_SETTINGS; then diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 86a75a15a..6c33ea954 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -659,16 +659,6 @@ prompt_for_confirmation(){ echo } -# Function to restore a secret setting stored in a file. -# restore-secret -restore-secret() { - if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/$2" ]; then - echo "Restoring $1 ..." - echo "ghe-config '$3' '$(cat "$GHE_RESTORE_SNAPSHOT_PATH/$2")'" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/bash - fi -} - #initialize progress tracking by clearing out the temp files used to track init-progress() { if [ -d /tmp/backup-utils-progress ]; then diff --git a/share/github-backup-utils/ghe-backup-secrets b/share/github-backup-utils/ghe-backup-secrets new file mode 100755 index 000000000..546be420e --- /dev/null +++ b/share/github-backup-utils/ghe-backup-secrets @@ -0,0 +1,186 @@ +#!/usr/bin/env bash +#/ Usage: ghe-backup-secrets +#/ +#/ Note: This script typically isn't called directly. It's invoked by the +#/ ghe-backup command. +set -e + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" + +# Grab the host +host="$GHE_HOSTNAME" + +# Perform a host-check and establish GHE_REMOTE_XXX variables. +ghe_remote_version_required "$host" + + +# Function to backup a secret setting to a file. +# backup-secret [--best-effort] +backup-secret() { + best_effort=false + description="" + file="" + setting="" + count=0 + + while [ $# -gt 0 ]; do + case "$1" in + --best-effort) + shift 1 + best_effort=true + ;; + *) + case $count in + 0) + description=$1 + ;; + 1) + file=$1 + ;; + 2) + setting=$1 + ;; + *) + >&2 echo "Too many arguments" + ;; + esac + count=$((count+1)) + shift 1 + esac + done + + log_info "* Transferring $description ..." 1>&3 + ghe-ssh "$host" -- ghe-config "$setting" > "$file+" || ( + if [ "$best_effort" = "false" ]; then + echo "Warning: $description not set" >&2 + fi + ) + if [ -n "$(cat "$file+")" ]; then + mv "$file+" "$file" + else + unlink "$file+" + fi +} + +bm_start "$(basename $0)" + +# Create the snapshot directory if needed and change into it. +mkdir -p "$GHE_SNAPSHOT_DIR" +cd "$GHE_SNAPSHOT_DIR" + +log_info "* Transferring secrets data ..." 1>&3 + +backup-secret "management console password" "manage-password" "secrets.manage" +backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" +backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" +backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" + +# backup encryption keying material and create backup value current encryption for GHES 3.7.0 onwards +# this is for forwards compatibility with GHES 3.8.0 onwards +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then + backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" + cat "$GHE_SNAPSHOT_DIR/encrypted-column-encryption-keying-material" | sed 's:.*;::' > "$GHE_SNAPSHOT_DIR/encrypted-column-current-encryption-key" +fi + +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then + backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" + backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" + backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" + backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" +fi + +if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.11.0)" ]; then + backup-secret "secret scanning encrypted content keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" +fi + +# Backup argon secrets for multiuser from ghes version 3.8 onwards +if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then + backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" +fi + +# Backup external MySQL password if running external MySQL DB. +if is_service_external 'mysql'; then + backup-secret "external MySQL password" "external-mysql-password" "secrets.external.mysql" +fi + +# Backup Actions settings. +if ghe-ssh "$host" -- ghe-config --true app.actions.enabled; then + backup-secret "Actions configuration database login" "actions-config-db-login" "secrets.actions.ConfigurationDatabaseSqlLogin" + backup-secret "Actions configuration database password" "actions-config-db-password" "secrets.actions.ConfigurationDatabaseSqlPassword" + backup-secret "Actions framework access token key secret" "actions-framework-access-token" "secrets.actions.FrameworkAccessTokenKeySecret" --best-effort + backup-secret "Actions Url signing HMAC key primary" "actions-url-signing-hmac-key-primary" "secrets.actions.UrlSigningHmacKeyPrimary" + backup-secret "Actions Url signing HMAC key secondary" "actions-url-signing-hmac-key-secondary" "secrets.actions.UrlSigningHmacKeySecondary" + backup-secret "Actions OAuth S2S signing cert" "actions-oauth-s2s-signing-cert" "secrets.actions.OAuthS2SSigningCert" + backup-secret "Actions OAuth S2S signing key" "actions-oauth-s2s-signing-key" "secrets.actions.OAuthS2SSigningKey" + backup-secret "Actions OAuth S2S signing cert thumbprint" "actions-oauth-s2s-signing-cert-thumbprint" "secrets.actions.OAuthS2SSigningCertThumbprint" + backup-secret "Actions primary encryption cert thumbprint" "actions-primary-encryption-cert-thumbprint" "secrets.actions.PrimaryEncryptionCertificateThumbprint" + backup-secret "Actions AAD cert thumbprint" "actions-aad-cert-thumbprint" "secrets.actions.AADCertThumbprint" --best-effort + backup-secret "Actions delegated auth cert thumbprint" "actions-delegated-auth-cert-thumbprint" "secrets.actions.DelegatedAuthCertThumbprint" --best-effort + backup-secret "Actions runtime service principal cert" "actions-runtime-service-principal-cert" "secrets.actions.RuntimeServicePrincipalCertificate" --best-effort + backup-secret "Actions S2S encryption cert" "actions-s2s-encryption-cert" "secrets.actions.S2SEncryptionCertificate" + backup-secret "Actions secondary encryption cert thumbprint" "actions-secondary-encryption-cert-thumbprint" "secrets.actions.SecondaryEncryptionCertificateThumbprint" + backup-secret "Actions service principal cert" "actions-service-principal-cert" "secrets.actions.ServicePrincipalCertificate" --best-effort + backup-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" + backup-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" + + backup-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" + backup-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" + backup-secret "Actions Launch Client id" "actions-launch-client-id" "secrets.launch.client-id" + backup-secret "Actions Launch Client secret" "actions-launch-client-secret" "secrets.launch.client-secret" + backup-secret "Actions Launch receiver webhook secret" "actions-launch-receiver-webhook-secret" "secrets.launch.receiver-webhook-secret" + backup-secret "Actions Launch app private key" "actions-launch-app-private-key" "secrets.launch.app-private-key" + backup-secret "Actions Launch app public key" "actions-launch-app-public-key" "secrets.launch.app-public-key" + backup-secret "Actions Launch app id" "actions-launch-app-id" "secrets.launch.app-id" + backup-secret "Actions Launch app relay id" "actions-launch-app-relay-id" "secrets.launch.app-relay-id" + backup-secret "Actions Launch action runner secret" "actions-launch-action-runner-secret" "secrets.launch.action-runner-secret" + backup-secret "Actions Launch service cert" "actions-launch-azp-app-cert" "secrets.launch.azp-app-cert" + backup-secret "Actions Launch service private key" "actions-launch-app-app-private-key" "secrets.launch.azp-app-private-key" +fi + +if ghe-ssh "$host" -- ghe-config --true app.packages.enabled; then + backup-secret "Packages aws access key" "packages-aws-access-key" "secrets.packages.aws-access-key" + backup-secret "Packages aws secret key" "packages-aws-secret-key" "secrets.packages.aws-secret-key" + backup-secret "Packages s3 bucket" "packages-s3-bucket" "secrets.packages.s3-bucket" + backup-secret "Packages storage service url" "packages-service-url" "secrets.packages.service-url" + backup-secret "Packages blob storage type" "packages-blob-storage-type" "secrets.packages.blob-storage-type" + backup-secret "Packages azure connection string" "packages-azure-connection-string" "secrets.packages.azure-connection-string" + backup-secret "Packages azure container name" "packages-azure-container-name" "secrets.packages.azure-container-name" +fi + +# Backup Chat Integration settings +if ghe-ssh "$host" -- ghe-config --true app.chatops.enabled; then + backup-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id" + backup-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password" + backup-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint" + backup-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle" + backup-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name" + backup-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id" + backup-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id" + backup-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret" + backup-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token" + backup-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token" + backup-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint" + backup-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret" + backup-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token" + backup-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command" + backup-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name" + backup-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode" + backup-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint" + backup-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type" + backup-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams" + backup-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams" + backup-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams" + backup-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams" + backup-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret" + backup-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret" + backup-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack" + backup-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack" + backup-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack" + backup-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack" +fi + +bm_end "$(basename $0)" + +exit 0 diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings index 7cfd62b8d..f3d262293 100755 --- a/share/github-backup-utils/ghe-backup-settings +++ b/share/github-backup-utils/ghe-backup-settings @@ -25,165 +25,6 @@ ghe-ssh "$host" -- 'ghe-export-settings' > settings.json log_info "* Transferring license data ..." 1>&3 ghe-ssh "$host" -- "sudo cat '$GHE_REMOTE_LICENSE_FILE'" > enterprise.ghl -# Function to backup a secret setting to a file. -# backup-secret [--best-effort] -backup-secret() { - - best_effort=false - description="" - file="" - setting="" - count=0 - - while [ $# -gt 0 ]; do - case "$1" in - --best-effort) - shift 1 - best_effort=true - ;; - *) - case $count in - 0) - description=$1 - ;; - 1) - file=$1 - ;; - 2) - setting=$1 - ;; - *) - >&2 echo "Too many arguments" - ;; - esac - count=$((count+1)) - shift 1 - esac - done - - log_info "* Transferring $description ..." 1>&3 - ghe-ssh "$host" -- ghe-config "$setting" > "$file+" || ( - if [ "$best_effort" = "false" ]; then - echo "Warning: $description not set" >&2 - fi - ) - if [ -n "$(cat "$file+")" ]; then - mv "$file+" "$file" - else - unlink "$file+" - fi -} - -backup-secret "management console password" "manage-password" "secrets.manage" -backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" -backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" -backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" - -# backup encryption keying material and create backup value current encryption for GHES 3.7.0 onwards -# this is for forwards compatibility with GHES 3.8.0 onwards -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then - backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" - cat "$GHE_SNAPSHOT_DIR/encrypted-column-encryption-keying-material" | sed 's:.*;::' > "$GHE_SNAPSHOT_DIR/encrypted-column-current-encryption-key" -fi - -# secret scanning encrypted secrets keys were added in GHES 3.8.0 -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then - backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" - backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" - backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" - backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" -fi - -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.11.0)" ]; then - backup-secret "secret scanning encrypted content keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" -fi - -# Backup argon secrets for multiuser from ghes version 3.8 onwards -if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then - backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" -fi - -# Backup external MySQL password if running external MySQL DB. -if is_service_external 'mysql'; then - backup-secret "external MySQL password" "external-mysql-password" "secrets.external.mysql" -fi - -# Backup Actions settings. -if ghe-ssh "$host" -- ghe-config --true app.actions.enabled; then - backup-secret "Actions configuration database login" "actions-config-db-login" "secrets.actions.ConfigurationDatabaseSqlLogin" - backup-secret "Actions configuration database password" "actions-config-db-password" "secrets.actions.ConfigurationDatabaseSqlPassword" - backup-secret "Actions framework access token key secret" "actions-framework-access-token" "secrets.actions.FrameworkAccessTokenKeySecret" --best-effort - backup-secret "Actions Url signing HMAC key primary" "actions-url-signing-hmac-key-primary" "secrets.actions.UrlSigningHmacKeyPrimary" - backup-secret "Actions Url signing HMAC key secondary" "actions-url-signing-hmac-key-secondary" "secrets.actions.UrlSigningHmacKeySecondary" - backup-secret "Actions OAuth S2S signing cert" "actions-oauth-s2s-signing-cert" "secrets.actions.OAuthS2SSigningCert" - backup-secret "Actions OAuth S2S signing key" "actions-oauth-s2s-signing-key" "secrets.actions.OAuthS2SSigningKey" - backup-secret "Actions OAuth S2S signing cert thumbprint" "actions-oauth-s2s-signing-cert-thumbprint" "secrets.actions.OAuthS2SSigningCertThumbprint" - backup-secret "Actions primary encryption cert thumbprint" "actions-primary-encryption-cert-thumbprint" "secrets.actions.PrimaryEncryptionCertificateThumbprint" - backup-secret "Actions AAD cert thumbprint" "actions-aad-cert-thumbprint" "secrets.actions.AADCertThumbprint" --best-effort - backup-secret "Actions delegated auth cert thumbprint" "actions-delegated-auth-cert-thumbprint" "secrets.actions.DelegatedAuthCertThumbprint" --best-effort - backup-secret "Actions runtime service principal cert" "actions-runtime-service-principal-cert" "secrets.actions.RuntimeServicePrincipalCertificate" --best-effort - backup-secret "Actions S2S encryption cert" "actions-s2s-encryption-cert" "secrets.actions.S2SEncryptionCertificate" - backup-secret "Actions secondary encryption cert thumbprint" "actions-secondary-encryption-cert-thumbprint" "secrets.actions.SecondaryEncryptionCertificateThumbprint" - backup-secret "Actions service principal cert" "actions-service-principal-cert" "secrets.actions.ServicePrincipalCertificate" --best-effort - backup-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" - backup-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" - - backup-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" - backup-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" - backup-secret "Actions Launch Client id" "actions-launch-client-id" "secrets.launch.client-id" - backup-secret "Actions Launch Client secret" "actions-launch-client-secret" "secrets.launch.client-secret" - backup-secret "Actions Launch receiver webhook secret" "actions-launch-receiver-webhook-secret" "secrets.launch.receiver-webhook-secret" - backup-secret "Actions Launch app private key" "actions-launch-app-private-key" "secrets.launch.app-private-key" - backup-secret "Actions Launch app public key" "actions-launch-app-public-key" "secrets.launch.app-public-key" - backup-secret "Actions Launch app id" "actions-launch-app-id" "secrets.launch.app-id" - backup-secret "Actions Launch app relay id" "actions-launch-app-relay-id" "secrets.launch.app-relay-id" - backup-secret "Actions Launch action runner secret" "actions-launch-action-runner-secret" "secrets.launch.action-runner-secret" - backup-secret "Actions Launch service cert" "actions-launch-azp-app-cert" "secrets.launch.azp-app-cert" - backup-secret "Actions Launch service private key" "actions-launch-app-app-private-key" "secrets.launch.azp-app-private-key" -fi - -if ghe-ssh "$host" -- ghe-config --true app.packages.enabled; then - backup-secret "Packages aws access key" "packages-aws-access-key" "secrets.packages.aws-access-key" - backup-secret "Packages aws secret key" "packages-aws-secret-key" "secrets.packages.aws-secret-key" - backup-secret "Packages s3 bucket" "packages-s3-bucket" "secrets.packages.s3-bucket" - backup-secret "Packages storage service url" "packages-service-url" "secrets.packages.service-url" - backup-secret "Packages blob storage type" "packages-blob-storage-type" "secrets.packages.blob-storage-type" - backup-secret "Packages azure connection string" "packages-azure-connection-string" "secrets.packages.azure-connection-string" - backup-secret "Packages azure container name" "packages-azure-container-name" "secrets.packages.azure-container-name" -fi - -# Backup Chat Integration settings -if ghe-ssh "$host" -- ghe-config --true app.chatops.enabled; then - backup-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id" - backup-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password" - backup-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint" - backup-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle" - backup-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name" - backup-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id" - backup-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id" - backup-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret" - backup-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token" - backup-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token" - backup-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint" - backup-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret" - backup-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token" - backup-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command" - backup-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name" - backup-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode" - backup-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint" - backup-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type" - backup-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams" - backup-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams" - backup-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams" - backup-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams" - backup-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret" - backup-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret" - backup-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack" - backup-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack" - backup-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack" - backup-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack" -fi - if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/idp.crt"; then log_info "* Transferring SAML keys ..." 1>&3 ghe-ssh $host -- sudo tar -C $GHE_REMOTE_DATA_USER_DIR/common/ -cf - "idp.crt saml-sp.p12" > saml-keys.tar diff --git a/share/github-backup-utils/ghe-restore-actions b/share/github-backup-utils/ghe-restore-actions index 303a2abd2..b27dc9aa6 100755 --- a/share/github-backup-utils/ghe-restore-actions +++ b/share/github-backup-utils/ghe-restore-actions @@ -52,48 +52,6 @@ log_rsync "END: actions rsync" 1>&3 # Restore Actions settings. ghe_verbose "* Restoring Actions settings to $host ..." -restore-secret "Actions configuration database login" "actions-config-db-login" "secrets.actions.ConfigurationDatabaseSqlLogin" -restore-secret "Actions configuration database password" "actions-config-db-password" "secrets.actions.ConfigurationDatabaseSqlPassword" -restore-secret "Actions framework access token key secret" "actions-framework-access-token" "secrets.actions.FrameworkAccessTokenKeySecret" -restore-secret "Actions Url signing HMAC key primary" "actions-url-signing-hmac-key-primary" "secrets.actions.UrlSigningHmacKeyPrimary" -restore-secret "Actions Url signing HMAC key secondary" "actions-url-signing-hmac-key-secondary" "secrets.actions.UrlSigningHmacKeySecondary" -restore-secret "Actions OAuth S2S signing cert" "actions-oauth-s2s-signing-cert" "secrets.actions.OAuthS2SSigningCert" -restore-secret "Actions OAuth S2S signing key" "actions-oauth-s2s-signing-key" "secrets.actions.OAuthS2SSigningKey" -restore-secret "Actions OAuth S2S signing cert thumbprint" "actions-oauth-s2s-signing-cert-thumbprint" "secrets.actions.OAuthS2SSigningCertThumbprint" -restore-secret "Actions primary encryption cert thumbprint" "actions-primary-encryption-cert-thumbprint" "secrets.actions.PrimaryEncryptionCertificateThumbprint" -restore-secret "Actions AAD cert thumbprint" "actions-aad-cert-thumbprint" "secrets.actions.AADCertThumbprint" -restore-secret "Actions delegated auth cert thumbprint" "actions-delegated-auth-cert-thumbprint" "secrets.actions.DelegatedAuthCertThumbprint" -restore-secret "Actions runtime service principal cert" "actions-runtime-service-principal-cert" "secrets.actions.RuntimeServicePrincipalCertificate" -restore-secret "Actions S2S encryption cert" "actions-s2s-encryption-cert" "secrets.actions.S2SEncryptionCertificate" -restore-secret "Actions secondary encryption cert thumbprint" "actions-secondary-encryption-cert-thumbprint" "secrets.actions.SecondaryEncryptionCertificateThumbprint" -restore-secret "Actions service principal cert" "actions-service-principal-cert" "secrets.actions.ServicePrincipalCertificate" -restore-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" - -restore-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" -restore-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" -restore-secret "Actions Launch Client id" "actions-launch-client-id" "secrets.launch.client-id" -restore-secret "Actions Launch Client secret" "actions-launch-client-secret" "secrets.launch.client-secret" -restore-secret "Actions Launch receiver webhook secret" "actions-launch-receiver-webhook-secret" "secrets.launch.receiver-webhook-secret" -restore-secret "Actions Launch app private key" "actions-launch-app-private-key" "secrets.launch.app-private-key" -restore-secret "Actions Launch app public key" "actions-launch-app-public-key" "secrets.launch.app-public-key" -restore-secret "Actions Launch app id" "actions-launch-app-id" "secrets.launch.app-id" -restore-secret "Actions Launch app relay id" "actions-launch-app-relay-id" "secrets.launch.app-relay-id" -restore-secret "Actions Launch action runner secret" "actions-launch-action-runner-secret" "secrets.launch.action-runner-secret" -restore-secret "Actions Launch service cert" "actions-launch-azp-app-cert" "secrets.launch.azp-app-cert" -restore-secret "Actions Launch service private key" "actions-launch-app-app-private-key" "secrets.launch.azp-app-private-key" - -restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" "secrets.launch.token-oauth-key" -restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert" - -# Restore storage container prefix, but only if it exists, and the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings -if [[ $RESTORE_SETTINGS == "true" ]]; then - if [[ -e "$GHE_RESTORE_SNAPSHOT_PATH/actions-storage-container-prefix" ]]; then - restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" - else - log_warn "Actions storage container prefix not present in backup. Skipping ..." - fi -fi - # Setup the database logins. ghe_verbose "* Restoring database logins and users to $host ..." diff --git a/share/github-backup-utils/ghe-restore-chat-integration b/share/github-backup-utils/ghe-restore-chat-integration deleted file mode 100755 index 0f0ba4b44..000000000 --- a/share/github-backup-utils/ghe-restore-chat-integration +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore-chat-integration -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-restore command. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Show usage and bail with no arguments -[ -z "$*" ] && print_usage - -bm_start "$(basename $0)" - -# Grab host arg -GHE_HOSTNAME="$1" - -# The snapshot to restore should be set by the ghe-restore command but this lets -# us run this script directly. -: ${GHE_RESTORE_SNAPSHOT:=current} - -# Path to snapshot dir we're restoring from -export GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" - -port=$(ssh_port_part "$GHE_HOSTNAME") -export port -host=$(ssh_host_part "$GHE_HOSTNAME") - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Restore Chat Integration settings. -ghe_verbose "Restoring Chat Integration settings ..." - -restore-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id" -restore-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password" -restore-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint" -restore-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle" -restore-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name" -restore-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id" -restore-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id" -restore-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret" -restore-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token" -restore-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token" -restore-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint" -restore-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret" -restore-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token" -restore-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command" -restore-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name" -restore-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode" -restore-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint" -restore-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type" -restore-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams" -restore-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams" -restore-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams" -restore-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams" -restore-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret" -restore-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret" -restore-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack" -restore-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack" -restore-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack" -restore-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack" - -bm_end "$(basename $0)" \ No newline at end of file diff --git a/share/github-backup-utils/ghe-restore-column-encryption-keys b/share/github-backup-utils/ghe-restore-column-encryption-keys deleted file mode 100755 index d30cacd51..000000000 --- a/share/github-backup-utils/ghe-restore-column-encryption-keys +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore-column-encryption-keys -#/ Restore the column encryption keys from a snapshot to the given . -#/ This script will be run automatically by `ghe-restore -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Show usage and bail with no arguments -[ -z "$*" ] && print_usage - -bm_start "$(basename $0)" - -# Grab host arg -GHE_HOSTNAME="$1" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$GHE_HOSTNAME" - -# The snapshot to restore should be set by the ghe-restore command but this lets -# us run this script directly. -: ${GHE_RESTORE_SNAPSHOT:=current} - -# Path to snapshot dir we're restoring from -: ${GHE_RESTORE_SNAPSHOT_PATH:="$GHE_DATA_DIR/current"} - -# Restore encrypted column encryption keying material for GHES 3.7.0 onward -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then - log_info "Restoring encrypted column encryption keying material" - restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" -fi - -# Restore encrypted column current encryption key for GHES 3.8.0 onwards -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then - log_info "Restoring encrypted column current encryption key" - restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" -fi - - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-mysql b/share/github-backup-utils/ghe-restore-mysql index 8e75ea0f1..a251c820a 100755 --- a/share/github-backup-utils/ghe-restore-mysql +++ b/share/github-backup-utils/ghe-restore-mysql @@ -29,9 +29,6 @@ export GHE_RESTORE_SNAPSHOT # The directory holding the snapshot to restore GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" -# Always restore the password pepper here since it is tied to the MySQL data. -restore-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" - if is_external_database_snapshot; then if [ -n "$EXTERNAL_DATABASE_RESTORE_SCRIPT" ]; then $EXTERNAL_DATABASE_RESTORE_SCRIPT diff --git a/share/github-backup-utils/ghe-restore-packages b/share/github-backup-utils/ghe-restore-packages deleted file mode 100755 index e9842d095..000000000 --- a/share/github-backup-utils/ghe-restore-packages +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore-packages -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-restore command. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Show usage and bail with no arguments -[ -z "$*" ] && print_usage - -bm_start "$(basename $0)" - -# Grab host arg -GHE_HOSTNAME="$1" - -# The snapshot to restore should be set by the ghe-restore command but this lets -# us run this script directly. -: ${GHE_RESTORE_SNAPSHOT:=current} - -# Path to snapshot dir we're restoring from -export GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" - -port=$(ssh_port_part "$GHE_HOSTNAME") -export port -host=$(ssh_host_part "$GHE_HOSTNAME") - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Restore Packages settings. -ghe_verbose "Restoring Packages settings ..." - -restore-secret "Packages aws access key" "packages-aws-access-key" "secrets.packages.aws-access-key" -restore-secret "Packages aws secret key" "packages-aws-secret-key" "secrets.packages.aws-secret-key" -restore-secret "Packages s3 bucket" "packages-s3-bucket" "secrets.packages.s3-bucket" -restore-secret "Packages storage service url" "packages-service-url" "secrets.packages.service-url" -restore-secret "Packages blob storage type" "packages-blob-storage-type" "secrets.packages.blob-storage-type" -restore-secret "Packages azure connection string" "packages-azure-connection-string" "secrets.packages.azure-connection-string" -restore-secret "Packages azure container name" "packages-azure-container-name" "secrets.packages.azure-container-name" - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys b/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys deleted file mode 100755 index 04f7588a7..000000000 --- a/share/github-backup-utils/ghe-restore-secret-scanning-encryption-keys +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore-secret-scanning-encryption-keys -#/ Restore the secret scanning encryption keys from a snapshot to the given . -#/ This script will be run automatically by `ghe-restore` -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$(dirname "${BASH_SOURCE[0]}")/ghe-backup-config" - -# Show usage and bail with no arguments -[ -z "$*" ] && print_usage - -bm_start "$(basename $0)" - -# Grab host arg -GHE_HOSTNAME="$1" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$GHE_HOSTNAME" - -# The snapshot to restore should be set by the ghe-restore command but this lets -# us run this script directly. -: ${GHE_RESTORE_SNAPSHOT:=current} - -# Path to snapshot dir we're restoring from -: ${GHE_RESTORE_SNAPSHOT_PATH:="$GHE_DATA_DIR/current"} - -# Restore secret scanning encrypted secrets storage keys if present -log_info "Restoring secret scanning encrypted secrets storage keys" -restore-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" -restore-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" - -# Restore secret scanning encrypted secrets transit keys if present -log_info "Restoring secret scanning encrypted secrets transit keys" -restore-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" -restore-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" - -# Restore secret scanning content scanning keys if present -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.11.0)" ]; then - log_info "Restoring secret scanning content scanning keys" - restore-secret "secret scanning user content delimited encryption root keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" -fi - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-secrets b/share/github-backup-utils/ghe-restore-secrets new file mode 100755 index 000000000..3d6b5dd8e --- /dev/null +++ b/share/github-backup-utils/ghe-restore-secrets @@ -0,0 +1,146 @@ +#!/usr/bin/env bash +#/ Usage: ghe-restore-secrets +#/ +#/ Note: This script typically isn't called directly. It's invoked by the +#/ ghe-restore command. +set -e + +# Bring in the backup configuration +# shellcheck source=share/github-backup-utils/ghe-backup-config +. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" + +# Show usage and bail with no arguments +[ -z "$*" ] && print_usage + +bm_start "$(basename $0)" + +# Grab host arg +GHE_HOSTNAME="$1" + +# The snapshot to restore should be set by the ghe-restore command but this lets +# us run this script directly. +: ${GHE_RESTORE_SNAPSHOT:=current} + +# Path to snapshot dir we're restoring from +export GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT" + +host=$(ssh_host_part "$GHE_HOSTNAME") + +# Perform a host-check and establish GHE_REMOTE_XXX variables. +ghe_remote_version_required "$host" + +# Otherwise use legacy +# Function to restore a secret setting stored in a file. +# restore-secret +restore-secret() { + if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/$2" ]; then + echo "Restoring $1 ..." + echo "ghe-config '$3' '$(cat "$GHE_RESTORE_SNAPSHOT_PATH/$2")'" | + ghe-ssh "$GHE_HOSTNAME" -- /bin/bash + fi +} + +log_info "Restoring secrets and applying cleanup ..." 1>&3 + +restore-secret "management console password" "manage-password" "secrets.manage" +restore-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" +restore-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" +restore-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" + +restore-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" + +restore-secret "external MySQL password" "external-mysql-password" "secrets.external.mysql" + +restore-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id" +restore-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password" +restore-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint" +restore-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle" +restore-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name" +restore-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id" +restore-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id" +restore-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret" +restore-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token" +restore-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token" +restore-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint" +restore-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret" +restore-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token" +restore-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command" +restore-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name" +restore-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode" +restore-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint" +restore-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type" +restore-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams" +restore-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams" +restore-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams" +restore-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams" +restore-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret" +restore-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret" +restore-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack" +restore-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack" +restore-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack" +restore-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack" + +restore-secret "Packages aws access key" "packages-aws-access-key" "secrets.packages.aws-access-key" +restore-secret "Packages aws secret key" "packages-aws-secret-key" "secrets.packages.aws-secret-key" +restore-secret "Packages s3 bucket" "packages-s3-bucket" "secrets.packages.s3-bucket" +restore-secret "Packages storage service url" "packages-service-url" "secrets.packages.service-url" +restore-secret "Packages blob storage type" "packages-blob-storage-type" "secrets.packages.blob-storage-type" +restore-secret "Packages azure connection string" "packages-azure-connection-string" "secrets.packages.azure-connection-string" +restore-secret "Packages azure container name" "packages-azure-container-name" "secrets.packages.azure-container-name" + +# Restore storage container prefix, but only if it exists, and the `-c` option is used with ghe-restore to avoid staging instances using production bucket settings +if [[ $RESTORE_SETTINGS == "true" ]]; then + if [[ -e "$GHE_RESTORE_SNAPSHOT_PATH/actions-storage-container-prefix" ]]; then + restore-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" + else + log_warn "Actions storage container prefix not present in backup. Skipping ..." + fi +fi + +restore-secret "Actions configuration database login" "actions-config-db-login" "secrets.actions.ConfigurationDatabaseSqlLogin" +restore-secret "Actions configuration database password" "actions-config-db-password" "secrets.actions.ConfigurationDatabaseSqlPassword" +restore-secret "Actions framework access token key secret" "actions-framework-access-token" "secrets.actions.FrameworkAccessTokenKeySecret" +restore-secret "Actions Url signing HMAC key primary" "actions-url-signing-hmac-key-primary" "secrets.actions.UrlSigningHmacKeyPrimary" +restore-secret "Actions Url signing HMAC key secondary" "actions-url-signing-hmac-key-secondary" "secrets.actions.UrlSigningHmacKeySecondary" +restore-secret "Actions OAuth S2S signing cert" "actions-oauth-s2s-signing-cert" "secrets.actions.OAuthS2SSigningCert" +restore-secret "Actions OAuth S2S signing key" "actions-oauth-s2s-signing-key" "secrets.actions.OAuthS2SSigningKey" +restore-secret "Actions OAuth S2S signing cert thumbprint" "actions-oauth-s2s-signing-cert-thumbprint" "secrets.actions.OAuthS2SSigningCertThumbprint" +restore-secret "Actions primary encryption cert thumbprint" "actions-primary-encryption-cert-thumbprint" "secrets.actions.PrimaryEncryptionCertificateThumbprint" +restore-secret "Actions AAD cert thumbprint" "actions-aad-cert-thumbprint" "secrets.actions.AADCertThumbprint" +restore-secret "Actions delegated auth cert thumbprint" "actions-delegated-auth-cert-thumbprint" "secrets.actions.DelegatedAuthCertThumbprint" +restore-secret "Actions runtime service principal cert" "actions-runtime-service-principal-cert" "secrets.actions.RuntimeServicePrincipalCertificate" +restore-secret "Actions S2S encryption cert" "actions-s2s-encryption-cert" "secrets.actions.S2SEncryptionCertificate" +restore-secret "Actions secondary encryption cert thumbprint" "actions-secondary-encryption-cert-thumbprint" "secrets.actions.SecondaryEncryptionCertificateThumbprint" +restore-secret "Actions service principal cert" "actions-service-principal-cert" "secrets.actions.ServicePrincipalCertificate" +restore-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" + +restore-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" +restore-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" +restore-secret "Actions Launch Client id" "actions-launch-client-id" "secrets.launch.client-id" +restore-secret "Actions Launch Client secret" "actions-launch-client-secret" "secrets.launch.client-secret" +restore-secret "Actions Launch receiver webhook secret" "actions-launch-receiver-webhook-secret" "secrets.launch.receiver-webhook-secret" +restore-secret "Actions Launch app private key" "actions-launch-app-private-key" "secrets.launch.app-private-key" +restore-secret "Actions Launch app public key" "actions-launch-app-public-key" "secrets.launch.app-public-key" +restore-secret "Actions Launch app id" "actions-launch-app-id" "secrets.launch.app-id" +restore-secret "Actions Launch app relay id" "actions-launch-app-relay-id" "secrets.launch.app-relay-id" +restore-secret "Actions Launch action runner secret" "actions-launch-action-runner-secret" "secrets.launch.action-runner-secret" +restore-secret "Actions Launch service cert" "actions-launch-azp-app-cert" "secrets.launch.azp-app-cert" +restore-secret "Actions Launch service private key" "actions-launch-app-app-private-key" "secrets.launch.azp-app-private-key" + +restore-secret "Actions Launch token oauth key" "actions-oauth-s2s-signing-key" "secrets.launch.token-oauth-key" +restore-secret "Actions Launch token oauth cert" "actions-oauth-s2s-signing-cert" "secrets.launch.token-oauth-cert" + +# Restore secret scanning +restore-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" +restore-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" +restore-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" +restore-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" +restore-secret "secret scanning user content delimited encryption root keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" + +# Restore encrypted column +restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" +restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" + +bm_end "$(basename $0)" + +exit 0 diff --git a/share/github-backup-utils/ghe-restore-settings b/share/github-backup-utils/ghe-restore-settings index ad06f30a6..8d20d8333 100755 --- a/share/github-backup-utils/ghe-restore-settings +++ b/share/github-backup-utils/ghe-restore-settings @@ -30,38 +30,11 @@ ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-license' < "$GHE_RESTORE_SNAPSHOT_PATH/en log_info "Restoring settings and applying configuration ..." -# Restore external MySQL password if running external MySQL DB. -restore-secret "external MySQL password" "external-mysql-password" "secrets.external.mysql" - -log_info "Restoring packages settings ..." -ghe-restore-packages "$GHE_HOSTNAME" 1>&3 - -echo "Restoring chat integration settings ..." -ghe-restore-chat-integration "$GHE_HOSTNAME" 1>&3 - # work around issue importing settings with bad storage mode values ( cat "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" && echo ) | sed 's/"storage_mode": "device"/"storage_mode": "rootfs"/' | ghe-ssh "$GHE_HOSTNAME" -- '/usr/bin/env GHEBUVER=2 ghe-import-settings' 1>&3 -# Restore management console password hash if present. -restore-secret "management console password" "manage-password" "secrets.manage" - -# Restore management console argon2 secret if present. -restore-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" - -# Restore kredz.credz HMAC key if present. -restore-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" - -# Restore kredz.varz HMAC key if present. -restore-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" - -# Restore encrypted column encryption keying material if present -restore-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" - -# Restore encrypted column current encryption key if present -restore-secret "encrypted column current encryption key" "encrypted-column-current-encryption-key" "secrets.github.encrypted-column-current-encryption-key" - # Restore SAML keys if present. if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/saml-keys.tar" ]; then log_info "Restoring SAML keys ..." diff --git a/test/test-ghe-restore.sh b/test/test-ghe-restore.sh index 3ea47e2b5..2b430e912 100755 --- a/test/test-ghe-restore.sh +++ b/test/test-ghe-restore.sh @@ -389,39 +389,6 @@ begin_test "ghe-restore with encrypted column current encryption key for version ) end_test -begin_test "ghe-restore with secret scanning encrypted secrets encryption keys for versions below 3.8.0" -( - set -e - rm -rf "$GHE_REMOTE_ROOT_DIR" - setup_remote_metadata - - required_files=( - "secret-scanning-encrypted-secrets-current-storage-key" - "secret-scanning-encrypted-secrets-delimited-storage-keys" - "secret-scanning-encrypted-secrets-current-shared-transit-key" - "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" - ) - - for file in "${required_files[@]}"; do - echo "foo" >"$GHE_DATA_DIR/current/$file" - done - - GHE_REMOTE_VERSION=3.7.0 ghe-restore -v -f localhost - - required_secrets=( - "secrets.secret-scanning.encrypted-secrets-current-storage-key" - "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" - "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" - "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" - ) - - for secret in "${required_secrets[@]}"; do - [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting these to not be set for versions below 3.8.0 - done -) -end_test - - begin_test "ghe-restore with secret scanning encrypted secrets encryption keys for versions 3.8.0+" ( set -e @@ -454,32 +421,6 @@ begin_test "ghe-restore with secret scanning encrypted secrets encryption keys f ) end_test -begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions below 3.11.0" -( - set -e - rm -rf "$GHE_REMOTE_ROOT_DIR" - setup_remote_metadata - - required_files=( - "secret-scanning-user-content-delimited-encryption-root-keys" - ) - - for file in "${required_files[@]}"; do - echo "foo" >"$GHE_DATA_DIR/current/$file" - done - - GHE_REMOTE_VERSION=3.10.0 ghe-restore -v -f localhost - - required_secrets=( - "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" - ) - - for secret in "${required_secrets[@]}"; do - [ "$(ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret")" = "" ] # expecting that this secret was not backed up on versions below 3.11.0, this secret was not present in earlier versions - done -) -end_test - begin_test "ghe-restore with secret scanning encrypted content encryption keys for versions 3.11.0+" ( set -e From 5c1c6fa1309696d5c5b0e417aeeb82eaf6d88f3b Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 12 Oct 2023 11:54:36 -0400 Subject: [PATCH 799/946] Attempting to fix linting errors --- docs/usage.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index e4ed5b7e2..2918a34da 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -2,11 +2,10 @@ After the initial backup, use the following commands: - - The `ghe-backup` command creates incremental snapshots of repository data, - along with full snapshots of all other pertinent data stores. - - The `ghe-restore` command restores snapshots to the same or separate GitHub - Enterprise appliance. You must add the backup host's SSH key to the target - GitHub Enterprise Server appliance before using this command. + - The `ghe-backup` command creates incremental snapshots of repository data, long with full snapshots of all other pertinent data stores. + - The `ghe-restore` command restores snapshots to the same or separate GitHub +Enterprise appliance. You must add the backup host's SSH key to the target +GitHub Enterprise Server appliance before using this command. These commands are run on the host you [installed][1] Backup Utilities on. From 676c3041c1e68fddb2e433678e4ccf25faf0d8d2 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 12 Oct 2023 15:23:17 -0400 Subject: [PATCH 800/946] Trying to fix linting errors again. --- docs/usage.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 2918a34da..8d72ba323 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -2,8 +2,8 @@ After the initial backup, use the following commands: - - The `ghe-backup` command creates incremental snapshots of repository data, long with full snapshots of all other pertinent data stores. - - The `ghe-restore` command restores snapshots to the same or separate GitHub +- The `ghe-backup` command creates incremental snapshots of repository data, long with full snapshots of all other pertinent data stores. +- The `ghe-restore` command restores snapshots to the same or separate GitHub Enterprise appliance. You must add the backup host's SSH key to the target GitHub Enterprise Server appliance before using this command. From 1354eb8e512722c76f6bdefa2b3ea0a470f3e6e8 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 12 Oct 2023 15:28:08 -0400 Subject: [PATCH 801/946] Another round of linting error fixes --- docs/usage.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 8d72ba323..29d08de04 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -3,7 +3,7 @@ After the initial backup, use the following commands: - The `ghe-backup` command creates incremental snapshots of repository data, long with full snapshots of all other pertinent data stores. -- The `ghe-restore` command restores snapshots to the same or separate GitHub +- The `ghe-restore` command restores snapshots to the same or separate GitHub Enterprise appliance. You must add the backup host's SSH key to the target GitHub Enterprise Server appliance before using this command. @@ -79,12 +79,12 @@ The `ghe-backup` and `ghe-restore` commands also have a verbose output mode (`-v`) that lists files as they're being transferred. It's often useful to enable when output is logged to a file. -Every time you execute `ghe-backup` we verify the storage and software setup of the host -you [installed][1] Backup Utilities on, to make sure our [requirements][2] for the host are -met. You can disable this check using the `--skip-checks` argument or by +Every time you execute `ghe-backup` we verify the storage and software setup of the host +you [installed][1] Backup Utilities on, to make sure our [requirements][2] for the host are +met. You can disable this check using the `--skip-checks` argument or by adding `GHE_SKIP_CHECKS=true` to your configuration file. -### Restoring settings, TLS certificate, and license +### Restoring settings, TLS certificate, and license When restoring to a new GitHub Enterprise Server instance, settings, certificate, and license data *are* restored. These settings must be reviewed and saved before @@ -99,7 +99,7 @@ forcing settings, certificate, and license data to be overwritten with the backu ## Backup and restore with GitHub Actions enabled GitHub Actions data on your external storage provider is not included in regular GitHub Enterprise Server -backups, and must be backed up separately. When restoring a GitHub Enterprise Server backup with +backups, and must be backed up separately. When restoring a GitHub Enterprise Server backup with GitHub Actions enabled, the following steps are required: 1. Enable GitHub Actions on the replacement appliance and configure it to use the same GitHub Actions From 559f7e62ca2cf1ac466bbc7ae3028a5e7320f84f Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 12 Oct 2023 15:44:43 -0400 Subject: [PATCH 802/946] More linting fixes --- docs/usage.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 29d08de04..4324b58cc 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -15,7 +15,7 @@ You can supply your own configuration file or use the example configuration file An example configuration file with documentation on possible settings can found in [backup.config-example](../backup.config-example). -There are a number of command line options that can also be passed to the `ghe-restore` command. Of particular note, if you use an external MySQL service but are restoring from a snapshot prior to enabling this, or vice versa, you must migrate the MySQL data outside of the context of backup-utils first, then pass the `--skip-mysql` flag to `ghe-restore`. +There are a number of command-line options that can also be passed to the `ghe-restore` command. Of particular note, if you use an external MySQL service but are restoring from a snapshot prior to enabling this, or vice versa, you must migrate the MySQL data outside of the context of backup-utils first, then pass the `--skip-mysql` flag to `ghe-restore`. ## Example backup and restore usage @@ -104,7 +104,7 @@ GitHub Actions enabled, the following steps are required: 1. Enable GitHub Actions on the replacement appliance and configure it to use the same GitHub Actions external storage configuration as the original appliance. -2. Put replacement appliance into maintenance mode. +2. Put replacement appliance into maintenance mode. 3. Use `ghe-restore` to restore the backup. 4. Re-register your self-hosted runners on the replacement appliance. From b53f1d5b599d0595dfd36322fbabdf95ac097d52 Mon Sep 17 00:00:00 2001 From: Hao Jiang <45571951+jianghao0718@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:47:55 -0600 Subject: [PATCH 803/946] Remove unused code in ghe-restore-es-rsync --- share/github-backup-utils/ghe-restore-es-rsync | 4 ---- 1 file changed, 4 deletions(-) diff --git a/share/github-backup-utils/ghe-restore-es-rsync b/share/github-backup-utils/ghe-restore-es-rsync index 1ba09afed..80a7f729a 100755 --- a/share/github-backup-utils/ghe-restore-es-rsync +++ b/share/github-backup-utils/ghe-restore-es-rsync @@ -44,10 +44,6 @@ else "$snapshot_dir/elasticsearch/" \ "$(ssh_host_part "$GHE_HOSTNAME"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch-restore" 1>&3 log_rsync "END: elasticsearch rsync" 1>&3 - # restoring in >=2.14 will remove incompatible indices created with 1.x. - if [ "$GHE_VERSION_MAJOR" -eq 2 ] && [ "$GHE_VERSION_MINOR" -ge 14 ]; then - ghe-ssh "$GHE_HOSTNAME" -- "sudo /usr/local/share/enterprise/ghe-es-remove-1x-indices" - fi fi bm_end "$(basename $0)" From 58d94fc0303750861e6e2af1e6f4a751aa98ce56 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 13:48:04 +0000 Subject: [PATCH 804/946] test create-github-app-token on test branch --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 49a7c0156..008484729 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -24,7 +24,7 @@ jobs: steps: # resulting token still gets denied by the backup-utils repo # see: https://github.com/actions/create-github-app-token/pull/46 - - uses: timreimherr/create-github-app-token@main + - uses: actions/create-github-app-token@v1 id: app-token with: # required From 2d2a3d3bb4d77af4b108752e5d50a06ba01ddfb6 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 14:05:06 +0000 Subject: [PATCH 805/946] update build-and-release to use action --- .github/workflows/build-and-release.yml | 201 +++++++++++------------- 1 file changed, 88 insertions(+), 113 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 008484729..a9e5cf2a5 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -4,10 +4,6 @@ name: Build and Release on: workflow_dispatch: inputs: - gh-token: - description: 'GitHub Token - used to create a commit in the backup-utils repo' - required: true - type: string version: description: 'Version - patch version of the release (e.g. x.y.z)' required: true @@ -22,14 +18,67 @@ jobs: build: runs-on: ubuntu-latest steps: - # resulting token still gets denied by the backup-utils repo - # see: https://github.com/actions/create-github-app-token/pull/46 - uses: actions/create-github-app-token@v1 id: app-token with: # required - app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "backup-utils,backup-utils-private" + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils-private + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag # this is required for the build scripts + run: | + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb + run: | + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + release: + needs: build + runs-on: ubuntu-latest + outputs: + commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + # required + app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils @@ -37,120 +86,46 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils + ref: master - name: Create empty commit uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: - branch: tims-test-branch + branch: master commit_message: "${{ github.event.inputs.version }} release" commit_user_name: "${{ github.actor }}" commit_user_email: "ghes-releases-team@github.com" commit_options: "--allow-empty" skip_dirty_check: true - - name: Log a message - if: success() - run: echo "The previous step succeeded" - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repository: github/backup-utils-private - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag # this is required for the build scripts - # run: | - # git config user.name "${{ github.actor }}" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # release: - # needs: build - # runs-on: ubuntu-latest - # outputs: - # commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} - # steps: - # # resulting token still gets denied by the backup-utils repo - # # see: https://github.com/actions/create-github-app-token/pull/46 - # # - uses: timreimherr/create-github-app-token@main - # # id: app-token - # # with: - # # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # # owner: ${{ github.repository_owner }} - # # repositories: backup-utils,backup-utils-private - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repository: github/backup-utils - # ref: master - # - name: Create empty commit - # uses: stefanzweifel/git-auto-commit-action@v4 - # id: empty-commit - # with: - # branch: master - # commit_message: "${{ github.event.inputs.version }} release" - # commit_user_name: "${{ github.actor }}" - # commit_user_email: "ghes-releases-team@github.com" - # commit_options: "--allow-empty" - # skip_dirty_check: true - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repository: github/backup-utils-private - # - name: Download deb artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Download tarball artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # - name: Create Release - # uses: ncipollo/release-action@v1 - # with: - # token: ${{ github.event.inputs.gh-token }} - # repo: backup-utils - # name: | - # GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - # artifacts: | - # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - # github-backup-utils_${{ github.event.inputs.version }}_all.deb - # tag: v${{ github.event.inputs.version }} - # commit: ${{ steps.empty-commit.outputs.commit_hash }} - # bodyFile: release-notes/${{ github.event.inputs.version }}.md - # draft: ${{ github.event.inputs.draft }} - # allowUpdates: true - # artifactContentType: "raw" + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils-private + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Create Release + uses: ncipollo/release-action@v1 + with: + token: ${{ steps.app-token.outputs.token }} + repo: backup-utils + name: | + GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + artifacts: | + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils_${{ github.event.inputs.version }}_all.deb + tag: v${{ github.event.inputs.version }} + commit: ${{ steps.empty-commit.outputs.commit_hash }} + bodyFile: release-notes/${{ github.event.inputs.version }}.md + draft: ${{ github.event.inputs.draft }} + allowUpdates: true + artifactContentType: "raw" From c1a7c09973bb8ace42236631cf8ad5451fcaae5e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 14:05:21 +0000 Subject: [PATCH 806/946] test release notes for test --- release-notes/12.12.12.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 release-notes/12.12.12.md diff --git a/release-notes/12.12.12.md b/release-notes/12.12.12.md new file mode 100644 index 000000000..445d9aada --- /dev/null +++ b/release-notes/12.12.12.md @@ -0,0 +1,7 @@ +### Changes + +* Test release notes. + +### Bug fixes + +* More test release notes. \ No newline at end of file From e69f7d1b8220f6475ce82fb1bf4af586bbd2c63d Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 14:50:59 +0000 Subject: [PATCH 807/946] test empty commit against master --- .github/workflows/build-and-release.yml | 189 +++++++++++++----------- 1 file changed, 102 insertions(+), 87 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index a9e5cf2a5..d77906fa0 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -17,61 +17,6 @@ on: jobs: build: runs-on: ubuntu-latest - steps: - - uses: actions/create-github-app-token@v1 - id: app-token - with: - # required - app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: "backup-utils,backup-utils-private" - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils-private - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag # this is required for the build scripts - run: | - git config user.name "${{ github.actor }}" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - release: - needs: build - runs-on: ubuntu-latest - outputs: - commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} steps: - uses: actions/create-github-app-token@v1 id: app-token @@ -86,46 +31,116 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - ref: master - name: Create empty commit uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: branch: master - commit_message: "${{ github.event.inputs.version }} release" - commit_user_name: "${{ github.actor }}" + commit_message: "Test ${{ github.event.inputs.version }} release commit" + commit_user_name: "release-controller[bot]" commit_user_email: "ghes-releases-team@github.com" + commit_author: "release-controller[bot]" commit_options: "--allow-empty" + push_options: "--force" skip_dirty_check: true - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils-private - - name: Download deb artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Download tarball artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - - name: Create Release - uses: ncipollo/release-action@v1 - with: - token: ${{ steps.app-token.outputs.token }} - repo: backup-utils - name: | - GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - artifacts: | - github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - github-backup-utils_${{ github.event.inputs.version }}_all.deb - tag: v${{ github.event.inputs.version }} - commit: ${{ steps.empty-commit.outputs.commit_hash }} - bodyFile: release-notes/${{ github.event.inputs.version }}.md - draft: ${{ github.event.inputs.draft }} - allowUpdates: true - artifactContentType: "raw" + - name: Log a message + if: success() + run: echo "The previous step succeeded" + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Create tag # this is required for the build scripts + # run: | + # git config user.name "${{ github.actor }}" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # release: + # needs: build + # runs-on: ubuntu-latest + # outputs: + # commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} + # steps: + # - uses: actions/create-github-app-token@v1 + # id: app-token + # with: + # # required + # app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: "backup-utils,backup-utils-private" + # - name: Checkout backup-utils + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils + # ref: master + # - name: Create empty commit + # uses: stefanzweifel/git-auto-commit-action@v4 + # id: empty-commit + # with: + # branch: master + # commit_message: "${{ github.event.inputs.version }} release" + # commit_user_name: "${{ github.actor }}" + # commit_user_email: "ghes-releases-team@github.com" + # commit_options: "--allow-empty" + # skip_dirty_check: true + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils-private + # - name: Download deb artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Download tarball artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # - name: Create Release + # uses: ncipollo/release-action@v1 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repo: backup-utils + # name: | + # GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + # artifacts: | + # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + # github-backup-utils_${{ github.event.inputs.version }}_all.deb + # tag: v${{ github.event.inputs.version }} + # commit: ${{ steps.empty-commit.outputs.commit_hash }} + # bodyFile: release-notes/${{ github.event.inputs.version }}.md + # draft: ${{ github.event.inputs.draft }} + # allowUpdates: true + # artifactContentType: "raw" From 2289bfcafe941eb04896bcf26943479c53133f59 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 14:54:14 +0000 Subject: [PATCH 808/946] author --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index d77906fa0..c0c35ea15 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -39,7 +39,7 @@ jobs: commit_message: "Test ${{ github.event.inputs.version }} release commit" commit_user_name: "release-controller[bot]" commit_user_email: "ghes-releases-team@github.com" - commit_author: "release-controller[bot]" + commit_author: "release-controller" commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true From 8553bd8c99dba00546c6e23f3a3a8d9383d03e81 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 14:55:54 +0000 Subject: [PATCH 809/946] author 2 --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c0c35ea15..83df40618 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -39,7 +39,7 @@ jobs: commit_message: "Test ${{ github.event.inputs.version }} release commit" commit_user_name: "release-controller[bot]" commit_user_email: "ghes-releases-team@github.com" - commit_author: "release-controller" + commit_author: "release-controller ghes-releases-team@github.com" commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true From 2fdfafe0bb1d0517ea6dbd91fb2efbd834e50055 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 14:57:40 +0000 Subject: [PATCH 810/946] don't set author --- .github/workflows/build-and-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 83df40618..eed8d8de9 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -37,9 +37,8 @@ jobs: with: branch: master commit_message: "Test ${{ github.event.inputs.version }} release commit" - commit_user_name: "release-controller[bot]" + commit_user_name: "release-controller" commit_user_email: "ghes-releases-team@github.com" - commit_author: "release-controller ghes-releases-team@github.com" commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true From f60549f73321af1e6adcde885eeb2d34ce9da4b0 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 15:01:48 +0000 Subject: [PATCH 811/946] try release-controller again --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index eed8d8de9..006b24c9d 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -39,6 +39,7 @@ jobs: commit_message: "Test ${{ github.event.inputs.version }} release commit" commit_user_name: "release-controller" commit_user_email: "ghes-releases-team@github.com" + commit_author: "release-controller " commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true From 43978250559a6efd19b605c0bcc2b82f248cce7c Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 15:07:30 +0000 Subject: [PATCH 812/946] default author --- .github/workflows/build-and-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 006b24c9d..8bade7a1f 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -37,9 +37,8 @@ jobs: with: branch: master commit_message: "Test ${{ github.event.inputs.version }} release commit" - commit_user_name: "release-controller" + commit_user_name: "${{ github.actor }}" commit_user_email: "ghes-releases-team@github.com" - commit_author: "release-controller " commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true From a4e63ea04210538074d60e744c7e295fe405ac6b Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 17:37:38 +0000 Subject: [PATCH 813/946] set author --- .github/workflows/build-and-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 8bade7a1f..d3293be75 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -37,8 +37,9 @@ jobs: with: branch: master commit_message: "Test ${{ github.event.inputs.version }} release commit" - commit_user_name: "${{ github.actor }}" + commit_user_name: "release-controller" commit_user_email: "ghes-releases-team@github.com" + commit_author: "release-controller " commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true From 05950382eedea3ed27a11fa40d345230fa31824e Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 17:41:42 +0000 Subject: [PATCH 814/946] use rc --- .github/workflows/build-and-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index d3293be75..496cefdaf 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -37,9 +37,9 @@ jobs: with: branch: master commit_message: "Test ${{ github.event.inputs.version }} release commit" - commit_user_name: "release-controller" - commit_user_email: "ghes-releases-team@github.com" - commit_author: "release-controller " + commit_user_name: "release-controller[bot]" + commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" + commit_author: "release-controller[bot] <223695+release-controller[bot]@users.noreply.github.com>" commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true From 827d8800f25b3505eb17eaa48ba7021db3801ef9 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 17:52:19 +0000 Subject: [PATCH 815/946] remove rc --- .github/workflows/build-and-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 496cefdaf..0e89ed42b 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -39,7 +39,6 @@ jobs: commit_message: "Test ${{ github.event.inputs.version }} release commit" commit_user_name: "release-controller[bot]" commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" - commit_author: "release-controller[bot] <223695+release-controller[bot]@users.noreply.github.com>" commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true From 0a9894e9a4a90d422427b4ea6e46503d92e9efc2 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 21:31:55 +0000 Subject: [PATCH 816/946] enable setting commit sha for release --- .github/workflows/build-and-release.yml | 198 ++++++++++++------------ 1 file changed, 100 insertions(+), 98 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 0e89ed42b..6d6ccbf44 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -13,6 +13,10 @@ on: required: true type: boolean default: true + backup-utils-release-commit: + description: 'Release Commit - true if the release should be a release commit' + required: false + type: string jobs: build: @@ -26,12 +30,69 @@ jobs: private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag # this is required for the build scripts + run: | + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb + run: | + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + release: + needs: build + runs-on: ubuntu-latest + outputs: + commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} + release-commit: ${{ steps.resolve-release-commit.outputs.release-commit }} + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils + if: !github.event.inputs.backup-utils-release-commit uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils + ref: master - name: Create empty commit + if: !github.event.inputs.backup-utils-release-commit uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: @@ -42,104 +103,45 @@ jobs: commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true - - name: Log a message - if: success() - run: echo "The previous step succeeded" - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag # this is required for the build scripts - # run: | - # git config user.name "${{ github.actor }}" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # release: - # needs: build - # runs-on: ubuntu-latest - # outputs: - # commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} - # steps: - # - uses: actions/create-github-app-token@v1 - # id: app-token - # with: - # # required - # app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: "backup-utils,backup-utils-private" - # - name: Checkout backup-utils - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils - # ref: master - # - name: Create empty commit - # uses: stefanzweifel/git-auto-commit-action@v4 - # id: empty-commit - # with: - # branch: master - # commit_message: "${{ github.event.inputs.version }} release" - # commit_user_name: "${{ github.actor }}" - # commit_user_email: "ghes-releases-team@github.com" - # commit_options: "--allow-empty" - # skip_dirty_check: true - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils-private - # - name: Download deb artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Download tarball artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # - name: Create Release - # uses: ncipollo/release-action@v1 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repo: backup-utils - # name: | - # GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - # artifacts: | - # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - # github-backup-utils_${{ github.event.inputs.version }}_all.deb - # tag: v${{ github.event.inputs.version }} - # commit: ${{ steps.empty-commit.outputs.commit_hash }} - # bodyFile: release-notes/${{ github.event.inputs.version }}.md - # draft: ${{ github.event.inputs.draft }} - # allowUpdates: true - # artifactContentType: "raw" + - name: Resolve release commit + id: resolve-release-commit + if: github.event.inputs.backup-utils-release-commit + run: | + echo "Useing sha from input backup-utils-release-commit" + echo "release-commit=${{ github.event.inputs.backup-utils-release-commit }}" >> $GITHUB_OUTPUT + else: + echo "Using sha from empty commit" + echo "release-commit=${{ steps.empty-commit.outputs.commit_hash }}" >> $GITHUB_OUTPUT + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils-private + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Create Release + uses: ncipollo/release-action@v1 + with: + token: ${{ steps.app-token.outputs.token }} + repo: backup-utils + name: | + GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} + artifacts: | + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils_${{ github.event.inputs.version }}_all.deb + tag: v${{ github.event.inputs.version }} + # use release-commit value + commit: ${{ steps.resolve-release-commit.outputs.release-commit }} + bodyFile: release-notes/${{ github.event.inputs.version }}.md + draft: ${{ github.event.inputs.draft }} + allowUpdates: true + artifactContentType: "raw" From be24c6e1230efd2223abd88d2f8e9b2442b376ec Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 21:34:16 +0000 Subject: [PATCH 817/946] update input description --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6d6ccbf44..23431075c 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -14,7 +14,7 @@ on: type: boolean default: true backup-utils-release-commit: - description: 'Release Commit - true if the release should be a release commit' + description: 'Backup Utils Release Commit - sha of the commit to associate with backup-utils release, if empty an empty commit will be created on master' required: false type: string From d02b7d68ef495dc9737d4af8a8ba5a51fd4fb048 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 21:35:17 +0000 Subject: [PATCH 818/946] update desc --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 23431075c..f4adddf23 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -14,7 +14,7 @@ on: type: boolean default: true backup-utils-release-commit: - description: 'Backup Utils Release Commit - sha of the commit to associate with backup-utils release, if empty an empty commit will be created on master' + description: 'Backup Utils Release Commit - sha of the commit to associate with backup-utils release. If blank, an empty commit will be created on master' required: false type: string From 38b8cdd449448bfb72a7bd9a31e05610c9f39961 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 21:35:53 +0000 Subject: [PATCH 819/946] reorder inputs --- .github/workflows/build-and-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index f4adddf23..7dd6e6897 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -8,15 +8,15 @@ on: description: 'Version - patch version of the release (e.g. x.y.z)' required: true type: string + backup-utils-release-commit: + description: 'Backup Utils Release Commit - sha of the commit to associate with backup-utils release. If blank, an empty commit will be created on master' + required: false + type: string draft: description: 'Draft - true if the release should be a draft' required: true type: boolean default: true - backup-utils-release-commit: - description: 'Backup Utils Release Commit - sha of the commit to associate with backup-utils release. If blank, an empty commit will be created on master' - required: false - type: string jobs: build: From e164d529f7956097a74fd84d58c4479f3ca77b3a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 21:38:43 +0000 Subject: [PATCH 820/946] fix eval statements --- .github/workflows/build-and-release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7dd6e6897..055228c89 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -85,14 +85,15 @@ jobs: owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils - if: !github.event.inputs.backup-utils-release-commit + if: github.event.inputs.backup-utils-release-commit == '' uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils ref: master - name: Create empty commit - if: !github.event.inputs.backup-utils-release-commit + # if github.event.inputs.backup-utils-release-commit is empty string, then create an empty commit + if: github.event.inputs.backup-utils-release-commit == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: @@ -105,7 +106,7 @@ jobs: skip_dirty_check: true - name: Resolve release commit id: resolve-release-commit - if: github.event.inputs.backup-utils-release-commit + if: github.event.inputs.backup-utils-release-commit != '' run: | echo "Useing sha from input backup-utils-release-commit" echo "release-commit=${{ github.event.inputs.backup-utils-release-commit }}" >> $GITHUB_OUTPUT From 77d98638d88690fec292dfbf8f66f426ddfe0984 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 21:42:03 +0000 Subject: [PATCH 821/946] fix resolve commit --- .github/workflows/build-and-release.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 055228c89..c3e1d560a 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -106,13 +106,14 @@ jobs: skip_dirty_check: true - name: Resolve release commit id: resolve-release-commit - if: github.event.inputs.backup-utils-release-commit != '' run: | - echo "Useing sha from input backup-utils-release-commit" - echo "release-commit=${{ github.event.inputs.backup-utils-release-commit }}" >> $GITHUB_OUTPUT - else: - echo "Using sha from empty commit" - echo "release-commit=${{ steps.empty-commit.outputs.commit_hash }}" >> $GITHUB_OUTPUT + if [[ -z "${{ github.event.inputs.backup-utils-release-commit }}" ]]; then + echo "Using empty commit sha for release commit" + echo "release-commit=${{ steps.empty-commit.outputs.commit_hash }}" >> $GITHUB_OUTPUT + else + echo "Using provided commit sha for release commit" + echo "release-commit=${{ github.event.inputs.backup-utils-release-commit }}" >> $GITHUB_OUTPUT + fi - name: Checkout backup-utils-private uses: actions/checkout@v4 with: From 5a2c6f1248c76992b730b32ee5898d76dce672e0 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 21:52:06 +0000 Subject: [PATCH 822/946] remove blank lines --- .github/workflows/build-and-release.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c3e1d560a..1667f5bf1 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -85,7 +85,7 @@ jobs: owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils - if: github.event.inputs.backup-utils-release-commit == '' + if: ${{ github.event.inputs.backup-utils-release-commit }} == '' uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} @@ -93,7 +93,7 @@ jobs: ref: master - name: Create empty commit # if github.event.inputs.backup-utils-release-commit is empty string, then create an empty commit - if: github.event.inputs.backup-utils-release-commit == '' + if: ${{ github.event.inputs.backup-utils-release-commit }} == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: @@ -143,8 +143,4 @@ jobs: bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true - artifactContentType: "raw" - - - - + artifactContentType: "raw" \ No newline at end of file From 00b46d937b8b62d3894705b723eaea09192bcd34 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 21:54:34 +0000 Subject: [PATCH 823/946] avoid globbing? --- .github/workflows/build-and-release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 1667f5bf1..bdc2a69db 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -107,13 +107,13 @@ jobs: - name: Resolve release commit id: resolve-release-commit run: | - if [[ -z "${{ github.event.inputs.backup-utils-release-commit }}" ]]; then - echo "Using empty commit sha for release commit" - echo "release-commit=${{ steps.empty-commit.outputs.commit_hash }}" >> $GITHUB_OUTPUT + "if [[ -z '${{ github.event.inputs.backup-utils-release-commit }}' ]]; then + echo 'Using empty commit sha for release commit' + echo 'release-commit=${{ steps.empty-commit.outputs.commit_hash }}' >> $GITHUB_OUTPUT else - echo "Using provided commit sha for release commit" - echo "release-commit=${{ github.event.inputs.backup-utils-release-commit }}" >> $GITHUB_OUTPUT - fi + echo 'Using provided commit sha for release commit' + echo 'release-commit=${{ github.event.inputs.backup-utils-release-commit }}' >> $GITHUB_OUTPUT + fi" - name: Checkout backup-utils-private uses: actions/checkout@v4 with: From c506a52b6247d931ec6cc76ab03edb5d7ec80647 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 22:13:08 +0000 Subject: [PATCH 824/946] eval was correct, revert --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index bdc2a69db..aecb756c2 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -85,7 +85,7 @@ jobs: owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils - if: ${{ github.event.inputs.backup-utils-release-commit }} == '' + if: github.event.inputs.backup-utils-release-commit == '' uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} @@ -93,7 +93,7 @@ jobs: ref: master - name: Create empty commit # if github.event.inputs.backup-utils-release-commit is empty string, then create an empty commit - if: ${{ github.event.inputs.backup-utils-release-commit }} == '' + if: github.event.inputs.backup-utils-release-commit == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: From 70f21fffea0849dbcd6d798aa88797aaa4f588e4 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 22:21:18 +0000 Subject: [PATCH 825/946] does copilot know the answer? --- .github/workflows/build-and-release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index aecb756c2..62100f420 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -107,13 +107,13 @@ jobs: - name: Resolve release commit id: resolve-release-commit run: | - "if [[ -z '${{ github.event.inputs.backup-utils-release-commit }}' ]]; then - echo 'Using empty commit sha for release commit' - echo 'release-commit=${{ steps.empty-commit.outputs.commit_hash }}' >> $GITHUB_OUTPUT + if [[ -z "${{ github.event.inputs.backup-utils-release-commit }}" ]]; then + echo "Using empty commit sha for release commit" + echo "release-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" else - echo 'Using provided commit sha for release commit' - echo 'release-commit=${{ github.event.inputs.backup-utils-release-commit }}' >> $GITHUB_OUTPUT - fi" + echo "Using provided commit sha for release commit" + echo "release-commit=\"${{ github.event.inputs.backup-utils-release-commit }}\"" >> "$GITHUB_OUTPUT" + fi - name: Checkout backup-utils-private uses: actions/checkout@v4 with: From 425162cce2c6bf2317f1ab22e7dc6c4d0f22d66d Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 23:35:35 +0000 Subject: [PATCH 826/946] don't need priavte repo in release? --- .github/workflows/build-and-release.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 62100f420..c727e45ea 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -25,7 +25,6 @@ jobs: - uses: actions/create-github-app-token@v1 id: app-token with: - # required app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} @@ -92,7 +91,6 @@ jobs: repository: github/backup-utils ref: master - name: Create empty commit - # if github.event.inputs.backup-utils-release-commit is empty string, then create an empty commit if: github.event.inputs.backup-utils-release-commit == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit @@ -114,11 +112,11 @@ jobs: echo "Using provided commit sha for release commit" echo "release-commit=\"${{ github.event.inputs.backup-utils-release-commit }}\"" >> "$GITHUB_OUTPUT" fi - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils-private + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils-private - name: Download deb artifact uses: actions/download-artifact@v3 with: @@ -138,7 +136,6 @@ jobs: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - # use release-commit value commit: ${{ steps.resolve-release-commit.outputs.release-commit }} bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} From c7dc45529bf4eafb36fb1c86d30c6f2d45101b31 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Mon, 16 Oct 2023 23:39:13 +0000 Subject: [PATCH 827/946] add owner --- .github/workflows/build-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c727e45ea..62bb55b22 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -129,6 +129,7 @@ jobs: uses: ncipollo/release-action@v1 with: token: ${{ steps.app-token.outputs.token }} + owner: github repo: backup-utils name: | GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} From ea39b5eb1112c7d1e980d8f3d3786d11896362a0 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 17 Oct 2023 09:06:56 -0400 Subject: [PATCH 828/946] for release notes --- .github/workflows/build-and-release.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 62bb55b22..1bf9e9124 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -112,11 +112,12 @@ jobs: echo "Using provided commit sha for release commit" echo "release-commit=\"${{ github.event.inputs.backup-utils-release-commit }}\"" >> "$GITHUB_OUTPUT" fi - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils-private + # need backup-utils-private for release notes + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils-private - name: Download deb artifact uses: actions/download-artifact@v3 with: From d9a2830f5d85d40ef06fa764c600f5629b49f543 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 17 Oct 2023 09:13:27 -0400 Subject: [PATCH 829/946] can use branch ref also --- .github/workflows/build-and-release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 1bf9e9124..efd0d16b6 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -8,8 +8,8 @@ on: description: 'Version - patch version of the release (e.g. x.y.z)' required: true type: string - backup-utils-release-commit: - description: 'Backup Utils Release Commit - sha of the commit to associate with backup-utils release. If blank, an empty commit will be created on master' + branch-ref-or-commit: + description: 'Branch ref or commit - the backup-utils release will associated with the branch ref or commit provided. If blank, an empty commit will be created on master' required: false type: string draft: @@ -84,14 +84,14 @@ jobs: owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils - if: github.event.inputs.backup-utils-release-commit == '' + if: github.event.inputs.branch-ref-or-commit == '' uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils ref: master - name: Create empty commit - if: github.event.inputs.backup-utils-release-commit == '' + if: github.event.inputs.branch-ref-or-commit == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: @@ -105,12 +105,12 @@ jobs: - name: Resolve release commit id: resolve-release-commit run: | - if [[ -z "${{ github.event.inputs.backup-utils-release-commit }}" ]]; then + if [[ -z "${{ github.event.inputs.branch-ref-or-commit }}" ]]; then echo "Using empty commit sha for release commit" echo "release-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" else echo "Using provided commit sha for release commit" - echo "release-commit=\"${{ github.event.inputs.backup-utils-release-commit }}\"" >> "$GITHUB_OUTPUT" + echo "release-commit=\"${{ github.event.inputs.branch-ref-or-commit }}\"" >> "$GITHUB_OUTPUT" fi # need backup-utils-private for release notes - name: Checkout backup-utils-private From 80d4abea80c44b6db69fbb22f64f4714db4fa358 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 17 Oct 2023 09:26:06 -0400 Subject: [PATCH 830/946] reuse app token --- .github/workflows/build-and-release.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index efd0d16b6..bf849a8da 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -20,7 +20,10 @@ on: jobs: build: + name: build runs-on: ubuntu-latest + outputs: + token: ${{ steps.app-token.outputs.token }} steps: - uses: actions/create-github-app-token@v1 id: app-token @@ -74,20 +77,13 @@ jobs: runs-on: ubuntu-latest outputs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} - release-commit: ${{ steps.resolve-release-commit.outputs.release-commit }} + release-ref-or-commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} steps: - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils if: github.event.inputs.branch-ref-or-commit == '' uses: actions/checkout@v4 with: - token: ${{ steps.app-token.outputs.token }} + token: ${{ needs.build.outputs.token }} repository: github/backup-utils ref: master - name: Create empty commit @@ -107,16 +103,16 @@ jobs: run: | if [[ -z "${{ github.event.inputs.branch-ref-or-commit }}" ]]; then echo "Using empty commit sha for release commit" - echo "release-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" + echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" else echo "Using provided commit sha for release commit" - echo "release-commit=\"${{ github.event.inputs.branch-ref-or-commit }}\"" >> "$GITHUB_OUTPUT" + echo "release-ref-or-commit=\"${{ github.event.inputs.branch-ref-or-commit }}\"" >> "$GITHUB_OUTPUT" fi # need backup-utils-private for release notes - name: Checkout backup-utils-private uses: actions/checkout@v4 with: - token: ${{ steps.app-token.outputs.token }} + token: ${{ needs.build.outputs.token }} repository: github/backup-utils-private - name: Download deb artifact uses: actions/download-artifact@v3 @@ -129,7 +125,7 @@ jobs: - name: Create Release uses: ncipollo/release-action@v1 with: - token: ${{ steps.app-token.outputs.token }} + token: ${{ needs.build.outputs.token }} owner: github repo: backup-utils name: | @@ -138,7 +134,7 @@ jobs: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - commit: ${{ steps.resolve-release-commit.outputs.release-commit }} + commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true From 5641ebcaa212449c74268e1ef9be6ebe629c6075 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 17 Oct 2023 09:41:15 -0400 Subject: [PATCH 831/946] fic input name --- .github/workflows/build-and-release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index bf849a8da..12a6e5f7f 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -8,7 +8,7 @@ on: description: 'Version - patch version of the release (e.g. x.y.z)' required: true type: string - branch-ref-or-commit: + branch_ref_or_commit: description: 'Branch ref or commit - the backup-utils release will associated with the branch ref or commit provided. If blank, an empty commit will be created on master' required: false type: string @@ -80,14 +80,14 @@ jobs: release-ref-or-commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} steps: - name: Checkout backup-utils - if: github.event.inputs.branch-ref-or-commit == '' + if: github.event.inputs.branch_ref_or_commit == '' uses: actions/checkout@v4 with: token: ${{ needs.build.outputs.token }} repository: github/backup-utils ref: master - name: Create empty commit - if: github.event.inputs.branch-ref-or-commit == '' + if: github.event.inputs.branch_ref_or_commit == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: @@ -101,12 +101,12 @@ jobs: - name: Resolve release commit id: resolve-release-commit run: | - if [[ -z "${{ github.event.inputs.branch-ref-or-commit }}" ]]; then + if [[ -z "${{ github.event.inputs.branch_ref_or_commit }}" ]]; then echo "Using empty commit sha for release commit" echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" else echo "Using provided commit sha for release commit" - echo "release-ref-or-commit=\"${{ github.event.inputs.branch-ref-or-commit }}\"" >> "$GITHUB_OUTPUT" + echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" fi # need backup-utils-private for release notes - name: Checkout backup-utils-private From 7b286fc3c08c01d4f9a66affd5c88ed9f2ddf764 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 17 Oct 2023 12:28:06 -0400 Subject: [PATCH 832/946] skip token revoke --- .github/workflows/build-and-release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 12a6e5f7f..18a7cb596 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -23,7 +23,7 @@ jobs: name: build runs-on: ubuntu-latest outputs: - token: ${{ steps.app-token.outputs.token }} + rc-app-token: ${{ steps.app-token.outputs.token }} steps: - uses: actions/create-github-app-token@v1 id: app-token @@ -32,6 +32,7 @@ jobs: private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" + skip-token-revoke: true - name: Checkout backup-utils-private uses: actions/checkout@v4 with: @@ -83,7 +84,7 @@ jobs: if: github.event.inputs.branch_ref_or_commit == '' uses: actions/checkout@v4 with: - token: ${{ needs.build.outputs.token }} + token: ${{ needs.build.outputs.rc-app-token }} repository: github/backup-utils ref: master - name: Create empty commit @@ -108,11 +109,10 @@ jobs: echo "Using provided commit sha for release commit" echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" fi - # need backup-utils-private for release notes - - name: Checkout backup-utils-private + - name: Checkout backup-utils-private for release notes uses: actions/checkout@v4 with: - token: ${{ needs.build.outputs.token }} + token: ${{ needs.build.outputs.rc-app-token }} repository: github/backup-utils-private - name: Download deb artifact uses: actions/download-artifact@v3 @@ -125,7 +125,7 @@ jobs: - name: Create Release uses: ncipollo/release-action@v1 with: - token: ${{ needs.build.outputs.token }} + token: ${{ needs.build.outputs.rc-app-token }} owner: github repo: backup-utils name: | From fef0eec8daf907694a57dda4b1b4163b4230133f Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 17 Oct 2023 13:55:51 -0400 Subject: [PATCH 833/946] use create token again --- .github/workflows/build-and-release.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 18a7cb596..31eca6eab 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -20,7 +20,6 @@ on: jobs: build: - name: build runs-on: ubuntu-latest outputs: rc-app-token: ${{ steps.app-token.outputs.token }} @@ -31,8 +30,7 @@ jobs: app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} - repositories: "backup-utils,backup-utils-private" - skip-token-revoke: true + repositories: "backup-utils-private" - name: Checkout backup-utils-private uses: actions/checkout@v4 with: @@ -80,11 +78,18 @@ jobs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} release-ref-or-commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils if: github.event.inputs.branch_ref_or_commit == '' uses: actions/checkout@v4 with: - token: ${{ needs.build.outputs.rc-app-token }} + token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils ref: master - name: Create empty commit @@ -109,10 +114,14 @@ jobs: echo "Using provided commit sha for release commit" echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" fi + - name: Check rc-app-token value + if: needs.build.outputs.rc-app-token == '' + run: | + echo "****** rc-app-token is empty ******" - name: Checkout backup-utils-private for release notes uses: actions/checkout@v4 with: - token: ${{ needs.build.outputs.rc-app-token }} + token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils-private - name: Download deb artifact uses: actions/download-artifact@v3 From a8e052d1b0c28a88c523072aba995808db9f54ec Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 17 Oct 2023 14:43:19 -0400 Subject: [PATCH 834/946] use app token in release --- .github/workflows/build-and-release.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 31eca6eab..50e86dfef 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -114,10 +114,6 @@ jobs: echo "Using provided commit sha for release commit" echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" fi - - name: Check rc-app-token value - if: needs.build.outputs.rc-app-token == '' - run: | - echo "****** rc-app-token is empty ******" - name: Checkout backup-utils-private for release notes uses: actions/checkout@v4 with: @@ -134,7 +130,7 @@ jobs: - name: Create Release uses: ncipollo/release-action@v1 with: - token: ${{ needs.build.outputs.rc-app-token }} + token: ${{ steps.app-token.outputs.token }} owner: github repo: backup-utils name: | From 6211c8556fa48fd9ed713cf9fbf1ac333dd96ed3 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Tue, 17 Oct 2023 16:53:58 -0400 Subject: [PATCH 835/946] just create draft release --- .github/workflows/build-and-release.yml | 166 ++++++++++++------------ 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 50e86dfef..e55205902 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -19,60 +19,60 @@ on: default: true jobs: - build: - runs-on: ubuntu-latest - outputs: - rc-app-token: ${{ steps.app-token.outputs.token }} - steps: - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: "backup-utils-private" - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag # this is required for the build scripts - run: | - git config user.name "${{ github.actor }}" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # build: + # runs-on: ubuntu-latest + # outputs: + # rc-app-token: ${{ steps.app-token.outputs.token }} + # steps: + # - uses: actions/create-github-app-token@v1 + # id: app-token + # with: + # app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: "backup-utils-private" + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Create tag # this is required for the build scripts + # run: | + # git config user.name "${{ github.actor }}" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: - needs: build + # needs: build runs-on: ubuntu-latest outputs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} @@ -85,25 +85,25 @@ jobs: private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - - name: Checkout backup-utils - if: github.event.inputs.branch_ref_or_commit == '' - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - repository: github/backup-utils - ref: master - - name: Create empty commit - if: github.event.inputs.branch_ref_or_commit == '' - uses: stefanzweifel/git-auto-commit-action@v4 - id: empty-commit - with: - branch: master - commit_message: "Test ${{ github.event.inputs.version }} release commit" - commit_user_name: "release-controller[bot]" - commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" - commit_options: "--allow-empty" - push_options: "--force" - skip_dirty_check: true + # - name: Checkout backup-utils + # if: github.event.inputs.branch_ref_or_commit == '' + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # repository: github/backup-utils + # ref: master + # - name: Create empty commit + # if: github.event.inputs.branch_ref_or_commit == '' + # uses: stefanzweifel/git-auto-commit-action@v4 + # id: empty-commit + # with: + # branch: master + # commit_message: "Test ${{ github.event.inputs.version }} release commit" + # commit_user_name: "release-controller[bot]" + # commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" + # commit_options: "--allow-empty" + # push_options: "--force" + # skip_dirty_check: true - name: Resolve release commit id: resolve-release-commit run: | @@ -119,14 +119,14 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils-private - - name: Download deb artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Download tarball artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # - name: Download deb artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Download tarball artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - name: Create Release uses: ncipollo/release-action@v1 with: @@ -135,9 +135,9 @@ jobs: repo: backup-utils name: | GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - artifacts: | - github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - github-backup-utils_${{ github.event.inputs.version }}_all.deb + # artifacts: | + # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + # github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} bodyFile: release-notes/${{ github.event.inputs.version }}.md From 067f6c1bbe6ae6a59703a71ed669f3ac3b97b1ab Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 09:17:29 -0400 Subject: [PATCH 836/946] create empty commit on branch ref and use commit sha in release --- .github/workflows/build-and-release.yml | 164 ++++++++++++------------ 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index e55205902..7425d3d6f 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -19,58 +19,58 @@ on: default: true jobs: - # build: - # runs-on: ubuntu-latest - # outputs: - # rc-app-token: ${{ steps.app-token.outputs.token }} - # steps: - # - uses: actions/create-github-app-token@v1 - # id: app-token - # with: - # app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: "backup-utils-private" - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag # this is required for the build scripts - # run: | - # git config user.name "${{ github.actor }}" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + build: + runs-on: ubuntu-latest + outputs: + rc-app-token: ${{ steps.app-token.outputs.token }} + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "backup-utils-private" + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag # this is required for the build scripts + run: | + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb + run: | + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: # needs: build runs-on: ubuntu-latest @@ -85,35 +85,35 @@ jobs: private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - # - name: Checkout backup-utils - # if: github.event.inputs.branch_ref_or_commit == '' - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # repository: github/backup-utils - # ref: master - # - name: Create empty commit - # if: github.event.inputs.branch_ref_or_commit == '' - # uses: stefanzweifel/git-auto-commit-action@v4 - # id: empty-commit - # with: - # branch: master - # commit_message: "Test ${{ github.event.inputs.version }} release commit" - # commit_user_name: "release-controller[bot]" - # commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" - # commit_options: "--allow-empty" - # push_options: "--force" - # skip_dirty_check: true - - name: Resolve release commit - id: resolve-release-commit - run: | - if [[ -z "${{ github.event.inputs.branch_ref_or_commit }}" ]]; then - echo "Using empty commit sha for release commit" - echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" - else - echo "Using provided commit sha for release commit" - echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" - fi + - name: Checkout backup-utils + # if: github.event.inputs.branch_ref_or_commit == '' + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils + ref: ${{ github.event.inputs.branch_ref_or_commit }}} + - name: Create empty commit + # if: github.event.inputs.branch_ref_or_commit == '' + uses: stefanzweifel/git-auto-commit-action@v4 + id: empty-commit + with: + branch: ${{ github.event.inputs.branch_ref_or_commit }} + commit_message: "Test ${{ github.event.inputs.version }} release commit" + commit_user_name: "release-controller[bot]" + commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" + commit_options: "--allow-empty" + push_options: "--force" + skip_dirty_check: true + # - name: Resolve release commit + # id: resolve-release-commit + # run: | + # if [[ -z "${{ github.event.inputs.branch_ref_or_commit }}" ]]; then + # echo "Using empty commit sha for release commit" + # echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" + # else + # echo "Using provided commit sha for release commit" + # echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" + # fi - name: Checkout backup-utils-private for release notes uses: actions/checkout@v4 with: @@ -139,7 +139,7 @@ jobs: # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ # github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} + commit: ${{ steps.empty-commit.outputs.commit_hash }} bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true From c3900111e4f76b8988d3806c59cbd01181f6e249 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 09:18:30 -0400 Subject: [PATCH 837/946] just release --- .github/workflows/build-and-release.yml | 104 ++++++++++++------------ 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7425d3d6f..f602d9371 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -19,58 +19,58 @@ on: default: true jobs: - build: - runs-on: ubuntu-latest - outputs: - rc-app-token: ${{ steps.app-token.outputs.token }} - steps: - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: "backup-utils-private" - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag # this is required for the build scripts - run: | - git config user.name "${{ github.actor }}" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # build: + # runs-on: ubuntu-latest + # outputs: + # rc-app-token: ${{ steps.app-token.outputs.token }} + # steps: + # - uses: actions/create-github-app-token@v1 + # id: app-token + # with: + # app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: "backup-utils-private" + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Create tag # this is required for the build scripts + # run: | + # git config user.name "${{ github.actor }}" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: # needs: build runs-on: ubuntu-latest From c597504b0cbe25e35a6a520eae6a0a2d43e99046 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 09:20:28 -0400 Subject: [PATCH 838/946] fix checkout --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index f602d9371..e1473663e 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -91,7 +91,7 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - ref: ${{ github.event.inputs.branch_ref_or_commit }}} + # ref: ${{ github.event.inputs.branch_ref_or_commit }}} - name: Create empty commit # if: github.event.inputs.branch_ref_or_commit == '' uses: stefanzweifel/git-auto-commit-action@v4 From 7f738f05c47262fcaae1627e59ab7e18990545d5 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 09:29:56 -0400 Subject: [PATCH 839/946] try one more time --- .github/workflows/build-and-release.yml | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index e1473663e..79777fadb 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -86,14 +86,14 @@ jobs: owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils - # if: github.event.inputs.branch_ref_or_commit == '' + if: github.event.inputs.branch_ref_or_commit == '' uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils # ref: ${{ github.event.inputs.branch_ref_or_commit }}} - name: Create empty commit - # if: github.event.inputs.branch_ref_or_commit == '' + if: github.event.inputs.branch_ref_or_commit == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: @@ -104,16 +104,16 @@ jobs: commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true - # - name: Resolve release commit - # id: resolve-release-commit - # run: | - # if [[ -z "${{ github.event.inputs.branch_ref_or_commit }}" ]]; then - # echo "Using empty commit sha for release commit" - # echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" - # else - # echo "Using provided commit sha for release commit" - # echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" - # fi + - name: Resolve release commit + id: resolve-release-commit + run: | + if [[ -z "${{ github.event.inputs.branch_ref_or_commit }}" ]]; then + echo "Using empty commit sha for release commit" + echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" + else + echo "Using provided commit sha for release commit" + echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" + fi - name: Checkout backup-utils-private for release notes uses: actions/checkout@v4 with: @@ -139,7 +139,7 @@ jobs: # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ # github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - commit: ${{ steps.empty-commit.outputs.commit_hash }} + commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true From 4e343a5ec8503d36cc866f325459f3789ac7e597 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 09:34:48 -0400 Subject: [PATCH 840/946] always empty commit on release branch --- .github/workflows/build-and-release.yml | 160 ++++++++++++------------ 1 file changed, 79 insertions(+), 81 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 79777fadb..923fdf727 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -8,9 +8,9 @@ on: description: 'Version - patch version of the release (e.g. x.y.z)' required: true type: string - branch_ref_or_commit: - description: 'Branch ref or commit - the backup-utils release will associated with the branch ref or commit provided. If blank, an empty commit will be created on master' - required: false + release_commit_branch: + description: 'Release Commit Branch - the branch on which the release commit will be made.' + required: true type: string draft: description: 'Draft - true if the release should be a draft' @@ -19,58 +19,58 @@ on: default: true jobs: - # build: - # runs-on: ubuntu-latest - # outputs: - # rc-app-token: ${{ steps.app-token.outputs.token }} - # steps: - # - uses: actions/create-github-app-token@v1 - # id: app-token - # with: - # app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: "backup-utils-private" - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag # this is required for the build scripts - # run: | - # git config user.name "${{ github.actor }}" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + build: + runs-on: ubuntu-latest + outputs: + rc-app-token: ${{ steps.app-token.outputs.token }} + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "backup-utils-private" + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag # this is required for the build scripts + run: | + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb + run: | + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: # needs: build runs-on: ubuntu-latest @@ -86,47 +86,45 @@ jobs: owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" - name: Checkout backup-utils - if: github.event.inputs.branch_ref_or_commit == '' uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - # ref: ${{ github.event.inputs.branch_ref_or_commit }}} - name: Create empty commit - if: github.event.inputs.branch_ref_or_commit == '' + if: github.event.inputs.release_commit_branch == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: - branch: ${{ github.event.inputs.branch_ref_or_commit }} + branch: ${{ github.event.inputs.release_commit_branch }} commit_message: "Test ${{ github.event.inputs.version }} release commit" commit_user_name: "release-controller[bot]" commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true - - name: Resolve release commit - id: resolve-release-commit - run: | - if [[ -z "${{ github.event.inputs.branch_ref_or_commit }}" ]]; then - echo "Using empty commit sha for release commit" - echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" - else - echo "Using provided commit sha for release commit" - echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT" - fi + # - name: Resolve release commit + # id: resolve-release-commit + # run: | + # if [[ -z "${{ github.event.inputs.release_commit_branch }}" ]]; then + # echo "Using empty commit sha for release commit" + # echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" + # else + # echo "Using provided commit sha for release commit" + # echo "release-ref-or-commit=\"${{ github.event.inputs.release_commit_branch }}\"" >> "$GITHUB_OUTPUT" + # fi - name: Checkout backup-utils-private for release notes uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils-private - # - name: Download deb artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Download tarball artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - name: Create Release uses: ncipollo/release-action@v1 with: @@ -135,11 +133,11 @@ jobs: repo: backup-utils name: | GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} - # artifacts: | - # github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ - # github-backup-utils_${{ github.event.inputs.version }}_all.deb + artifacts: | + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} + commit: ${{ steps.empty-commit.outputs.commit_hash }} bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true From 04c7806b092ccec3575555699069dd64c6168018 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 09:36:01 -0400 Subject: [PATCH 841/946] after build --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 923fdf727..536c8f971 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -72,7 +72,7 @@ jobs: path: | dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: - # needs: build + needs: build runs-on: ubuntu-latest outputs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} From 3ad603b75e6dcbd9fd940b8dbd9c3c0bd2da18e7 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 09:36:52 -0400 Subject: [PATCH 842/946] comment out old output --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 536c8f971..d6681ea68 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -76,7 +76,7 @@ jobs: runs-on: ubuntu-latest outputs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} - release-ref-or-commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} + # release-ref-or-commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} steps: - uses: actions/create-github-app-token@v1 id: app-token From 1eb6431c5261242cd9f5e2c74998189219302ca1 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 10:39:35 -0400 Subject: [PATCH 843/946] one more test --- .github/workflows/build-and-release.yml | 110 ++++++++++++------------ 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index d6681ea68..5419fbbef 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -19,60 +19,60 @@ on: default: true jobs: - build: - runs-on: ubuntu-latest - outputs: - rc-app-token: ${{ steps.app-token.outputs.token }} - steps: - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: "backup-utils-private" - - name: Checkout backup-utils-private - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y moreutils debhelper help2man devscripts gzip - - name: Create tag # this is required for the build scripts - run: | - git config user.name "${{ github.actor }}" - git config user.email "ghes-releases-team@github.com" - git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Package deb - run: | - ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - - name: Upload deb artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - path: | - dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Package tarball - run: | - ./script/package-tarball - - name: Upload tarball artifact - uses: actions/upload-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - path: | - dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # build: + # runs-on: ubuntu-latest + # outputs: + # rc-app-token: ${{ steps.app-token.outputs.token }} + # steps: + # - uses: actions/create-github-app-token@v1 + # id: app-token + # with: + # app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + # private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + # owner: ${{ github.repository_owner }} + # repositories: "backup-utils-private" + # - name: Checkout backup-utils-private + # uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + # - name: Install dependencies + # run: | + # sudo apt-get update -y + # sudo apt-get install -y moreutils debhelper help2man devscripts gzip + # - name: Create tag # this is required for the build scripts + # run: | + # git config user.name "${{ github.actor }}" + # git config user.email "ghes-releases-team@github.com" + # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + # git push origin "v${{ github.event.inputs.version }}" + # - name: Package deb + # run: | + # ./script/package-deb + # # many need to remove this once release-notes compilation is automated + # - name: Rename deb artifact + # run: | + # for file in dist/github-backup-utils_*_all.deb; do + # if [[ -f "$file" ]]; then + # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + # fi + # done + # - name: Upload deb artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # path: | + # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Package tarball + # run: | + # ./script/package-tarball + # - name: Upload tarball artifact + # uses: actions/upload-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # path: | + # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: - needs: build + # needs: build runs-on: ubuntu-latest outputs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} @@ -91,7 +91,7 @@ jobs: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - name: Create empty commit - if: github.event.inputs.release_commit_branch == '' + # if: github.event.inputs.release_commit_branch == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: @@ -137,7 +137,7 @@ jobs: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - commit: ${{ steps.empty-commit.outputs.commit_hash }} + commit: 3.9-main bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true From 7a88c2c933aabf070d9b0cf87615ec4f5bdd786a Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 10:42:11 -0400 Subject: [PATCH 844/946] test, no artifacts --- .github/workflows/build-and-release.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 5419fbbef..953ff86b8 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -117,14 +117,14 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils-private - - name: Download deb artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - - name: Download tarball artifact - uses: actions/download-artifact@v3 - with: - name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + # - name: Download deb artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + # - name: Download tarball artifact + # uses: actions/download-artifact@v3 + # with: + # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - name: Create Release uses: ncipollo/release-action@v1 with: From 7ab47f1160153771c246d0531319447df5be84cc Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 11:50:08 -0400 Subject: [PATCH 845/946] try stable branch --- .github/workflows/build-and-release.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 953ff86b8..da58c6bb1 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -8,10 +8,6 @@ on: description: 'Version - patch version of the release (e.g. x.y.z)' required: true type: string - release_commit_branch: - description: 'Release Commit Branch - the branch on which the release commit will be made.' - required: true - type: string draft: description: 'Draft - true if the release should be a draft' required: true @@ -76,7 +72,6 @@ jobs: runs-on: ubuntu-latest outputs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} - # release-ref-or-commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }} steps: - uses: actions/create-github-app-token@v1 id: app-token @@ -85,17 +80,20 @@ jobs: private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: "backup-utils,backup-utils-private" + - name: Get major-feature from version + id: get-major-feature + run: | + echo "major-feature=\"$(echo "${{ github.event.inputs.version }}" | cut -d '.' -f 1,2)\"" >> "$GITHUB_OUTPUT" - name: Checkout backup-utils uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils - name: Create empty commit - # if: github.event.inputs.release_commit_branch == '' uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: - branch: ${{ github.event.inputs.release_commit_branch }} + branch: ${{ steps.get-major-feature.outputs.major-feature}}-stable commit_message: "Test ${{ github.event.inputs.version }} release commit" commit_user_name: "release-controller[bot]" commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" @@ -134,10 +132,10 @@ jobs: name: | GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }} artifacts: | - github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \ + github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - commit: 3.9-main + commit: ${{ steps.get-major-feature.outputs.major-feature}}-stable bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true From 68c71b97f0ad99f34c2b1e6e38f5d960ff307379 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 13:38:05 -0400 Subject: [PATCH 846/946] handle major-feature --- .github/workflows/build-and-release.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index da58c6bb1..7402a17d7 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -83,7 +83,10 @@ jobs: - name: Get major-feature from version id: get-major-feature run: | - echo "major-feature=\"$(echo "${{ github.event.inputs.version }}" | cut -d '.' -f 1,2)\"" >> "$GITHUB_OUTPUT" + echo "MAJOR_FEATURE=$(echo "${{ github.event.inputs.version }} | cut -d '.' -f 1,2)" >> "$GITHUB_ENV" + - name: Verify major-feature + run: | + echo "major_feature: $MAJOR_FEATURE" - name: Checkout backup-utils uses: actions/checkout@v4 with: @@ -93,7 +96,7 @@ jobs: uses: stefanzweifel/git-auto-commit-action@v4 id: empty-commit with: - branch: ${{ steps.get-major-feature.outputs.major-feature}}-stable + branch: ${{ env.MAJOR_FEATURE }}-stable commit_message: "Test ${{ github.event.inputs.version }} release commit" commit_user_name: "release-controller[bot]" commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" From 56c72781e79d7aff1607b7f5358ebc363a6c2742 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 13:56:36 -0400 Subject: [PATCH 847/946] fix major-feature --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7402a17d7..48d0a8ca9 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -83,7 +83,7 @@ jobs: - name: Get major-feature from version id: get-major-feature run: | - echo "MAJOR_FEATURE=$(echo "${{ github.event.inputs.version }} | cut -d '.' -f 1,2)" >> "$GITHUB_ENV" + echo "MAJOR_FEATURE=\"$(echo "${{ github.event.inputs.version }}" | cut -d '.' -f 1,2)\"" >> "$GITHUB_ENV" - name: Verify major-feature run: | echo "major_feature: $MAJOR_FEATURE" @@ -138,7 +138,7 @@ jobs: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, github-backup-utils_${{ github.event.inputs.version }}_all.deb tag: v${{ github.event.inputs.version }} - commit: ${{ steps.get-major-feature.outputs.major-feature}}-stable + commit: ${{ env.MAJOR_FEATURE }}-stable bodyFile: release-notes/${{ github.event.inputs.version }}.md draft: ${{ github.event.inputs.draft }} allowUpdates: true From f147c4e8c8b67e04f80363fab1120044501eac09 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 14:13:22 -0400 Subject: [PATCH 848/946] try another fix --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 48d0a8ca9..8f03dec9a 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -83,7 +83,7 @@ jobs: - name: Get major-feature from version id: get-major-feature run: | - echo "MAJOR_FEATURE=\"$(echo "${{ github.event.inputs.version }}" | cut -d '.' -f 1,2)\"" >> "$GITHUB_ENV" + echo "MAJOR_FEATURE=$(echo ${{ github.event.inputs.version }} | cut -d '.' -f 1,2)" >> "$GITHUB_ENV" - name: Verify major-feature run: | echo "major_feature: $MAJOR_FEATURE" From aa80191b74138d6b71997976630f3bfded0440d2 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 14:17:12 -0400 Subject: [PATCH 849/946] check release --- release-notes/{12.12.12.md => 3.10.99.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename release-notes/{12.12.12.md => 3.10.99.md} (100%) diff --git a/release-notes/12.12.12.md b/release-notes/3.10.99.md similarity index 100% rename from release-notes/12.12.12.md rename to release-notes/3.10.99.md From 77dad72bc7c6516af482e973d8981bf090ccf1f4 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 14:40:37 -0400 Subject: [PATCH 850/946] should be done --- .github/workflows/build-and-release.yml | 132 +++++++++++------------- 1 file changed, 61 insertions(+), 71 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 8f03dec9a..3f6b78648 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -15,60 +15,60 @@ on: default: true jobs: - # build: - # runs-on: ubuntu-latest - # outputs: - # rc-app-token: ${{ steps.app-token.outputs.token }} - # steps: - # - uses: actions/create-github-app-token@v1 - # id: app-token - # with: - # app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} - # private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} - # owner: ${{ github.repository_owner }} - # repositories: "backup-utils-private" - # - name: Checkout backup-utils-private - # uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # - name: Install dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y moreutils debhelper help2man devscripts gzip - # - name: Create tag # this is required for the build scripts - # run: | - # git config user.name "${{ github.actor }}" - # git config user.email "ghes-releases-team@github.com" - # git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" - # git push origin "v${{ github.event.inputs.version }}" - # - name: Package deb - # run: | - # ./script/package-deb - # # many need to remove this once release-notes compilation is automated - # - name: Rename deb artifact - # run: | - # for file in dist/github-backup-utils_*_all.deb; do - # if [[ -f "$file" ]]; then - # mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - # fi - # done - # - name: Upload deb artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # path: | - # dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Package tarball - # run: | - # ./script/package-tarball - # - name: Upload tarball artifact - # uses: actions/upload-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - # path: | - # dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + build: + runs-on: ubuntu-latest + outputs: + rc-app-token: ${{ steps.app-token.outputs.token }} + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "backup-utils-private" + - name: Checkout backup-utils-private + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y moreutils debhelper help2man devscripts gzip + - name: Create tag # this is required for the build scripts + run: | + git config user.name "${{ github.actor }}" + git config user.email "ghes-releases-team@github.com" + git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Package deb + run: | + ./script/package-deb + # many need to remove this once release-notes compilation is automated + - name: Rename deb artifact + run: | + for file in dist/github-backup-utils_*_all.deb; do + if [[ -f "$file" ]]; then + mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" + fi + done + - name: Upload deb artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + path: | + dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Package tarball + run: | + ./script/package-tarball + - name: Upload tarball artifact + uses: actions/upload-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + path: | + dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz release: - # needs: build + needs: build runs-on: ubuntu-latest outputs: commit_hash: ${{ steps.empty-commit.outputs.commit_hash }} @@ -103,29 +103,19 @@ jobs: commit_options: "--allow-empty" push_options: "--force" skip_dirty_check: true - # - name: Resolve release commit - # id: resolve-release-commit - # run: | - # if [[ -z "${{ github.event.inputs.release_commit_branch }}" ]]; then - # echo "Using empty commit sha for release commit" - # echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT" - # else - # echo "Using provided commit sha for release commit" - # echo "release-ref-or-commit=\"${{ github.event.inputs.release_commit_branch }}\"" >> "$GITHUB_OUTPUT" - # fi - name: Checkout backup-utils-private for release notes uses: actions/checkout@v4 with: token: ${{ steps.app-token.outputs.token }} repository: github/backup-utils-private - # - name: Download deb artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils_${{ github.event.inputs.version }}_all.deb - # - name: Download tarball artifact - # uses: actions/download-artifact@v3 - # with: - # name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz + - name: Download deb artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils_${{ github.event.inputs.version }}_all.deb + - name: Download tarball artifact + uses: actions/download-artifact@v3 + with: + name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz - name: Create Release uses: ncipollo/release-action@v1 with: From 540ae1cc01cf3bc3c2172feff74078646dc26f83 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 14:50:40 -0400 Subject: [PATCH 851/946] remove test message --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 3f6b78648..c9b6b66e8 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -97,7 +97,7 @@ jobs: id: empty-commit with: branch: ${{ env.MAJOR_FEATURE }}-stable - commit_message: "Test ${{ github.event.inputs.version }} release commit" + commit_message: "${{ github.event.inputs.version }} release" commit_user_name: "release-controller[bot]" commit_user_email: "223695+release-controller[bot]@users.noreply.github.com" commit_options: "--allow-empty" From 30612641edc735f268a73fdcecf6cfe8f6ca8476 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 18 Oct 2023 15:45:57 -0400 Subject: [PATCH 852/946] remove test release notes --- release-notes/3.10.99.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 release-notes/3.10.99.md diff --git a/release-notes/3.10.99.md b/release-notes/3.10.99.md deleted file mode 100644 index 445d9aada..000000000 --- a/release-notes/3.10.99.md +++ /dev/null @@ -1,7 +0,0 @@ -### Changes - -* Test release notes. - -### Bug fixes - -* More test release notes. \ No newline at end of file From 5d2d9a8ada57e543383f585d08c857bee518cfad Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Fri, 20 Oct 2023 23:20:02 +0000 Subject: [PATCH 853/946] remove file rename step --- .github/workflows/build-and-release.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c9b6b66e8..edf115738 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -44,14 +44,6 @@ jobs: - name: Package deb run: | ./script/package-deb - # many need to remove this once release-notes compilation is automated - - name: Rename deb artifact - run: | - for file in dist/github-backup-utils_*_all.deb; do - if [[ -f "$file" ]]; then - mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb" - fi - done - name: Upload deb artifact uses: actions/upload-artifact@v3 with: From dfca0ab97591346f2abc3ad05fa84893de4e3fdf Mon Sep 17 00:00:00 2001 From: Quinn Murphy Date: Mon, 23 Oct 2023 14:03:40 -0400 Subject: [PATCH 854/946] Add unit test for track progress (#659) * Add unit test for track progress * add end_test * change test and fix init-progress * Make the test go green * Update ghe-backup-config --- share/github-backup-utils/ghe-backup-config | 14 +++++--------- test/test-ghe-backup.sh | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 6c33ea954..cd9972b59 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -661,17 +661,13 @@ prompt_for_confirmation(){ #initialize progress tracking by clearing out the temp files used to track init-progress() { - if [ -d /tmp/backup-utils-progress ]; then + + if [ -e /tmp/backup-utils-progress ]; then rm -rf /tmp/backup-utils-progress/* fi - - mkdir -p /tmp/backup-utils-progress - chmod -R 777 /tmp/backup-utils-progress - - touch /tmp/backup-utils-progress/total - touch /tmp/backup-utils-progress/type - touch /tmp/backup-utils-progress/progress - touch /tmp/backup-utils-progress/info + # shellcheck disable=SC2174 # We are fine with -m only affecting the deepest directory + mkdir -m 777 -p /tmp/backup-utils-progress + touch /tmp/backup-utils-progress/{total,type,progress,info} } diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index d6391bbef..dabce1ed4 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -1074,3 +1074,18 @@ begin_test "ghe-backup collects information on system where backup-utils is inst ) end_test + +# Check that backup-utils manages track-progress folder correctly +begin_test "ghe-backup manages progress tracking files properly" +( + set -e + + if [ -e /tmp/backup-utils-progress ]; then + rm -rf /tmp/backup-utils-progress/* + fi + + output=$(ghe-backup) + echo "$output" | grep -v "mkdir: cannot create directory /tmp/backup-utils-progress: File exists" + +) +end_test \ No newline at end of file From d9cf3a64fc521f43eb2553e06dbedaf59596be1c Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 24 Oct 2023 09:52:06 -0700 Subject: [PATCH 855/946] Use os-release for host info resolves https://github.com/github/ghes/issues/7336 --- bin/ghe-backup | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 1dfaf748b..448a5840e 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -231,9 +231,11 @@ fi # Output system information of the backup host -# If /etc/issue.net exists, use it to get the OS version -if [ -f /etc/issue.net ]; then - echo "Running on: $(cat /etc/issue.net)" +# If /etc/os-release exists, use it to get the OS version +if [ -f /etc/os-release ]; then + OS_NAME=$(grep '^NAME' /etc/os-release | cut -d'"' -f2) + VERSION_ID=$(grep '^VERSION_ID' /etc/os-release | cut -d'"' -f2) + echo "Running on: $OS_NAME $VERSION_ID" else echo "Running on: Unknown OS" fi From 4b477a69b59ef625d606905bda65f74f0a984f7f Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Wed, 25 Oct 2023 16:18:29 +0200 Subject: [PATCH 856/946] update warning message (#699) --- share/github-backup-utils/ghe-backup-secrets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-secrets b/share/github-backup-utils/ghe-backup-secrets index 546be420e..6d7ab5db6 100755 --- a/share/github-backup-utils/ghe-backup-secrets +++ b/share/github-backup-utils/ghe-backup-secrets @@ -54,7 +54,7 @@ backup-secret() { log_info "* Transferring $description ..." 1>&3 ghe-ssh "$host" -- ghe-config "$setting" > "$file+" || ( if [ "$best_effort" = "false" ]; then - echo "Warning: $description not set" >&2 + echo "Info: $description not set. Skipping..." >&2 fi ) if [ -n "$(cat "$file+")" ]; then From c30b46422c2b4638a01b1965f41f748612907b74 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 25 Oct 2023 20:59:43 +0000 Subject: [PATCH 857/946] check for RO file-system --- bin/ghe-host-check | 35 ++++++++++++++++++++++++++++++++++- test/test-ghe-host-check.sh | 10 ++++++++++ test/testlib.sh | 4 ++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 5cd39abee..4262887e1 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -115,6 +115,39 @@ if [ -z "$version" ]; then exit 2 fi +NON_WRITABLE="" +# ensure all nodes are writable +if "$CLUSTER"; then + if [ -z "$FILE_TO_TEST" ]; then + FILE_TO_TEST="/data/user/tmp/test-ro-file.txt" + fi + + # Iterate through each node in the cluster + nodes=$(ghe-ssh "$host" ghe-cluster-nodes) + first=true + # echo $nodes | while read -r node; do + for node in $nodes; do + if ! $(echo "set -o pipefail; ssh "$node" -- 'touch "$FILE_TO_TEST" && rm "$FILE_TO_TEST"'" | ghe-ssh "$host" /bin/bash); then + #echo "File system is writable on $node" + #else + echo "File system is not writeable on $node" 1>&2 + if [ "$first" = true ]; then + NON_WRITABLE="$node" + first=false + else + NON_WRITABLE="$NON_WRITABLE, $node" + fi + fi || true + done + # Display the comma-separated list of non-writable nodes + if [ ! -z "$NON_WRITABLE" ]; then + echo "Error: Non-writable nodes: $NON_WRITABLE . Please make sure the file systems for all Enterprise nodes are writable." 1>&2 + exit 1 + else + echo "All nodes are writable." + fi +fi + # Block restoring snapshots to older releases of GitHub Enterprise Server if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version) @@ -177,7 +210,7 @@ SKIP_MSG #Display dir requirements for repositories and mysql echo -e "\nChecking host for sufficient space for a backup..." - available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') + available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." repos_disk_size=$(transfer_size repositories /tmp) diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index f2c5cca54..ebe02f0e6 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -123,3 +123,13 @@ begin_test "ghe-host-check blocks restore to old release" ! GHE_TEST_REMOTE_VERSION=$bu_version_major.$((bu_version_minor-1)).$bu_version_patch ghe-restore -v ) end_test + +# Check ghe-host-check detects RO file system +begin_test "ghe-host-check fails when encountering RO file-system" +( + set -e + + enable_ro_fs + ! FILE_TO_TEST=/run/user/501/test ghe-host-check +) +end_test diff --git a/test/testlib.sh b/test/testlib.sh index edeec8ea2..b72866abe 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -728,3 +728,7 @@ setup_actions_enabled_settings_for_restore() { echo > "$GHE_DATA_DIR/1/settings.json" git config -f "$GHE_DATA_DIR/1/settings.json" --bool app.actions.enabled $1 } + +enable_ro_fs() { + ghe-ssh "$GHE_HOSTNAME" -- 'sudo mount -o remount,rw /run/user/501' +} From 44a59b55378cce06845acb46e71d981b6b91fdb0 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 25 Oct 2023 14:24:21 -0700 Subject: [PATCH 858/946] Update test-ghe-backup.sh --- test/test-ghe-backup.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test-ghe-backup.sh b/test/test-ghe-backup.sh index dabce1ed4..30fc23fcb 100755 --- a/test/test-ghe-backup.sh +++ b/test/test-ghe-backup.sh @@ -1068,7 +1068,9 @@ begin_test "ghe-backup collects information on system where backup-utils is inst set -e output=$(ghe-backup) - echo "$output" | grep "Running on: $(cat /etc/issue.net)" + OS_NAME=$(grep '^NAME' /etc/os-release | cut -d'"' -f2) + VERSION_ID=$(grep '^VERSION_ID' /etc/os-release | cut -d'"' -f2) + echo "$output" | grep "Running on: $OS_NAME $VERSION_ID" echo "$output" | grep "CPUs: $(nproc)" echo "$output" | grep "Memory total/used/free+share/buff/cache:" @@ -1088,4 +1090,4 @@ begin_test "ghe-backup manages progress tracking files properly" echo "$output" | grep -v "mkdir: cannot create directory /tmp/backup-utils-progress: File exists" ) -end_test \ No newline at end of file +end_test From 494a521089c71e595a77983f0f4b02ee3b79685b Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 26 Oct 2023 00:30:52 +0000 Subject: [PATCH 859/946] check for tmp dir --- bin/ghe-host-check | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 4262887e1..8bcdb85f0 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -119,7 +119,11 @@ NON_WRITABLE="" # ensure all nodes are writable if "$CLUSTER"; then if [ -z "$FILE_TO_TEST" ]; then - FILE_TO_TEST="/data/user/tmp/test-ro-file.txt" + if [ -d "/data/user/tmp" ]; then + FILE_TO_TEST="/data/user/tmp/test-ro-file.txt" + else + FILE_TO_TEST="/tmp/test-ro-file.txt" + fi fi # Iterate through each node in the cluster From 88f8489b6ebf36703a80754f9bba581a61e556d0 Mon Sep 17 00:00:00 2001 From: djdefi Date: Mon, 30 Oct 2023 15:43:34 -0700 Subject: [PATCH 860/946] Shellcheck docker-image.yml --- .github/workflows/docker-image.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 07c44f9df..03050f1d4 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,4 +1,4 @@ -name: Docker Image CI +name: Docker Image Build CI on: push: @@ -13,16 +13,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build the Ubuntu Docker image - run: docker build . --file Dockerfile --tag backup-utils:${GITHUB_RUN_ID} + run: docker build . --file Dockerfile --tag backup-utils:"${GITHUB_RUN_ID}" - name: Build the Alpine Docker image - run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID} + run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:"${GITHUB_RUN_ID}" - name: Run tests in Ubuntu Docker image run: | - docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version - docker run backup-utils:${GITHUB_RUN_ID} rsync --version + docker run backup-utils:"${GITHUB_RUN_ID}" ghe-backup --version + docker run backup-utils:"${GITHUB_RUN_ID}" rsync --version - name: Run tests in Alpine Docker image run: | - docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version - docker run backup-utils-alpine:${GITHUB_RUN_ID} rsync --version + docker run backup-utils-alpine:"${GITHUB_RUN_ID}" ghe-backup --version + docker run backup-utils-alpine:"${GITHUB_RUN_ID}" rsync --version From d4c2952dda4176289eb9b0375c4efc9786d2d4d1 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 31 Oct 2023 15:15:50 -0700 Subject: [PATCH 861/946] Shellcheck fix backuprestore.yml --- .github/workflows/backuprestore.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/backuprestore.yml b/.github/workflows/backuprestore.yml index 13bbf40e0..34cf69032 100644 --- a/.github/workflows/backuprestore.yml +++ b/.github/workflows/backuprestore.yml @@ -28,7 +28,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: github/backup-utils-private ref: ${{ inputs.ref }} @@ -51,13 +51,13 @@ jobs: run: docker load -i backup-utils.tar - uses: actions/checkout@v3 - name: Create backup directory - run: mkdir $HOME/ghe-backup-data + run: mkdir "$HOME"/ghe-backup-data - name: set up ssh SSH_KEY - run: echo -e "${SSH_KEY}\n" > $HOME/backup + run: echo -e "${SSH_KEY}\n" > "$HOME"/backup - name: set up ssh key permissions - run: chmod 0600 $HOME/backup + run: chmod 0600 "$HOME"/backup - name: change version - run: echo "3.8.0" > $HOME/version + run: echo "3.8.0" > "$HOME"/version - name: Perform backup run: | docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ @@ -70,7 +70,7 @@ jobs: --rm \ backup-utils ghe-backup - name: Prepare for restore - run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" + run: ssh -p122 -i "$HOME"/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -s" - name: Restore data to instance run: | docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \ @@ -83,5 +83,5 @@ jobs: --rm \ backup-utils ghe-restore ${{ inputs.hostname }} - name: Reset maintenance mode after restore - run: ssh -p122 -i $HOME/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" + run: ssh -p122 -i "$HOME"/backup -o StrictHostKeyChecking=no admin@${{ inputs.hostname }} "ghe-maintenance -u" From d9619a1a5578efd93cf2fea0c0c9d5181d6d9ac1 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 31 Oct 2023 15:16:42 -0700 Subject: [PATCH 862/946] Lint fix restore.yml --- .github/workflows/restore.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/restore.yml b/.github/workflows/restore.yml index ab0627751..5f4e723a1 100644 --- a/.github/workflows/restore.yml +++ b/.github/workflows/restore.yml @@ -51,7 +51,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: github/backup-utils-private ref: ${{ inputs.ref }} @@ -69,7 +69,7 @@ jobs: needs: build runs-on: group: larger-hosted-public-runners - labels: ubuntu-latest-xl + labels: ubuntu-latest env: SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} steps: From 4f8b5de6f45ad2f7ef9819f26579b0726ecd4aa3 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 1 Nov 2023 09:22:12 -0700 Subject: [PATCH 863/946] Linter fix backup.yml --- .github/workflows/backup.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 237d8e131..0d50f8f81 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -47,7 +47,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: github/backup-utils-private token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}" @@ -62,7 +62,7 @@ jobs: needs: build runs-on: group: larger-hosted-public-runners - labels: ubuntu-latest-xl + labels: ubuntu-latest env: SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }} steps: @@ -98,7 +98,7 @@ jobs: sudo tar -czvf "${{ inputs.backup-name }}.tar.gz" -C "$HOME/ghe-backup-data/$current" . - name: Login to Azure - if: ${{ inputs.backup-name }} != "" + if: inputs.backup-name != "" run: | az login \ --service-principal \ @@ -108,11 +108,11 @@ jobs: az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" - name: Upload backup to Azure - if: ${{ inputs.backup-name }} != "" + if: inputs.backup-name != "" run: | az storage blob upload \ --account-name "${{ secrets.AZURE_ACCOUNT_NAME }}" \ --container-name "${{ secrets.AZURE_CONTAINER_NAME }}" \ --name "${{ inputs.backup-name }}.tar.gz" \ --file "${{ inputs.backup-name }}.tar.gz" \ - --connection-string "${{ secrets.CONNECTIONSTRING }}" \ No newline at end of file + --connection-string "${{ secrets.CONNECTIONSTRING }}" From c8f1a5e28ad3fda848abeaece2bb47845fe2b0d5 Mon Sep 17 00:00:00 2001 From: djdefi Date: Wed, 1 Nov 2023 09:29:15 -0700 Subject: [PATCH 864/946] Adjust if statement syntax --- .github/workflows/backup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 0d50f8f81..cfb154aae 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -98,7 +98,7 @@ jobs: sudo tar -czvf "${{ inputs.backup-name }}.tar.gz" -C "$HOME/ghe-backup-data/$current" . - name: Login to Azure - if: inputs.backup-name != "" + if: "${{ inputs.backup-name != '' }}" run: | az login \ --service-principal \ @@ -108,7 +108,7 @@ jobs: az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" - name: Upload backup to Azure - if: inputs.backup-name != "" + if: "${{ inputs.backup-name != '' }}" run: | az storage blob upload \ --account-name "${{ secrets.AZURE_ACCOUNT_NAME }}" \ From ac1cbb1dc0b39e4d86490f21d7ab25cafa1cb004 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 1 Nov 2023 20:06:49 +0000 Subject: [PATCH 865/946] fix test runs --- bin/ghe-host-check | 8 +++++--- test/test-ghe-host-check.sh | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 8bcdb85f0..2b77d11ff 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -85,7 +85,9 @@ if [ $rc -ne 0 ]; then exit $rc fi -CLUSTER=false +if [ -z "$CLUSTER" ]; then + CLUSTER=false +fi if ghe-ssh "$host" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ]"; then CLUSTER=true @@ -117,7 +119,7 @@ fi NON_WRITABLE="" # ensure all nodes are writable -if "$CLUSTER"; then +if [ "$CLUSTER" == "true" ] ; then if [ -z "$FILE_TO_TEST" ]; then if [ -d "/data/user/tmp" ]; then FILE_TO_TEST="/data/user/tmp/test-ro-file.txt" @@ -164,7 +166,7 @@ if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then fi if [ -z "$GHE_ALLOW_REPLICA_BACKUP" ]; then - if [ "$(ghe-ssh $host -- cat $GHE_REMOTE_ROOT_DIR/etc/github/repl-state 2>/dev/null || true)" = "replica" ]; then + if [ "$(ghe-ssh $host -- cat $GHE_REMOTE_ROOT_DIR/etc/github/repl-state1 2>/dev/null || true)" = "replica" ]; then echo "Error: high availability replica detected." 1>&2 echo "Backup Utilities should be used to backup from the primary node in" 1>&2 echo "high availability environments to ensure consistent and reliable backups." 1>&2 diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index ebe02f0e6..1a32e34cd 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -129,7 +129,12 @@ begin_test "ghe-host-check fails when encountering RO file-system" ( set -e - enable_ro_fs - ! FILE_TO_TEST=/run/user/501/test ghe-host-check + ghe-ssh "$GHE_HOSTNAME" -- 'mkdir -p "~/tmp"' + # Remove write access in ~/tmp + ghe-ssh "$GHE_HOSTNAME" -- 'chmod a-w -R "~/tmp"' + + # File creation fails for CLUSTER + ! FILE_TO_TEST="~/tmp/test" CLUSTER=true ghe-host-check + FILE_TO_TEST="~/tmp/test" CLUSTER=false ghe-host-check ) end_test From c86c42548cafd6e915ee708775751b7fc11d7892 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 1 Nov 2023 20:24:19 +0000 Subject: [PATCH 866/946] remove unused function --- test/testlib.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/testlib.sh b/test/testlib.sh index b72866abe..edeec8ea2 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -728,7 +728,3 @@ setup_actions_enabled_settings_for_restore() { echo > "$GHE_DATA_DIR/1/settings.json" git config -f "$GHE_DATA_DIR/1/settings.json" --bool app.actions.enabled $1 } - -enable_ro_fs() { - ghe-ssh "$GHE_HOSTNAME" -- 'sudo mount -o remount,rw /run/user/501' -} From 970cb37787700dd7590e4a4f38dd8aa27e30a77a Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Wed, 1 Nov 2023 21:17:42 +0000 Subject: [PATCH 867/946] SC updates --- bin/ghe-host-check | 2 +- test/test-ghe-host-check.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 2b77d11ff..cf62e6453 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -133,7 +133,7 @@ if [ "$CLUSTER" == "true" ] ; then first=true # echo $nodes | while read -r node; do for node in $nodes; do - if ! $(echo "set -o pipefail; ssh "$node" -- 'touch "$FILE_TO_TEST" && rm "$FILE_TO_TEST"'" | ghe-ssh "$host" /bin/bash); then + if ! echo "set -o pipefail; ssh $node -- 'touch $FILE_TO_TEST && rm $FILE_TO_TEST'" | ghe-ssh "$host" /bin/bash; then #echo "File system is writable on $node" #else echo "File system is not writeable on $node" 1>&2 diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index 1a32e34cd..a772399d6 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -134,7 +134,7 @@ begin_test "ghe-host-check fails when encountering RO file-system" ghe-ssh "$GHE_HOSTNAME" -- 'chmod a-w -R "~/tmp"' # File creation fails for CLUSTER - ! FILE_TO_TEST="~/tmp/test" CLUSTER=true ghe-host-check - FILE_TO_TEST="~/tmp/test" CLUSTER=false ghe-host-check + ! FILE_TO_TEST="$HOME/tmp/test" CLUSTER=true ghe-host-check + FILE_TO_TEST="$HOME/tmp/test" CLUSTER=false ghe-host-check ) end_test From 0bb47041013c696121843420bd8c4a59b1326b75 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Thu, 2 Nov 2023 20:09:21 +0000 Subject: [PATCH 868/946] review updates --- backup.config-example | 4 ++++ bin/ghe-host-check | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/backup.config-example b/backup.config-example index 535a2f636..99bcfd232 100644 --- a/backup.config-example +++ b/backup.config-example @@ -32,6 +32,10 @@ GHE_NUM_SNAPSHOTS=10 # disk space validation and software version checks on the backup-host will be disabled. #GHE_SKIP_CHECKS=false +# Cluster filesystem to check if it's writable as part of ghe-host-check +# By default it is /data/user/tmp but can be updated if needed +#GHE_FILE_SYSTEM_CHECK="/data/user/tmp" + # The hostname of the GitHub appliance to restore. If you've set up a separate # GitHub appliance to act as a standby for recovery, specify its IP or hostname # here. The host to restore to may also be specified directly when running diff --git a/bin/ghe-host-check b/bin/ghe-host-check index cf62e6453..b5bdcd1ff 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -120,23 +120,22 @@ fi NON_WRITABLE="" # ensure all nodes are writable if [ "$CLUSTER" == "true" ] ; then - if [ -z "$FILE_TO_TEST" ]; then + if [ -z "$GHE_FILE_SYSTEM_CHECK" ]; then if [ -d "/data/user/tmp" ]; then FILE_TO_TEST="/data/user/tmp/test-ro-file.txt" else FILE_TO_TEST="/tmp/test-ro-file.txt" fi + else + FILE_TO_TEST="$GHE_FILE_SYSTEM_CHECK/test-ro-file.txt" fi # Iterate through each node in the cluster nodes=$(ghe-ssh "$host" ghe-cluster-nodes) first=true - # echo $nodes | while read -r node; do for node in $nodes; do if ! echo "set -o pipefail; ssh $node -- 'touch $FILE_TO_TEST && rm $FILE_TO_TEST'" | ghe-ssh "$host" /bin/bash; then - #echo "File system is writable on $node" - #else - echo "File system is not writeable on $node" 1>&2 + echo "File system is not writeable or no permission on $node" 1>&2 if [ "$first" = true ]; then NON_WRITABLE="$node" first=false @@ -147,7 +146,7 @@ if [ "$CLUSTER" == "true" ] ; then done # Display the comma-separated list of non-writable nodes if [ ! -z "$NON_WRITABLE" ]; then - echo "Error: Non-writable nodes: $NON_WRITABLE . Please make sure the file systems for all Enterprise nodes are writable." 1>&2 + log_error "Error: Following nodes are non-writable - $NON_WRITABLE. Please make sure the filesystem for all GHES nodes are writable." 1>&2 exit 1 else echo "All nodes are writable." From 6d86ba0920b326e3335370939a28de86ba40a34f Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 3 Nov 2023 14:55:07 +0000 Subject: [PATCH 869/946] fix typo --- bin/ghe-host-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index b5bdcd1ff..24a9ed262 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -165,7 +165,7 @@ if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then fi if [ -z "$GHE_ALLOW_REPLICA_BACKUP" ]; then - if [ "$(ghe-ssh $host -- cat $GHE_REMOTE_ROOT_DIR/etc/github/repl-state1 2>/dev/null || true)" = "replica" ]; then + if [ "$(ghe-ssh $host -- cat $GHE_REMOTE_ROOT_DIR/etc/github/repl-state 2>/dev/null || true)" = "replica" ]; then echo "Error: high availability replica detected." 1>&2 echo "Backup Utilities should be used to backup from the primary node in" 1>&2 echo "high availability environments to ensure consistent and reliable backups." 1>&2 From 6396e77e3100b9eceb5ec3c9fc8eb53977a52277 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 3 Nov 2023 16:28:48 +0000 Subject: [PATCH 870/946] log error msg when any node is offline --- bin/ghe-backup | 2 +- bin/ghe-host-check | 9 ++++++--- share/github-backup-utils/ghe-backup-config | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 1dfaf748b..eeb872e3d 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -375,7 +375,7 @@ if [ -z "$failures" ]; then else log_info "Expired and incomplete snapshots to be pruned separately" fi -else +else log_info "Skipping pruning snapshots, since some backups failed..." fi diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 5cd39abee..60bdddf21 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -91,11 +91,13 @@ if ghe-ssh "$host" -- \ CLUSTER=true fi +set +e # ensure all nodes in the cluster are online/reachable and running the same version if "$CLUSTER"; then online_status=$(ghe-ssh "$host" ghe-cluster-host-check) if [ "$online_status" != "Cluster is ready to configure." ]; then - echo "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2 + echo "$online_status" 1>&2 + log_error "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2 exit 1 fi @@ -103,10 +105,11 @@ if "$CLUSTER"; then distinct_versions=$(echo "$node_version_list" | awk '{split($0, a, ":"); print a[2]}' | awk '{print $4}' | uniq | wc -l) if [ "$distinct_versions" -ne 1 ]; then echo "Version mismatch: $node_version_list" 1>&2 - echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2 + log_error "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2 exit 1 fi fi +set -e version=$(echo "$output" | grep "GitHub Enterprise" | awk '{print $NF}') @@ -177,7 +180,7 @@ SKIP_MSG #Display dir requirements for repositories and mysql echo -e "\nChecking host for sufficient space for a backup..." - available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') + available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." repos_disk_size=$(transfer_size repositories /tmp) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 6c33ea954..08379ce95 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -667,7 +667,7 @@ init-progress() { mkdir -p /tmp/backup-utils-progress chmod -R 777 /tmp/backup-utils-progress - + touch /tmp/backup-utils-progress/total touch /tmp/backup-utils-progress/type touch /tmp/backup-utils-progress/progress From be270eeeff0bc5684a0b7fd6c8727e5a9445f0b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:44:28 +0000 Subject: [PATCH 871/946] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/backup.yml | 2 +- .github/workflows/backuprestore.yml | 2 +- .github/workflows/integration-tests.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/rsync-docker-bump.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index cfb154aae..2b59e7894 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -71,7 +71,7 @@ jobs: name: backup-utils - name: Load docker container run: docker load -i backup-utils.tar - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Create backup directory run: mkdir "$HOME/ghe-backup-data" - name: set up ssh SSH_KEY diff --git a/.github/workflows/backuprestore.yml b/.github/workflows/backuprestore.yml index 34cf69032..a87c54ec9 100644 --- a/.github/workflows/backuprestore.yml +++ b/.github/workflows/backuprestore.yml @@ -49,7 +49,7 @@ jobs: name: backup-utils - name: Load docker container run: docker load -i backup-utils.tar - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Create backup directory run: mkdir "$HOME"/ghe-backup-data - name: set up ssh SSH_KEY diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 603f7affa..a2cf68531 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -27,7 +27,7 @@ jobs: - enterprise2-backup-utils-binary-backup - enterprise2-backup-utils-migration steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 1 - name: Queue ${{ matrix.jankyJobName }} build @@ -50,7 +50,7 @@ jobs: - enterprise2-backup-utils-cluster-binary-backup - enterprise2-backup-utils-cluster-migration steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 1 - name: Queue ${{ matrix.jankyJobName }} build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7fc33e1cd..0f26e9aa1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 50583737b..e1917684d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: tar --xz -xvf "shellcheck-stable.linux.x86_64.tar.xz" sudo cp shellcheck-stable/shellcheck /usr/bin/shellcheck - name: Get Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Test run: | export PATH="$PATH:/snap/bin" diff --git a/.github/workflows/rsync-docker-bump.yml b/.github/workflows/rsync-docker-bump.yml index 2cfe7782c..0acaae854 100644 --- a/.github/workflows/rsync-docker-bump.yml +++ b/.github/workflows/rsync-docker-bump.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get latest rsync tag id: latest_tag From 5460d8458371414051261e62952478c7d1db8a21 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Fri, 3 Nov 2023 17:03:59 +0000 Subject: [PATCH 872/946] test update --- test/test-ghe-host-check.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index a772399d6..f1e964da5 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -134,7 +134,7 @@ begin_test "ghe-host-check fails when encountering RO file-system" ghe-ssh "$GHE_HOSTNAME" -- 'chmod a-w -R "~/tmp"' # File creation fails for CLUSTER - ! FILE_TO_TEST="$HOME/tmp/test" CLUSTER=true ghe-host-check - FILE_TO_TEST="$HOME/tmp/test" CLUSTER=false ghe-host-check + ! FILE_TO_TEST="$HOME/tmp/test" CLUSTER=true GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check + FILE_TO_TEST="$HOME/tmp/test" CLUSTER=false GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check ) end_test From 8116c8a0802b5434ca6c3530568a51cec430af84 Mon Sep 17 00:00:00 2001 From: Dax Amin Date: Fri, 3 Nov 2023 13:38:15 -0400 Subject: [PATCH 873/946] remove empty line --- share/github-backup-utils/ghe-backup-config | 1 - 1 file changed, 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index 9af250b5f..cd9972b59 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -665,7 +665,6 @@ init-progress() { if [ -e /tmp/backup-utils-progress ]; then rm -rf /tmp/backup-utils-progress/* fi - # shellcheck disable=SC2174 # We are fine with -m only affecting the deepest directory mkdir -m 777 -p /tmp/backup-utils-progress touch /tmp/backup-utils-progress/{total,type,progress,info} From 47abd682e9d8cb8c34bb40a0eafece6224963b67 Mon Sep 17 00:00:00 2001 From: alejndr0 Date: Mon, 6 Nov 2023 15:54:59 +0000 Subject: [PATCH 874/946] Disable compression on ghe-backup-repositories by default --- share/github-backup-utils/ghe-backup-repositories | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index e90d8c37a..636e610c8 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -194,7 +194,7 @@ sync_data (){ echo 1>&3 log_info "* Transferring auxiliary files ..." 1>&3 - rsync_repository_data $1:122 $2 -z <&3 log_info "* Transferring packed-refs files ..." 1>&3 - rsync_repository_data $1:122 $2 -z <&3 log_info "* Transferring refs and reflogs ..." 1>&3 - rsync_repository_data $1:122 $2 -z <&3 log_info "* Transferring special data directories from $h..." 1>&3 - rsync_repository_data $h:122 -z < Date: Mon, 6 Nov 2023 15:13:51 -0500 Subject: [PATCH 875/946] Update backup.config-example Co-authored-by: Quinn Murphy --- backup.config-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index 99bcfd232..66dc5731e 100644 --- a/backup.config-example +++ b/backup.config-example @@ -34,7 +34,7 @@ GHE_NUM_SNAPSHOTS=10 # Cluster filesystem to check if it's writable as part of ghe-host-check # By default it is /data/user/tmp but can be updated if needed -#GHE_FILE_SYSTEM_CHECK="/data/user/tmp" +#GHE_FILE_SYSTEM_WRITE_CHECK="/data/user/tmp" # The hostname of the GitHub appliance to restore. If you've set up a separate # GitHub appliance to act as a standby for recovery, specify its IP or hostname From 10a2905c8c37415c21ed18504a2f9ca5f6556e36 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Mon, 6 Nov 2023 22:17:20 +0000 Subject: [PATCH 876/946] readability updates --- bin/ghe-host-check | 22 +++++++++------------- test/test-ghe-host-check.sh | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index 24a9ed262..a432f3f7c 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -120,36 +120,32 @@ fi NON_WRITABLE="" # ensure all nodes are writable if [ "$CLUSTER" == "true" ] ; then - if [ -z "$GHE_FILE_SYSTEM_CHECK" ]; then + if [ -z "$GHE_FILE_SYSTEM_WRITE_CHECK" ]; then if [ -d "/data/user/tmp" ]; then - FILE_TO_TEST="/data/user/tmp/test-ro-file.txt" + WRITE_CHECK_FILE="/data/user/tmp/test-ro-file.txt" else - FILE_TO_TEST="/tmp/test-ro-file.txt" + WRITE_CHECK_FILE="/tmp/test-ro-file.txt" fi else - FILE_TO_TEST="$GHE_FILE_SYSTEM_CHECK/test-ro-file.txt" + WRITE_CHECK_FILE="$GHE_FILE_SYSTEM_CHECK/test-ro-file.txt" fi # Iterate through each node in the cluster nodes=$(ghe-ssh "$host" ghe-cluster-nodes) first=true for node in $nodes; do - if ! echo "set -o pipefail; ssh $node -- 'touch $FILE_TO_TEST && rm $FILE_TO_TEST'" | ghe-ssh "$host" /bin/bash; then + if ! echo "set -o pipefail; ssh $node -- 'touch $WRITE_CHECK_FILE && rm $WRITE_CHECK_FILE'" | ghe-ssh "$host" /bin/bash; then echo "File system is not writeable or no permission on $node" 1>&2 - if [ "$first" = true ]; then - NON_WRITABLE="$node" - first=false - else - NON_WRITABLE="$NON_WRITABLE, $node" - fi + NON_WRITABLE+="$node " fi || true done # Display the comma-separated list of non-writable nodes - if [ ! -z "$NON_WRITABLE" ]; then + if [ -n "$NON_WRITABLE" ]; then + NON_WRITABLE=$(echo "$NON_WRITABLE" | sed 's/ /, /g; s/, $//') log_error "Error: Following nodes are non-writable - $NON_WRITABLE. Please make sure the filesystem for all GHES nodes are writable." 1>&2 exit 1 else - echo "All nodes are writable." + log_info "All nodes are writable." fi fi diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index f1e964da5..50b4ed996 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -134,7 +134,7 @@ begin_test "ghe-host-check fails when encountering RO file-system" ghe-ssh "$GHE_HOSTNAME" -- 'chmod a-w -R "~/tmp"' # File creation fails for CLUSTER - ! FILE_TO_TEST="$HOME/tmp/test" CLUSTER=true GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check - FILE_TO_TEST="$HOME/tmp/test" CLUSTER=false GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check + ! WRITE_CHECK_FILE="$HOME/tmp/test" CLUSTER=true GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check + WRITE_CHECK_FILE="$HOME/tmp/test" CLUSTER=false GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check ) end_test From 265b9fa06b0fccf22cc743652d13615aa2af398a Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 7 Nov 2023 04:29:12 +0000 Subject: [PATCH 877/946] SC fix --- bin/ghe-host-check | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index a432f3f7c..fedc84852 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -132,7 +132,6 @@ if [ "$CLUSTER" == "true" ] ; then # Iterate through each node in the cluster nodes=$(ghe-ssh "$host" ghe-cluster-nodes) - first=true for node in $nodes; do if ! echo "set -o pipefail; ssh $node -- 'touch $WRITE_CHECK_FILE && rm $WRITE_CHECK_FILE'" | ghe-ssh "$host" /bin/bash; then echo "File system is not writeable or no permission on $node" 1>&2 From 18d6113aedd699df376eb25c9089304262aee193 Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 7 Nov 2023 14:26:38 +0000 Subject: [PATCH 878/946] progress file for ha instances --- share/github-backup-utils/ghe-backup-repositories | 6 ++++++ share/github-backup-utils/ghe-backup-storage | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index e90d8c37a..f4d3a4b44 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -78,6 +78,12 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi +# hostnames for HA +if ghe-ssh "$GHE_HOSTNAME" -- \ + "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ] && [ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then + hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -i |cut -f 2) +fi + # Make sure root backup dir exists if this is the first run mkdir -p "$backup_dir" diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index 9752de21d..bac467c8a 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -51,6 +51,12 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi +# hostnames for HA +if ghe-ssh "$GHE_HOSTNAME" -- \ + "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ] && [ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then + hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -i |cut -f 2) +fi + # Make sure root backup dir exists if this is the first run mkdir -p "$backup_dir" From eabec3431bf55db7e5e8dc92948aadc582a3371d Mon Sep 17 00:00:00 2001 From: Chuck Pathanjali Date: Tue, 7 Nov 2023 18:32:02 +0000 Subject: [PATCH 879/946] re-trigger for cluster --- share/github-backup-utils/ghe-backup-repositories | 2 +- share/github-backup-utils/ghe-backup-storage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index f4d3a4b44..abf73a6cd 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -81,7 +81,7 @@ fi # hostnames for HA if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ] && [ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -i |cut -f 2) + hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -i | cut -f 2) fi # Make sure root backup dir exists if this is the first run diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index bac467c8a..c64309202 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -54,7 +54,7 @@ fi # hostnames for HA if ghe-ssh "$GHE_HOSTNAME" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ] && [ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -i |cut -f 2) + hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -i | cut -f 2) fi # Make sure root backup dir exists if this is the first run From 11a96f6d24bbd858afa1e594edbf0083bcd305ac Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 7 Nov 2023 10:54:33 -0800 Subject: [PATCH 880/946] Update docs/requirements.md --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index af0fc805f..5a8c4347a 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,7 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2] 1.7.6 or newer, [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), and [jq][11] v1.5 or newer. See below for an update on rsync. +Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2] 1.7.6 or newer, [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), [jq][11] v1.5 or newer and [bc][12] v1.0.6 or newer. See below for an update on rsync. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From f19c20639c7e5da9e6b0e52de0c14b6484edc349 Mon Sep 17 00:00:00 2001 From: djdefi Date: Tue, 7 Nov 2023 15:14:02 -0800 Subject: [PATCH 881/946] Update requirements.md --- docs/requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.md b/docs/requirements.md index 5a8c4347a..20b3a3fad 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -5,7 +5,7 @@ storage and must have network connectivity with the GitHub Enterprise Server app ## Backup host requirements -Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2] 1.7.6 or newer, [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), [jq][11] v1.5 or newer and [bc][12] v1.0.6 or newer. See below for an update on rsync. +Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2] 1.7.6 or newer, [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), [jq][11] v1.5 or newer and [bc][12] v1.0.7 or newer. See below for an update on rsync. The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. From cc320085950c6bdb464f4ef1adf85bba19d81bae Mon Sep 17 00:00:00 2001 From: "Roger D. Winans" Date: Tue, 14 Nov 2023 23:43:39 +0000 Subject: [PATCH 882/946] Merge pull request #726 from github/solvaholic/soften-warning Remove "contact support" from warning about route verification --- share/github-backup-utils/ghe-backup-repositories | 2 +- share/github-backup-utils/ghe-backup-storage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index 68442b527..543effb35 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -384,7 +384,7 @@ if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then done |sort|uniq > $tempdir/source_routes (cd $backup_dir/ && find * -mindepth 5 -maxdepth 6 -type d -name \*.git | fix_paths_for_ghe_version | uniq | sort | uniq) > $tempdir/destination_routes - git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more repository networks and/or gists were not found on the source appliance. Please contact GitHub Enterprise Support for assistance." + git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more repository networks and/or gists were not found on the source appliance." increment-progress-total-count 1 bm_end "$(basename $0) - Verifying Routes" fi diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index c64309202..c513290bf 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -155,7 +155,7 @@ if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then cat $tempdir/*.rsync | uniq | sort | uniq > $tempdir/source_routes (cd $backup_dir/ && find * -mindepth 3 -maxdepth 3 -type f -print | uniq | sort | uniq) > $tempdir/destination_routes - git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more storage objects were not found on the source appliance. Please contact GitHub Enterprise Support for assistance." + git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more storage objects were not found on the source appliance." increment-progress-total-count 1 bm_end "$(basename $0) - Verifying Routes" From cc6566b6185875fd12ecaf2f113e58d6646f597d Mon Sep 17 00:00:00 2001 From: Dax Amin Date: Thu, 16 Nov 2023 08:54:45 +0000 Subject: [PATCH 883/946] Merge pull request #725 from github/ha-sync Create sync file on HA replica from primary node [cluster] --- share/github-backup-utils/ghe-backup-config | 30 +++++++++++++++++++ .../ghe-backup-repositories | 25 ++++++++++++---- share/github-backup-utils/ghe-backup-storage | 25 ++++++++++++---- share/github-backup-utils/ghe-gc-disable | 18 ++--------- 4 files changed, 72 insertions(+), 26 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config index cd9972b59..30062a8f6 100755 --- a/share/github-backup-utils/ghe-backup-config +++ b/share/github-backup-utils/ghe-backup-config @@ -676,3 +676,33 @@ increment-progress-total-count() { ((PROGRESS_TOTAL += $1)) echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total } + +## +# This function is used by ghe-gc-disable, ghe-backup-repositories, and ghe-backup-storage +# This function should be used directly to disable and drain GC operations ONLY on HA-replica node +# (as done in ghe-backup-repositories and ghe-backup-storage) +# Otherwise use ghe-gc-disable which will call this function with the correct parameters. +# +# Arguments: +# $1 - path to sync-in-progress file ($SYNC_IN_PROGRESS_FILE) +# $2 - git cooldown period ($GHE_GIT_COOLDOWN_PERIOD) +## +gc_disable() { + set -e + local sync_in_progress="$1" + local git_cooldown_period="$2" + + # Touch the sync-in-progress file, disabling GC operations, and wait for all + # active GC processes to finish on the remote side. + sudo -u git touch "$sync_in_progress" + for _ in $(seq $git_cooldown_period); do + # note: the bracket synta[x] below is to prevent matches against the + # grep process itself. + if ps axo args | grep -E -e "^git( -.*)? nw-repac[k]( |$)" -e "^git( -.*)? g[c]( |$)" >/dev/null; then + sleep 1 + else + exit 0 + fi + done + exit 7 +} diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories index 68442b527..209d81367 100755 --- a/share/github-backup-utils/ghe-backup-repositories +++ b/share/github-backup-utils/ghe-backup-repositories @@ -78,10 +78,9 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi -# hostnames for HA -if ghe-ssh "$GHE_HOSTNAME" -- \ - "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ] && [ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -i | cut -f 2) +# Replica hostnames for HA +if ghe-ssh "$GHE_HOSTNAME" -- "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then + ha_replica_hosts=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes --replica) fi # Make sure root backup dir exists if this is the first run @@ -96,11 +95,18 @@ cleanup() { # Enable remote GC operations for hostname in $hostnames; do - ghe-gc-enable $ssh_config_file_opt $hostname:$port || { + ghe-gc-enable $ssh_config_file_opt $hostname:$port || { echo "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 } done + # Enable remote GC operations for HA replica + for replica_host in $ha_replica_hosts; do + echo "set -o pipefail; ssh $replica_host -- 'sudo rm -f $SYNC_IN_PROGRESS_FILE'" | ghe-ssh "$host" /bin/bash || { + echo "Re-enable gc on $replica_host failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 + } + done + ghe-ssh "$GHE_HOSTNAME" -- rm -rf $remote_tempdir rm -rf $tempdir } @@ -111,6 +117,15 @@ for hostname in $hostnames; do ghe-gc-disable $ssh_config_file_opt $hostname:$port done +# Disable remote GC operations for HA replica +# gc_disable is a function defined in ghe-backup-config +# gc_disable is called on the replica node via the primary node, because replica node is not expected to be reachable from backup host. But replica node is expected to be reachable from primary node. +for replica_host in $ha_replica_hosts; do + echo "set -o pipefail; ssh $replica_host -- '$(declare -f gc_disable); gc_disable \"$SYNC_IN_PROGRESS_FILE\" \"$GHE_GIT_COOLDOWN_PERIOD\"'" | ghe-ssh "$host" /bin/bash || { + echo "Disable gc on $replica_host failed" 1>&2 + } +done + # If we have a previous increment, avoid transferring existing files via rsync's # --link-dest support. This also decreases physical space usage considerably. if [ -d "$backup_current" ]; then diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage index c64309202..82ec98f2e 100755 --- a/share/github-backup-utils/ghe-backup-storage +++ b/share/github-backup-utils/ghe-backup-storage @@ -51,10 +51,9 @@ if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" fi -# hostnames for HA -if ghe-ssh "$GHE_HOSTNAME" -- \ - "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ] && [ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -i | cut -f 2) +# Replica hostnames for HA +if ghe-ssh "$GHE_HOSTNAME" -- "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then + ha_replica_hosts=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes --replica) fi # Make sure root backup dir exists if this is the first run @@ -65,11 +64,18 @@ mkdir -p "$backup_dir" cleanup() { # Enable remote maintenance operations for hostname in $hostnames; do - ghe-gc-enable $ssh_config_file_opt $hostname:$port || { + ghe-gc-enable $ssh_config_file_opt $hostname:$port || { log_warn "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 } done + # Enable remote GC operations for HA replica + for replica_host in $ha_replica_hosts; do + echo "set -o pipefail; ssh $replica_host -- 'sudo rm -f $SYNC_IN_PROGRESS_FILE'" | ghe-ssh "$host" /bin/bash || { + echo "Re-enable gc on $replica_host failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 + } + done + ghe-ssh "$GHE_HOSTNAME" -- rm -rf $remote_tempdir rm -rf $tempdir } @@ -80,6 +86,15 @@ for hostname in $hostnames; do ghe-gc-disable $ssh_config_file_opt $hostname:$port done +# Disable remote GC operations for HA replica +# gc_disable is a function defined in ghe-backup-config +# gc_disable is called on the replica node via the primary node, because replica node is not expected to be reachable from backup host. But replica node is expected to be reachable from primary node. +for replica_host in $ha_replica_hosts; do + echo "set -o pipefail; ssh $replica_host -- '$(declare -f gc_disable); gc_disable \"$SYNC_IN_PROGRESS_FILE\" \"$GHE_GIT_COOLDOWN_PERIOD\"'" | ghe-ssh "$host" /bin/bash || { + echo "Disable gc on $replica_host failed" 1>&2 + } +done + # If we have a previous increment and it is not empty, avoid transferring existing files via rsync's # --link-dest support. This also decreases physical space usage considerably. if [ -d "$GHE_DATA_DIR/current/storage" ] && [ "$(ls -A $GHE_DATA_DIR/current/storage)" ]; then diff --git a/share/github-backup-utils/ghe-gc-disable b/share/github-backup-utils/ghe-gc-disable index 1e5a63bc5..67cdef6d4 100755 --- a/share/github-backup-utils/ghe-gc-disable +++ b/share/github-backup-utils/ghe-gc-disable @@ -32,22 +32,8 @@ done # Exit early when testing [ -n "$GHE_TEST_REMOTE_VERSION" ] && exit 0 -# Touch the sync-in-progress file, disabling GC operations, and wait for all -# active GC processes to finish on the remote side. -echo " - set -e - sudo -u git touch '$SYNC_IN_PROGRESS_FILE' - for i in \$(seq $GHE_GIT_COOLDOWN_PERIOD); do - # note: the bracket synta[x] below is to prevent matches against the - # grep process itself. - if ps axo args | grep -E -e '^git( -.*)? nw-repac[k]( |$)' -e '^git( -.*)? g[c]( |$)' >/dev/null; then - sleep 1 - else - exit 0 - fi - done - exit 7 -" | ghe-ssh $opts "$host" -- /bin/bash || { +# gc_disable is a function defined in ghe-backup-config +echo "set -o pipefail; $(declare -f gc_disable); gc_disable \"$SYNC_IN_PROGRESS_FILE\" \"$GHE_GIT_COOLDOWN_PERIOD\"" | ghe-ssh $opts "$host" -- /bin/bash || { res=$? if [ $res = 7 ]; then log_error "Error: Git GC processes remain after $GHE_GIT_COOLDOWN_PERIOD seconds. Aborting..." 1>&2 From b2131769bb948a91eb325804e41a5c197eb6d81e Mon Sep 17 00:00:00 2001 From: Andrew Mildahl Date: Tue, 28 Nov 2023 15:54:38 -0600 Subject: [PATCH 884/946] Update versions --- bin/ghe-host-check | 2 +- share/github-backup-utils/version | 2 +- test/testlib.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ghe-host-check b/bin/ghe-host-check index abc0b40b2..59bc9b526 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -173,7 +173,7 @@ fi # backup-utils 2.13 onwards limits support to the current and previous two releases # of GitHub Enterprise Server. -supported_minimum_version="3.7.0" +supported_minimum_version="3.9.0" if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then supported=1 diff --git a/share/github-backup-utils/version b/share/github-backup-utils/version index 30291cba2..afad81866 100644 --- a/share/github-backup-utils/version +++ b/share/github-backup-utils/version @@ -1 +1 @@ -3.10.0 +3.11.0 diff --git a/test/testlib.sh b/test/testlib.sh index edeec8ea2..8251fa316 100755 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -48,7 +48,7 @@ export GHE_BACKUP_CONFIG GHE_DATA_DIR GHE_REMOTE_DATA_DIR GHE_REMOTE_ROOT_DIR # The default remote appliance version. This may be set in the environment prior # to invoking tests to emulate a different remote vm version. -: ${GHE_TEST_REMOTE_VERSION:=3.8.0.rc1} +: ${GHE_TEST_REMOTE_VERSION:=3.11.0.rc1} export GHE_TEST_REMOTE_VERSION # Source in the backup config and set GHE_REMOTE_XXX variables based on the From bec5f580420fe65289a6bc32ee90d580516f7377 Mon Sep 17 00:00:00 2001 From: Andrew Mildahl Date: Tue, 28 Nov 2023 16:56:51 -0600 Subject: [PATCH 885/946] Fix ghe-host-check unsupported version test for unreleased feature versions --- test/test-ghe-host-check.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index 50b4ed996..55f2e6c83 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -68,10 +68,10 @@ begin_test "ghe-host-check detects unsupported GitHub Enterprise Server versions if [ -z "$supported" ] then #BACKUP_UTILS_VERSION WAS NOT FOUND IN LATEST.JSON, CHECK IF ITS GREATER THAN LAST VERSION - if [ "$(version $bu_major_minor)" -ge "$(version ${keys[$((${#keys[@]} - 2 ))]})" ]; then + if [ "$(version $bu_major_minor)" -ge "$(version ${keys[$((${#keys[@]}))]})" ]; then GHE_TEST_REMOTE_VERSION="$bu_major_minor.0" ghe-host-check - GHE_TEST_REMOTE_VERSION="${keys[$(( ${#keys[@]} - 2 ))]}.0" ghe-host-check - GHE_TEST_REMOTE_VERSION="${keys[$(( ${#keys[@]} - 3 ))]}.0" ghe-host-check + GHE_TEST_REMOTE_VERSION="${keys[$(( ${#keys[@]}))]}.0" ghe-host-check + GHE_TEST_REMOTE_VERSION="${keys[$(( ${#keys[@]} - 1 ))]}.0" ghe-host-check fi else #BACKUP_UTILS_VERSION WAS FOUND IN LATEST.JSON From 3cef5b8df620226071a9e4a61d878c638545099b Mon Sep 17 00:00:00 2001 From: Andrew Mildahl Date: Tue, 28 Nov 2023 20:28:02 -0600 Subject: [PATCH 886/946] Fix ghe-host-check unsupported version test by sorting supported versions --- test/test-ghe-host-check.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index 55f2e6c83..fb547bf34 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -63,32 +63,30 @@ begin_test "ghe-host-check detects unsupported GitHub Enterprise Server versions # Use the modified releases string as needed supported=$(echo "$releases_with_replacement" | jq -r 'select(."'${bu_major_minor}'")') # shellcheck disable=SC2207 # Command required as alternatives fail - keys=($(echo "$releases_with_replacement" | jq -r 'keys[]')) + keys=($(echo "$releases_with_replacement" | jq -r '. | keys_unsorted | sort_by( split(".") | map(tonumber) )[]')) if [ -z "$supported" ] then #BACKUP_UTILS_VERSION WAS NOT FOUND IN LATEST.JSON, CHECK IF ITS GREATER THAN LAST VERSION - if [ "$(version $bu_major_minor)" -ge "$(version ${keys[$((${#keys[@]}))]})" ]; then + if [ "$(version $bu_major_minor)" -ge "$(version ${keys[-1]})" ]; then GHE_TEST_REMOTE_VERSION="$bu_major_minor.0" ghe-host-check - GHE_TEST_REMOTE_VERSION="${keys[$(( ${#keys[@]}))]}.0" ghe-host-check - GHE_TEST_REMOTE_VERSION="${keys[$(( ${#keys[@]} - 1 ))]}.0" ghe-host-check + # Test most recent 2 versions + GHE_TEST_REMOTE_VERSION="${keys[-1]}.0" ghe-host-check + GHE_TEST_REMOTE_VERSION="${keys[-2]}.0" ghe-host-check fi else #BACKUP_UTILS_VERSION WAS FOUND IN LATEST.JSON ix=0 - for i in "${keys[@]}";do + for i in "${keys[@]}";do if [ "$i" == "$bu_major_minor" ];then break fi ix=$(( $ix + 1 )) done GHE_TEST_REMOTE_VERSION="${keys[$ix]}.0" ghe-host-check - # sometimes when the latest.json is updated during a release this test gets broken. - if [ "${keys[$(( $ix - 1 ))]}" != "latest" ]; then - GHE_TEST_REMOTE_VERSION="${keys[$(( $ix - 1 ))]}.0" ghe-host-check - fi + # Test previous 2 supported versions + GHE_TEST_REMOTE_VERSION="${keys[$(( $ix - 1 ))]}.0" ghe-host-check GHE_TEST_REMOTE_VERSION="${keys[$(( $ix - 2 ))]}.0" ghe-host-check - fi ! GHE_TEST_REMOTE_VERSION=11.340.36 ghe-host-check GHE_TEST_REMOTE_VERSION=$bu_version_major.$bu_version_minor.999 ghe-host-check From b4b127f1762b71a1153f660632f9aaf8e23e1e12 Mon Sep 17 00:00:00 2001 From: Andrew Mildahl Date: Wed, 29 Nov 2023 00:16:57 -0600 Subject: [PATCH 887/946] Fix ghe-host-check unsupported version test for unreleased versions --- test/test-ghe-host-check.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index fb547bf34..80a62cfc5 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -70,9 +70,10 @@ begin_test "ghe-host-check detects unsupported GitHub Enterprise Server versions #BACKUP_UTILS_VERSION WAS NOT FOUND IN LATEST.JSON, CHECK IF ITS GREATER THAN LAST VERSION if [ "$(version $bu_major_minor)" -ge "$(version ${keys[-1]})" ]; then GHE_TEST_REMOTE_VERSION="$bu_major_minor.0" ghe-host-check - # Test most recent 2 versions + # Test most recent version + # Don't test 2 versions back because it fails when we bump the version on + # master after branching for a feature release, before it's released GHE_TEST_REMOTE_VERSION="${keys[-1]}.0" ghe-host-check - GHE_TEST_REMOTE_VERSION="${keys[-2]}.0" ghe-host-check fi else #BACKUP_UTILS_VERSION WAS FOUND IN LATEST.JSON From 872f6569e73b6eed2cb7dfbf00a33becbc7d0c23 Mon Sep 17 00:00:00 2001 From: Andrew Mildahl Date: Wed, 29 Nov 2023 15:52:58 -0600 Subject: [PATCH 888/946] Revert "Merge pull request #717 from github/daxamin-offline-error" This reverts commit c1a2b87fba87766abe57d1b6c4bcfb4d6cb9ad65, reversing changes made to 0889f597bfa044b5d8554e86a13b440863712a3b. --- bin/ghe-backup | 2 +- bin/ghe-host-check | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/bin/ghe-backup b/bin/ghe-backup index 1ae6b868c..448a5840e 100755 --- a/bin/ghe-backup +++ b/bin/ghe-backup @@ -377,7 +377,7 @@ if [ -z "$failures" ]; then else log_info "Expired and incomplete snapshots to be pruned separately" fi -else +else log_info "Skipping pruning snapshots, since some backups failed..." fi diff --git a/bin/ghe-host-check b/bin/ghe-host-check index abc0b40b2..fc0a0b6e2 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -93,13 +93,11 @@ if ghe-ssh "$host" -- \ CLUSTER=true fi -set +e # ensure all nodes in the cluster are online/reachable and running the same version if "$CLUSTER"; then online_status=$(ghe-ssh "$host" ghe-cluster-host-check) if [ "$online_status" != "Cluster is ready to configure." ]; then - echo "$online_status" 1>&2 - log_error "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2 + echo "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2 exit 1 fi @@ -107,11 +105,10 @@ if "$CLUSTER"; then distinct_versions=$(echo "$node_version_list" | awk '{split($0, a, ":"); print a[2]}' | awk '{print $4}' | uniq | wc -l) if [ "$distinct_versions" -ne 1 ]; then echo "Version mismatch: $node_version_list" 1>&2 - log_error "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2 + echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2 exit 1 fi fi -set -e version=$(echo "$output" | grep "GitHub Enterprise" | awk '{print $NF}') @@ -213,7 +210,7 @@ SKIP_MSG #Display dir requirements for repositories and mysql echo -e "\nChecking host for sufficient space for a backup..." - available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') + available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." repos_disk_size=$(transfer_size repositories /tmp) From 01f42a98927398a3b49d04a4d345045ff85598aa Mon Sep 17 00:00:00 2001 From: Andrew Mildahl Date: Wed, 29 Nov 2023 15:53:28 -0600 Subject: [PATCH 889/946] Revert "Merge pull request #700 from github/check-ro-filesystem" This reverts commit 0aa36fdd1ed87b608feadc07a4585247d36e0970, reversing changes made to c1a2b87fba87766abe57d1b6c4bcfb4d6cb9ad65. --- backup.config-example | 4 ---- bin/ghe-host-check | 35 +---------------------------------- test/test-ghe-host-check.sh | 15 --------------- 3 files changed, 1 insertion(+), 53 deletions(-) diff --git a/backup.config-example b/backup.config-example index 66dc5731e..535a2f636 100644 --- a/backup.config-example +++ b/backup.config-example @@ -32,10 +32,6 @@ GHE_NUM_SNAPSHOTS=10 # disk space validation and software version checks on the backup-host will be disabled. #GHE_SKIP_CHECKS=false -# Cluster filesystem to check if it's writable as part of ghe-host-check -# By default it is /data/user/tmp but can be updated if needed -#GHE_FILE_SYSTEM_WRITE_CHECK="/data/user/tmp" - # The hostname of the GitHub appliance to restore. If you've set up a separate # GitHub appliance to act as a standby for recovery, specify its IP or hostname # here. The host to restore to may also be specified directly when running diff --git a/bin/ghe-host-check b/bin/ghe-host-check index fc0a0b6e2..5cd39abee 100755 --- a/bin/ghe-host-check +++ b/bin/ghe-host-check @@ -85,9 +85,7 @@ if [ $rc -ne 0 ]; then exit $rc fi -if [ -z "$CLUSTER" ]; then - CLUSTER=false -fi +CLUSTER=false if ghe-ssh "$host" -- \ "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ]"; then CLUSTER=true @@ -117,37 +115,6 @@ if [ -z "$version" ]; then exit 2 fi -NON_WRITABLE="" -# ensure all nodes are writable -if [ "$CLUSTER" == "true" ] ; then - if [ -z "$GHE_FILE_SYSTEM_WRITE_CHECK" ]; then - if [ -d "/data/user/tmp" ]; then - WRITE_CHECK_FILE="/data/user/tmp/test-ro-file.txt" - else - WRITE_CHECK_FILE="/tmp/test-ro-file.txt" - fi - else - WRITE_CHECK_FILE="$GHE_FILE_SYSTEM_CHECK/test-ro-file.txt" - fi - - # Iterate through each node in the cluster - nodes=$(ghe-ssh "$host" ghe-cluster-nodes) - for node in $nodes; do - if ! echo "set -o pipefail; ssh $node -- 'touch $WRITE_CHECK_FILE && rm $WRITE_CHECK_FILE'" | ghe-ssh "$host" /bin/bash; then - echo "File system is not writeable or no permission on $node" 1>&2 - NON_WRITABLE+="$node " - fi || true - done - # Display the comma-separated list of non-writable nodes - if [ -n "$NON_WRITABLE" ]; then - NON_WRITABLE=$(echo "$NON_WRITABLE" | sed 's/ /, /g; s/, $//') - log_error "Error: Following nodes are non-writable - $NON_WRITABLE. Please make sure the filesystem for all GHES nodes are writable." 1>&2 - exit 1 - else - log_info "All nodes are writable." - fi -fi - # Block restoring snapshots to older releases of GitHub Enterprise Server if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version) diff --git a/test/test-ghe-host-check.sh b/test/test-ghe-host-check.sh index 50b4ed996..f2c5cca54 100755 --- a/test/test-ghe-host-check.sh +++ b/test/test-ghe-host-check.sh @@ -123,18 +123,3 @@ begin_test "ghe-host-check blocks restore to old release" ! GHE_TEST_REMOTE_VERSION=$bu_version_major.$((bu_version_minor-1)).$bu_version_patch ghe-restore -v ) end_test - -# Check ghe-host-check detects RO file system -begin_test "ghe-host-check fails when encountering RO file-system" -( - set -e - - ghe-ssh "$GHE_HOSTNAME" -- 'mkdir -p "~/tmp"' - # Remove write access in ~/tmp - ghe-ssh "$GHE_HOSTNAME" -- 'chmod a-w -R "~/tmp"' - - # File creation fails for CLUSTER - ! WRITE_CHECK_FILE="$HOME/tmp/test" CLUSTER=true GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check - WRITE_CHECK_FILE="$HOME/tmp/test" CLUSTER=false GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check -) -end_test From 3bc10598b490069c033ef7c05ba89a6ba24819e9 Mon Sep 17 00:00:00 2001 From: Andrew Mildahl Date: Wed, 29 Nov 2023 19:51:17 -0600 Subject: [PATCH 890/946] Add 3.11.0 release notes --- release-notes/3.11.0.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 release-notes/3.11.0.md diff --git a/release-notes/3.11.0.md b/release-notes/3.11.0.md new file mode 100644 index 000000000..197501c92 --- /dev/null +++ b/release-notes/3.11.0.md @@ -0,0 +1,18 @@ +### Bug Fixes + +* `ghe-backup-myql` and `ghe-restore-mysql` will now exit 1 on errors. +* On an instance with Actions enabled, incorrect backup and restore settings prevented the storage container name from being restored. This made the logs from that container inaccessible, and caused Actions to create a new storage container in a different location. +* When backups are run for HA instances in both primary and replica nodes a `.sync-in-progress` file will be created. This will disable `NetworkMaintenance` jobs from running and queueing up when backups are running from the primary node. + +### Changes + +* Estimated transfer sizes will be calculated on appropriate nodes for clustered environments. +* Added support for finding the `parallel` command from the `moreutils` tool suite on more Linux distributions, including Arch Linux and Alpine Linux. +* `ghe-restore` avoids unnecessary `rsync` operations when restoring to non-clustered environments. +* `ghe-backup` and `ghe-restore` output their total runtime +* `rsync` compression is now disabled by default. The `-z` flag has been removed from the `ghe-rsync` command in multiple files to improve transfer speed and reduce CPU usage. To enable `rsync` compression globally, add `GHE_RSYNC_COMPRESSION_ENABLED=yes` to the `backup.config` file. +* Updates the Host OS version output to use `/etc/os-release` for better compatibility with other Linux distributions. + +### Backups and Disaster Recovery + +* When a NFS mount is detected for snapshots on backup hosts, backup logs will show a warning to notify the user that such a setup may incur performance issues as highlighted in [storage requirements](https://github.com/github/backup-utils-private/blob/master/docs/requirements.md#storage-requirements) documentation. From 5534c57f0ea41c31c8d3e4aab9330836cf241598 Mon Sep 17 00:00:00 2001 From: Andrew Mildahl Date: Wed, 29 Nov 2023 20:01:02 -0600 Subject: [PATCH 891/946] Add 3.11.0 debian/changelog --- debian/changelog | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/debian/changelog b/debian/changelog index fb6b9940b..0d6f1e8d4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,49 @@ +github-backup-utils (3.11.0) UNRELEASED; urgency=medium + + * `ghe-backup-myql` and `ghe-restore-mysql` will now exit 1 on errors. + * On an instance with Actions enabled, incorrect backup and restore settings prevented the storage container name from being restored. This made the logs from that container inaccessible, and caused Actions to create a new storage container in a different location. + * When backups are run for HA instances in both primary and replica nodes a `.sync-in-progress` file will be created. This will disable `NetworkMaintenance` jobs from running and queueing up when backups are running from the primary node. + * Estimated transfer sizes will be calculated on appropriate nodes for clustered environments. + * Added support for finding the `parallel` command from the `moreutils` tool suite on more Linux distributions, including Arch Linux and Alpine Linux. + * `ghe-restore` avoids unnecessary `rsync` operations when restoring to non-clustered environments. + * `ghe-backup` and `ghe-restore` output their total runtime + * `rsync` compression is now disabled by default. The `-z` flag has been removed from the `ghe-rsync` command in multiple files to improve transfer speed and reduce CPU usage. To enable `rsync` compression globally, add `GHE_RSYNC_COMPRESSION_ENABLED=yes` to the `backup.config` file. + * Updates the Host OS version output to use `/etc/os-release` for better compatibility with other Linux distributions. + * When a NFS mount is detected for snapshots on backup hosts, backup logs will show a warning to notify the user that such a setup may incur performance issues as highlighted in [storage requirements](https://github.com/github/backup-utils-private/blob/master/docs/requirements.md#storage-requirements) documentation. + + -- Andrew Mildahl Thu, 30 Nov 2023 01:57:12 +0000 + +github-backup-utils (3.10.0) UNRELEASED; urgency=medium + + -- Balwinder Sohi Wed, 30 Aug 2023 17:39:31 +0000 + +github-backup-utils (3.10.0) UNRELEASED; urgency=medium + + * Remove -o option from ps use #341 + * Switch to TMPDIR before initiating SSH multiplexing workaround to prevent locking the destination filesystem #348 + * Move check for git for ssh muxing into ghe-ssh #378 + * Check filesystem supports hardlinks #388 + * Remove check for git from ghe-ssh #393 + * Clean up stale HA nodes on restore #396 + + -- Balwinder Sohi Wed, 09 Aug 2023 19:37:10 +0000 + +github-backup-utils (3.9.0) UNRELEASED; urgency=medium + + * Set restore status on all cluster nodes #274 + * Fix pages backups and restores in GitHub Enterprise 11.10 #275 + * Backup and restore custom CA certificates #281 + * Set the benchmark file path consistently #283 + * Suppress dd output noise #289 + * Track completeness of Elasticsearch JSON dumps #298 + * Use existing Elasticsearch indices to speed up transfer during a restore #310 + * Include the user data directory in the benchmark name #311 + * Use calculated routes when backing up storage data from a cluster #318 + * Refresh the existing indices when restoring Elasticsearch indices to cluster #328 + * Use git to generate short name for SSH multiplex control path #335 + + -- Junior Eluhu Mon, 12 Jun 2023 20:46:10 +0000 + github-backup-utils (3.8.0) focal; urgency=medium -- Daniel Johnson Tue, 07 Feb 2023 21:43:26 +0000 From 07686532d824e3384183453ae7eaf2a1621b2e56 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 30 Nov 2023 11:59:38 -0500 Subject: [PATCH 892/946] Simplified the Support section --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4ee951f58..8e1d1adb2 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,8 @@ GitHub Enterprise Server. ## Support -If you find a bug or would like to request a feature in Backup Utilities, please -open an issue or pull request on this repository. If you have a question related -to your specific GitHub Enterprise Server setup or would like assistance with -backup site setup or recovery, please contact our [Enterprise support team][3] -instead. +If you have a question related to your specific GitHub Enterprise Server setup, would like assistance with +backup site setup or recovery, or would like to report a bug or a feature request, please contact our [Enterprise support team][3]. [1]: https://github.com/enterprise [2]: docs/requirements.md#github-enterprise-version-requirements From a0d9dc18d3072051aac10636eee7d183af8a167d Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 30 Nov 2023 12:19:02 -0500 Subject: [PATCH 893/946] Added details about the repository settings changes we made on 2023-11-30 I copied and pasted the contents from this issue (https://github.com/github/backup-utils/issues/1140) into the README file. --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/README.md b/README.md index 8e1d1adb2..8376f371c 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,63 @@ GitHub Enterprise Server. If you have a question related to your specific GitHub Enterprise Server setup, would like assistance with backup site setup or recovery, or would like to report a bug or a feature request, please contact our [Enterprise support team][3]. + +## Repository updates - November 2023 + +In October 2023 we announced a number of changes to this repository. These changes will improve our (GitHub’s) ability to ship enhancements and new features to backup-utils, as well as simplify how GitHub Enterprise Server customers interact with backup-utils. + +Our process for shipping new versions of backup-utils prior to November 2023 involved a 2-way sync between this repository and an internal repository. This 2-way sync became significantly more problematic once we started regularly shipping patches in alignment with GitHub Enterprise Server. + +As of 2023-11-30 we have stopped this 2-way sync so that our internal repository becomes the source of truth for the backup-utils source code. With the the 2-way sync stopped, this public repository will be used to host documentation about backup-utils and to publish new versions of backup-utils. You will be able to access a specific version of backup-utils (which includes the full source code) from the [release page](https://github.com/github/backup-utils/releases) of this repository. + +This change has not affected the functionality of the backup-utils tool or a customer’s ability to backup or restore their GitHub Enterprise Server instance. + +### Details + +There are three specific areas that have been affected by us stop the 2-way sync between our internal repository and this public repository on 2023-11-30: + +1. **Pull requests**: Customers should no longer open pull requests in this repository. These pull requests will not be reviewed or merged. This is necessary because we will no longer be syncing changes between this repository and our internal repository. +2. **Issues**: Customers cannot open issues in this repository. Instead, customers will need to follow the standard support process and open a support ticket for any questions/concerns/problems with backup-utils. This will ensure all customer requests are handled consistently. +3. **Installing/upgrading backup-utils**: Customers will not be able to use a clone of the repository to install and upgrade backup-utils. Customers will need to download a specific version of backup-utils from the [release page](https://github.com/github/backup-utils/releases) (either as a Debian package or as an archive file - see below for details on how to incorporate this change). + +### Timeline + +Below is the two phase timeline we will follow to roll out the changes described above: + +* **Phase 1 (rolled out on 2023-11-30):** We have closed all open pull requests and issues (after reviewing each one and porting them to our internal repository if merited), and updated the repository settings so that new issues cannot be opened. Also, we have stop syncing code from our internal repository to this repository. + * As of 2023-11-30, you can still get a working copy of backup-utils by cloning the repository. But the code will not be updated in the repository; you can access updated versions of backup-utils via the [release page](https://github.com/github/backup-utils/releases). +* **Phase 2 (rolling out 2024-02-20):** The backup-utils code will be removed and the repository will be used to host documentation for backup-utils. After this date, you will no longer be able to clone a working copy of backup-utils from the repository. Instead, you will need to download a specific version of backup-utils from the [release page](https://github.com/github/backup-utils/releases). + +### Updating your backup-utils upgrade process + +#### Clone of repository + +If your current process for upgrading backup-utils involves a clone of the repository, you will need to modify your process to download a new version of backup-utils and set it up. + +For example, you could download the v3.10.0 (github-backup-utils-v3.10.0.tar.gz) artifact from the [releases page](https://github.com/github/backup-utils/releases/tag/v3.10.0) with: + +``` +$ wget https://github.com/github/backup-utils/releases/download/v3.10.0/github-backup-utils-v3.10.0.tar.gz +``` +And then extract it: + +``` +$ tar xzvf github-backup-utils-v3.10.0.tar.gz +``` + +This will give you a new folder, `github-backup-utils-v3.10.0`, which contains the code for version 3.10.0 of backup-utils. Once you copy over your backup.config file from a previous installation of backup-utils your new version of backup-utils will be ready to use. + +#### Docker + +For customers that currently use Docker to create a backup-utils image, their existing process may need updating as a result of this change. Previously customers could execute this command to build a Docker image of backup-utils: + +``` +$ docker build github.com/github/backup-utils +``` + +This will not work after phase 2 roles out. You will need to update your process to first download an archive from the [release page](https://github.com/github/backup-utils/releases), extract it, and then build the Dockerfile inside the extracted directory. + + [1]: https://github.com/enterprise [2]: docs/requirements.md#github-enterprise-version-requirements [3]: https://support.github.com/ From d68e166e580caf64ae3ab84ba4f8dd039547ffa1 Mon Sep 17 00:00:00 2001 From: "Roger D. Winans" Date: Thu, 30 Nov 2023 13:12:19 -0500 Subject: [PATCH 894/946] Delete docs/SUPPORT.md --- docs/SUPPORT.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 docs/SUPPORT.md diff --git a/docs/SUPPORT.md b/docs/SUPPORT.md deleted file mode 100644 index a05a91f5b..000000000 --- a/docs/SUPPORT.md +++ /dev/null @@ -1,13 +0,0 @@ -# Support - -## How to file issues and get help - -**github/backup-utils** uses GitHub issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. - -For non-urgent help, feature requests, and questions about using this project, please [open an issue](https://github.com/github/backup-utils/issues/new/choose). - -For urgent help with **backup-utils**, for example when restoring a backup to recover from a site failure or other disaster, please [open a ticket in GitHub's support portal](https://support.github.com/contact) and work with GitHub Support directly. - -## GitHub Support Policy - -**github/backup-utils** is an MIT-licensed open source project under active development and maintained by GitHub staff. We will do our best to respond to support, feature requests, and community questions in a timely manner. From 687b17889378ea16edb1372eca367060edd71031 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 30 Nov 2023 14:42:41 -0500 Subject: [PATCH 895/946] Fixing linting errors --- README.md | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8376f371c..a36add80a 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,16 @@ backup site setup or recovery, or would like to report a bug or a feature reques ## Repository updates - November 2023 -In October 2023 we announced a number of changes to this repository. These changes will improve our (GitHub’s) ability to ship enhancements and new features to backup-utils, as well as simplify how GitHub Enterprise Server customers interact with backup-utils. +In October 2023 we announced a number of changes to this repository. +These changes will improve our (GitHub’s) ability to ship enhancements and new features to backup-utils, +as well as simplify how GitHub Enterprise Server customers interact with backup-utils. -Our process for shipping new versions of backup-utils prior to November 2023 involved a 2-way sync between this repository and an internal repository. This 2-way sync became significantly more problematic once we started regularly shipping patches in alignment with GitHub Enterprise Server. +Our process for shipping new versions of backup-utils prior to November 2023 involved a 2-way sync between this repository and an internal repository. +This 2-way sync became significantly more problematic once we started regularly shipping patches in alignment with GitHub Enterprise Server. -As of 2023-11-30 we have stopped this 2-way sync so that our internal repository becomes the source of truth for the backup-utils source code. With the the 2-way sync stopped, this public repository will be used to host documentation about backup-utils and to publish new versions of backup-utils. You will be able to access a specific version of backup-utils (which includes the full source code) from the [release page](https://github.com/github/backup-utils/releases) of this repository. +As of 2023-11-30 we have stopped this 2-way sync so that our internal repository becomes the source of truth for the backup-utils source code. +With the the 2-way sync stopped, this public repository will be used to host documentation about backup-utils and to publish new versions of backup-utils. +You will be able to access a specific version of backup-utils (which includes the full source code) from the [release page](https://github.com/github/backup-utils/releases) of this repository. This change has not affected the functionality of the backup-utils tool or a customer’s ability to backup or restore their GitHub Enterprise Server instance. @@ -62,17 +67,27 @@ This change has not affected the functionality of the backup-utils tool or a cus There are three specific areas that have been affected by us stop the 2-way sync between our internal repository and this public repository on 2023-11-30: -1. **Pull requests**: Customers should no longer open pull requests in this repository. These pull requests will not be reviewed or merged. This is necessary because we will no longer be syncing changes between this repository and our internal repository. -2. **Issues**: Customers cannot open issues in this repository. Instead, customers will need to follow the standard support process and open a support ticket for any questions/concerns/problems with backup-utils. This will ensure all customer requests are handled consistently. -3. **Installing/upgrading backup-utils**: Customers will not be able to use a clone of the repository to install and upgrade backup-utils. Customers will need to download a specific version of backup-utils from the [release page](https://github.com/github/backup-utils/releases) (either as a Debian package or as an archive file - see below for details on how to incorporate this change). +1. **Pull requests**: Customers should no longer open pull requests in this repository. +These pull requests will not be reviewed or merged. +This is necessary because we will no longer be syncing changes between this repository and our internal repository. +2. **Issues**: Customers cannot open issues in this repository. +Instead, customers will need to follow the standard support process and open a support ticket for any questions/concerns/problems with backup-utils. +This will ensure all customer requests are handled consistently. +3. **Installing/upgrading backup-utils**: Customers will not be able to use a clone of the repository to install and upgrade backup-utils. +Customers will need to download a specific version of backup-utils from the [release page](https://github.com/github/backup-utils/releases) +(either as a Debian package or as an archive file - see below for details on how to incorporate this change). ### Timeline Below is the two phase timeline we will follow to roll out the changes described above: -* **Phase 1 (rolled out on 2023-11-30):** We have closed all open pull requests and issues (after reviewing each one and porting them to our internal repository if merited), and updated the repository settings so that new issues cannot be opened. Also, we have stop syncing code from our internal repository to this repository. - * As of 2023-11-30, you can still get a working copy of backup-utils by cloning the repository. But the code will not be updated in the repository; you can access updated versions of backup-utils via the [release page](https://github.com/github/backup-utils/releases). -* **Phase 2 (rolling out 2024-02-20):** The backup-utils code will be removed and the repository will be used to host documentation for backup-utils. After this date, you will no longer be able to clone a working copy of backup-utils from the repository. Instead, you will need to download a specific version of backup-utils from the [release page](https://github.com/github/backup-utils/releases). +* **Phase 1 (rolled out on 2023-11-30):** We have closed all open pull requests and issues (after reviewing each one and porting them to our internal repository if merited), +and updated the repository settings so that new issues cannot be opened. Also, we have stop syncing code from our internal repository to this repository. + * As of 2023-11-30, you can still get a working copy of backup-utils by cloning the repository. + But the code will not be updated in the repository; you can access updated versions of backup-utils via the [release page](https://github.com/github/backup-utils/releases). +* **Phase 2 (rolling out 2024-02-20):** The backup-utils code will be removed and the repository will be used to host documentation for backup-utils. +After this date, you will no longer be able to clone a working copy of backup-utils from the repository. +Instead, you will need to download a specific version of backup-utils from the [release page](https://github.com/github/backup-utils/releases). ### Updating your backup-utils upgrade process @@ -82,12 +97,12 @@ If your current process for upgrading backup-utils involves a clone of the repos For example, you could download the v3.10.0 (github-backup-utils-v3.10.0.tar.gz) artifact from the [releases page](https://github.com/github/backup-utils/releases/tag/v3.10.0) with: -``` +```shell $ wget https://github.com/github/backup-utils/releases/download/v3.10.0/github-backup-utils-v3.10.0.tar.gz ``` And then extract it: -``` +```shell $ tar xzvf github-backup-utils-v3.10.0.tar.gz ``` @@ -97,7 +112,7 @@ This will give you a new folder, `github-backup-utils-v3.10.0`, which contains t For customers that currently use Docker to create a backup-utils image, their existing process may need updating as a result of this change. Previously customers could execute this command to build a Docker image of backup-utils: -``` +```shell $ docker build github.com/github/backup-utils ``` From 2525298bd4ac3ce9ede78eef54bd2702c7a71f14 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 30 Nov 2023 14:50:57 -0500 Subject: [PATCH 896/946] Fix linting errors with dollar sign --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a36add80a..a186c5b3f 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Below is the two phase timeline we will follow to roll out the changes described * **Phase 1 (rolled out on 2023-11-30):** We have closed all open pull requests and issues (after reviewing each one and porting them to our internal repository if merited), and updated the repository settings so that new issues cannot be opened. Also, we have stop syncing code from our internal repository to this repository. - * As of 2023-11-30, you can still get a working copy of backup-utils by cloning the repository. + * As of 2023-11-30, you can still get a working copy of backup-utils by cloning the repository. But the code will not be updated in the repository; you can access updated versions of backup-utils via the [release page](https://github.com/github/backup-utils/releases). * **Phase 2 (rolling out 2024-02-20):** The backup-utils code will be removed and the repository will be used to host documentation for backup-utils. After this date, you will no longer be able to clone a working copy of backup-utils from the repository. @@ -98,12 +98,12 @@ If your current process for upgrading backup-utils involves a clone of the repos For example, you could download the v3.10.0 (github-backup-utils-v3.10.0.tar.gz) artifact from the [releases page](https://github.com/github/backup-utils/releases/tag/v3.10.0) with: ```shell -$ wget https://github.com/github/backup-utils/releases/download/v3.10.0/github-backup-utils-v3.10.0.tar.gz +\$ wget https://github.com/github/backup-utils/releases/download/v3.10.0/github-backup-utils-v3.10.0.tar.gz ``` And then extract it: ```shell -$ tar xzvf github-backup-utils-v3.10.0.tar.gz +\$ tar xzvf github-backup-utils-v3.10.0.tar.gz ``` This will give you a new folder, `github-backup-utils-v3.10.0`, which contains the code for version 3.10.0 of backup-utils. Once you copy over your backup.config file from a previous installation of backup-utils your new version of backup-utils will be ready to use. @@ -113,7 +113,7 @@ This will give you a new folder, `github-backup-utils-v3.10.0`, which contains t For customers that currently use Docker to create a backup-utils image, their existing process may need updating as a result of this change. Previously customers could execute this command to build a Docker image of backup-utils: ```shell -$ docker build github.com/github/backup-utils +\$ docker build github.com/github/backup-utils ``` This will not work after phase 2 roles out. You will need to update your process to first download an archive from the [release page](https://github.com/github/backup-utils/releases), extract it, and then build the Dockerfile inside the extracted directory. From c06ec959046894bdff1ad7a17470f235b461caec Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 30 Nov 2023 20:12:57 -0500 Subject: [PATCH 897/946] Fixed a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f9f7838e6..c0ceedb0e 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Customers will need to download a specific version of backup-utils from the [rel Below is the two phase timeline we will follow to roll out the changes described above: * **Phase 1 (rolled out on 2023-11-30):** We have closed all open pull requests and issues (after reviewing each one and porting them to our internal repository if merited), -and updated the repository settings so that new issues cannot be opened. Also, we have stop syncing code from our internal repository to this repository. +and updated the repository settings so that new issues cannot be opened. Also, we have stopped syncing code from our internal repository to this repository. * As of 2023-11-30, you can still get a working copy of backup-utils by cloning the repository. But the code will not be updated in the repository; you can access updated versions of backup-utils via the [release page](https://github.com/github/backup-utils/releases). * **Phase 2 (rolling out 2024-02-20):** The backup-utils code will be removed and the repository will be used to host documentation for backup-utils. From 2e668ce05f65f020127325f0348537713190eba9 Mon Sep 17 00:00:00 2001 From: David Jarzebowski Date: Thu, 30 Nov 2023 20:17:28 -0500 Subject: [PATCH 898/946] Updating requirement about rsync's '--trust-sender' flag --- docs/requirements.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/requirements.md b/docs/requirements.md index 58dfe16ae..27e490fc3 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -22,6 +22,7 @@ CPU and memory requirements are dependent on the size of the GitHub Enterprise S The [fix in rsync `3.2.5`](https://github.com/WayneD/rsync/blob/master/NEWS.md#news-for-rsync-325-14-aug-2022) for [CVE-2022-29154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29154) can cause severe performance degradation to `backup-utils`. If you encounter this degradation you can mitigate it by using the `--trust-sender` flag, which is available in rsync >= v3.2.5. +**Note**: If you are using backup-utils 3.9 or greater, `--trust-sender` is automatically used if your rsync version supports it and no further changes are needed. If your backup host is running rsync < v3.2.5 you may or may not need to make changes to your rsync package, depending on whether your rsync package has backported the fix for CVE-2022-29154 without also backporting the `--trust-sender` flag. From d0a6f5aa9fedce484d9ee01c38abbea2a053ce2c Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Tue, 5 Dec 2023 11:12:26 -0700 Subject: [PATCH 899/946] auto close PR from fork repo to prevent custoemr submitting PRs --- .github/workflows/close-pulls.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/close-pulls.yml diff --git a/.github/workflows/close-pulls.yml b/.github/workflows/close-pulls.yml new file mode 100644 index 000000000..ab3126b25 --- /dev/null +++ b/.github/workflows/close-pulls.yml @@ -0,0 +1,21 @@ +--- +name: Auto Close Pull Requests + +on: + schedule: + - cron: '0 * * * *' + +jobs: + close-fork-pulls: + runs-on: ubuntu-latest + + steps: + - name: Close Pull Requests + uses: peter-evans/close-fork-pulls@v2 + with: + comment: | + As of 2023-11-30 we have stopped this 2-way sync so that our internal repository becomes the source of truth for the backup-utils source code. With the the 2-way sync stopped, this public repository will be used to host documentation about backup-utils and to publish new versions of backup-utils. You will be able to access a specific version of backup-utils (which includes the full source code) from the [release page](https://github.com/github/backup-utils/releases) of this repository. + + Customers should no longer open pull requests in this repository. These pull requests will not be reviewed or merged. We will automatically close all PRs opened in this repository. + + Customers cannot open issues in this repository. Instead, customers will need to follow the standard support process and open a support ticket for any questions/concerns/problems with backup-utils. This will ensure all customer requests are handled consistently. From 2b993ac3bd90430513cbf050178546dd012526e3 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Tue, 5 Dec 2023 11:45:34 -0700 Subject: [PATCH 900/946] Update with comments --- .github/workflows/close-pulls.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/close-pulls.yml b/.github/workflows/close-pulls.yml index ab3126b25..24f0391ba 100644 --- a/.github/workflows/close-pulls.yml +++ b/.github/workflows/close-pulls.yml @@ -14,7 +14,7 @@ jobs: uses: peter-evans/close-fork-pulls@v2 with: comment: | - As of 2023-11-30 we have stopped this 2-way sync so that our internal repository becomes the source of truth for the backup-utils source code. With the the 2-way sync stopped, this public repository will be used to host documentation about backup-utils and to publish new versions of backup-utils. You will be able to access a specific version of backup-utils (which includes the full source code) from the [release page](https://github.com/github/backup-utils/releases) of this repository. + As of 2023-11-30 we have stopped the 2-way sync between this repository and our internal repository, so that our internal repository becomes the source of truth for the backup-utils source code. With the the 2-way sync stopped, this public repository will be used to host documentation about backup-utils and to publish new versions of backup-utils. You will be able to access a specific version of backup-utils (which includes the full source code) from the [release page](https://github.com/github/backup-utils/releases) of this repository. Customers should no longer open pull requests in this repository. These pull requests will not be reviewed or merged. We will automatically close all PRs opened in this repository. From e4f3ae78261da0b1ec9ce5ebd437db14637b5848 Mon Sep 17 00:00:00 2001 From: "release-controller[bot]" Date: Thu, 15 Feb 2024 22:34:51 +0000 Subject: [PATCH 901/946] 3.12.0 release --- docs/getting-started.md | 2 +- docs/requirements.md | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 02f2cbe9b..ac85e5073 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -1,6 +1,6 @@ # Getting started - 1. [Download the latest release version][1] and extract the repository using `tar`: + 1. [Download the latest version of backup-utils][1] and extract the repository using `tar`: `tar -xzvf /path/to/github-backup-utils-vMAJOR.MINOR.PATCH.tar.gz` diff --git a/docs/requirements.md b/docs/requirements.md index 27e490fc3..6fa54e567 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -7,12 +7,10 @@ storage and must have network connectivity with the GitHub Enterprise Server app Backup host software requirements are modest: Linux or other modern Unix operating system (Ubuntu is highly recommended) with [bash][1], [git][2] 1.7.6 or newer, [OpenSSH][3] 5.6 or newer, [rsync][4] v2.6.4 or newer* (see [below](april-2023-update-of-rsync-requirements) for exceptions), [jq][11] v1.5 or newer and [bc][12] v1.0.7 or newer. See below for an update on rsync. -Ubuntu is the operating system we use to test `backup-utils` and it’s what we recommend you use too. You are welcome to use a different operating system, and we'll do our best to help you if you run into issues. But we can't guarantee that we'll be able to resolve issues that are specific to that operating system. - -Additionally, we encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. - The parallel backup and restore feature will require [GNU awk][10] and [moreutils][9] to be installed. +We encourage the use of [Docker](docker.md), as it ensures compatible versions of the aforementioned software are available to backup-utils. + The backup host must be able to establish outbound network connections to the GitHub appliance over SSH. TCP port 122 is used to backup GitHub Enterprise Server. CPU and memory requirements are dependent on the size of the GitHub Enterprise Server appliance. We recommend a minimum of 4 cores and 8GB of RAM for the host running [GitHub Enterprise Backup Utilities](https://github.com/github/backup-utils). We recommend monitoring the backup host's CPU and memory usage to ensure it is sufficient for your environment. @@ -67,23 +65,23 @@ Please avoid using an NFS mount for the data directory (where backup data is sto Starting with Backup Utilities v2.13.0, version support is inline with that of the [GitHub Enterprise Server upgrade requirements][8] and as such, support is limited to three versions of GitHub Enterprise Server: the version that corresponds with the version -of Backup Utilities, and the two releases prior to it. +of Backup Utilities, and the two versions prior to it. For example, Backup Utilities v2.13.0 can be used to backup and restore all patch -releases from 2.11.0 to the latest patch release of GitHub Enterprise Server 2.13. +versions from 2.11.0 to the latest patch version of GitHub Enterprise Server 2.13. Backup Utilities v2.14.0 will be released when GitHub Enterprise Server 2.14.0 is released -and will then be used to backup all releases of GitHub Enterprise Server from 2.12.0 -to the latest patch release of GitHub Enterprise Server 2.14. +and will then be used to backup all versions of GitHub Enterprise Server from 2.12.0 +to the latest patch version of GitHub Enterprise Server 2.14. Backup Utilities v2.11.4 and earlier offer support for GitHub Enterprise Server 2.10 -and earlier releases up to GitHub Enterprise Server 2.2.0. Backup Utilities v2.11.0 and earlier +and earlier versions up to GitHub Enterprise Server 2.2.0. Backup Utilities v2.11.0 and earlier offer support for GitHub Enterprise Server 2.1.0 and earlier. -**Note**: You can restore a snapshot that's at most two feature releases behind +**Note**: You can restore a snapshot that's at most two feature versions behind the restore target's version of GitHub Enterprise Server. For example, to restore a snapshot of GitHub Enterprise Server 2.11, the target GitHub Enterprise Server appliance must be running GitHub Enterprise Server 2.12.x or 2.13.x. You can't restore a snapshot from -2.10 to 2.13, because that's three releases ahead. +2.10 to 2.13, because that's three versions ahead. **Note**: You _cannot_ restore a backup created from a newer version of GitHub Enterprise Server to an older version. For example, an attempt to restore a snapshot of GitHub Enterprise Server 2.21 to a GitHub Enterprise Server 2.20 environment will fail with an error of `Error: Snapshot can not be restored to an older release of GitHub Enterprise Server.`. From 9a8c195637871a17b0f670d7c8f6e28482714fa2 Mon Sep 17 00:00:00 2001 From: Hao Jiang Date: Tue, 19 Mar 2024 17:47:46 -0600 Subject: [PATCH 902/946] Remove code from backup-utils --- CONTRIBUTING.md | 12 - Dockerfile | 76 -- Dockerfile.alpine | 20 - LICENSE | 20 - Makefile | 27 - STYLEGUIDE.md | 250 ---- backup.config-example | 123 -- bin/ghe-backup | 406 ------ bin/ghe-backup-progress | 56 - bin/ghe-host-check | 265 ---- bin/ghe-restore | 727 ----------- debian/changelog | 666 ---------- debian/clean | 1 - debian/compat | 1 - debian/control | 32 - debian/copyright | 33 - debian/install | 2 - debian/manpages | 1 - debian/rules | 18 - debian/source/format | 1 - ownership.yaml | 29 - release-notes/3.11.0.md | 18 - script/package-deb | 42 - script/package-tarball | 42 - script/release | 506 -------- script/test | 28 - share/github-backup-utils/bm.sh | 63 - share/github-backup-utils/ghe-backup-actions | 51 - share/github-backup-utils/ghe-backup-config | 708 ----------- .../ghe-backup-es-audit-log | 58 - share/github-backup-utils/ghe-backup-es-rsync | 86 -- share/github-backup-utils/ghe-backup-fsck | 91 -- .../github-backup-utils/ghe-backup-git-hooks | 114 -- share/github-backup-utils/ghe-backup-minio | 55 - share/github-backup-utils/ghe-backup-mssql | 363 ------ share/github-backup-utils/ghe-backup-mysql | 48 - .../ghe-backup-mysql-binary | 60 - .../ghe-backup-mysql-logical | 27 - share/github-backup-utils/ghe-backup-pages | 89 -- share/github-backup-utils/ghe-backup-redis | 55 - .../ghe-backup-repositories | 407 ------ share/github-backup-utils/ghe-backup-secrets | 186 --- share/github-backup-utils/ghe-backup-settings | 50 - share/github-backup-utils/ghe-backup-storage | 179 --- .../ghe-backup-store-version | 23 - share/github-backup-utils/ghe-backup-strategy | 20 - share/github-backup-utils/ghe-backup-userdata | 64 - .../ghe-cluster-find-nodes | 41 - .../ghe-detect-leaked-ssh-keys | 140 --- share/github-backup-utils/ghe-docker-init | 12 - share/github-backup-utils/ghe-gc-disable | 42 - share/github-backup-utils/ghe-gc-enable | 35 - .../ghe-incremental-backup-restore | 380 ------ .../ghe-maintenance-mode-status | 30 - share/github-backup-utils/ghe-prune-snapshots | 130 -- share/github-backup-utils/ghe-restore-actions | 68 - .../ghe-restore-es-audit-log | 76 -- .../github-backup-utils/ghe-restore-es-rsync | 49 - ...tore-external-database-compatibility-check | 44 - .../github-backup-utils/ghe-restore-git-hooks | 99 -- share/github-backup-utils/ghe-restore-minio | 57 - share/github-backup-utils/ghe-restore-mssql | 91 -- share/github-backup-utils/ghe-restore-mysql | 82 -- .../ghe-restore-mysql-binary | 125 -- .../ghe-restore-mysql-legacy | 55 - .../ghe-restore-mysql-logical | 52 - share/github-backup-utils/ghe-restore-pages | 166 --- share/github-backup-utils/ghe-restore-redis | 26 - .../ghe-restore-repositories | 248 ---- .../ghe-restore-repositories-gist | 175 --- share/github-backup-utils/ghe-restore-secrets | 146 --- .../github-backup-utils/ghe-restore-settings | 52 - .../ghe-restore-snapshot-path | 32 - .../github-backup-utils/ghe-restore-ssh-keys | 28 - share/github-backup-utils/ghe-restore-storage | 181 --- share/github-backup-utils/ghe-rsync | 72 -- .../ghe-rsync-feature-checker | 47 - share/github-backup-utils/ghe-rsync-size | 106 -- share/github-backup-utils/ghe-ssh | 86 -- share/github-backup-utils/ghe-ssh-config | 86 -- .../ghe-ssh-leaked-host-keys-list.txt | 531 -------- share/github-backup-utils/requirements.txt | 3 - share/github-backup-utils/track-progress | 18 - share/github-backup-utils/version | 1 - test/STYLEGUIDE.md | 36 - test/backup.config | 11 - test/bin/chown | 1 - test/bin/cron | 1 - test/bin/curl | 22 - test/bin/dgit-cluster-backup-routes | 31 - test/bin/dgit-cluster-restore-finalize | 1 - test/bin/dgit-cluster-restore-routes | 9 - test/bin/dpages-cluster-restore-finalize | 1 - test/bin/dpages-cluster-restore-routes | 9 - test/bin/enterprise-configure | 6 - test/bin/ghe-actions-console | 1 - test/bin/ghe-actions-start | 1 - test/bin/ghe-actions-stop | 1 - test/bin/ghe-cluster-config-apply | 6 - test/bin/ghe-cluster-config-update | 6 - test/bin/ghe-cluster-each | 35 - test/bin/ghe-cluster-host-check | 5 - test/bin/ghe-cluster-nodes | 41 - test/bin/ghe-config | 18 - test/bin/ghe-config-apply | 6 - test/bin/ghe-dpages | 1 - test/bin/ghe-es-load-json | 5 - test/bin/ghe-es-remove-1x-indices | 1 - test/bin/ghe-es-snapshot | 6 - test/bin/ghe-export-authorized-keys | 1 - test/bin/ghe-export-mssql | 1 - test/bin/ghe-export-mysql | 1 - test/bin/ghe-export-redis | 1 - test/bin/ghe-export-settings | 1 - test/bin/ghe-export-ssh-host-keys | 18 - test/bin/ghe-export-ssl-ca-certificates | 1 - test/bin/ghe-fake-export-command | 6 - test/bin/ghe-fake-finalize-command | 16 - test/bin/ghe-fake-import-command | 6 - test/bin/ghe-fake-true | 4 - test/bin/ghe-hook-env-update | 11 - test/bin/ghe-import-authorized-keys | 1 - test/bin/ghe-import-license | 1 - test/bin/ghe-import-mssql | 1 - test/bin/ghe-import-mysql | 1 - test/bin/ghe-import-mysql-mysqldump | 1 - test/bin/ghe-import-mysql-xtrabackup | 1 - test/bin/ghe-import-redis | 1 - test/bin/ghe-import-settings | 1 - test/bin/ghe-import-ssh-host-keys | 1 - test/bin/ghe-import-ssl-ca-certificates | 1 - test/bin/ghe-maintenance | 1 - test/bin/ghe-mssql-console | 21 - test/bin/ghe-negotiate-version | 7 - test/bin/ghe-nomad-cleanup | 5 - test/bin/ghe-nomad-jobs | 7 - test/bin/ghe-redis-cli | 37 - test/bin/ghe-reset-gh-connect | 1 - test/bin/ghe-service-ensure-elasticsearch | 6 - test/bin/ghe-service-ensure-mysql | 6 - test/bin/ghe-service-wait-mysql | 6 - test/bin/ghe-spokes | 16 - test/bin/ghe-storage | 1 - test/bin/gist-cluster-restore-finalize | 1 - test/bin/gist-cluster-restore-routes | 9 - test/bin/github-env | 1 - test/bin/ionice-stub | 3 - test/bin/nomad | 6 - test/bin/python | 28 - test/bin/service | 1 - test/bin/ssh | 51 - test/bin/storage-cluster-backup-routes | 10 - test/bin/storage-cluster-restore-finalize | 1 - test/bin/storage-cluster-restore-routes | 10 - test/bin/systemctl | 1 - test/cluster.conf | 65 - test/test-docker-build.sh | 63 - test/test-ghe-backup-config.sh | 227 ---- test/test-ghe-backup-parallel.sh | 12 - test/test-ghe-backup.sh | 1093 ----------------- test/test-ghe-cluster-find-nodes.sh | 41 - test/test-ghe-detect-leaked-ssh-keys.sh | 61 - test/test-ghe-host-check.sh | 124 -- test/test-ghe-incremental-restore.sh | 82 -- test/test-ghe-prune-snapshots.sh | 111 -- test/test-ghe-restore-external-database.sh | 194 --- test/test-ghe-restore-parallel.sh | 24 - test/test-ghe-restore.sh | 1022 --------------- test/test-ghe-rsync-feature-checker.sh | 156 --- test/test-ghe-ssh-config.sh | 103 -- test/test-ghe-ssh.sh | 53 - test/test-shellcheck.sh | 66 - test/testlib.sh | 730 ----------- 173 files changed, 14612 deletions(-) delete mode 100644 CONTRIBUTING.md delete mode 100644 Dockerfile delete mode 100644 Dockerfile.alpine delete mode 100644 LICENSE delete mode 100644 Makefile delete mode 100644 STYLEGUIDE.md delete mode 100644 backup.config-example delete mode 100755 bin/ghe-backup delete mode 100755 bin/ghe-backup-progress delete mode 100755 bin/ghe-host-check delete mode 100755 bin/ghe-restore delete mode 100644 debian/changelog delete mode 100644 debian/clean delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/install delete mode 100644 debian/manpages delete mode 100755 debian/rules delete mode 100644 debian/source/format delete mode 100644 ownership.yaml delete mode 100644 release-notes/3.11.0.md delete mode 100755 script/package-deb delete mode 100755 script/package-tarball delete mode 100755 script/release delete mode 100755 script/test delete mode 100755 share/github-backup-utils/bm.sh delete mode 100755 share/github-backup-utils/ghe-backup-actions delete mode 100755 share/github-backup-utils/ghe-backup-config delete mode 100755 share/github-backup-utils/ghe-backup-es-audit-log delete mode 100755 share/github-backup-utils/ghe-backup-es-rsync delete mode 100755 share/github-backup-utils/ghe-backup-fsck delete mode 100755 share/github-backup-utils/ghe-backup-git-hooks delete mode 100755 share/github-backup-utils/ghe-backup-minio delete mode 100755 share/github-backup-utils/ghe-backup-mssql delete mode 100755 share/github-backup-utils/ghe-backup-mysql delete mode 100755 share/github-backup-utils/ghe-backup-mysql-binary delete mode 100755 share/github-backup-utils/ghe-backup-mysql-logical delete mode 100755 share/github-backup-utils/ghe-backup-pages delete mode 100755 share/github-backup-utils/ghe-backup-redis delete mode 100755 share/github-backup-utils/ghe-backup-repositories delete mode 100755 share/github-backup-utils/ghe-backup-secrets delete mode 100755 share/github-backup-utils/ghe-backup-settings delete mode 100755 share/github-backup-utils/ghe-backup-storage delete mode 100755 share/github-backup-utils/ghe-backup-store-version delete mode 100755 share/github-backup-utils/ghe-backup-strategy delete mode 100755 share/github-backup-utils/ghe-backup-userdata delete mode 100755 share/github-backup-utils/ghe-cluster-find-nodes delete mode 100755 share/github-backup-utils/ghe-detect-leaked-ssh-keys delete mode 100755 share/github-backup-utils/ghe-docker-init delete mode 100755 share/github-backup-utils/ghe-gc-disable delete mode 100755 share/github-backup-utils/ghe-gc-enable delete mode 100644 share/github-backup-utils/ghe-incremental-backup-restore delete mode 100755 share/github-backup-utils/ghe-maintenance-mode-status delete mode 100755 share/github-backup-utils/ghe-prune-snapshots delete mode 100755 share/github-backup-utils/ghe-restore-actions delete mode 100755 share/github-backup-utils/ghe-restore-es-audit-log delete mode 100755 share/github-backup-utils/ghe-restore-es-rsync delete mode 100755 share/github-backup-utils/ghe-restore-external-database-compatibility-check delete mode 100755 share/github-backup-utils/ghe-restore-git-hooks delete mode 100755 share/github-backup-utils/ghe-restore-minio delete mode 100755 share/github-backup-utils/ghe-restore-mssql delete mode 100755 share/github-backup-utils/ghe-restore-mysql delete mode 100755 share/github-backup-utils/ghe-restore-mysql-binary delete mode 100755 share/github-backup-utils/ghe-restore-mysql-legacy delete mode 100755 share/github-backup-utils/ghe-restore-mysql-logical delete mode 100755 share/github-backup-utils/ghe-restore-pages delete mode 100755 share/github-backup-utils/ghe-restore-redis delete mode 100755 share/github-backup-utils/ghe-restore-repositories delete mode 100755 share/github-backup-utils/ghe-restore-repositories-gist delete mode 100755 share/github-backup-utils/ghe-restore-secrets delete mode 100755 share/github-backup-utils/ghe-restore-settings delete mode 100755 share/github-backup-utils/ghe-restore-snapshot-path delete mode 100755 share/github-backup-utils/ghe-restore-ssh-keys delete mode 100755 share/github-backup-utils/ghe-restore-storage delete mode 100755 share/github-backup-utils/ghe-rsync delete mode 100755 share/github-backup-utils/ghe-rsync-feature-checker delete mode 100644 share/github-backup-utils/ghe-rsync-size delete mode 100755 share/github-backup-utils/ghe-ssh delete mode 100755 share/github-backup-utils/ghe-ssh-config delete mode 100644 share/github-backup-utils/ghe-ssh-leaked-host-keys-list.txt delete mode 100644 share/github-backup-utils/requirements.txt delete mode 100755 share/github-backup-utils/track-progress delete mode 100644 share/github-backup-utils/version delete mode 100644 test/STYLEGUIDE.md delete mode 100644 test/backup.config delete mode 120000 test/bin/chown delete mode 120000 test/bin/cron delete mode 100755 test/bin/curl delete mode 100755 test/bin/dgit-cluster-backup-routes delete mode 120000 test/bin/dgit-cluster-restore-finalize delete mode 100755 test/bin/dgit-cluster-restore-routes delete mode 120000 test/bin/dpages-cluster-restore-finalize delete mode 100755 test/bin/dpages-cluster-restore-routes delete mode 100755 test/bin/enterprise-configure delete mode 100755 test/bin/ghe-actions-console delete mode 120000 test/bin/ghe-actions-start delete mode 120000 test/bin/ghe-actions-stop delete mode 100755 test/bin/ghe-cluster-config-apply delete mode 100755 test/bin/ghe-cluster-config-update delete mode 100755 test/bin/ghe-cluster-each delete mode 100755 test/bin/ghe-cluster-host-check delete mode 100755 test/bin/ghe-cluster-nodes delete mode 100755 test/bin/ghe-config delete mode 100755 test/bin/ghe-config-apply delete mode 120000 test/bin/ghe-dpages delete mode 100755 test/bin/ghe-es-load-json delete mode 120000 test/bin/ghe-es-remove-1x-indices delete mode 100755 test/bin/ghe-es-snapshot delete mode 120000 test/bin/ghe-export-authorized-keys delete mode 120000 test/bin/ghe-export-mssql delete mode 120000 test/bin/ghe-export-mysql delete mode 120000 test/bin/ghe-export-redis delete mode 120000 test/bin/ghe-export-settings delete mode 100755 test/bin/ghe-export-ssh-host-keys delete mode 120000 test/bin/ghe-export-ssl-ca-certificates delete mode 100755 test/bin/ghe-fake-export-command delete mode 100755 test/bin/ghe-fake-finalize-command delete mode 100755 test/bin/ghe-fake-import-command delete mode 100755 test/bin/ghe-fake-true delete mode 100755 test/bin/ghe-hook-env-update delete mode 120000 test/bin/ghe-import-authorized-keys delete mode 120000 test/bin/ghe-import-license delete mode 120000 test/bin/ghe-import-mssql delete mode 120000 test/bin/ghe-import-mysql delete mode 120000 test/bin/ghe-import-mysql-mysqldump delete mode 120000 test/bin/ghe-import-mysql-xtrabackup delete mode 120000 test/bin/ghe-import-redis delete mode 120000 test/bin/ghe-import-settings delete mode 120000 test/bin/ghe-import-ssh-host-keys delete mode 120000 test/bin/ghe-import-ssl-ca-certificates delete mode 120000 test/bin/ghe-maintenance delete mode 100755 test/bin/ghe-mssql-console delete mode 100755 test/bin/ghe-negotiate-version delete mode 100755 test/bin/ghe-nomad-cleanup delete mode 100755 test/bin/ghe-nomad-jobs delete mode 100755 test/bin/ghe-redis-cli delete mode 120000 test/bin/ghe-reset-gh-connect delete mode 100755 test/bin/ghe-service-ensure-elasticsearch delete mode 100755 test/bin/ghe-service-ensure-mysql delete mode 100755 test/bin/ghe-service-wait-mysql delete mode 100755 test/bin/ghe-spokes delete mode 120000 test/bin/ghe-storage delete mode 120000 test/bin/gist-cluster-restore-finalize delete mode 100755 test/bin/gist-cluster-restore-routes delete mode 120000 test/bin/github-env delete mode 100755 test/bin/ionice-stub delete mode 100755 test/bin/nomad delete mode 100755 test/bin/python delete mode 120000 test/bin/service delete mode 100755 test/bin/ssh delete mode 100755 test/bin/storage-cluster-backup-routes delete mode 120000 test/bin/storage-cluster-restore-finalize delete mode 100755 test/bin/storage-cluster-restore-routes delete mode 120000 test/bin/systemctl delete mode 100644 test/cluster.conf delete mode 100755 test/test-docker-build.sh delete mode 100755 test/test-ghe-backup-config.sh delete mode 100755 test/test-ghe-backup-parallel.sh delete mode 100755 test/test-ghe-backup.sh delete mode 100755 test/test-ghe-cluster-find-nodes.sh delete mode 100755 test/test-ghe-detect-leaked-ssh-keys.sh delete mode 100755 test/test-ghe-host-check.sh delete mode 100755 test/test-ghe-incremental-restore.sh delete mode 100755 test/test-ghe-prune-snapshots.sh delete mode 100755 test/test-ghe-restore-external-database.sh delete mode 100755 test/test-ghe-restore-parallel.sh delete mode 100755 test/test-ghe-restore.sh delete mode 100755 test/test-ghe-rsync-feature-checker.sh delete mode 100755 test/test-ghe-ssh-config.sh delete mode 100755 test/test-ghe-ssh.sh delete mode 100755 test/test-shellcheck.sh delete mode 100755 test/testlib.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 042d7c71a..000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,12 +0,0 @@ -# Contributing - -Looking to contribute something to this project? That is great, we always appreciate pull requests! Here's how you can help: - -1. Fork the project to your account. -2. Clone the fork (`git clone https://github.com/[username]/backup-utils.git`). -3. Create a new feature branch (`git checkout -b my-feature-branch`). -4. Add and then commit your changes (`git commit -am "Add a new backup endpoint."`). -5. Push your feature branch to GitHub.com (`git push -u origin my-feature-branch`). -6. Open a [Pull Request](https://github.com/github/backup-utils/compare/) and wait for our feedback. - -Have a look at the [styleguide](https://github.com/github/backup-utils/tree/master/STYLEGUIDE.md) to make sure your code style is consistent with the code in this repository. diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 710cb9d52..000000000 --- a/Dockerfile +++ /dev/null @@ -1,76 +0,0 @@ -# Multi stage build for backup-utils -# Build layer is for compiling rsync from source -# Runtime layer is for running backup-utils -# https://docs.docker.com/develop/develop-images/multistage-build/ -# https://docs.docker.com/engine/userguide/eng-image/multistage-build/ - -# Build layer -FROM ubuntu:focal AS build - -# Install build dependencies -RUN apt-get update && apt-get install --no-install-recommends -y \ - gcc \ - g++ \ - gawk \ - autoconf \ - make \ - automake \ - python3-cmarkgfm \ - acl \ - libacl1-dev \ - attr \ - libattr1-dev \ - libxxhash-dev \ - libzstd-dev \ - liblz4-dev \ - libssl-dev \ - git \ - jq \ - bc \ - curl \ - tar \ - gzip \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -# Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag -ARG RSYNC_TAG=v3.2.7 -RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz -RUN mkdir -p /rsync-${RSYNC_TAG}&& tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} --strip-components=1 && ls -la -# Change to the working directory of the rsync source -WORKDIR /rsync-${RSYNC_TAG} -RUN ls -la && ./configure -RUN make -RUN make install - -# Reset working directory -WORKDIR / - -# Runtime layer -FROM ubuntu:focal AS runtime - -# Install runtime dependencies - bash, git, OpenSSH 5.6 or newer, and jq v1.5 or newer. -RUN apt-get update && apt-get install --no-install-recommends -y \ - bash \ - git \ - openssh-client \ - jq \ - bc \ - moreutils \ - gawk \ - ca-certificates \ - xxhash \ - && rm -rf /var/lib/apt/lists/* - -# Copy rsync from build layer -COPY --from=build /usr/local/bin/rsync /usr/local/bin/rsync - -# Copy backup-utils from repository into /backup-utils -COPY ./ /backup-utils/ - -WORKDIR /backup-utils - -RUN chmod +x /backup-utils/share/github-backup-utils/ghe-docker-init - -ENTRYPOINT ["/backup-utils/share/github-backup-utils/ghe-docker-init"] -CMD ["ghe-host-check"] diff --git a/Dockerfile.alpine b/Dockerfile.alpine deleted file mode 100644 index 2c21bf2cd..000000000 --- a/Dockerfile.alpine +++ /dev/null @@ -1,20 +0,0 @@ -FROM alpine:latest - -RUN apk --update --no-cache add \ - tar \ - rsync \ - ca-certificates \ - openssh \ - git \ - bash \ - gawk \ - procps \ - coreutils - -COPY ./ /backup-utils/ -WORKDIR /backup-utils - -RUN chmod +x /backup-utils/share/github-backup-utils/ghe-docker-init - -ENTRYPOINT ["/backup-utils/share/github-backup-utils/ghe-docker-init"] -CMD ["ghe-host-check"] diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 4d231b456..000000000 --- a/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2014 GitHub Inc. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile deleted file mode 100644 index c8eaa0ff1..000000000 --- a/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -SHELL = /bin/sh - -test: info - @echo Running tests - @script/test - -info: - @echo This is github/backup-utils - @echo shell is $(shell ls -l $(SHELL) | sed 's@.*/bin/sh@/bin/sh@') - @rsync --version | head -1 - @echo - -dist: - @script/package-tarball - -deb: - @script/package-deb - -clean: - rm -rf dist - -# List pull requests that need to be merged into stable -# (helpful for the release notes) -pending-prs: - @git log stable...master | grep "Merge pull request" - -.PHONY: test info dist clean pending-prs diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md deleted file mode 100644 index 9c1fc1e86..000000000 --- a/STYLEGUIDE.md +++ /dev/null @@ -1,250 +0,0 @@ -## Bash Style Guide - -If you've not done much Bash development before you may find these debugging tips useful: http://wiki.bash-hackers.org/scripting/debuggingtips. - ---- -##### Scripts must start with `#!/usr/bin/env bash` - ---- -##### Use `set -e` - -If the return value of a command can be ignored, suffix it with `|| true`: - -```bash -set -e -command_that_might_fail || true -command_that_should_not_fail -``` - -Note that ignoring an exit status with `|| true` is not a good practice though. Generally speaking, it's better to handle the error. - ---- -##### Avoid manually checking exit status with `$?` - -Rely on `set -e` instead: - -```bash -cmd -if [ $? -eq 0 ]; then - echo worked -fi -``` - -should be written as: - -```bash -set -e -if cmd; then - echo worked -fi -``` - ---- -##### Include a usage, description and optional examples - -Use this format: - -```bash -#!/usr/bin/env bash -#/ Usage: ghe-this-is-my-script [options] -#/ -#/ This is a brief description of the script's purpose. -#/ -#/ OPTIONS: -#/ -h | --help Show this message. -#/ -l | --longopt An option. -#/ -c Another option. -#/ -#/ EXAMPLES: (optional section but nice to have when not trivial) -#/ -#/ This will do foo and bar: -#/ $ ghe-this-is-my-script --longopt foobar -c 2 -#/ -set -e -``` - -If there are no options or required arguments, the `OPTIONS` section can be ignored. - ---- -##### Customer-facing scripts must accept both -h and --help arguments - -They should also print the usage information and exit 2. - -For example: - -```bash -#!/usr/bin/env bash -#/ Usage: ghe-this-is-my-script [options] -#/ -#/ This is a brief description of the script's purpose. -set -e - -if [ "$1" = "--help" -o "$1" = "-h" ]; then - grep '^#/' <"$0" | cut -c 4- - exit 2 -fi - -``` - ---- -##### Avoid Bash arrays - -Main issues: - -* Portability -* Important bugs in Bash versions < 4.3 - ---- -##### Use `test` or `[` whenever possible - -```bash -test -f /etc/passwd -test -f /etc/passwd -a -f /etc/group -if [ "string" = "string" ]; then - true -fi -``` - ---- -##### Scripts may use `[[` for advanced bash features - -```bash -if [[ "$(hostname)" = *.iad.github.net ]]; then - true -fi -``` - ---- -##### Scripts may use Bash for loops - -Preferred: - -```bash -for i in $(seq 0 9); do -done -``` - -or: - -```bash -for ((n=0; n<10; n++)); do -done -``` - ---- -##### Use `$[x+y*z]` for mathematical expressions - -```bash -local n=1 -let n++ -n=$[n+1] # preferred -n=$[$n+1] -n=$((n+1)) -n=$(($n+1)) -``` - ---- -##### Use variables sparingly - -Short paths and other constants should be repeated liberally throughout code since they -can be search/replaced easily if they ever change. - -```bash -DATA_DB_PATH=/data/user/db -mkdir -p $DATA_DB_PATH -rsync $DATA_DB_PATH remote:$DATA_DB_PATH -``` - -versus the much more readable: - -```bash -mkdir -p /data/user/db -rsync /data/user/db remote:/data/user/db -``` - ---- -##### Use lowercase and uppercase variable names - -Use lowercase variables for locals and internal variables, and uppercase for variables inherited or exported via the environment - -```bash -#!/usr/bin/env bash -#/ Usage: [DEBUG=0] process_repo -nwo=$1 -[ -n $DEBUG ] && echo "** processing $nwo" >&2 - -export GIT_DIR=/data/repos/$nwo.git -git rev-list -``` - ---- -##### Use `${var}` for interpolation only when required - -```bash -greeting=hello -echo $greeting -echo ${greeting}world -``` - ---- -##### Use functions sparingly, opting for small/simple/sequential scripts instead whenever possible - -When defining functions, use the following style: - -```bash -my_function() { - local arg1=$1 - [ -n $arg1 ] || return - ... -} -``` - ---- -##### Use `< /etc/foo # interpolated before ssh - chmod 0600 /etc/foo -eof -``` - ---- -##### Quote variables that could reasonably have a space now or in the future - -```bash -if [ ! -z "$packages" ]; then - true -fi -``` - ---- -##### Use two space indentation - ---- -##### Scripts should not produce errors or warnings when checked with ShellCheck - -Use inline comments to disable specific tests, and explain why the test has been disabled. - -```bash -hexToAscii() { - # shellcheck disable=SC2059 # $1 needs to be interpreted as a formatted string - printf "\x$1" -} -``` - -### Testing - -See [the style guide](https://github.com/github/backup-utils/blob/master/test/STYLEGUIDE.md) diff --git a/backup.config-example b/backup.config-example deleted file mode 100644 index 535a2f636..000000000 --- a/backup.config-example +++ /dev/null @@ -1,123 +0,0 @@ -# GitHub Enterprise Server backup configuration file - -# The hostname of the GitHub Enterprise Server appliance to back up. The host -# must be reachable via SSH from the backup host. -GHE_HOSTNAME="github.example.com" - -# Path to where backup data is stored. By default this is the "data" -# directory next to this file but can be set to an absolute path -# elsewhere for backing up to a separate partition / mount point. -GHE_DATA_DIR="data" - -# The number of backup snapshots to retain. Old snapshots are pruned after each -# successful ghe-backup run. This option should be tuned based on the frequency -# of scheduled backup runs. If backups are scheduled hourly, snapshots will be -# available for the past N hours; if backups are scheduled daily, snapshots will -# be available for the past N days ... -GHE_NUM_SNAPSHOTS=10 - -# Pruning snapshots can be scheduled outside of the backup process. -# If set to 'yes', snapshots will not be pruned by ghe-backup. -# Instead, ghe-pruning-snapshots will need to be invoked separately via cron -#GHE_PRUNING_SCHEDULED=yes - -# If --incremental is used to generate incremental MySQL backups with ghe-backup, -# then you need to specify how many cycles of full and incremental backups will be -# performed before the next full backup is created. -# For example, if `GHE_INCREMENTAL_BACKUP_MAX` is set to 14, backup-utils will -# run 1 full backup and then 13 incremental backups before performing another full backup on the next cycle. -#GHE_INCREMENTAL_MAX_BACKUPS=14 - -# If GHE_SKIP_CHECKS is set to true (or if --skip-checks is used with ghe-backup) then ghe-host-check -# disk space validation and software version checks on the backup-host will be disabled. -#GHE_SKIP_CHECKS=false - -# The hostname of the GitHub appliance to restore. If you've set up a separate -# GitHub appliance to act as a standby for recovery, specify its IP or hostname -# here. The host to restore to may also be specified directly when running -# ghe-restore so use of this variable isn't strictly required. -# -#GHE_RESTORE_HOST="github-standby.example.com" - -# If set to 'yes', ghe-restore will omit the restore of audit logs. -# -#GHE_RESTORE_SKIP_AUDIT_LOGS=no - -# When verbose output is enabled with `-v`, it's written to stdout by default. If -# you'd prefer it to be written to a separate file, set this option. -# -#GHE_VERBOSE_LOG="/var/log/backup-verbose.log" - -# Any extra options passed to the SSH command. -# In a single instance environment, nothing is required by default. -# In a clustering environment, "-i abs-path-to-ssh-private-key" is required. -# -#GHE_EXTRA_SSH_OPTS="" - -# Any extra options passed to the rsync command. Nothing required by default. -# -#GHE_EXTRA_RSYNC_OPTS="" - -# If set to 'yes', rsync will be set to use compression during backups and restores transfers. Defaults to 'no'. -# -#GHE_RSYNC_COMPRESSION_ENABLED=yes - -# If enabled and set to 'no', rsync warning message during backups will be suppressed. -#RSYNC_WARNING=no - - -# If set to 'yes', logging output will be colorized. -# -#OUTPUT_COLOR=no - -# If set to 'no', GHE_DATA_DIR will not be created automatically -# and restore/backup will exit 8 -# -#GHE_CREATE_DATA_DIR=yes - -# If set to 'yes', git fsck will run on the repositories -# and print some additional info. -# -# WARNING: do not enable this, only useful for debugging/development -#GHE_BACKUP_FSCK=no - -# Cadence of MSSQL backups -# ,, all in minutes -# e.g. -# - Full backup every week (10080 minutes) -# - Differential backup every day (1440 minutes) -# - Transactionlog backup every 15 minutes -# -#GHE_MSSQL_BACKUP_CADENCE=10080,1440,15 - -# If set to 'yes', ghe-backup jobs will run in parallel. Defaults to 'no'. -# -#GHE_PARALLEL_ENABLED=yes - -# Sets the maximum number of jobs to run in parallel. Defaults to the number -# of available processing units on the machine. -# -#GHE_PARALLEL_MAX_JOBS=2 - -# Sets the maximum number of rsync jobs to run in parallel. Defaults to the -# configured GHE_PARALLEL_MAX_JOBS, or the number of available processing -# units on the machine. -# -# GHE_PARALLEL_RSYNC_MAX_JOBS=3 - -# When jobs are running in parallel wait as needed to avoid starting new jobs -# when the system's load average is not below the specified percentage. Defaults to -# unrestricted. -# -#GHE_PARALLEL_MAX_LOAD=50 - -# When running an external mysql database, run this script to trigger a MySQL backup -# rather than attempting to backup via backup-utils directly. -#EXTERNAL_DATABASE_BACKUP_SCRIPT="/bin/false" - -# When running an external mysql database, run this script to trigger a MySQL restore -# rather than attempting to backup via backup-utils directly. -#EXTERNAL_DATABASE_RESTORE_SCRIPT="/bin/false" - -# If set to 'yes', Pages data will be included in backup and restore. Defaults to 'yes' -#GHE_BACKUP_PAGES=no diff --git a/bin/ghe-backup b/bin/ghe-backup deleted file mode 100755 index 448a5840e..000000000 --- a/bin/ghe-backup +++ /dev/null @@ -1,406 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup [-hv] [--version] -#/ -#/ Take snapshots of all GitHub Enterprise data, including Git repository data, -#/ the MySQL database, instance settings, GitHub Pages data, etc. -#/ -#/ OPTIONS: -#/ -v | --verbose Enable verbose output. -#/ -h | --help Show this message. -#/ --version Display version information. -#/ -i | --incremental Incremental backup -#/ --skip-checks Skip storage/sw version checks -#/ - -set -e - -# Parse arguments -while true; do - case "$1" in - -h|--help) - export GHE_SHOW_HELP=true - shift - ;; - --version) - export GHE_SHOW_VERSION=true - shift - ;; - -v|--verbose) - export GHE_VERBOSE=true - shift - ;; - -i|--incremental) - export GHE_INCREMENTAL=true - shift - ;; - --skip-checks) - export GHE_SKIP_CHECKS=true - shift - ;; - -*) - echo "Error: invalid argument: '$1'" 1>&2 - exit 1 - ;; - *) - break - ;; - esac -done - - -export CALLING_SCRIPT="ghe-backup" - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" - - -# Check to make sure moreutils parallel is installed and working properly -ghe_parallel_check - - -# Used to record failed backup steps -failures= -failures_file="$(mktemp -t backup-utils-backup-failures-XXXXXX)" - -# CPU and IO throttling to keep backups from thrashing around. -export GHE_NICE=${GHE_NICE:-"nice -n 19"} -export GHE_IONICE=${GHE_IONICE:-"ionice -c 3"} - -# Create the timestamped snapshot directory where files for this run will live, -# change into it, and mark the snapshot as incomplete by touching the -# 'incomplete' file. If the backup succeeds, this file will be removed -# signifying that the snapshot is complete. -mkdir -p "$GHE_SNAPSHOT_DIR" -cd "$GHE_SNAPSHOT_DIR" -touch "incomplete" - -# Exit early if the snapshot filesystem doesn't support hard links, symlinks and -# if rsync doesn't support hardlinking of dangling symlinks -trap 'rm -rf src dest1 dest2' EXIT -mkdir -p src -touch src/testfile -if ! ln -s /data/does/not/exist/hooks/ src/ >/dev/null 2>&1; then - log_error "Error: the filesystem containing $GHE_DATA_DIR does not support symbolic links. \nGit repositories contain symbolic links that need to be preserved during a backup." 1>&2 - exit 1 -fi - -if ! output=$(rsync -a src/ dest1 2>&1 && rsync -av src/ --link-dest=../dest1 dest2 2>&1); then - log_error "Error: rsync encountered an error that could indicate a problem with permissions,\n hard links, symbolic links, or another issue that may affect backups." 1>&2 - echo "$output" - exit 1 -fi - -if [ "$(stat -c %i dest1/testfile)" != "$(stat -c %i dest2/testfile)" ]; then - log_error "Error: the filesystem containing $GHE_DATA_DIR does not support hard links.\n Backup Utilities use hard links to store backup data efficiently." 1>&2 - exit 1 -fi -rm -rf src dest1 dest2 - -# 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. -# -# Set up a trap to remove the in-progress file if we exit for any reason but -# verify that we are the same process before doing so. -# -# The cleanup trap also handles disabling maintenance mode on the appliance if -# it was automatically enabled. -cleanup () { - if [ -f ../in-progress ]; then - progress=$(cat ../in-progress) - snapshot=$(echo "$progress" | cut -d ' ' -f 1) - pid=$(echo "$progress" | cut -d ' ' -f 2) - if [ "$snapshot" = "$GHE_SNAPSHOT_TIMESTAMP" ] && [ "$$" = "$pid" ]; then - unlink ../in-progress - fi - fi - - rm -rf "$failures_file" - rm -f "${GHE_DATA_DIR}/in-progress-backup" - rm -rf /tmp/backup-utils-progress/* - - # Cleanup SSH multiplexing - ghe-ssh --clean - - bm_end "$(basename $0)" -} - -# Setup exit traps -trap 'cleanup' EXIT -trap 'exit $?' INT # ^C always terminate - - -# Check to see if there is a running restore -ghe_restore_check - -# Check to see if there is a running backup -if [ -h ../in-progress ]; then - - log_error "Detected a backup already in progress from a previous version of ghe-backup. \nIf there is no backup in progress anymore, please remove \nthe $GHE_DATA_DIR/in-progress file." >&2 - exit 1 -fi - -if [ -f ../in-progress ]; then - progress=$(cat ../in-progress) - snapshot=$(echo "$progress" | cut -d ' ' -f 1) - pid=$(echo "$progress" | cut -d ' ' -f 2) - if ! ps -p "$pid" >/dev/null 2>&1; then - # We can safely remove in-progress, ghe-prune-snapshots - # will clean up the failed backup. - unlink ../in-progress - else - log_error "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid. \nIf PID $pid is not a process related to the backup utilities, please remove \nthe $GHE_DATA_DIR/in-progress file and try again." 1>&2 - exit 1 - fi -fi - -# Perform a host connection check and establish the remote appliance version. -# The version is available in the GHE_REMOTE_VERSION variable and also written -# to a version file in the snapshot directory itself. -# ghe_remote_version_required should be run before any other instances of ghe-ssh -# to ensure that there are no problems with host key verification. -ghe_remote_version_required -echo "$GHE_REMOTE_VERSION" > version - -# Setup progress tracking -init-progress -export PROGRESS_TOTAL=14 # Minimum number of steps in backup is 14 -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total -export PROGRESS_TYPE="Backup" -echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress/type -export PROGRESS=0 # Used to track progress of backup -echo "$PROGRESS" > /tmp/backup-utils-progress/progress - -OPTIONAL_STEPS=0 -# Backup actions+mssql -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 2)) -fi - -# Backup fsck -if [ "$GHE_BACKUP_FSCK" = "yes" ]; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi - -# Backup minio -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi - -# Backup pages -if [ "$GHE_BACKUP_PAGES" != "no" ]; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi - -PROGRESS_TOTAL=$((OPTIONAL_STEPS + PROGRESS_TOTAL)) # Minimum number of steps in backup is 14 -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total - -# check that incremental settings are valid if set -is_inc=$(is_incremental_backup_feature_on) - -if [ "$is_inc" = true ]; then -if [ "$GHE_VERSION_MAJOR" -lt 3 ]; then - log_error "Can only perform incremental backups on enterprise version 3.10 or higher" - exit 1 -fi -if [ "$GHE_VERSION_MINOR" -lt 10 ]; then - log_error "Can only perform incremental backups on enterprise version 3.10 or higher" - exit 1 -fi - - incremental_backup_check - # If everything is ok, check if we have hit GHE_MAX_INCREMENTAL_BACKUPS, performing pruning actions if necessary - check_for_incremental_max_backups - # initialize incremental backup if it hasn't been done yet - incremental_backup_init -fi - -echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress -echo "$GHE_SNAPSHOT_TIMESTAMP $$" > "${GHE_DATA_DIR}/in-progress-backup" - -bm_start "$(basename $0)" -START_TIME=$(date +%s) -log_info "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP" - - - -if [ -n "$GHE_ALLOW_REPLICA_BACKUP" ]; then - echo "Warning: backing up a high availability replica may result in inconsistent or unreliable backups." -fi - -# Output system information of the backup host - -# If /etc/os-release exists, use it to get the OS version -if [ -f /etc/os-release ]; then - OS_NAME=$(grep '^NAME' /etc/os-release | cut -d'"' -f2) - VERSION_ID=$(grep '^VERSION_ID' /etc/os-release | cut -d'"' -f2) - echo "Running on: $OS_NAME $VERSION_ID" -else - echo "Running on: Unknown OS" -fi - -# If nproc command exists, use it to get the number of CPUs -if command -v nproc >/dev/null 2>&1; then - echo "CPUs: $(nproc)" -else - echo "CPUs: Unknown" -fi - -# If the free command exists, use it to get the memory details -if command -v free >/dev/null 2>&1; then - echo "Memory $(free -m | grep '^Mem:' | awk '{print "total/used/free+share/buff/cache: " $2 "/" $3 "/" $4 "+" $5 "/" $6 "/" $7}')" -else - echo "Memory: Unknown" -fi - - -# Log backup start message in /var/log/syslog on remote instance -ghe_remote_logger "Starting backup from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP ..." - -export GHE_BACKUP_STRATEGY=${GHE_BACKUP_STRATEGY:-$(ghe-backup-strategy)} - -# Record the strategy with the snapshot so we will know how to restore. -echo "$GHE_BACKUP_STRATEGY" > strategy - -# Create benchmark file -bm_init > /dev/null - -ghe-backup-store-version || -log_warn "Warning: storing backup-utils version remotely failed." - -log_info "Backing up GitHub secrets ..." -ghe-backup-secrets || failures="$failures secrets" - -log_info "Backing up GitHub settings ..." -ghe-backup-settings || failures="$failures settings" - -log_info "Backing up SSH authorized keys ..." -bm_start "ghe-export-authorized-keys" -ghe-ssh "$GHE_HOSTNAME" -- 'ghe-export-authorized-keys' > authorized-keys.json || -failures="$failures authorized-keys" -bm_end "ghe-export-authorized-keys" - -log_info "Backing up SSH host keys ..." -bm_start "ghe-export-ssh-host-keys" -ghe-ssh "$GHE_HOSTNAME" -- 'ghe-export-ssh-host-keys' > ssh-host-keys.tar || -failures="$failures ssh-host-keys" -bm_end "ghe-export-ssh-host-keys" - -ghe-backup-mysql || failures="$failures mysql" - -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Backing up MSSQL databases ..." - ghe-backup-mssql 1>&3 || failures="$failures mssql" - - log_info "Backing up Actions data ..." - ghe-backup-actions 1>&3 || failures="$failures actions" -fi - -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - log_info "Backing up Minio data ..." - ghe-backup-minio 1>&3 || failures="$failures minio" -fi - -cmd_title=$(log_info "Backing up Redis database ...") -commands=(" -echo \"$cmd_title\" -ghe-backup-redis > redis.rdb || printf %s \"redis \" >> \"$failures_file\"") - -cmd_title=$(log_info "Backing up audit log ...") -commands+=(" -echo \"$cmd_title\" -ghe-backup-es-audit-log || printf %s \"audit-log \" >> \"$failures_file\"") - -cmd_title=$(log_info "Backing up Git repositories ...") -commands+=(" -echo \"$cmd_title\" -ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"") - -# Pages backups are skipped only if GHE_BACKUP_PAGES is explicitly set to 'no' to guarantee backward compatibility. -# If a customer upgrades backup-utils but keeps the config file from a previous version, Pages backups still work as expected. - -if [ "$GHE_BACKUP_PAGES" != "no" ]; then - cmd_title=$(log_info "Backing up GitHub Pages artifacts ...") - commands+=(" - echo \"$cmd_title\" - ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"") -fi - -cmd_title=$(log_info "Backing up storage data ...") -commands+=(" -echo \"$cmd_title\" -ghe-backup-storage || printf %s \"storage \" >> \"$failures_file\"") - -cmd_title=$(log_info "Backing up custom Git hooks ...") -commands+=(" -echo \"$cmd_title\" -ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"") - -if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then - increment-progress-total-count 1 - cmd_title=$(log_info "Backing up Elasticsearch indices ...") - commands+=(" - echo \"$cmd_title\" - ghe-backup-es-rsync || printf %s \"elasticsearch \" >> \"$failures_file\"") -fi - -if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - "$GHE_PARALLEL_COMMAND" "${GHE_PARALLEL_COMMAND_OPTIONS[@]}" -- "${commands[@]}" -else - for c in "${commands[@]}"; do - eval "$c" - done -fi - -if [ -s "$failures_file" ]; then - failures="$failures $(cat "$failures_file")" -fi - -# git fsck repositories after the backup -if [ "$GHE_BACKUP_FSCK" = "yes" ]; then - log_info "Running git fsck on repositories ..." - ghe-backup-fsck "$GHE_SNAPSHOT_DIR" || failures="$failures fsck" -fi - -# If everything was successful, mark the snapshot as complete, update the -# current symlink to point to the new snapshot and prune expired and failed -# snapshots. -if [ -z "$failures" ]; then - rm "incomplete" - - rm -f "../current" - ln -s "$GHE_SNAPSHOT_TIMESTAMP" "../current" - - if [[ $GHE_PRUNING_SCHEDULED != "yes" ]]; then - ghe-prune-snapshots - else - log_info "Expired and incomplete snapshots to be pruned separately" - fi -else - log_info "Skipping pruning snapshots, since some backups failed..." -fi - -END_TIME=$(date +%s) -log_info "Runtime: $((END_TIME - START_TIME)) seconds" -log_info "Completed backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP at $(date +"%H:%M:%S")" - -# Exit non-zero and list the steps that failed. -if [ -z "$failures" ]; then - ghe_remote_logger "Completed backup from $(hostname) / snapshot $GHE_SNAPSHOT_TIMESTAMP successfully." -else - steps="${failures// /, }" - ghe_remote_logger "Completed backup from $(hostname) / snapshot $GHE_SNAPSHOT_TIMESTAMP with failures: ${steps}." - log_error "Error: Snapshot incomplete. Some steps failed: ${steps}. " - ghe_backup_finished - exit 1 -fi - -# Detect if the created backup contains any leaked ssh keys -log_info "Checking for leaked ssh keys ..." -ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true - -log_info "Backup of $GHE_HOSTNAME finished." - -# Remove in-progress file -ghe_backup_finished diff --git a/bin/ghe-backup-progress b/bin/ghe-backup-progress deleted file mode 100755 index 7ab36e084..000000000 --- a/bin/ghe-backup-progress +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-progress [--once] -#/ Tracks the completed steps of a backup or restore operation. -#/ -#/ By default the progress is printed every continuously or until a key is pressed. -#/ Use the --once option to print the current progress once and exit. -#/ -#/ Options: -#/ --once Don't loop, just print the current progress once. -# -set -e - -while true; do - case "$1" in - -o|--once) - ONCE=1 - shift - ;; - -h|--help) - export GHE_SHOW_HELP=true - shift - ;; - -*) - echo "Unknown option: $1" >&2 - exit 1 - ;; - *) - break - ;; - esac -done - -check_for_progress_file() { - if [ ! -f /tmp/backup-utils-progress/info ]; then - echo "No progress file found. Has a backup or restore been started?" - exit 1 - fi -} - -if [ -n "$ONCE" ]; then - check_for_progress_file - cat /tmp/backup-utils-progress/info -else - check_for_progress_file - clear - cat /tmp/backup-utils-progress/info - while true; do - if read -r -t 1 -n 1; then - clear - exit ; - else - clear - cat /tmp/backup-utils-progress/info - fi - done -fi diff --git a/bin/ghe-host-check b/bin/ghe-host-check deleted file mode 100755 index 73a984c30..000000000 --- a/bin/ghe-host-check +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-host-check [-h] [--version] [] -#/ -#/ Verify connectivity with the GitHub Enterprise Server host. -#/ -#/ OPTIONS: -#/ -h | --help Show this message. -#/ --version Display version information. -#/ The GitHub Enterprise Server host to check. When no -#/ is provided, the $GHE_HOSTNAME configured in -#/ backup.config is assumed. -#/ - -set -e - -while true; do - case "$1" in - -h | --help) - export GHE_SHOW_HELP=true - shift - ;; - --version) - export GHE_SHOW_VERSION=true - shift - ;; - -*) - echo "Error: invalid argument: '$1'" 1>&2 - exit 1 - ;; - *) - break - ;; - esac -done - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-backup-config" - -# Use the host provided on the command line if provided, or fallback on the -# $GHE_HOSTNAME configured in backup.config when not present. -host="${1:-$GHE_HOSTNAME}" - -# Options to pass to SSH during connection check -options=" - -o PasswordAuthentication=no - -o ConnectTimeout=5 - -o ConnectionAttempts=1 -" - -# Split host:port into parts -port=$(ssh_port_part "$host") -hostname=$(ssh_host_part "$host") - -set +e -# ghe-negotiate-version verifies if the target is a GitHub Enterprise Server instance -output=$(echo "ghe-negotiate-version backup-utils $BACKUP_UTILS_VERSION" | ghe-ssh -o BatchMode=no $options $host -- /bin/sh 2>&1) -rc=$? -set -e - -if [ $rc -ne 0 ]; then - case $rc in - 255) - 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 - exec "$(basename $0)" "$hostname:122" - fi - - echo "$output" 1>&2 - echo "Error: ssh connection with '$host' failed" 1>&2 - echo "Note that your SSH key needs to be setup on $host as described in:" 1>&2 - echo "* https://docs.github.com/enterprise-server/admin/configuration/configuring-your-enterprise/accessing-the-administrative-shell-ssh" 1>&2 - ;; - 101) - echo "Error: couldn't read GitHub Enterprise Server fingerprint on '$host' or this isn't a GitHub appliance." 1>&2 - ;; - 1) - if [ "${port:-22}" -eq 22 ] && echo "$output" | grep "use port 122" >/dev/null; then - exec "$(basename $0)" "$hostname:122" - else - echo "$output" 1>&2 - fi - ;; - - esac - exit $rc -fi - -CLUSTER=false -if ghe-ssh "$host" -- \ - "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ]"; then - CLUSTER=true -fi - -# ensure all nodes in the cluster are online/reachable and running the same version -if "$CLUSTER"; then - online_status=$(ghe-ssh "$host" ghe-cluster-host-check) - if [ "$online_status" != "Cluster is ready to configure." ]; then - echo "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2 - exit 1 - fi - - node_version_list=$(ghe-ssh "$host" ghe-cluster-each -- ghe-version) - distinct_versions=$(echo "$node_version_list" | awk '{split($0, a, ":"); print a[2]}' | awk '{print $4}' | uniq | wc -l) - if [ "$distinct_versions" -ne 1 ]; then - echo "Version mismatch: $node_version_list" 1>&2 - echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2 - exit 1 - fi -fi - -version=$(echo "$output" | grep "GitHub Enterprise" | awk '{print $NF}') - -if [ -z "$version" ]; then - echo "Error: failed to parse version on '$host' or this isn't a GitHub appliance." 1>&2 - exit 2 -fi - -# Block restoring snapshots to older releases of GitHub Enterprise Server -if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then - snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version) - # shellcheck disable=SC2046 # Word splitting is required to populate the variables - read -r snapshot_version_major snapshot_version_minor _ <<<$(ghe_parse_version $snapshot_version) - if [ "$(version $GHE_REMOTE_VERSION)" -lt "$(version $snapshot_version_major.$snapshot_version_minor.0)" ]; then - echo "Error: Snapshot can not be restored to an older release of GitHub Enterprise Server." >&2 - exit 1 - fi -fi - -if [ -z "$GHE_ALLOW_REPLICA_BACKUP" ]; then - if [ "$(ghe-ssh $host -- cat $GHE_REMOTE_ROOT_DIR/etc/github/repl-state 2>/dev/null || true)" = "replica" ]; then - echo "Error: high availability replica detected." 1>&2 - echo "Backup Utilities should be used to backup from the primary node in" 1>&2 - echo "high availability environments to ensure consistent and reliable backups." 1>&2 - exit 1 - fi -fi - -# backup-utils 2.13 onwards limits support to the current and previous two releases -# of GitHub Enterprise Server. -supported_minimum_version="3.9.0" - -if [ "$(version $version)" -ge "$(version $supported_minimum_version)" ]; then - supported=1 -fi - -if [ -z "$supported" ]; then - echo "Error: unsupported release of GitHub Enterprise Server detected." 1>&2 - echo "Backup Utilities v$BACKUP_UTILS_VERSION requires GitHub Enterprise Server v$supported_minimum_version or newer." 1>&2 - echo "Please update your GitHub Enterprise Server appliance or use an older version of Backup Utilities." 1>&2 - exit 1 -fi - -if [[ "$CALLING_SCRIPT" == "ghe-backup" && "$GHE_SKIP_CHECKS" != "true" ]]; then - cat << SKIP_MSG -**You can disable the following storage & version checks by running ghe-backup with option "--skip-checks" -OR updating GHE_SKIP_CHECKS to 'true' in your backup.config file. - -SKIP_MSG - - # Bring in the requirements file - min_rsync="" - min_openssh="" - min_jq="" - # shellcheck source=share/github-backup-utils/requirements.txt - . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt" - - #source disk size file - # shellcheck source=share/github-backup-utils/ghe-rsync-size - . "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size" - - #Check if GHE_DATA_DIR is NFS mounted - fs_info=$(stat -f -c "%T" "$GHE_DATA_DIR") || true - if [ "$fs_info" == "nfs" ]; then - echo "Warning: NFS (Network File System) detected for $GHE_DATA_DIR" 1>&2 - echo "Please review https://gh.io/backup-utils-storage-requirements for details." 1>&2 - fi - - #Display dir requirements for repositories and mysql - echo -e "\nChecking host for sufficient space for a backup..." - available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}') - echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." - - repos_disk_size=$(transfer_size repositories /tmp) - pages_disk_size=$(transfer_size pages /tmp) - es_disk_size=$(transfer_size elasticsearch /tmp) - stor_disk_size=$(transfer_size storage /tmp) - minio_disk_size=$(transfer_size minio /tmp) - mysql_disk_size=$(transfer_size mysql /tmp) - actions_disk_size=$(transfer_size actions /tmp) - mssql_disk_size=$(transfer_size mssql /tmp) - - min_disk_req=$((repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size)) - recommended_disk_req=$((min_disk_req * 5)) - echo " - Available space: $((available_space / (1024 ** 2))) MB" - echo " - Min Disk required for this backup is at least $min_disk_req MB" - echo -e " - Recommended Disk requirement is $recommended_disk_req MB\n" - - printf '### Estimated Data Transfer Sizes - - - repositories: %d MB - - pages: %d MB - - elasticsearch: %d MB - - storage: %d MB - - minio: %d MB - - mysql: %d MB - - actions: %d MB - - mssql: %d MB -\n' \ - "$repos_disk_size" "$pages_disk_size" "$es_disk_size" "$stor_disk_size" "$minio_disk_size" "$mysql_disk_size" "$actions_disk_size" "$mssql_disk_size" - - if [[ $((available_space / (1024 * 1024))) -lt $min_disk_req ]]; then - echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2 - exit 1 - fi - - #Check rsync, openssh & jq versions - commands=("jq" "rsync" "ssh") - missing_command="" - for cmd in "${commands[@]}"; do - if ! command -v "$cmd" > /dev/null 2>&1; then - missing_command+="$cmd " - fi - done - - # Check if any command is missing - if [[ -n "$missing_command" ]]; then - echo "One or more required tools not found: $missing_command" 1>&2 - echo "Please make sure the following utils are installed and available in your PATH: $missing_command" 1>&2 - exit 1 - fi - - echo "### Software versions" - rsync_version=$(rsync --version | grep 'version' | awk '{print $3}' | tr -cd '[:digit:].\n') - if awk "BEGIN {exit !($rsync_version < $min_rsync)}" &> /dev/null; then - echo "rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2 - echo "Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2 - exit 1 - elif [[ $rsync_version < 3.2.5 ]] && [[ $RSYNC_WARNING != "no" ]]; then - printf "\n **WARNING:** rsync version %s on backup host is less than 3.2.5, which could result in performance degradation. - For more details, please read documentation at https://gh.io/april-2023-update-of-rsync-requirements - You can disable this warning by changing RSYNC_WARNING to 'no' in your backup.config file.\n\n" \ - "$rsync_version" - fi - echo " - rsync ${rsync_version} >= required ($min_rsync)" - - ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1 | tr -cd '[:digit:].\n') - if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then - echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2 - echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2 - exit 1 - else - echo " - openSSH ${ssh_version} >= required ($min_openssh)" - fi - - jq_version=$(jq --version |awk -F\- '{print $2}' | tr -cd '[:digit:].\n') - if awk "BEGIN {exit !($jq_version < $min_jq)}" &> /dev/null; then - echo "jq version $jq_version in backup-host does not meet minimum requirements." 1>&2 - echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2 - exit 1 - else - echo " - jq ${jq_version} >= required ($min_jq)" - fi -fi - -echo -e "\nConnect $hostname:$port OK (v$version)" diff --git a/bin/ghe-restore b/bin/ghe-restore deleted file mode 100755 index 101f19ebc..000000000 --- a/bin/ghe-restore +++ /dev/null @@ -1,727 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore [-cfhv] [--version] [--skip-mysql] [-s ] [] -#/ -#/ Restores a GitHub instance from local backup snapshots. -#/ -#/ Note that the GitHub Enterprise host must be reachable and your SSH key must -#/ be setup as described in the following help article: -#/ -#/ -#/ -#/ OPTIONS: -#/ -c | --config Restore appliance settings and license in addition to -#/ datastores. Settings are not restored by default to -#/ prevent overwriting different configuration on the -#/ restore host. -#/ -f | --force Don't prompt for confirmation before restoring. -#/ -h | --help Show this message. -#/ -v | --verbose Enable verbose output. -#/ --skip-mysql Skip MySQL restore steps. Only applicable to external databases. -#/ --version Display version information and exit. -#/ -#/ -s Restore from the snapshot with the given id. Available -#/ snapshots may be listed under the data directory. -#/ -#/ The is the hostname or IP of the GitHub Enterprise -#/ instance. The may be omitted when the -#/ GHE_RESTORE_HOST config variable is set in backup.config. -#/ When a argument is provided, it always overrides -#/ the configured restore host. -#/ - -set -e - -# Parse arguments -: "${RESTORE_SETTINGS:=false}" -export RESTORE_SETTINGS - -: "${FORCE:=false}" -export FORCE - -: "${SKIP_MYSQL:=false}" -export SKIP_MYSQL - -while true; do - case "$1" in - --skip-mysql) - SKIP_MYSQL=true - shift - ;; - -f|--force) - FORCE=true - shift - ;; - -s) - snapshot_id="$(basename "$2")" - shift 2 - ;; - -c|--config) - RESTORE_SETTINGS=true - shift - ;; - -h|--help) - export GHE_SHOW_HELP=true - shift - ;; - --version) - export GHE_SHOW_VERSION=true - shift - ;; - -v|--verbose) - export GHE_VERBOSE=true - shift - ;; - -i|--incremental) - export GHE_INCREMENTAL=true - shift - ;; - -*) - echo "Error: invalid argument: '$1'" 1>&2 - exit 1 - ;; - *) - if [ -n "$1" ]; then - GHE_RESTORE_HOST_OPT="$1" - shift - else - break - fi - ;; - esac -done - - - -start_cron () { - log_info "Starting cron ..." - if $CLUSTER; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo timeout 120s service cron start"; then - log_warn "Failed to start cron on one or more nodes" - fi - else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo timeout 120s service cron start"; then - log_warn "Failed to start cron" - fi - fi -} - -cleanup () { - log_info " Exiting, cleaning up ..." - if [ -n "$1" ]; then - update_restore_status "$1" - fi - - if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Restarting Actions after restore ..." - # In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the - # force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists - # in the --help output - if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start --help' | grep -q force; then - ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start -f' 1>&3 - else - ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start' 1>&3 - fi - fi - - if ! $CRON_RUNNING; then - start_cron - fi - - # Cleanup SSH multiplexing - log_info "Cleaning up SSH multiplexing ..." - if ! ghe-ssh --clean; then - log_info "Failed to clean up SSH multiplexing" - fi - - # Remove in-progress file - log_info "Removing in-progress file ..." 1>&3 - if ! rm -f "${GHE_DATA_DIR}/in-progress-restore"; then - log_error "Failed to remove in-progress file" 1>&3 - fi - - # Remove progress files - rm -rf /tmp/backup-utils-progress/* - - bm_end "$(basename $0)" -} - -# This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally. -# because it doesn't run locally does not redirect output to fd 3 or use log_info/log_warn/log_error. -# shellcheck disable=SC2034 -cleanup_cluster_nodes() { - uuid="$1" - if [ -z "$uuid" ]; then - log_error "Node UUID required." - exit 2 - fi - - echo "Cleaning up spokes" - ghe-spokes server evacuate "git-server-$uuid" 'Removing replica' - ghe-spokes server destroy "git-server-$uuid" - - echo "Cleaning up storage" - ghe-storage destroy-host "storage-server-$uuid" --force - - echo "Cleaning up dpages" - ghe-dpages offline "pages-server-$uuid" - ghe-dpages remove "pages-server-$uuid" - - echo "Cleaning up redis" - ghe-redis-cli del "resque:queue:maint_git-server-$uuid" - ghe-redis-cli srem resque:queues "maint_git-server-$uuid" -} - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config" - - - - - -# Check to make sure moreutils parallel is installed and working properly -ghe_parallel_check - -# Check to make sure another restore process is not running -ghe_restore_check - -# Grab the host arg -GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}" - -# Hostname without any port suffix -hostname=$(echo "$GHE_HOSTNAME" | cut -f 1 -d :) - -# Show usage with no -[ -z "$GHE_HOSTNAME" ] && print_usage - -# Flag to indicate if this script has stopped Actions. -ACTIONS_STOPPED=false - -# ghe-restore-snapshot-path validates it exists, determines what current is, -# and if there's any problem, exit for us -GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")" -GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH") -export GHE_RESTORE_SNAPSHOT - -# Check to make sure backup is not running -ghe_backup_check - -# Detect if the backup we are restoring has a leaked ssh key -echo "Checking for leaked keys in the backup snapshot that is being restored ..." -ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true - -# Figure out whether to use the tarball or rsync restore strategy based on the -# strategy file written in the snapshot directory. -GHE_BACKUP_STRATEGY=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/strategy") - -# Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. -ghe_remote_version_required "$GHE_HOSTNAME" - -# Figure out if this instance has been configured or is entirely new. -instance_configured=false -if is_instance_configured; then - instance_configured=true -else - RESTORE_SETTINGS=true -fi - -# Figure out if we're restoring into cluster -CLUSTER=false -if ghe-ssh "$GHE_HOSTNAME" -- \ - "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ]"; then - CLUSTER=true -fi -export CLUSTER - -# Restoring a cluster backup to a standalone appliance is not supported -if ! $CLUSTER && [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - log_error "Error: Snapshot from a GitHub Enterprise cluster cannot be restored to a standalone appliance. Aborting." >&2 - exit 1 -fi - -# Ensure target appliance and restore snapshot are a compatible combination with respect to BYODB -if ! ghe-restore-external-database-compatibility-check; then - exit 1 -fi - -# Figure out if this appliance is in a replication pair -if ghe-ssh "$GHE_HOSTNAME" -- \ - "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - log_error "Error: Restoring to an appliance with replication enabled is not supported. Please teardown replication before restoring." >&2 - exit 1 -fi - -# Prompt to verify the restore host given is correct. Restoring overwrites -# important data on the destination appliance that cannot be recovered. This is -# mostly to prevent accidents where the backup host is given to restore instead -# of a separate restore host since they're used in such close proximity. -if $instance_configured && ! $FORCE; then - echo - echo "WARNING: All data on GitHub Enterprise appliance $hostname ($GHE_REMOTE_VERSION)" - echo " will be overwritten with data from snapshot ${GHE_RESTORE_SNAPSHOT}." - echo - - if is_external_database_snapshot && $RESTORE_SETTINGS; then - echo "WARNING: This operation will also restore the external MySQL connection configuration," - echo " which may be dangerous if the GHES appliance the snapshot was taken from is still online." - echo - fi - - prompt_for_confirmation "Please verify that this is the correct restore host before continuing." -fi - -# Prompt to verify that restoring BYODB snapshot to unconfigured instance -# will result in BYODB connection information being restored as well. -if is_external_database_snapshot && ! $instance_configured && ! $FORCE; then - echo - echo "WARNING: This operation will also restore the external MySQL connection configuration," - echo " which may be dangerous if the GHES appliance the snapshot was taken from is still online." - echo - - prompt_for_confirmation "Please confirm this before continuing." -fi -# Calculate the actual amounts of steps in the restore process -# taking into account the options passed to the script and the appliance configuration -# calculate restore steps -OPTIONAL_STEPS=0 - -# Restoring UUID -if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi -# Restoring Actions + MSSQL -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 2)) -fi -# Restoring minio -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi -# Restoring Elasticsearch -if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi -# Restoring audit log -if $CLUSTER || [ "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.12.9)" ]; then - if [[ "$GHE_RESTORE_SKIP_AUDIT_LOG" != "yes" ]]; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) - fi -fi -# Replica cleanup -if ! $CLUSTER && $instance_configured; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 1)) -fi -# Restoring settings + restore-chat-integration + restore-packages -if $RESTORE_SETTINGS; then - OPTIONAL_STEPS=$((OPTIONAL_STEPS + 3)) -fi - -# Minimum number of steps is 7 -export PROGRESS_TOTAL=$((OPTIONAL_STEPS + 7)) - -init-progress -echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total -export PROGRESS_TYPE="Restore" -echo "$PROGRESS_TYPE" > /tmp/backup-utils-progress/type -export PROGRESS=0 # Used to track progress of restore -echo "$PROGRESS" > /tmp/backup-utils-progress/progress - -# Log restore start message locally and in /var/log/syslog on remote instance -bm_start "$(basename $0)" -START_TIME=$(date +%s) -log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT" - -if [ "$GHE_INCREMENTAL" ]; then - if [ "$GHE_VERSION_MAJOR" -lt 3 ]; then - log_error "Can only perform incremental restores on enterprise version 3.10 or higher" - exit 1 -fi -if [ "$GHE_VERSION_MINOR" -lt 10 ]; then - log_error "Can only perform incremental restores on enterprise version 3.10 or higher" - exit 1 -fi - log_info "Incremental restore from snapshot $GHE_RESTORE_SNAPSHOT" - # If we see 'inc_previous' prepended to the snapshot name, then - # we set $INC_FULL_BACKUP and $INC_SNAPSHOT_DATA to $INC_PREVIOUS_FULL_BACKUP and - # $INC_PREVIOUS_SNAPSHOT_DATA respectively. Otherwise, leave them at default setting - # so that incremental restore is from current cycle - if [[ "$GHE_RESTORE_SNAPSHOT" =~ ^inc_previous ]]; then - INC_FULL_BACKUP=$INC_PREVIOUS_FULL_BACKUP - INC_SNAPSHOT_DATA=$INC_PREVIOUS_SNAPSHOT_DATA - log_info "Incremental restore from previous cycle snapshot. Using $INC_FULL_BACKUP" - log_info "Incremental restore from previous cycle snapshot. Using $INC_SNAPSHOT_DATA" - fi - log_info "Validating snapshot $GHE_RESTORE_SNAPSHOT" - validate_inc_snapshot_data "$GHE_RESTORE_SNAPSHOT" -fi -ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..." -# Create an in-progress-restore file to prevent simultaneous backup or restore runs -echo "${START_TIME} $$" > "${GHE_DATA_DIR}/in-progress-restore" - -# Keep other processes on the VM or cluster in the loop about the restore status. -# -# Other processes will look for these states: -# "restoring" - restore is currently in progress -# "failed" - restore has failed -# "complete" - restore has completed successfully -update_restore_status () { - if $CLUSTER; then - echo "ghe-cluster-each -- \"echo '$1' | sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/ghe-restore-status' >/dev/null\"" | - ghe-ssh "$GHE_HOSTNAME" /bin/bash - else - echo "$1" | - ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/ghe-restore-status' >/dev/null" - fi -} - -CRON_RUNNING=true -# Update remote restore state file and setup failure trap -trap "cleanup failed" EXIT -update_restore_status "restoring" - -# Make sure the GitHub appliance is in maintenance mode. -if $instance_configured; then - if ! ghe-maintenance-mode-status "$GHE_HOSTNAME"; then - log_error "Error: $GHE_HOSTNAME must be put in maintenance mode before restoring. Aborting." 1>&2 - exit 1 - fi -fi - -# Get GHES release version in major.minor format -RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-version' | cut -d '.' -f 1,2) - -# If the backup being restored is from an appliance with Actions disabled, restoring it onto an appliance with Actions enabled will cause -# mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace -ACTIONS_ENABLED_IN_BACKUP=$(git config -f "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" --bool app.actions.enabled | xargs) -if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_error "Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2 - exit 1 -fi - -# Make sure the GitHub appliance has Actions enabled if the snapshot contains Actions data. -# If above is true, also check if ac is present in appliance then snapshot should also contains ac databases -if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then - if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - ac_db_ghe=$(echo 'ghe-mssql-console -y -n -q "SELECT name FROM sys.databases" | grep -i "ArtifactCache" | wc -l | tr -d " "' | ghe-ssh "$GHE_HOSTNAME" /bin/bash) - ac_db_snapshot=$(find "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/mssql/" -maxdepth 1 -name 'ArtifactCache*.bak' | wc -l | tr -d " ") - if [[ $ac_db_ghe -gt 0 && $ac_db_snapshot -eq 0 ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service enabled but no Actions Cache data is present in snapshot to restore. Aborting \n Please disable Actions cache service in $GHE_HOSTNAME and retry\nTo disable Actions Cache service run as admin: ghe-actions-cache-disable" 1>&2 - exit 1 - fi - if [[ $ac_db_ghe -eq 0 && $ac_db_snapshot -gt 0 && ! $RESTORE_SETTINGS ]]; then - log_error "$GHE_HOSTNAME has Actions Cache service disabled but the snapshot is attempting to restore data for the service. Aborting. \n Please enable Actions cache service in $GHE_HOSTNAME and retry \n To enable Actions Cache service run as admin: ghe-actions-cache-enable" 1>&2 - exit 1 - fi - else - log_error "$GHE_HOSTNAME must have GitHub Actions enabled before restoring since the snapshot contains Actions data. Aborting. \n Setup details for enabling Actions can be found here: https://docs.github.com/en/enterprise-server@$RELEASE_VERSION/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled" 1>&2 - exit 1 - fi -fi - -# Create benchmark file -bm_init > /dev/null - -ghe-backup-store-version || -log_warn "Warning: storing backup-utils version remotely failed." - -# Stop cron and timerd, as scheduled jobs may disrupt the restore process. -log_info "Stopping cron and github-timerd ..." -if $CLUSTER; then - bm_start "$(basename $0) - Stopping cron and github-timerd on cluster" - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then - log_warn "Failed to stop cron on one or more nodes" 1>&3 - fi - bm_end "$(basename $0) - Stopping cron and github-timerd on cluster" - if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then - if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then - log_warn "Failed to stop github-timerd on one or more nodes" 1>&3 - fi - fi - else - if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service github-timerd stop"; then - log_warn "Failed to stop github-timerd on one or more nodes" 1>&3 - fi - fi - -else - bm_start "$(basename $0) - Stopping cron and github-timerd" - echo "$(basename $0) - Stopping cron and github-timerd" - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"; then - log_warn "Failed to stop cron" 1>&3 - fi - bm_end "$(basename $0) - Stopping cron and github-timerd" - if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then - if ghe-ssh "$GHE_HOSTNAME" -- "systemctl -q is-active nomad && nomad job status --short github-timerd &>/dev/null"; then - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo nomad stop github-timerd 1>/dev/null"; then - log_warn "Failed to stop github-timerd" 1>&3 - fi - fi - else - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service github-timerd stop"; then - log_warn "Failed to stop github-timerd" 1>&3 - fi - fi - -fi -CRON_RUNNING=false - -ghe-restore-secrets "$GHE_HOSTNAME" - -# Restore settings and license if restoring to an unconfigured appliance or when -# specified manually. -if $RESTORE_SETTINGS; then - ghe-restore-settings "$GHE_HOSTNAME" -fi - -# Make sure mysql and elasticsearch are prep'd and running before restoring. -# These services will not have been started on appliances that have not been -# configured yet. -if ! $CLUSTER; then - echo "sudo ghe-service-ensure-mysql && sudo ghe-service-ensure-elasticsearch" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi - -# Restore UUID if present and not restoring to cluster. -if [ -s "$GHE_RESTORE_SNAPSHOT_PATH/uuid" ] && ! $CLUSTER; then - log_info "Restoring UUID ..." - - bm_start "$(basename $0) - Restore UUID" - ghe-ssh "$GHE_HOSTNAME" -- "sudo sponge '$GHE_REMOTE_DATA_USER_DIR/common/uuid' 2>/dev/null" <"$GHE_RESTORE_SNAPSHOT_PATH/uuid" - ghe-ssh "$GHE_HOSTNAME" -- "sudo systemctl stop consul" || true - ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf /data/user/consul/raft" - bm_end "$(basename $0) - Restore UUID" -fi - - -if is_external_database_snapshot; then - appliance_strategy="external" - backup_snapshot_strategy="external" -else - if is_binary_backup_feature_on; then - appliance_strategy="binary" - else - appliance_strategy="logical" - fi - - if is_binary_backup "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"; then - backup_snapshot_strategy="binary" - else - backup_snapshot_strategy="logical" - fi -fi - -if is_external_database_target_or_snapshot && $SKIP_MYSQL; then - log_info "Skipping MySQL restore." -else - log_info "Restoring MySQL database from ${backup_snapshot_strategy} backup snapshot on an appliance configured for ${appliance_strategy} backups ..." - increment-progress-total-count 2 - ghe-restore-mysql "$GHE_HOSTNAME" 1>&3 -fi - - - -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then - log_info "Stopping Actions before restoring databases ..." - # We mark Actions as stopped even if the `ghe-actions-stop` - # fails to ensure that we cleanly start actions when performing cleanup. - ACTIONS_STOPPED=true - ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3 - - log_info "Restoring MSSQL databases ..." - ghe-restore-mssql "$GHE_HOSTNAME" 1>&3 - - log_info "Restoring Actions data ..." - ghe-restore-actions "$GHE_HOSTNAME" 1>&3 - echo "* WARNING: Every self-hosted Actions runner that communicates with the restored GHES server must be restarted or reconfigured in order to continue functioning." - echo "See https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners for more details on how to reconfigure self-hosted Actions runners." -fi - -if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then - log_info "Restoring MinIO data ..." - ghe-restore-minio "$GHE_HOSTNAME" 1>&3 -fi - -# log input into a variable for the parallel command, as the functions don't work with eval -cmd_title=$(log_info "Restoring Redis database ...") -commands=(" -echo \"$cmd_title\" -ghe-restore-redis \"$GHE_HOSTNAME\" \"$GHE_RESTORE_SNAPSHOT_PATH\"") - -cmd_title=$(log_info "Restoring Git Repositories ...") -commands+=(" -echo \"$cmd_title\" -ghe-restore-repositories \"$GHE_HOSTNAME\"") - -cmd_title=$(log_info "Restoring Gists ...") -commands+=(" -echo \"$cmd_title\" -ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") - -if [ "$GHE_BACKUP_PAGES" != "no" ]; then - cmd_title=$(log_info "Restoring Pages ...") - commands+=(" - echo \"$cmd_title\" - ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") -fi - -cmd_title=$(log_info "Restoring SSH authorized keys ...") -commands+=(" -echo \"$cmd_title\" -ghe-restore-ssh-keys \"$GHE_HOSTNAME\" \"$GHE_RESTORE_SNAPSHOT_PATH\"") - -cmd_title=$(log_info "Restoring storage data ...") -commands+=(" -echo \"$cmd_title\" -ghe-restore-storage \"$GHE_HOSTNAME\" 1>&3") - -cmd_title=$(log_info "Restoring custom Git hooks ...") -commands+=(" -echo \"$cmd_title\" -ghe-restore-git-hooks \"$GHE_HOSTNAME\" 1>&3") - -if ! $CLUSTER && [ -d "$GHE_RESTORE_SNAPSHOT_PATH/elasticsearch" ]; then - cmd_title=$(log_info "Restoring Elasticsearch indices ...") - commands+=(" - echo \"$cmd_title\" - ghe-restore-es-rsync \"$GHE_HOSTNAME\" 1>&3") -fi - -# Restore the audit log migration sentinel file, if it exists in the snapshot -if test -f "$GHE_RESTORE_SNAPSHOT_PATH/es-scan-complete"; then - log_info "Restoring Elasticsearch audit log migration sentinel file ..." 1>&3 - if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo touch $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - log_info "Failed to restore Elasticsearch audit log migration sentinel file." 1>&3 - fi -fi - -# Restore exported audit logs to 2.12.9 and newer single nodes and -# all releases of cluster -if $CLUSTER || [ "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.12.9)" ]; then - if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then - log_info "Skipping restore of audit logs." - else - cmd_title=$(log_info "Restoring Audit logs ...") - commands+=(" - echo \"$cmd_title\" - ghe-restore-es-audit-log \"$GHE_HOSTNAME\" 1>&3") - fi - -fi - -if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then - log_info "Restoring data in parallel ..." - "$GHE_PARALLEL_COMMAND" "${GHE_PARALLEL_COMMAND_OPTIONS[@]}" -- "${commands[@]}" -else - log_info "Restoring data serially ..." 1>&3 - for c in "${commands[@]}"; do - . "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/bm.sh" - eval "$c" - done -fi - -# Restart an already running memcached to reset the cache after restore -log_info "Restarting memcached ..." 1>&3 -bm_start "$(basename $0) - Restarting memcached" -echo "sudo restart -q memcached 2>/dev/null || true" | -ghe-ssh "$GHE_HOSTNAME" -- /bin/sh -bm_end "$(basename $0) - Restarting memcached" - -# Prevent GitHub Connect jobs running before we've had a chance to reset -# the configuration by setting the last run date to now. -if ! $RESTORE_SETTINGS; then - log_info "Setting last run date for GitHub Connect jobs ..." 1>&3 - echo "now=$(date +%s.0000000); ghe-redis-cli mset timer:UpdateConnectInstallationInfo \$now timer:UploadEnterpriseServerUserAccountsJob \$now timer:UploadConnectMetricsJob \$now timer:GitHubConnectPushNewContributionsJob \$now" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi - -# When restoring to a host that has already been configured, kick off a -# config run to perform data migrations. -if $CLUSTER; then - log_info "Configuring cluster ..." - bm_start "$(basename $0) - configure cluster" - if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then - ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-nomad-cleanup" 1>&3 2>&3 - elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then - ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- /usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 - fi - ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-config-apply" 1>&3 2>&3 - bm_end "$(basename $0) - configure cluster" -elif $instance_configured; then - log_info "Configuring appliance ..." - bm_start "$(basename $0) - configure appliance" - if [ "$GHE_VERSION_MAJOR" -eq "3" ]; then - ghe-ssh "$GHE_HOSTNAME" -- "ghe-nomad-cleanup" 1>&3 2>&3 - elif [ "$GHE_VERSION_MAJOR" -eq "2" ] && [ "$GHE_VERSION_MINOR" -eq "22" ]; then - ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-cleanup" 1>&3 2>&3 - fi - ghe-ssh "$GHE_HOSTNAME" -- "ghe-config-apply" 1>&3 2>&3 - bm_end "$(basename $0) - configure appliance" -fi - -# Clear GitHub Connect settings stored in the restored database. -# This needs to happen after `ghe-config-apply` to ensure all migrations have run. -if ! $RESTORE_SETTINGS; then - log_info "Clearing GitHub Connect settings ..." 1>&3 - echo "if [ -f /usr/local/share/enterprise/ghe-reset-gh-connect ]; then /usr/local/share/enterprise/ghe-reset-gh-connect -y; fi" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi - -# Start cron. Timerd will start automatically as part of the config run. -start_cron -CRON_RUNNING=true - -# Clean up all stale replicas on configured instances. -if ! $CLUSTER && $instance_configured; then - log_info "Cleaning up replicas..." 1>&3 - bm_start "$(basename $0) - Cleanup replicas" - restored_uuid=$(cat "$GHE_RESTORE_SNAPSHOT_PATH/uuid") - other_nodes=$(echo " - set -o pipefail; \ - ghe-spokes server show --json \ - | jq -r '.[] | select(.host | contains(\"git-server\")).host' \ - | sed 's/^git-server-//g' \ - | ( grep -F -x -v \"$restored_uuid\" || true )" \ - | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash) - if [ -n "$other_nodes" ]; then - log_info "Cleaning up stale nodes ..." - for uuid in $other_nodes; do - # shellcheck disable=SC2034 - echo "set -o pipefail; $(typeset -f cleanup_cluster_nodes); cleanup_cluster_nodes $uuid" | ghe-ssh "$GHE_HOSTNAME" 1>&3 - done - fi - bm_end "$(basename $0) - Cleanup replicas" -fi - -# Update the remote status to "complete". This has to happen before importing -# ssh host keys because subsequent commands will fail due to the host key -# changing otherwise. -trap "cleanup" EXIT -update_restore_status "complete" - -# Log restore complete message in /var/log/syslog on remote instance -ghe_remote_logger "Completed restore from $(hostname) / snapshot ${GHE_RESTORE_SNAPSHOT}." - -if ! $CLUSTER; then - log_info "Restoring SSH host keys ..." - ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-ssh-host-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 -else - # This will make sure that Git over SSH host keys (babeld) are - # copied to all the cluster nodes so babeld uses the same keys. - log_info "Restoring Git over SSH host keys ..." - ghe-ssh "$GHE_HOSTNAME" -- "sudo tar -xpf - -C $GHE_REMOTE_DATA_USER_DIR/common" < "$GHE_RESTORE_SNAPSHOT_PATH/ssh-host-keys.tar" 1>&3 - ghe-ssh "$GHE_HOSTNAME" -- "sudo chown babeld:babeld $GHE_REMOTE_DATA_USER_DIR/common/ssh_host_*" 1>&3 - echo "if [ -f /usr/local/share/enterprise/ghe-cluster-config-update ]; then /usr/local/share/enterprise/ghe-cluster-config-update -s; else ghe-cluster-config-update -s; fi" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 -fi - -END_TIME=$(date +%s) -log_info "Runtime: $((END_TIME - START_TIME)) seconds" -log_info "Completed restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT at $(date +"%H:%M:%S")" - -log_info "Restore of $GHE_HOSTNAME finished." - -if ! $instance_configured; then - echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration." -fi - diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 011d50f79..000000000 --- a/debian/changelog +++ /dev/null @@ -1,666 +0,0 @@ -github-backup-utils (3.11.0) UNRELEASED; urgency=medium - - * `ghe-backup-myql` and `ghe-restore-mysql` will now exit 1 on errors. - * On an instance with Actions enabled, incorrect backup and restore settings prevented the storage container name from being restored. This made the logs from that container inaccessible, and caused Actions to create a new storage container in a different location. - * When backups are run for HA instances in both primary and replica nodes a `.sync-in-progress` file will be created. This will disable `NetworkMaintenance` jobs from running and queueing up when backups are running from the primary node. - * Estimated transfer sizes will be calculated on appropriate nodes for clustered environments. - * Added support for finding the `parallel` command from the `moreutils` tool suite on more Linux distributions, including Arch Linux and Alpine Linux. - * `ghe-restore` avoids unnecessary `rsync` operations when restoring to non-clustered environments. - * `ghe-backup` and `ghe-restore` output their total runtime - * `rsync` compression is now disabled by default. The `-z` flag has been removed from the `ghe-rsync` command in multiple files to improve transfer speed and reduce CPU usage. To enable `rsync` compression globally, add `GHE_RSYNC_COMPRESSION_ENABLED=yes` to the `backup.config` file. - * Updates the Host OS version output to use `/etc/os-release` for better compatibility with other Linux distributions. - * When a NFS mount is detected for snapshots on backup hosts, backup logs will show a warning to notify the user that such a setup may incur performance issues as highlighted in [storage requirements](https://github.com/github/backup-utils-private/blob/master/docs/requirements.md#storage-requirements) documentation. - - -- Andrew Mildahl Thu, 30 Nov 2023 01:57:12 +0000 - -github-backup-utils (3.10.0) UNRELEASED; urgency=medium - - * Remove -o option from ps use #341 - * Switch to TMPDIR before initiating SSH multiplexing workaround to prevent locking the destination filesystem #348 - * Move check for git for ssh muxing into ghe-ssh #378 - * Check filesystem supports hardlinks #388 - * Remove check for git from ghe-ssh #393 - * Clean up stale HA nodes on restore #396 - - -- Balwinder Sohi Wed, 09 Aug 2023 19:37:10 +0000 - -github-backup-utils (3.9.0) UNRELEASED; urgency=medium - - * Set restore status on all cluster nodes #274 - * Fix pages backups and restores in GitHub Enterprise 11.10 #275 - * Backup and restore custom CA certificates #281 - * Set the benchmark file path consistently #283 - * Suppress dd output noise #289 - * Track completeness of Elasticsearch JSON dumps #298 - * Use existing Elasticsearch indices to speed up transfer during a restore #310 - * Include the user data directory in the benchmark name #311 - * Use calculated routes when backing up storage data from a cluster #318 - * Refresh the existing indices when restoring Elasticsearch indices to cluster #328 - * Use git to generate short name for SSH multiplex control path #335 - - -- Junior Eluhu Mon, 12 Jun 2023 20:46:10 +0000 - -github-backup-utils (3.8.0) focal; urgency=medium - - -- Daniel Johnson Tue, 07 Feb 2023 21:43:26 +0000 - -github-backup-utils (3.7.0) UNRELEASED; urgency=medium - - - -- Devin Dooley Tue, 25 Oct 2022 00:35:38 +0000 - -github-backup-utils (3.6.0) UNRELEASED; urgency=medium - - - -- Joe Franks Wed, 17 Aug 2022 19:20:54 +0000 - -github-backup-utils (3.5.0) UNRELEASED; urgency=medium - - * Simplify complex redirects for ghe-rsync #881 - * On restore failure, restart cron on target host #883 - - -- Bon Sohi Thu, 12 May 2022 21:06:56 +0000 - -github-backup-utils (3.4.1) UNRELEASED; urgency=medium - - * Simplify complex redirects for ghe-rsync #881 - * On restore failure, restart cron on target host #883 - - -- Donal Ellis Fri, 22 Apr 2022 04:00:00 +0000 - -github-backup-utils (3.3.2) UNRELEASED; urgency=medium - - * Simplify complex redirects for ghe-rsync #881 - * On restore failure, restart cron on target host #883 - - -- Donal Ellis Fri, 22 Apr 2022 00:53:45 +0000 - -github-backup-utils (3.4.0) UNRELEASED; urgency=medium - - * Add anchor to usage doc for settings restore #865 - - -- Steve Culver Tue, 15 Feb 2022 19:25:09 +0000 - -github-backup-utils (3.3.1) UNRELEASED; urgency=medium - - * Fix compat issue with ghe-actions-start during maintenance mode #836 - - -- Balwinder Sohi Tue, 21 Dec 2021 23:38:01 +0000 - -github-backup-utils (3.3.0) UNRELEASED; urgency=medium - - -- Balwinder Sohi Wed, 08 Dec 2021 03:12:53 +0000 - -github-backup-utils (3.3.0.rc1) UNRELEASED; urgency=medium - - -- Nick Iodice Tue, 09 Nov 2021 19:56:08 +0000 - -github-backup-utils (3.2.0) UNRELEASED; urgency=medium - - -- Brett Westover Tue, 28 Sep 2021 16:50:00 +0000 - -github-backup-utils (3.2.0.rc3) UNRELEASED; urgency=medium - - * Move GitHub Connect reset to after ghe-config-apply #783 - - -- Brett Westover Fri, 17 Sep 2021 00:44:59 +0000 - -github-backup-utils (3.2.0.rc1) UNRELEASED; urgency=medium - - * Leaked host key check: Avoid false positives from FIPS mode #748 - * Always restore user-password-secrets #762 - * Make some of the actions setting best effort #767 - * Remove reference to `ghe-cluster-cleanup-nodes` #768 - * Stop/Restart Actions in ghe-restore #769 - * Clear GitHub Connect settings when not restoring settings #770 - * GitHub Connect Reset Issue #776 - - -- Brett Westover Fri, 10 Sep 2021 20:10:07 +0000 - -github-backup-utils (3.2.0) UNRELEASED; urgency=medium - - * Leaked host key check: Avoid false positives from FIPS mode #748 - * Always restore user-password-secrets #762 - * Make some of the actions setting best effort #767 - * Remove reference to `ghe-cluster-cleanup-nodes` #768 - * Stop/Restart Actions in ghe-restore #769 - * Clear GitHub Connect settings when not restoring settings #770 - - -- Brett Westover Thu, 09 Sep 2021 16:42:24 +0000 - -github-backup-utils (3.1.0) UNRELEASED; urgency=medium - - -- Zachary Mark Thu, 03 Jun 2021 16:55:16 +0000 - -github-backup-utils (3.1.0~rc1) UNRELEASED; urgency=medium - - [ Zachary Mark ] - * Update repository backups to use ghe-gc-* for lock file management #188 - * A faster way to restore storage blobs (clusters) #212 - * Bug fix: Be more specific in restore routes globbing #715 - * fix(docker): add coreutils to get flags for date #717 - * Add backup cadence variable to the appliance #719 - * Fix is_default_external_database_snapshot function #720 - - [ Hideki Yamane ] - * debian/rules - - Drop unnecessary build-indep: - - Add manpages generation. - * debian/changelog - - Fix some lintian warnings for old entries. - * debian/source/format - - Upgrade to newer source format 3.0 (native). - * debian/copyright - - Format it as Machine-readable debian/copyright format 1.0 - - Add entries Twan Wolthof and me for debian/* since - enough code was written by non-github.com employees, at least. - * debian/control - - Update descriptions in debian/control - - Fix "Architecture: all", instead of "any". - - Declare its Homepage as https://github.com/github/backup-utils - - Add Vcs-* metadata field. - - Specify "Rules-Requires-Root: no" - - Drop unnecessary "Build-Depends: devscripts" - - Set Standards-Version: 4.5.1 - - Update Maintainer as Zachary Mark - * debian/{clean,manpages} - - Add files to support manpages handles. - - -- Zachary Mark Thu, 06 May 2021 17:11:18 +0000 - -github-backup-utils (3.0.0) UNRELEASED; urgency=medium - - * Fix restoring the password pepper for already configured instances #683 - - -- Michael Dang Tue, 16 Feb 2021 22:32:25 +0000 - -github-backup-utils (3.0.0.rc1) UNRELEASED; urgency=medium - - * Cleanup nomad container when restore for 2.22 #670 - * Use ghe-cluster-nomad-cleanup for cluster mode #663 - * Only run ghe-nomad-cleanup in 3.0 #662 - * Revert backup-utils gitHub env and a few more fixes #661 - * Note how to test filesystem symlink / hardlink support #660 - * stop github-timerd based on its running environment #659 - * Backup and restore password pepper #656 - * github-env -> github-env-dispatch #654 - * Rename redis-cli to ghe-redis-cli #639 - - -- Michael Dang Thu, 14 Jan 2021 21:17:53 +0000 - -github-backup-utils (2.22.0) UNRELEASED; urgency=medium - - * Added basic timing around the ghe-restore process #625 - * Improve python3 & finding moreutils parallel #627 - * Turn off POSIX for ghe-backup-config #632 - * Add parallelized restore capability to ghe-restore-storage #635 - * Update backup-utils for new features in 2.22 #641 - - -- Hao Jiang Wed, 23 Sep 2020 15:48:54 +0000 - -github-backup-utils (2.21.0) UNRELEASED; urgency=medium - - * Introduce option to skip restoring of audit logs #596 - * Beta: Execute ghe-backup tasks in parallel #597 - * Beta: Execute ghe-restore tasks in parallel #601 - * Run repositories restore in parallel #603 - * Fix mismatched `bm_start` and `bm_end` commands #607 - * remove rsync restore method used by GHES versions prior to 2.13 #608 - * Output MySQL backup strategy for clarity during backup and restore #610 - - -- Hao Jiang Tue, 09 Jun 2020 17:59:06 +0000 - -github-backup-utils (2.19.5) UNRELEASED; urgency=medium - - * In legacy mode we should use ghe-import-mysql #581 - - -- Caine Jette Fri, 21 Feb 2020 19:13:17 +0000 - -github-backup-utils (2.20.2) UNRELEASED; urgency=medium - - * In legacy mode we should use ghe-import-mysql #581 - - -- Hao Jiang Thu, 20 Feb 2020 22:47:09 +0000 - -github-backup-utils (2.20.1) UNRELEASED; urgency=medium - - * Fixes gist route calculation for GHES version 2.20 - - -- Caine Jette Wed, 19 Feb 2020 21:47:18 +0000 - -github-backup-utils (2.19.4) UNRELEASED; urgency=medium - - * Fix the way we connect to mysql master using ssh forwarding for binary backups #567 - - -- Hao Jiang Tue, 18 Feb 2020 17:54:31 +0000 - -github-backup-utils (2.20.0) UNRELEASED; urgency=medium - - * Fix `ghe-backup-repositories` performance for large instances #541 - * Fix two issues with binary backup (slow gzip compression and support for restore from instances other than SQL master) #551 - - -- Alejandro Figueroa Tue, 11 Feb 2020 20:47:17 +0000 - -github-backup-utils (2.19.3) UNRELEASED; urgency=medium - - * Fix two issues with binary backup (slow gzip compression and support for restore from instances other than SQL master) #551 - - -- Hao Jiang Tue, 11 Feb 2020 19:31:55 +0000 - -github-backup-utils (2.19.2) UNRELEASED; urgency=medium - - * Fix `ghe-backup-repositories` performance for large instances #541 - - -- Evgenii Khramkov Fri, 31 Jan 2020 19:13:46 +0000 - -github-backup-utils (2.19.1) UNRELEASED; urgency=medium - - * Cater for more explicit gist paths used in routes file #524 - * Suppress "*.rsync': No such file or directory" errors when no data to backup or restore #525 - - -- Colin Seymour Wed, 11 Dec 2019 09:33:01 +0000 - -github-backup-utils (2.19.0) UNRELEASED; urgency=medium - - * Remove temporary exclude file from the backup host not the target GHES appliance #516 - * Update Debian package depends to include git #520 - - -- Colin Seymour Tue, 12 Nov 2019 18:57:12 +0000 - -github-backup-utils (2.18.0) UNRELEASED; urgency=medium - - * Replace "sed -E" in ghe-host-check with a more portable solution #509 - - -- Colin Seymour Tue, 20 Aug 2019 18:49:44 +0000 - -github-backup-utils (2.17.1) UNRELEASED; urgency=medium - - * Redirect ghe-export-audit-logs stderr output unless using verbose output #497 - - -- Colin Seymour Wed, 05 Jun 2019 08:43:25 +0000 - -github-backup-utils (2.17.0) UNRELEASED; urgency=medium - - * Restore target is ignored when specified on the command line #476 - * Support incremental backups for MySQL-stored audit logs #485 - - -- Colin Seymour Thu, 23 May 2019 08:20:15 +0000 - -github-backup-utils (2.16.1) UNRELEASED; urgency=medium - - * Detect storage user on each cluster host being backed up or restored #472 - - -- Colin Seymour Tue, 26 Feb 2019 16:37:04 +0000 - -github-backup-utils (2.16.0) UNRELEASED; urgency=medium - - * (There was no descriptions) - - -- Colin Seymour Tue, 22 Jan 2019 20:25:34 +0000 - -github-backup-utils (2.15.1) UNRELEASED; urgency=medium - - * Restoring to an un-configured appliance fails due to a missing license file #449 - - -- Colin Seymour Tue, 13 Nov 2018 17:34:21 +0000 - -github-backup-utils (2.15.0) UNRELEASED; urgency=medium - - * (There was no descriptions) - - -- Colin Seymour Tue, 16 Oct 2018 16:40:03 +0000 - -github-backup-utils (2.15.0) UNRELEASED; urgency=medium - - * (There was no descriptions) - - -- Colin Seymour Tue, 16 Oct 2018 16:07:36 +0000 - -github-backup-utils (2.14.3) UNRELEASED; urgency=medium - - * Improve multi-platform detection of simultaneous ghe-backup runs #435 - - -- Colin Seymour Tue, 11 Sep 2018 17:03:42 +0000 - -github-backup-utils (2.14.2) UNRELEASED; urgency=medium - - * Capture and display repository/gist warnings during cluster restore #423 - * Use remote tempdir when finalizing Pages routes #424 - * Use old rsync restore method for pages prior to 2.13 #426 - - -- Colin Seymour Tue, 21 Aug 2018 13:57:20 +0000 - -github-backup-utils (2.14.1) UNRELEASED; urgency=medium - - * Don't fail a backup if the Management Console password isn't set #416 - * Fix permissions issues when repeat restoring to configured cluster instance #417 - * Add missing dependencies to debian packaging #418 - * Prevent restoring snapshots to older releases #420 - - -- Colin Seymour Tue, 07 Aug 2018 16:00:36 +0000 - -github-backup-utils (2.14.0) UNRELEASED; urgency=medium - - * Disable pager and context when running git-diff #411 - * Optimise hookshot and audit log backups and restores and MySQL restores #413 - - -- Colin Seymour Thu, 12 Jul 2018 15:11:11 +0000 - -github-backup-utils (2.13.2) UNRELEASED; urgency=medium - - * Treat missing repository networks, gists, and storage objects as a non-critical error #386 - * Clean up stale HA nodes on restore #396 - * Cleanup all SSH muxes in a non blocking way #402 - * Raise an error if the current symlink doesn't exist when attempting to restore it #404 - - -- Colin Seymour Fri, 22 Jun 2018 10:08:22 +0000 - -github-backup-utils (2.13.1) UNRELEASED; urgency=medium - - * Retry with the admin ssh port on network unreachable too. #377 - * Output backup utils version on backup and restore #384 - * Check filesystem supports hardlinks #388 - * Switch back to optimised restore route calculation #389 - * Optionally log verbose output to a file instead of stdout #391 - * Switch back to optimised backup route calculation #392 - * Remove check for git from ghe-ssh #393 - * Use remote's mktemp to create temp dir on remote host #395 - - -- Colin Seymour Wed, 09 May 2018 10:16:18 +0000 - -github-backup-utils (2.13.0) UNRELEASED; urgency=medium - - * Unify the backup & restore process #375 - - -- Colin Seymour Tue, 27 Mar 2018 16:01:43 +0000 - -github-backup-utils (2.11.4) UNRELEASED; urgency=medium - - * Move check for git for ssh muxing into ghe-ssh #378 - * Make it clear the settings need to be applied after restoring to an unconfigured instance #381 - - -- Colin Seymour Tue, 27 Mar 2018 13:20:18 +0000 - -github-backup-utils (2.11.3) UNRELEASED; urgency=medium - - * Update argument parsing and help/usage consistency #320 - * Fix failures variable #353 - * Remove other snapshot contents before removing the "incomplete" file #358 - * Backup and restore the management console password #361 - * Check for git before allowing SSH multiplex #362 - * Cleanup SSH multiplexing on exit #363 - * Filter cluster nodes by role during backup and restore #367 - * Optimise route generation and finalisation during cluster restores of pages #369 - * Allow extra rsync options to override default options #370 - - -- Colin Seymour Wed, 28 Feb 2018 16:32:07 +0000 - -github-backup-utils (2.11.2) UNRELEASED; urgency=medium - - * Allow the restoration of configuration to Cluster #347 - * Switch to TMPDIR before initiating SSH multiplexing workaround to prevent locking the destination filesystem #348 - - -- Colin Seymour Thu, 09 Nov 2017 12:16:23 +0000 - -github-backup-utils (2.11.1) UNRELEASED; urgency=medium - - * Refresh the existing indices when restoring Elasticsearch indices to cluster #328 - * Fix failure to restore 2.9/2.10 backups to 2.11 prevented by incorrect detection of the audit log migration #333 - * Use git to generate short name for SSH multiplex control path #335 - * Remove use of --literally when computing arbitrary shasum #338 - * Remove -o option from ps use #341 - - -- Colin Seymour Thu, 05 Oct 2017 14:47:56 +0000 - -github-backup-utils (2.11.0) UNRELEASED; urgency=medium - - * Use calculated routes when backing up storage data from a cluster #318 - * Add SSH multiplexing support #321 - * Optimise route generation and finalisation during cluster restores #322 - * Prefer the SSH port specified on the command line #324 - - -- Colin Seymour Wed, 13 Sep 2017 16:31:20 +0000 - -github-backup-utils (2.10.0) UNRELEASED; urgency=medium - - * Include the user data directory in the benchmark name #311 - * Use existing Elasticsearch indices to speed up transfer during a restore #310 - * Improve detection of failures in cluster backup rsync threads #301 - * Improve redis backup robustness #306 - * Use default niceness for restores #308 - * Add additional case to SSH port detection logic #304 - * Suppress additional dd output noise #289 - * Track completeness of Elasticsearch JSON dumps #298 - - -- Steven Honson Thu, 08 Jun 2017 09:06:16 +1000 - -github-backup-utils (2.9.0) UNRELEASED; urgency=medium - - * Block restores to appliances with HA configured #291 - * Add a `--version` flag #284 - * Check backup-utils are not being run on GitHub Enterprise host #286 - * Backup and restore custom CA certificates #281 - * Hookshot backup/restores optimisations #276 - - -- Sergio Rubio Wed, 01 Mar 2017 09:39:26 -0800 - -github-backup-utils (2.8.3) UNRELEASED; urgency=medium - - * Set restore status on all cluster nodes #274 - * Fix pages backups and restores in GitHub Enterprise 11.10 #275 - - -- Steven Honson Wed, 21 Dec 2016 21:01:20 +1100 - -github-backup-utils (2.8.2) UNRELEASED; urgency=medium - - * Backup and restore the appliance UUID #272 - - -- Sergio Rubio Thu, 17 Nov 2016 15:58:08 +0100 - -github-backup-utils (2.8.1) UNRELEASED; urgency=medium - - * Stop cron and timerd during restore #269 - * Fix compatibility issue with older versions of OpenSSH #263 - - -- Sergio Rubio Mon, 14 Nov 2016 22:04:48 +0100 - -github-backup-utils (2.8.0) UNRELEASED; urgency=low - - * Adds support for GitHub Enterprise 2.8.0 - * Speedup storage restores #247 - * More portable backup-utils #260 - - -- rubiojr Wed, 09 Nov 2016 06:35:21 -0800 - -github-backup-utils (2.7.1) UNRELEASED; urgency=medium - - * Cluster: fix offline cluster node detection #250 - * Detect leaked ssh keys in backup snapshots #253 - - -- Sergio Rubio Tue, 20 Sep 2016 20:15:12 +0200 - -github-backup-utils (2.7.0) UNRELEASED; urgency=medium - - * GitHub Enterprise 2.7.0 support - - -- Sergio Rubio Wed, 03 Aug 2016 20:25:31 +0200 - -github-backup-utils (2.6.4) UNRELEASED; urgency=medium - - * Instrument/benchmark backups #238 - * Cluster: remove restoring cluster.conf on restore #242 - * Cluster: Prevent restoring to a standalone GHE appliance #244 - - -- Sergio Rubio Wed, 27 Jul 2016 19:15:53 +0200 - -github-backup-utils (2.6.3) UNRELEASED; urgency=medium - - * Cluster: git-hooks backup fixes #235 - - -- Sergio Rubio Wed, 29 Jun 2016 21:05:21 +0200 - -github-backup-utils (2.6.2) UNRELEASED; urgency=medium - - * git-hooks fixes #231 - * Cluster: speedup repositories restore #232 (requires GitHub Enterprise - 2.6.4) - * Cluster: restore Git over SSH keys #230 - * Benchmark restores #219 - - -- Sergio Rubio Wed, 22 Jun 2016 19:36:06 +0200 - -github-backup-utils (2.6.1) UNRELEASED; urgency=medium - - * Cluster: faster gist restores #220 - * Cluster: faster storage restores #212 - * Cluster: fix git-hooks restores #204 - - -- Sergio Rubio Tue, 31 May 2016 20:54:11 +0200 - -github-backup-utils (2.6.0) UNRELEASED; urgency=medium - - * Adds support for GitHub Enterprise 2.6 - * Adds an extra supported location for the backup configuration #197 - * New config option to check for corrupted repositories after the backup #195 - * General improvements and bug fixes - - -- Sergio Rubio Tue, 26 Apr 2016 18:03:01 +0200 - -github-backup-utils (2.5.2) UNRELEASED; urgency=medium - - * New configuration variable: GHE_CREATE_DATA_DIR #186 - * Require that snapshots originated from an instance running GitHub - Enterprise 2.5.0 or above when restoring to a cluster #182 - * Prevent Git GC operations and some other maintenance jobs from running - while repositories are being restored #179 - * Fix Solaris and SmartOS support, using Bash everywhere #177 - - -- Sergio Rubio Wed, 30 Mar 2016 14:32:15 +0200 - -github-backup-utils (2.5.1) UNRELEASED; urgency=medium - - * Fixes for cluster restores #173 - * Fix Elasticsearch backups for GitHub Enterprise <= 2.2 #175 - * Removed experimental S3 support #167 - * Remote logging output fixes #170 - * Update ghe-host-check to detect extra port 22 error #162 - - -- Sergio Rubio Wed, 09 Mar 2016 14:44:05 +0100 - -github-backup-utils (2.5.0) UNRELEASED; urgency=medium - - * Adds GitHub Enterprise 2.5 support - * Adds GitHub Enterprise Clustering support - * Backups and restores SAML keypairs - - -- Sergio Rubio Tue, 9 Feb 2016 00:02:37 +0000 - -github-backup-utils (2.4.0) UNRELEASED; urgency=medium - - * Moves the in-progress detection to a separate file with PID which is - removed if the process is no longer running after the backup. #145, #99 - * Updates the README to explain why backup-utils is useful even if you have - the high availability replica running. #140 - * Changes the use of the --link-dest option to only occur when backing up - populated directories. #138 - * Adds logging to /var/log/syslog on the remote GitHub Enterprise appliance - to both ghe-backup and ghe-restore. #131 - * Restarts memcached after restoring to an already configured appliance to - ensure it doesn't contain out-of-sync information. #130 - * Removes the temporary /data/user/repositories-nw-backup directory that - remains after successfully migrating the repository storage layout to the - new format used on GitHub Enterprise 2.2.0 and later after restoring a - backup from an older release of GitHub Enterprise. #129 - * Add devscripts to Debian's build-depends for checkbashisms. #101 - * Documents the -c option which forces the restoration of the configuration - information to an already configured appliance. #96 - - -- Colin Seymour Tue, 20 Oct 2015 00:02:37 +0000 - -github-backup-utils (2.2.0) UNRELEASED; urgency=medium - - * Adds support for the new repositories filesystem layout include in - GitHub Enterprise v2.2. #122, #124 - * ghe-restore now performs a config run on the instance after an incremental - restore to 11.10.x and 2.x instances. #100 - * ghe-restore now fails fast when run against a GHE instance with replication - enabled. Replication should be disabled during a restore and then setup - after the restore completes. #121 - * Fixes an issue with special port 122 detection failing when port is - overridden in an ssh config file. #102 - * Removes a warning message when running ghe-backup against an instance with - GitHub Pages disabled. #117 - * backup-utils release version numbers now track GitHub Enterprise releases - to ease the process of determining which version of backup-utils is - required for a given GitHub Enterprise version. - - -- Ryan Tomayko Wed, 29 Apr 2015 07:29:04 +0000 - -github-backup-utils (2.0.2) UNRELEASED; urgency=medium - - * ghe-restore now requires that an already-configured appliance be put into - maintenance mode manually. This is a safeguard against accidentally - overwriting data on the wrong instance. #62, #84 - * ghe-backup and ghe-restore now run a ghe-negotiate-version program on the - appliance to determine whether the backup-utils and GHE versions are - compatible. #91 - * Various portability fixes for problems surfaced when running on Solaris - and FreeBSD. #86, #87 - * Fixes an issue in ghe-backup where mysqldump failures weren't being - reported properly. #90 - * Automated builds are now run on Travis CI. #77 - - -- Ryan Tomayko Tue, 20 Jan 2015 16:00:00 +0000 - -github-backup-utils (2.0.1) UNRELEASED; urgency=medium - - * Adds /etc/github-backup-utils/backup.config as a default config file search - location for deb / system installs. - * Enables SSH BatchMode for all remote command invocation except initial host - check / version identification. - * Fixes a bug in ghe-backup where Git GC process detection would misclassify - long-running server processes matching /git.*gc/, causing the backup operation - to timeout. - * Adds a note and link to the Migrating from GitHub Enterprise v11.10.34x to - v2.0 documentation in the README. - * Adds example / documentation for the GHE_EXTRA_SSH_OPTS config value to the - backup.config-example file. - - -- Ryan Tomayko Mon, 17 Nov 2014 12:47:22 +0000 - -github-backup-utils (2.0.0) UNRELEASED; urgency=medium - - * Support for GitHub Enterprise 2.0. - * Support for migrating from GitHub Enterprise 11.10.34x to 2.0 (including from - VMware to AWS). - * ghe-backup retains hardlinks present on VM in backup snapshots, saving space. - * ghe-restore retains hardlinks present in backup snapshot when restoring to VM. - * backup-utils now includes debian packaging support. - * Fixes an issue with ghe-restore -s not using the snapshot specified. - * Fixes an issue with ghe-backup not waiting for nw-repack processes to finish - in some instances. - - -- Ryan Tomayko Mon, 10 Nov 2014 10:48:36 +0000 - -github-backup-utils (1.1.0) UNRELEASED; urgency=medium - - * Updated documentation on minimum GitHub Enterprise version requirements for - online and incremental backups from v11.10.341 to at least v11.10.342. - * The ghe-restore command now prompts for confirmation of the host to restore to - before performing any destructive operation. This is to reduce the chances of - restoring to the wrong host. The prompt may be bypassed in automated scenarios - by providing the --force option. - * Added a -c option to ghe-restore for restoring base appliance settings in - addition to primary datastores. See ghe-restore --help for more information. - * Added a note about disabling maintenance mode on the appliance after a - successful ghe-restore operation. - * Added support for filesystem layout changes and upgraded server components in - * future versions of GitHub Enterprise. - - -- Twan Wolthof Sat, 18 Oct 2014 19:14:47 +0000 - -github-backup-utils (1.0.1) UNRELEASED; urgency=medium - - * Initial release. - - -- Twan Wolthof Tue, 23 Sep 2014 08:34:55 +0000 diff --git a/debian/clean b/debian/clean deleted file mode 100644 index 0f651869c..000000000 --- a/debian/clean +++ /dev/null @@ -1 +0,0 @@ -debian/*.1 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec635144f..000000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control deleted file mode 100644 index b2cd7c945..000000000 --- a/debian/control +++ /dev/null @@ -1,32 +0,0 @@ -Source: github-backup-utils -Maintainer: Zachary Mark -Section: misc -Priority: optional -Standards-Version: 4.5.1 -Build-Depends: debhelper (>= 9), git, moreutils, jq, rsync (>= 2.6.4), help2man, -Homepage: https://github.com/github/backup-utils -Vcs-Git: https://github.com/github/backup-utils.git -Vcs-Browser: https://github.com/github/backup-utils -Rules-Requires-Root: no - -Package: github-backup-utils -Architecture: all -Depends: ${misc:Depends}, rsync (>= 2.6.4), moreutils, jq, git -Description: Backup and recovery utilities for GitHub Enterprise Server - The backup utilities implement a number of advanced capabilities for backup - hosts, built on top of the backup and restore features already included in - GitHub Enterprise Server. - . - These advanced features include: - - Complete GitHub Enterprise Server backup and recovery system via two simple - utilities: `ghe-backup` and `ghe-restore`. - - Online backups. The GitHub appliance need not be put in maintenance mode for - the duration of the backup run. - - Incremental backup of Git repository data. Only changes since the last - snapshot are transferred, leading to faster backup runs and lower network - bandwidth and machine utilization. - - Efficient snapshot storage. Only data added since the previous snapshot - consumes new space on the backup host. - - Multiple backup snapshots with configurable retention periods. - - Backup runs under the lowest CPU/IO priority on the GitHub appliance, - reducing performance impact while backups are in progress. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 8879cfae8..000000000 --- a/debian/copyright +++ /dev/null @@ -1,33 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: GitHub Enterprise Server Backup Utilities -Source: https://github.com/github/backup-utils - -Files: * -Copyright: 2014-2021, GitHub Inc. -License: MIT - -Files: debian/* -Copyright: 2014-2021, GitHub Inc. - 2014 Twan Wolthof - 2021 Hideki Yamane -License: MIT - -License: MIT - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - . - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/debian/install b/debian/install deleted file mode 100644 index bc992fc49..000000000 --- a/debian/install +++ /dev/null @@ -1,2 +0,0 @@ -bin/* usr/bin -share/* usr/share diff --git a/debian/manpages b/debian/manpages deleted file mode 100644 index 0f651869c..000000000 --- a/debian/manpages +++ /dev/null @@ -1 +0,0 @@ -debian/*.1 diff --git a/debian/rules b/debian/rules deleted file mode 100755 index af3d39d08..000000000 --- a/debian/rules +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/make -f - -VERSION=$$(cat $(CURDIR)/share/github-backup-utils/version) - -override_dh_auto_build: - # generate manpages for ghe-backup, ghe-host-check and ghe-restore - help2man $(CURDIR)/bin/ghe-backup -N -o $(CURDIR)/debian/ghe-backup.1 \ - -n "Take snapshots of all GitHub Enterprise data" \ - --version-string="ghe-backup $(VERSION)" - help2man $(CURDIR)/bin/ghe-host-check -N -o $(CURDIR)/debian/ghe-host-check.1 \ - -n "Restores a GitHub instance from local backup snapshots" \ - --version-string="ghe-host-check $(VERSION)" - help2man $(CURDIR)/bin/ghe-restore -N -o $(CURDIR)/debian/ghe-restore.1 \ - -n "Verify connectivity with the GitHub Enterprise Server host" \ - --version-string="ghe-restore $(VERSION)" - -%: - dh $@ diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 89ae9db8f..000000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/ownership.yaml b/ownership.yaml deleted file mode 100644 index bde619edc..000000000 --- a/ownership.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -version: 1 -ownership: -- name: ghes-backup-utilities - long_name: GHES Backup Utilities - description: GitHub Enterprise Disaster Recover Solution - kind: logical - repo: https://github.com/github/backup-utils-private - qos: best_effort - team_slack: ghes-lifecycle-aor - team: github/ghes-lifecycle - maintainer: whitneyimura - exec_sponsor: jakuboleksy - tier: 3 - product_manager: davidjarzebowski - sev1: - slack: ghes-on-call - alert_slack: ghes-backup-utils - pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20 - tta: 30 minutes - sev2: - issue: https://github.com/github/ghes/issues/new - tta: 1 business day - sev3: - issue: https://github.com/github/ghes/issues - tta: 1 week - support_squad: - slack: support-squad-infrastructure - issue: https://github.com/github/support-squad-infrastructure/issues diff --git a/release-notes/3.11.0.md b/release-notes/3.11.0.md deleted file mode 100644 index 197501c92..000000000 --- a/release-notes/3.11.0.md +++ /dev/null @@ -1,18 +0,0 @@ -### Bug Fixes - -* `ghe-backup-myql` and `ghe-restore-mysql` will now exit 1 on errors. -* On an instance with Actions enabled, incorrect backup and restore settings prevented the storage container name from being restored. This made the logs from that container inaccessible, and caused Actions to create a new storage container in a different location. -* When backups are run for HA instances in both primary and replica nodes a `.sync-in-progress` file will be created. This will disable `NetworkMaintenance` jobs from running and queueing up when backups are running from the primary node. - -### Changes - -* Estimated transfer sizes will be calculated on appropriate nodes for clustered environments. -* Added support for finding the `parallel` command from the `moreutils` tool suite on more Linux distributions, including Arch Linux and Alpine Linux. -* `ghe-restore` avoids unnecessary `rsync` operations when restoring to non-clustered environments. -* `ghe-backup` and `ghe-restore` output their total runtime -* `rsync` compression is now disabled by default. The `-z` flag has been removed from the `ghe-rsync` command in multiple files to improve transfer speed and reduce CPU usage. To enable `rsync` compression globally, add `GHE_RSYNC_COMPRESSION_ENABLED=yes` to the `backup.config` file. -* Updates the Host OS version output to use `/etc/os-release` for better compatibility with other Linux distributions. - -### Backups and Disaster Recovery - -* When a NFS mount is detected for snapshots on backup hosts, backup logs will show a warning to notify the user that such a setup may incur performance issues as highlighted in [storage requirements](https://github.com/github/backup-utils-private/blob/master/docs/requirements.md#storage-requirements) documentation. diff --git a/script/package-deb b/script/package-deb deleted file mode 100755 index 15a698e9c..000000000 --- a/script/package-deb +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# Usage: script/package-deb -# Script to build a deb release package from the current HEAD version. -# The package version comes from the debian/changelog file so that should -# be edited before running this. -set -e - -# Change into project root -cd "$(dirname "$0")"/.. - -# Fetch tags from remote repository -git fetch --tags - -# Basic package name and version. -PKG_BASE="github-backup-utils" -PKG_VERS="$(git describe --tags)" -PKG_NAME="${PKG_BASE}-${PKG_VERS}" -PKG_HEAD="$(git rev-parse HEAD)" - -# Run git-archive to generate tarball -rm -rf dist/debuild -trap "rm -rf dist/debuild" EXIT -mkdir -p dist/debuild - -distdir="$(pwd)/dist/debuild/$PKG_NAME" -git clone -q . "$distdir" -cd "$distdir" - -echo "Removing files listed in .releaseignore ..." -while IFS= read -r line; do - rm -rf "$line" -done < .releaseignore - -echo "Removing .releaseignore ..." -rm -f .releaseignore -git checkout -q "$PKG_HEAD" - -debuild -uc -us 1>&2 -cd .. -files=$(ls -1 *.deb *.tar.xz *.dsc *.changes) -mv $files ../ -for f in $files; do echo "dist/$f"; done diff --git a/script/package-tarball b/script/package-tarball deleted file mode 100755 index bf1510e8f..000000000 --- a/script/package-tarball +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# Usage: script/package-tarball -# Script to build a tarball release package from the current HEAD version. -# The package version comes from `git-describe --tags' so the release tag should -# be in place before this command is run. -set -e - -# Change into project root -cd "$(dirname "$0")"/.. - -# Fetch tags from remote repository -git fetch --tags - -# Basic package name and version. -PKG_BASE="github-backup-utils" -PKG_VERS="$(git describe --tags)" -PKG_NAME="${PKG_BASE}-${PKG_VERS}" - -# Remove all files or directories listed in .releaseignore -echo "Removing files listed in .releaseignore ..." -while IFS= read -r line; do - rm -rf "$line" -done < .releaseignore - -# Remove the .releaseignore file itself -echo "Removing .releaseignore ..." -rm -f .releaseignore - -# Run git-archive to generate tarball -echo "Creating ${PKG_NAME}.tar.gz ..." -mkdir -p dist -git archive \ - --format=tar.gz \ - --prefix="$PKG_NAME/" \ - --output="dist/${PKG_NAME}.tar.gz" \ - HEAD - -# List archive contents for review -gzip -dc < "dist/${PKG_NAME}.tar.gz" | tar tf - - -# Output location -echo "Package dist/${PKG_NAME}.tar.gz OK" diff --git a/script/release b/script/release deleted file mode 100755 index 9629cacff..000000000 --- a/script/release +++ /dev/null @@ -1,506 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -#/ Usage: release [--dry-run] [--skip-version-bump-check] [min_version] -#/ -#/ Publish a backup-utils release: -#/ * Updates the package changelog -#/ * Bumps the backup-utils version if required -#/ * Creates the release pull request -#/ * Merges the release pull request -#/ * Creates the release draft -#/ * Tags the release -#/ * Builds the release assets and uploads them -#/ -#/ Notes: -#/ * Needs GH_RELEASE_TOKEN and GH_AUTHOR set in the environment. -#/ * Export GH_OWNER and GH_REPO if you want to use a different owner/repo -#/ * Only pull requests labeled with bug, feature or enhancement will show up in the -#/ release page and the changelog. -#/ * If this is a X.Y.0 release, a minimum supported version needs to be supplied too. -#/ -require "json" -require "net/http" -require "time" -require "erb" -require "English" - -API_HOST = ENV["GH_HOST"] || "api.github.com" -API_PORT = 443 -GH_REPO = ENV["GH_REPO"] || "backup-utils" -GH_OWNER = ENV["GH_OWNER"] || "github" -GH_AUTHOR = ENV["GH_AUTHOR"] -DEB_PKG_NAME = "github-backup-utils" -GH_BASE_BRANCH = ENV["GH_BASE_BRANCH"] || "master" # TODO: should we even allow a default or require all params get set explicitly? -GH_STABLE_BRANCH = "" - -# If PUBLISH is false, we leave the release in a draft state to be manually published later through the UI -PUBLISH = ENV["PUBLISH"] == "true" || false - -CHANGELOG_TMPL = "" '<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium - -<%- changes.each do |ch| -%> - * <%= ch.strip.chomp %> -<% end -%> - - -- <%= GH_AUTHOR %> <%= Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %z") %> - -' "" - -# Override Kernel.warn -def warn(msg) - Kernel.warn msg unless @no_warn -end - -def client(host = API_HOST, port = API_PORT) - @http ||= begin - c = Net::HTTP.new(host, port) - c.use_ssl = true - c - end -end - -def get(path) - req = Net::HTTP::Get.new(path) - req["Authorization"] = "token #{release_token}" - client.request(req) -end - -def post(path, body) - req = Net::HTTP::Post.new(path) - req["Authorization"] = "token #{release_token}" - req.body = body - client.request(req) -end - -def post_file(path, body) - req = Net::HTTP::Post.new(path) - req["Authorization"] = "token #{release_token}" - req["Content-Type"] = path.match?(/.*\.tar\.gz$/) ? "application/tar+gzip" : "application/vnd.debian.binary-package" - req.body = body - client.request(req) -end - -def put(path, body) - req = Net::HTTP::Put.new(path) - req["Authorization"] = "token #{release_token}" - req.body = body - client.request(req) -end - -def patch(path, body) - req = Net::HTTP::Patch.new(path) - req["Authorization"] = "token #{release_token}" - req.body = body - client.request(req) -end - -def release_token - token = ENV["GH_RELEASE_TOKEN"] - raise "GH_RELEASE_TOKEN environment variable not set" if token.nil? - - token -end - -# Create a lightweight tag -def tag(name, sha) - body = { - "ref": "refs/tags/#{name}", - "sha": sha, - }.to_json - res = post("/repos/#{GH_OWNER}/#{GH_REPO}/git/refs", body) - - raise "Creating tag ref failed (#{res.code})" unless res.is_a? Net::HTTPSuccess -end - -def bug_or_feature?(issue_hash) - return true if issue_hash["labels"].find { |label| ["bug", "feature", "enhancement"].include?(label["name"]) } - false -end - -def issue_from(issue) - res = get("/repos/#{GH_OWNER}/#{GH_REPO}/issues/#{issue}") - raise "Issue ##{issue} not found in #{GH_OWNER}/#{GH_REPO}" unless res.is_a? Net::HTTPSuccess - - JSON.parse(res.body) -end - -def beautify_changes(changes) - out = [] - changes.each do |chg| - next unless chg =~ /#(\d+)/ - begin - issue = issue_from Regexp.last_match(1) - out << "#{issue["title"]} ##{Regexp.last_match(1)}" if bug_or_feature?(issue) - rescue => e - warn "Warning: #{e.message}" - end - end - - out -end - -def changelog - puts "building changelog by comparing origin/#{GH_STABLE_BRANCH}...origin/#{GH_BASE_BRANCH}" - changes = `git log --pretty=oneline origin/#{GH_STABLE_BRANCH}...origin/#{GH_BASE_BRANCH} --reverse --grep "Merge pull request" | sort -t\# -k2`.lines.map(&:strip) - raise "Building the changelog failed" if $CHILD_STATUS != 0 - - changes -end - -def build_changelog(changes, package_name, package_version) - ERB.new(CHANGELOG_TMPL, nil, "-").result(binding) -end - -def update_changelog(changes, name, version, path = "debian/changelog") - raise "debian/changelog not found" unless File.exist?(path) - File.open("#{path}.new", "w") do |f| - f.puts build_changelog changes, name, version - f.puts(File.read(path)) - end - File.rename("#{path}.new", path) -end - -def create_release(tag_name, branch, rel_name, rel_body, draft = true) - body = { - 'tag_name': tag_name, - 'target_commitish': branch, - 'name': rel_name, - 'body': rel_body, - 'draft': draft, - 'prerelease': false, - }.to_json - res = post("/repos/#{GH_OWNER}/#{GH_REPO}/releases", body) - - raise "Failed to create release (#{res.code})" unless res.is_a? Net::HTTPSuccess - - JSON.parse(res.body) -end - -def publish_release(release_id) - body = { - 'draft': false, - }.to_json - res = patch("/repos/#{GH_OWNER}/#{GH_REPO}/releases/#{release_id}", body) - - raise "Failed to update release (#{res.code})" unless res.is_a? Net::HTTPSuccess -end - -def list_releases - res = get("/repos/#{GH_OWNER}/#{GH_REPO}/releases") - raise "Failed to retrieve releases" unless res.is_a? Net::HTTPSuccess - - JSON.parse(res.body) -end - -def release_available?(tag_name) - return true if list_releases.find { |r| r["tag_name"] == tag_name } - - false -end - -def bump_version(new_version, min_version = nil, path = "share/github-backup-utils/version") - current_version = Gem::Version.new(File.read(path).strip.chomp) - if !@skip_version_bump_check && (Gem::Version.new(new_version) < current_version) - raise "New version should be newer than #{current_version}" - end - File.open("#{path}.new", "w") { |f| f.puts new_version } - File.rename("#{path}.new", path) - - unless min_version.nil? - content = File.read("bin/ghe-host-check") - new_content = content.gsub(/supported_minimum_version="[0-9]\.[0-9]+\.0"/, "supported_minimum_version=\"#{min_version}\"") - File.open("bin/ghe-host-check", "w") { |file| file.puts new_content } - - content = File.read("test/testlib.sh") - new_content = content.gsub(/GHE_TEST_REMOTE_VERSION:=[0-9]\.[0-9]+\.0/, "GHE_TEST_REMOTE_VERSION:=#{new_version}") - File.open("test/testlib.sh", "w") { |file| file.puts new_content } - end -end - -def push_release_branch(version) - unless (out = `git checkout --quiet -b release-#{version}`) - raise "Creating release branch failed:\n\n#{out}" - end - - unless (out = `git commit --quiet -m 'Bump version: #{version} [ci skip]' debian/changelog share/github-backup-utils/version bin/ghe-host-check test/testlib.sh script/test`) - raise "Error committing changelog and version:\n\n#{out}" - end - - unless (out = `git push --quiet origin release-#{version}`) - raise "Failed pushing the release branch:\n\n#{out}" - end -end - -def update_stable_branch - `git checkout --quiet #{GH_STABLE_BRANCH}` - unless (out = `git merge --quiet --ff-only origin/#{GH_BASE_BRANCH}`) - warn "Merging #{GH_BASE_BRANCH} into #{GH_STABLE_BRANCH} failed:\n\n#{out}" - end - unless (out = `git push --quiet origin #{GH_STABLE_BRANCH}`) - warn "Failed pushing the #{GH_STABLE_BRANCH} branch:\n\n#{out}" - end -end - -def create_release_pr(version, release_body) - body = { - 'title': "Bump version: #{version}", - 'body': release_body, - 'head': "release-#{version}", - 'base': GH_BASE_BRANCH, - }.to_json - res = post("/repos/#{GH_OWNER}/#{GH_REPO}/pulls", body) - raise "Creating release PR failed (#{res.code})" unless res.is_a? Net::HTTPSuccess - - JSON.parse(res.body) -end - -def merge_pr(number, sha, version) - body = { - 'commit_title': "Merge pull request ##{number} from github/release-#{version}", - 'commit_message': "Bump version: #{version}", - 'sha': sha, - 'merge_method': "merge", - }.to_json - pr_mergeable? number - res = put("/repos/#{GH_OWNER}/#{GH_REPO}/pulls/#{number}/merge", body) - raise "Merging PR failed (#{res.code})" unless res.is_a? Net::HTTPSuccess - - JSON.parse(res.body) -end - -class RetryError < StandardError -end - -def pr_mergeable?(number) - begin - retries ||= 5 - res = get("/repos/#{GH_OWNER}/#{GH_REPO}/pulls/#{number}") - raise RetryError if JSON.parse(res.body)["mergeable"].nil? - mergeable = JSON.parse(res.body)["mergeable"] - rescue RetryError - sleep 1 - retry unless (retries -= 1).zero? - raise "PR is unmergable." - end - - mergeable || false -end - -def can_auth? - !ENV["GH_RELEASE_TOKEN"].nil? -end - -def repo_exists? - res = get("/repos/#{GH_OWNER}/#{GH_REPO}") - res.is_a? Net::HTTPSuccess -end - -def can_build_deb? - system("which debuild > /dev/null 2>&1") -end - -def package_tarball - unless (out = `script/package-tarball 2>&1`) - raise "Failed to package tarball:\n\n#{out}" - end - out -end - -def package_deb - unless (out = `DEB_BUILD_OPTIONS=nocheck script/package-deb 2>&1`) - raise "Failed to package Debian package:\n\n#{out}" - end - out -end - -def attach_assets_to_release(upload_url, release_id, files) - @http = nil - client(URI(upload_url.gsub(/{.*}/, "")).host) - begin - files.each do |file| - raw_file = File.open(file).read - res = post_file("/repos/#{GH_OWNER}/#{GH_REPO}/releases/#{release_id}/assets?name=#{File.basename(file)}", raw_file) - raise "Failed to attach #{file} to release (#{res.code})" unless res.is_a? Net::HTTPSuccess - end - rescue => e - raise e - end - @http = nil -end - -def clean_up(version) - `git checkout --quiet #{GH_BASE_BRANCH}` - `git fetch --quiet origin --prune` - `git pull --quiet origin #{GH_BASE_BRANCH} --prune` - `git branch --quiet -D release-#{version} >/dev/null 2>&1` - `git push --quiet origin :release-#{version} >/dev/null 2>&1` - `git branch --quiet -D tmp-packaging >/dev/null 2>&1` -end - -def is_base_branch_valid?(branch) - if branch == "master" || branch.match(/^\d+\.\d+-main$/) - return true - else - return false - end -end - -def get_stable_branch_name(branch) - ## derive the proper stable branch. if the base branch is "master" the stable branch is just "stable" - ## if the base branch is a release branch, the stable branch will be "x.y-stable" - result = "" - if branch == "master" - result = "stable" - else - result = branch.gsub(/-main$/, "-stable") - end - - result -end - -#### All the action starts #### -if $PROGRAM_NAME == __FILE__ - begin - ## validate base branch. this must either be "master" or a release branch which will match the pattern "x.y-main" - raise "The branch #{GH_BASE_BRANCH} is not valid for releasing backup-utils. branch name must be master or match x.y-main" if !is_base_branch_valid?(GH_BASE_BRANCH) - - GH_STABLE_BRANCH = get_stable_branch_name(GH_BASE_BRANCH) - - puts "base branch = " + GH_BASE_BRANCH - puts "stable branch = " + GH_STABLE_BRANCH - - args = ARGV.dup - dry_run = false - skip_version_bump_check = false - if args.include?("--dry-run") - dry_run = true - args.delete "--dry-run" - end - - if args.include?("--no-warn") - @no_warn = true - args.delete "--no-warn" - end - - if args.include?("--skip-version-bump-check") - @skip_version_bump_check = true - args.delete "--skip-version-bump-check" - end - - raise "Usage: release [--dry-run] [--skip-version-bump-check] [min_version]" if args.empty? - - begin - version = Gem::Version.new(args[0]) - min_version = args[1] ? args[1] : nil - rescue ArgumentError - raise "Error parsing version #{args[0]}" - end - - raise "Minimum supported version is required for X.Y.0 releases\n\nUsage: release [--dry-run] [min_version]" if /[0-9]\.[0-9]+\.0/ =~ version.to_s && min_version.nil? - - raise "The repo #{GH_REPO} does not exist for #{GH_OWNER}" unless repo_exists? - - raise "GH_AUTHOR environment variable is not set" if GH_AUTHOR.nil? - - release_changes = [] - release_changes = beautify_changes changelog if can_auth? - release_a = false - release_a = release_available? "v#{version}" - - puts "Bumping version to #{version}..." - bump_version version, min_version - - if dry_run - puts "Existing release?: #{release_a}" - puts "New version: #{version}" - puts "Min version: #{min_version}" unless min_version.nil? - puts "Owner: #{GH_OWNER}" - puts "Repo: #{GH_REPO}" - puts "Author: #{GH_AUTHOR}" - puts "Token: #{ENV["GH_RELEASE_TOKEN"] && "set" || "unset"}" - puts "Base branch: #{GH_BASE_BRANCH}" - puts "Changelog:" - if release_changes.empty? - puts " => No new bug fixes, enhancements or features." - else - release_changes.each { |c| puts " * #{c}" } - end - puts "Changes:" - puts `git diff --color` - `git checkout -- share/github-backup-utils/version` - `git checkout -- bin/ghe-host-check` - `git checkout -- test/testlib.sh` - exit - end - - raise 'Unable to build Debian pkg: "debuild" not found.' unless can_build_deb? - - raise "Release #{version} already exists." if release_a - - `git fetch --quiet origin --prune` - branches = `git branch --all | grep release-#{version}$` - unless branches.empty? - out = "Release branch release-#{version} already exists. " - out += "Branches found:" - branches.each_line { |l| out += "\n* #{l.strip.chomp}" } - raise out - end - - puts "Updating changelog..." - update_changelog release_changes, DEB_PKG_NAME, version - release_body = "Includes general improvements & bug fixes" - release_body += " and support for GitHub Enterprise Server v#{version}" unless min_version.nil? - release_changes.each do |c| - release_body += "\n* #{c}" - end - - puts "Pushing release branch and creating release PR..." - push_release_branch version - res = create_release_pr(version, "#{release_body}\n\n/cc @github/backup-utils") - - puts "Merging release PR..." - res = merge_pr res["number"], res["head"]["sha"], version - - puts "Tagging and publishing release..." - tag "v#{version}", res["sha"] - - puts "Creating release..." - release_title = "GitHub Enterprise Server Backup Utilities v#{version}" - res = create_release "v#{version}", GH_BASE_BRANCH, release_title, release_body, true - - # Tidy up before building tarball and deb pkg - clean_up version - - puts "Building release tarball..." - package_tarball - - puts "Building Debian pkg..." - package_deb - - puts "Attaching Debian pkg and tarball to release..." - base_dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) - attach_assets_to_release res["upload_url"], res["id"], ["#{base_dir}/dist/#{DEB_PKG_NAME}-v#{version}.tar.gz"] - attach_assets_to_release res["upload_url"], res["id"], ["#{base_dir}/dist/#{DEB_PKG_NAME}_#{version}_all.deb"] - - if PUBLISH - puts "Publishing release..." - publish_release res["id"] - end - - puts "Cleaning up..." - clean_up version - - puts "Updating #{GH_STABLE_BRANCH} branch..." - update_stable_branch - - if !PUBLISH - puts 'Release left in a "Draft" state. Go to the https://github.com/github/backup-utils/releases and publish when ready.' - end - - puts "Released!" - rescue RuntimeError => e - $stderr.puts "Error: #{e}" - exit 1 - end -end diff --git a/script/test b/script/test deleted file mode 100755 index d30bfa8df..000000000 --- a/script/test +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# Usage: script/test -set -e - -ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -TMPDIR="$ROOTDIR/test/tmp" - -# Remove possible remnants of previous test runs -rm -rf "${TMPDIR:?}/*" - -print_test_results() { - if [ -n "$GITHUB_STEP_SUMMARY" ]; then - echo -e "### Test results\n" >> "$GITHUB_STEP_SUMMARY" - echo "| Test suite | Result | Successful | Failed | Skipped | Duration |" >> "$GITHUB_STEP_SUMMARY" - echo "|---|---|--:|--:|--:|--:|" >> "$GITHUB_STEP_SUMMARY" - sort -V "$TMPDIR/results" >> "$GITHUB_STEP_SUMMARY" - fi -} - -# Enable verbose logging of ssh commands -export GHE_VERBOSE_SSH=true - -if ! find test -name "test-*.sh" -print0 | sort -z |xargs -0 -n 1 /bin/bash; then - print_test_results - exit 1 -fi - -print_test_results diff --git a/share/github-backup-utils/bm.sh b/share/github-backup-utils/bm.sh deleted file mode 100755 index 561bcfffb..000000000 --- a/share/github-backup-utils/bm.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash -# bm.sh: benchmarking Bash code blocks -# -# Example: -# bm_start "wget request" -# wget --quiet https://www.google.com -# bm_end "wget request" -# -# Sample output: -# $ bash test.sh -# wget request took 2s - -bm_desc_to_varname(){ - echo "__bm$(echo "$@" | tr -cd '[[:alnum:]]')" -} - -bm_start() -{ - eval "$(bm_desc_to_varname "$@")_start=$(date +%s)" - if [ -n "$GHE_DEBUG" ]; then - echo "Debug: $1 (bm_start)" - fi - bm_init > /dev/null -} - -bm_init() { - if [ -n "$BM_FILE_PATH" ]; then - echo $BM_FILE_PATH - return - fi - - local logfile="benchmark.${BM_TIMESTAMP:-$(date +"%Y%m%dT%H%M%S")}.log" - if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then - export BM_FILE_PATH=$GHE_RESTORE_SNAPSHOT_PATH/benchmarks/$logfile - else - export BM_FILE_PATH=$GHE_SNAPSHOT_DIR/benchmarks/$logfile - fi - - mkdir -p "$(dirname $BM_FILE_PATH)" - echo $BM_FILE_PATH -} - -bm_end() { - if [ -z "$BM_FILE_PATH" ]; then - echo "Call bm_start first" >&2 - exit 1 - fi - - local tend tstart total - tend=$(date +%s) - tstart=$(eval "echo \$$(bm_desc_to_varname "$@")_start") - - total=$(($tend - $tstart)) - - echo "$1 took ${total}s" >> $BM_FILE_PATH - # also log timing information in the verbose log - echo "$1 took ${total}s" 1>&3 - if [ -n "$GHE_DEBUG" ]; then - echo "Debug: $1 took ${total}s (bm_end)" - fi - # track progress - progress "$1 took ${total}s" -} diff --git a/share/github-backup-utils/ghe-backup-actions b/share/github-backup-utils/ghe-backup-actions deleted file mode 100755 index b3f51741e..000000000 --- a/share/github-backup-utils/ghe-backup-actions +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-actions -#/ Take an online, incremental snapshot of all Actions data (excluding -#/ what is stored in MSSQL) -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Set up remote host and root backup snapshot directory based on config -port=$(ssh_port_part "$GHE_HOSTNAME") -host=$(ssh_host_part "$GHE_HOSTNAME") -backup_dir="$GHE_SNAPSHOT_DIR/actions" - -# Verify rsync is available. -if ! rsync --version 1>/dev/null 2>&1; then - log_error "Error: rsync not found." 1>&2 - exit 1 -fi - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Make sure root backup dir exists if this is the first run -mkdir -p "$backup_dir" - -# If we have a previous increment and it is not empty, avoid transferring existing files via rsync's -# --link-dest support. This also decreases physical space usage considerably. -if [ -d "$GHE_DATA_DIR/current/actions" ] && [ "$(ls -A $GHE_DATA_DIR/current/actions)" ]; then - link_dest="--link-dest=$GHE_DATA_DIR/current/actions" -fi - -# Transfer all Actions data from the user data directory using rsync. -ghe_verbose "* Transferring Actions files from $host ..." -log_rsync "BEGIN: actions rsync" 1>&3 -ghe-rsync -av \ - -e "ghe-ssh -p $port" \ - --rsync-path='sudo -u actions rsync' \ - --exclude "mutexes" --exclude "dumps" --exclude "tmp" \ - $link_dest \ - "$host:$GHE_REMOTE_DATA_USER_DIR/actions/" \ - "$GHE_SNAPSHOT_DIR/actions" 1>&3 -log_rsync "END: actions rsync" 1>&3 - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-config b/share/github-backup-utils/ghe-backup-config deleted file mode 100755 index 30062a8f6..000000000 --- a/share/github-backup-utils/ghe-backup-config +++ /dev/null @@ -1,708 +0,0 @@ -#!/usr/bin/env bash -# Usage: . ghe-backup-config -# GitHub Enterprise backup shell configuration. -# -# This file is sourced by the various utilities under bin and share/github-backup-utils to -# load in backup configuration and ensure things are configured properly. -# -# All commands in share/github-backup-utils/ should start with the following: -# -# . $( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config -# -# And all commands in bin/ should start with the following: -# -# . $( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config -# -set +o posix -# Terminal colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -BLUE='\033[0;34m' -NC='\033[0m' # No Color - - -# Assume this script lives in share/github-backup-utils/ when setting the root -GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" - -# Get the version from the version file. -BACKUP_UTILS_VERSION="$(cat "$GHE_BACKUP_ROOT/share/github-backup-utils/version")" - -# If a version check was requested, show the current version and exit -if [ -n "$GHE_SHOW_VERSION" ]; then - echo "GitHub backup-utils v$BACKUP_UTILS_VERSION" - exit 0 -fi - -# Check for "--help|-h" in args or GHE_SHOW_HELP=true and show usage -# shellcheck disable=SC2120 # Our arguments are optional and not meant to be the owning script's -print_usage() { - grep '^#/' <"$0" | cut -c 4- - exit "${1:-1}" -} - -if [ -n "$GHE_SHOW_HELP" ]; then - print_usage -else - for a in "$@"; do - if [ "$a" = "--help" ] || [ "$a" = "-h" ]; then - print_usage - fi - done -fi - -# Save off GHE_HOSTNAME from the environment since we want it to override the -# backup.config value when set. -GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME" - -# Source in the backup config file from the copy specified in the environment -# first and then fall back to the backup-utils root, home directory and system. -config_found=false -for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \ - "$HOME/.github-backup-utils/backup.config" "/etc/github-backup-utils/backup.config"; do - if [ -f "$f" ]; then - GHE_BACKUP_CONFIG="$f" - # shellcheck disable=SC1090 # This is a user-supplied value that can't be predicted - . "$GHE_BACKUP_CONFIG" - config_found=true - break - fi -done - -GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore") -GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup") - -export GHE_RESTORE_IN_PROGRESS -export GHE_BACKUP_IN_PROGRESS - -# Logging display and formatting functions - -log_level() { - local level=$1 - shift - local message=$* - local display="" - local timestamp - timestamp=$(date -u "+%FT%TZ") - - - if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then - if [ "$level" = "info" ]; then - display="INFO" - elif [ "$level" = "warn" ]; then - display="WARN" - elif [ "$level" = "error" ]; then - display="ERROR" - elif [ "$level" = "verbose" ]; then - display="INFO" - elif [ "$level" = "rsync" ]; then - display="RSYNC" - elif [ "$level" = "ssh" ]; then - display="SSH" - else - display="-" - fi - else - if [ "$level" = "info" ]; then - display="${GREEN}INFO${NC}" - elif [ "$level" = "warn" ]; then - display="${YELLOW}WARN${NC}" - elif [ "$level" = "error" ]; then - display="${RED}ERROR${NC}" - elif [ "$level" = "verbose" ]; then - display="${GREEN}INFO${NC}" - elif [ "$level" = "rsync" ]; then - display="${GREEN}RSYNC${NC}" - elif [ "$level" = "ssh" ]; then - display="${GREEN}SSH${NC}" - else - display="-" - fi - fi - echo -e "$timestamp $display $message" -} - -log_info(){ - log_level "info" "$1" -} - -log_warn(){ - log_level "warn" "$1" -} - -log_error(){ - log_level "error" "$1" -} - -log_verbose(){ - log_level "verbose" "$1" -} - -log_rsync(){ - log_level "rsync" "$1" -} - -log_ssh(){ - log_level "ssh" "$1" -} - -# Add the bin and share/github-backup-utils dirs to PATH -PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH" -# shellcheck source=share/github-backup-utils/bm.sh -. "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh" -# shellcheck source=share/github-backup-utils/ghe-incremental-backup-restore -. "$GHE_BACKUP_ROOT/share/github-backup-utils/ghe-incremental-backup-restore" -# shellcheck source=share/github-backup-utils/track-progress -. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress" - - -ghe_restore_check() { - if [ -h "$GHE_RESTORE_IN_PROGRESS" ]; then - echo " Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2 - echo " If there is no restore in progress anymore, please remove" 1>&2 - echo " the $GHE_RESTORE_IN_PROGRESS file and try again." 1>&2 - exit 1 - fi - - if [ -f "$GHE_RESTORE_IN_PROGRESS" ]; then - progress=$(cat "$GHE_RESTORE_IN_PROGRESS") - pid=$(echo "$progress" | cut -d ' ' -f 2) - echo " Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - echo " If PID $pid is not a process related to the restore utilities, please remove" 1>&2 - echo " the $GHE_RESTORE_IN_PROGRESS file and try again." 1>&2 - exit 1 - fi -} - -ghe_backup_check() { - if [ -h "$GHE_BACKUP_IN_PROGRESS" ]; then - echo " Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2 - echo " If there is no backup in progress anymore, please remove" 1>&2 - echo " the $GHE_DATA_DIR/$GHE_BACKUP_IN_PROGRESS file and try again." 1>&2 - exit 1 - fi - - if [ -f "$GHE_BACKUP_IN_PROGRESS" ]; then - progress=$(cat "$GHE_BACKUP_IN_PROGRESS") - pid=$(echo "$progress" | cut -d ' ' -f 2) - echo " Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2 - echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2 - echo " the $GHE_BACKUP_IN_PROGRESS file and try again." 1>&2 - exit 1 - fi -} - -ghe_restore_finished() { - if [ -f "$GHE_RESTORE_IN_PROGRESS" ]; then - rm -f "$GHE_RESTORE_IN_PROGRESS" - fi -} - -ghe_backup_finished() { - if [ -f "$GHE_BACKUP_IN_PROGRESS" ]; then - rm -f "$GHE_BACKUP_IN_PROGRESS" - fi -} - -ghe_parallel_check() { - GHE_PARALLEL_COMMAND_OPTIONS=() - GHE_PARALLEL_RSYNC_COMMAND_OPTIONS=() - - if [ "$GHE_PARALLEL_ENABLED" != "yes" ]; then - return 0 - fi - - # Some machines may have both moreutils parallel and GNU parallel installed. - # Check some variants to find it - GHE_PARALLEL_COMMAND="parallel" - local x - for x in \ - /usr/bin/parallel-moreutils \ - /usr/bin/parallel.moreutils \ - /usr/bin/parallel_moreutils \ - /usr/bin/moreutils-parallel \ - /usr/bin/moreutils.parallel \ - /usr/bin/moreutils_parallel \ - ; do - if [ -x "${x}" ]; then - GHE_PARALLEL_COMMAND="${x}" - break - fi - done - - # Check that the GHE_PARALLEL_COMMAND is pointing to moreutils parallel - if ! "$GHE_PARALLEL_COMMAND" -h | grep -q "parallel \[OPTIONS\] command -- arguments"; then - echo "Error: moreutils not found. Please install https://joeyh.name/code/moreutils" 1>&2 - exit 1 - fi - - if [ -n "$GHE_PARALLEL_MAX_JOBS" ]; then - GHE_PARALLEL_COMMAND_OPTIONS+=(-j "$GHE_PARALLEL_MAX_JOBS") - # Default to the number of max rsync jobs to the same as GHE_PARALLEL_MAX_JOBS, if not set. - # This is only applicable to ghe-restore-repositories currently. - : "${GHE_PARALLEL_RSYNC_MAX_JOBS:="$GHE_PARALLEL_MAX_JOBS"}" - fi - - if [ -n "$GHE_PARALLEL_RSYNC_MAX_JOBS" ]; then - GHE_PARALLEL_RSYNC_COMMAND_OPTIONS+=(-j "$GHE_PARALLEL_RSYNC_MAX_JOBS") - fi - - if [ -n "$GHE_PARALLEL_MAX_LOAD" ]; then - GHE_PARALLEL_COMMAND_OPTIONS+=(-l "$GHE_PARALLEL_MAX_LOAD") - GHE_PARALLEL_RSYNC_COMMAND_OPTIONS+=(-l "$GHE_PARALLEL_MAX_LOAD") - fi -} - -# Check that the config file exists before we source it in. -if ! $config_found; then - echo "Error: No backup configuration file found. Tried:" 1>&2 - [ -n "$GHE_BACKUP_CONFIG" ] && echo " - $GHE_BACKUP_CONFIG" 1>&2 - echo " - $GHE_BACKUP_ROOT/backup.config" 1>&2 - echo " - $HOME/.github-backup-utils/backup.config" 1>&2 - echo " - /etc/github-backup-utils/backup.config" 1>&2 - exit 2 -fi - -# If verbose logging is enabled, redirect fd 3 to stdout or the specified log file; -# otherwise, redirect it to /dev/null. Write verbose output to fd 3. -if [ -n "$GHE_VERBOSE" ]; then - if [ -n "$GHE_VERBOSE_LOG" ]; then - if [ "$GHE_PARALLEL_ENABLED" != "yes" ]; then - exec 3>>"$GHE_VERBOSE_LOG" - else - calling_script_name="$(caller | sed 's:.*/::')" - if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then - exec 3>>"$GHE_VERBOSE_LOG" - log_info "$calling_script_name $*" 1>&3 - else - # colorize the input if supported. - display_caller="${BLUE}$calling_script_name${NC}" - exec 3>>"$GHE_VERBOSE_LOG" - log_info "$display_caller $*" 1>&3 - fi - fi - else - exec 3>&1 - fi -else - exec 3>/dev/null -fi - - -# Restore saved off hostname. -[ -n "$GHE_HOSTNAME_PRESERVE" ] && GHE_HOSTNAME="$GHE_HOSTNAME_PRESERVE" - -# Check that the GHE hostname is set. -if [ -z "$GHE_HOSTNAME" ]; then - echo "Error: GHE_HOSTNAME not set in config file." 1>&2 - exit 2 -fi - -# Check that the GHE data directory is set. -if [ -z "$GHE_DATA_DIR" ]; then - echo "Error: GHE_DATA_DIR not set in config file." 1>&2 - exit 2 -fi - -# Convert the data directory path to an absolute path, basing any relative -# paths on the backup-utils root, and use readlink to canonicalize the path. -if [ "${GHE_DATA_DIR:0:1}" != "/" ]; then - GHE_DATA_DIR="$(cd "$GHE_BACKUP_ROOT" && readlink -m "$GHE_DATA_DIR")" -fi -export GHE_DATA_DIR - -# Assign the Release File path if it hasn't been provided (eg: by test suite) -: "${GHE_RELEASE_FILE:="/etc/github/enterprise-release"}" - -# Check that utils are not being run directly on GHE appliance. -if [ -f "$GHE_RELEASE_FILE" ]; then - echo "Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2 - echo " The backup utilities should be run on a host dedicated to" 1>&2 - echo " long-term permanent storage and must have network connectivity" 1>&2 - echo " with the GitHub Enterprise appliance." 1>&2 - exit 1 -fi - -GHE_CREATE_DATA_DIR=${GHE_CREATE_DATA_DIR:-yes} - -# Check that the data directory is set and create it if it doesn't exist. -if [ ! -d "$GHE_DATA_DIR" ] && [ "$GHE_CREATE_DATA_DIR" = "yes" ]; then - echo "Creating the backup data directory ..." 1>&3 - mkdir -p "$GHE_DATA_DIR" -fi - -if [ ! -d "$GHE_DATA_DIR" ]; then - echo "Error: GHE_DATA_DIR $GHE_DATA_DIR does not exist." >&2 - exit 8 -fi - -# Set some defaults if needed. -: "${GHE_NUM_SNAPSHOTS:=10}" - -# Generate a backup timestamp if one has not already been generated. -# We export the variable so the process group shares the same value. -: "${GHE_SNAPSHOT_TIMESTAMP:=$(date +"%Y%m%dT%H%M%S")}" -export GHE_SNAPSHOT_TIMESTAMP - -# Set the current snapshot directory to /. This is where -# all backups should be written for the current invocation. -GHE_SNAPSHOT_DIR="$GHE_DATA_DIR"/"$GHE_SNAPSHOT_TIMESTAMP" -export GHE_SNAPSHOT_DIR - -# The root filesystem location. This must be used so that tests can override -# the root as a local directory location. -: "${GHE_REMOTE_ROOT_DIR:=""}" - -# The root location of persistent data and applications on the remote side. This -# is always "/data" for GitHub instances. Use of this variable allows -# the location to be overridden in tests. -: "${GHE_REMOTE_DATA_DIR:="/data"}" - -# The root location of user data stores such as git repositories, pages sites, -# elasticsearch indices, etc. This is "/data" under 1.x filesystem layouts and -# "/data/user" under the 2.x filesystem layout. The location is adjusted -# dynamically in ghe_remote_version_config() immediately after obtaining the -# remote version. Utilities that transfer data in and out of the appliance -# should use this variable to ensure proper behavior under different versions. -: "${GHE_REMOTE_DATA_USER_DIR:="$GHE_REMOTE_DATA_DIR"}" - -# The location of the license file on the remote side. This is always -# "/data/enterprise/enterprise.ghl" for GitHub instances. Use of this variable -# allows the location to be overridden in tests. -: "${GHE_REMOTE_LICENSE_FILE:="$GHE_REMOTE_DATA_DIR/enterprise/enterprise.ghl"}" - -# The number of seconds to wait for in progress git-gc processes to complete -# before starting the sync of git data. See share/github-backup-utils/ghe-backup-repositories-rsync -# for more information. Default: 10 minutes. -: "${GHE_GIT_COOLDOWN_PERIOD:=600}" - -# Set "true" to get verbose logging of all ssh commands on stderr -: "${GHE_VERBOSE_SSH:=false}" - -# The location of the cluster configuration file on the remote side. -# This is always "/data/user/common/cluster.conf" for GitHub Cluster instances. -# Use of this variable allows the location to be overridden in tests. -: "${GHE_REMOTE_CLUSTER_CONF_FILE:="$GHE_REMOTE_DATA_DIR/user/common/cluster.conf"}" - -# The location of the file used to disable GC operations on the remote side. -: "${SYNC_IN_PROGRESS_FILE:="$GHE_REMOTE_DATA_USER_DIR/repositories/.sync_in_progress"}" - -# Base path for temporary directories and files. -: "${TMPDIR:="/tmp"}" - -# Backup cadence for MS SQL. Determines the kind of backup taken, either full, differential, -# or transaction log, based on when the last backup of that kind was taken. This defaults to -# taking a full backup once a week, a differential backup once a day, and transaction logs every -# 15 minutes. -: "${GHE_MSSQL_BACKUP_CADENCE:=10080,1440,15}" - -############################################################################### -### Dynamic remote version config - -# Adjusts remote paths based on the version of the remote appliance. This is -# called immediately after the remote version is obtained by -# ghe_remote_version_required(). Child processes inherit the values set here. -ghe_remote_version_config() { - GHE_REMOTE_DATA_USER_DIR="$GHE_REMOTE_DATA_DIR/user" - export GHE_REMOTE_DATA_DIR GHE_REMOTE_DATA_USER_DIR - export GHE_REMOTE_LICENSE_FILE -} - -############################################################################### -### Utility functions - -# Run ghe-host-check and establish the version of the remote GitHub instance in -# the exported GHE_REMOTE_VERSION variable. If the remote version has already -# been established then don't perform the host check again. Utilities in share/github-backup-utils -# that need the remote version should use this function instead of calling -# ghe-host-check directly to reduce ssh roundtrips. The top-level ghe-backup and -# ghe-restore commands establish the version for all subcommands. -# shellcheck disable=SC2120 # Our arguments are optional and not meant to be the owning script's -ghe_remote_version_required() { - if [ -z "$GHE_REMOTE_VERSION" ]; then - _out=$(ghe-host-check "$@") - echo "$_out" - _out_hostname=$(echo "$_out" | tail -n 1) - - # override hostname w/ ghe-host-check output because the port could have - # been autodetected to 122. - GHE_HOSTNAME="${_out_hostname/Connect /}" - GHE_HOSTNAME="${GHE_HOSTNAME/ OK*/}" - export GHE_HOSTNAME - - GHE_REMOTE_VERSION="${_out_hostname#*\(}" - GHE_REMOTE_VERSION="${GHE_REMOTE_VERSION%%\)*}" - export GHE_REMOTE_VERSION - - ghe_parse_remote_version "$GHE_REMOTE_VERSION" - ghe_remote_version_config "$GHE_REMOTE_VERSION" - fi - true -} - -# Parse a version string into major, minor and patch parts and echo. -ghe_parse_version() { - local version_major version_minor version_patch - - IFS=. read -r version_major version_minor version_patch _ <<<"${1#v}" - version_patch=${version_patch%%[a-zA-Z]*} - - echo "$version_major $version_minor $version_patch" -} -# Parse major, minor, and patch parts of the remote appliance version and store -# in GHE_VERSION_MAJOR, GHE_VERSION_MINOR, and GHE_VERSION_PATCH variables. All -# parts are numeric. This is called automatically from -# ghe_remote_version_required so shouldn't be used directly. -# -# Scripts use these variables to alter behavior based on what's supported on the -# appliance version. -ghe_parse_remote_version() { - # shellcheck disable=SC2046 # Word splitting is required to populate the variables - read -r GHE_VERSION_MAJOR GHE_VERSION_MINOR GHE_VERSION_PATCH < <(ghe_parse_version "$1") - export GHE_VERSION_MAJOR GHE_VERSION_MINOR GHE_VERSION_PATCH -} - -# In 3.11 we started to install 2 different version parallel(s) -# moreutils parallel and GNU parallel. When gnu parallel is installed, -# it renames moreutils parallel to parallel.moreutils -# set $PARALLEL_CMD envvar to be used in place of parallel commands -ghe_remote_parallel() { - if [ -z "$GHE_REMOTE_VERSION" ]; then - echo "Error: ghe_remote_version_required needs to be invoked before ghe_remote_parallel" 1>&2 - exit 1 - fi - - if [ "$GHE_VERSION_MINOR" -lt 11 ]; then - PARALLEL_CMD="parallel" - else - PARALLEL_CMD="parallel.moreutils" - fi - export PARALLEL_CMD -} - -# Parses the part out of a ":" or just "" string. -# This is used primarily to break hostspecs with non-standard ports down for -# rsync commands. -ssh_host_part() { - [ "${1##*:}" = "$1" ] && echo "$1" || echo "${1%:*}" -} - -# Parses the part out of a ":" or just "" string. -# This is used primarily to break hostspecs with non-standard ports down for -# rsync commands. -ssh_port_part() { - if [ "${1##*:}" != "$1" ] && [ "${1##*:}" -ne "122" ]; then - echo "Error: SSH port has to be 122 connecting to GitHub Enterprise Server, current value is ${1##*:} for $1." 1>&2 - exit 1 - fi - - echo 122 -} - -# Usage: ghe_remote_logger ... -# Log a message to /var/log/syslog on the remote instance. -# Note: Use sparingly. Remote logging requires an ssh connection per invocation. -ghe_remote_logger() { - echo "$@" | - ghe-ssh "$GHE_HOSTNAME" -- logger -t backup-utils || true -} - -# Usage: ghe_verbose -# Log if verbose mode is enabled (GHE_VERBOSE or `-v`). -ghe_verbose() { - if [ -n "$GHE_VERBOSE" ]; then - log_verbose "$@" 1>&3 - fi -} - -# Usage: ghe_debug OR echo | ghe_debug -# Log if debug mode is enabled (GHE_DEBUG). -ghe_debug() { - [ -z "$GHE_DEBUG" ] && return - - if [ $# -ne 0 ]; then - echo -e "Debug: $*" 1>&3 - elif [ -p /dev/stdin ]; then - echo -e "\n" 1>&3 - while read -r line; do - echo -e "Debug: $line" 1>&3 - done /dev/null || true -} - -# The list of gists returned by the source changed in 2.16.23, 2.17.14, -# 2.18.8, and 2.19.3. We need to account for this difference here. -# In older versions, all paths need to be truncated with `dirname`. -# In newer versions, gist paths are unmodified, and only other repo types -# are truncated with `dirname`. -fix_paths_for_ghe_version() { - if [[ "$GHE_REMOTE_VERSION" =~ 2.16. && "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.16.23)" ]] || - [[ "$GHE_REMOTE_VERSION" =~ 2.17. && "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.17.14)" ]] || - [[ "$GHE_REMOTE_VERSION" =~ 2.18. && "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.18.8)" ]] || - [[ "$(version "$GHE_REMOTE_VERSION")" -ge "$(version 2.19.3)" ]]; then - GIST_FILTER=(-e "/gist/b") - else - unset GIST_FILTER - fi - - # This sed expression is equivalent to running `dirname` on each line, - # but without all the fork+exec overhead of calling `dirname` that many - # times: - # 1. strip off trailing slashes - # 2. if the result has no slashes in it, the dirname is "." - # 3. truncate from the final slash (if any) to the end - # If the GIST_FILTER was set above (because we're on a modern version of - # GHES), then don't modify lines with "gist" in them. - sed "${GIST_FILTER[@]}" -e 's/\/$//; s/^[^\/]*$/./; s/\/[^\/]*$//' -} - -is_binary_backup_feature_on() { - ghe-ssh "$GHE_HOSTNAME" ghe-config --true "mysql.backup.binary" -} - -# Check if the backup is binary by looking up the sentinel file -is_binary_backup() { - test -f "$1/mysql-binary-backup-sentinel" -} - -# Check if a given service is managed externally on the appliance or in a snapshot. -# Usage: is_service_external $service [$config_file] -# Pass in the config file to check if the service is managed externally in the snapshot. -is_service_external(){ - service=$1 - config_file=$2 - case $service in - "mysql") - if [ -n "$config_file" ]; then - enabled=$(GIT_CONFIG="$config_file" git config mysql.external.enabled) - [ "$enabled" == "true" ]; - else - ghe-ssh "$GHE_HOSTNAME" -- ghe-config --true "mysql.external.enabled" - fi - ;; - *) - return 1 - ;; - esac -} - -is_instance_configured(){ - ghe-ssh "$GHE_HOSTNAME" -- "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/configured' ]" -} - -# Helper method that returns true if: -# - the target appliance uses the internal MySQL database (aka NOT BYODB), and -# - the snapshot being restored is from an appliance using an external MySQL database (BYODB) -external_database_snapshot_to_internal_database(){ - ! is_external_database_target && is_external_database_snapshot -} - -# Helper method that returns true if: -# - the target appliance uses an external MySQL database (BYODB), and -# - the snapshot being restored is from an appliance using an internal MySQL database (aka NOT BYODB) -internal_database_snapshot_to_external_database(){ - is_external_database_target && ! is_external_database_snapshot -} - -is_external_database_target_or_snapshot(){ - # If restoring settings, only check if the snapshot being restored was from an appliance with external DB configured. - if $RESTORE_SETTINGS; then - is_external_database_snapshot - else - # Check if restoring a snapshot with an external database configured, or restoring - # to an appliance with an external database configured. - is_external_database_snapshot || is_external_database_target - fi -} - -is_external_database_target(){ - is_service_external "mysql" -} - -is_external_database_snapshot(){ - is_service_external "mysql" "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/settings.json" -} - -# This file exists if this is a backup for an external database AND the backup was -# taken via our logical backup strategy. -is_default_external_database_snapshot(){ - is_external_database_snapshot && test -f "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/logical-external-database-backup-sentinel" -} - -prompt_for_confirmation(){ - echo "$1" - printf "Type 'yes' to continue: " - - while read -r response; do - case $response in - yes|Yes|YES) - break - ;; - '') - printf "Type 'yes' to continue: " - ;; - *) - echo "Restore aborted." 1>&2 - exit 1 - ;; - esac - done - - echo -} - -#initialize progress tracking by clearing out the temp files used to track -init-progress() { - - if [ -e /tmp/backup-utils-progress ]; then - rm -rf /tmp/backup-utils-progress/* - fi - # shellcheck disable=SC2174 # We are fine with -m only affecting the deepest directory - mkdir -m 777 -p /tmp/backup-utils-progress - touch /tmp/backup-utils-progress/{total,type,progress,info} -} - - -#increase total count of progress -increment-progress-total-count() { - ((PROGRESS_TOTAL += $1)) - echo "$PROGRESS_TOTAL" > /tmp/backup-utils-progress/total -} - -## -# This function is used by ghe-gc-disable, ghe-backup-repositories, and ghe-backup-storage -# This function should be used directly to disable and drain GC operations ONLY on HA-replica node -# (as done in ghe-backup-repositories and ghe-backup-storage) -# Otherwise use ghe-gc-disable which will call this function with the correct parameters. -# -# Arguments: -# $1 - path to sync-in-progress file ($SYNC_IN_PROGRESS_FILE) -# $2 - git cooldown period ($GHE_GIT_COOLDOWN_PERIOD) -## -gc_disable() { - set -e - local sync_in_progress="$1" - local git_cooldown_period="$2" - - # Touch the sync-in-progress file, disabling GC operations, and wait for all - # active GC processes to finish on the remote side. - sudo -u git touch "$sync_in_progress" - for _ in $(seq $git_cooldown_period); do - # note: the bracket synta[x] below is to prevent matches against the - # grep process itself. - if ps axo args | grep -E -e "^git( -.*)? nw-repac[k]( |$)" -e "^git( -.*)? g[c]( |$)" >/dev/null; then - sleep 1 - else - exit 0 - fi - done - exit 7 -} diff --git a/share/github-backup-utils/ghe-backup-es-audit-log b/share/github-backup-utils/ghe-backup-es-audit-log deleted file mode 100755 index 84da8953a..000000000 --- a/share/github-backup-utils/ghe-backup-es-audit-log +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-es-audit-log -#/ Take a backup of audit logs in Elasticsearch. -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Set up remote host and root elastic backup directory based on config -host="$GHE_HOSTNAME" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Make sure root backup dir exists if this is the first run -mkdir -p "$GHE_SNAPSHOT_DIR/audit-log" - -if ! indices=$(ghe-ssh "$host" "curl -s \"localhost:9201/_cat/indices/audit_log*?h=index,pri.store.size&bytes=b\""); then - log_error "ghe-backup-es-audit-log: Failed to retrieve audit log indices." 1>&2 - exit 1 -fi - -# Exit if no indices were found -[ -z "$indices" ] && exit - -# Determine if the audit log migration has occurred or is needed. -if echo 'set -o pipefail; ! test -e /data/user/common/es-scan-complete && test -f /usr/local/share/enterprise/run-audit-log-transitions.sh' | ghe-ssh "$host" /bin/bash; then - if echo 'set -o pipefail; echo n | /usr/local/share/enterprise/run-audit-log-transitions.sh > /dev/null 2>&1 && touch /data/user/common/es-scan-complete' | ghe-ssh "$host" /bin/bash; then - touch $GHE_SNAPSHOT_DIR/es-scan-complete - fi -fi - -IFS=$'\n' -for index in $indices; do - IFS=' ' - set $index - index_name=$1 - index_size=$2 - - if [[ -f $GHE_DATA_DIR/current/audit-log/$index_name.gz && $(cat $GHE_DATA_DIR/current/audit-log/$index_name.gz.size 2>/dev/null || true) -eq $index_size ]]; then - ghe_verbose "* Linking unchanged audit log index: $index_name" - # Hard link any indices that have not changed since the last backup - ln $GHE_DATA_DIR/current/audit-log/$index_name.gz $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz - ln $GHE_DATA_DIR/current/audit-log/$index_name.gz.size $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz.size - else - ghe_verbose "* Performing audit log export for index: $index_name" - echo "/usr/local/share/enterprise/ghe-es-dump-json \"http://localhost:9201/$index_name\" | gzip" | ghe-ssh "$host" -- /bin/bash > $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz - echo $index_size > $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz.size - fi -done - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-es-rsync b/share/github-backup-utils/ghe-backup-es-rsync deleted file mode 100755 index fce7043bb..000000000 --- a/share/github-backup-utils/ghe-backup-es-rsync +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-es-rsync -#/ Take an online, incremental snapshot of Elasticsearch indices. -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup when the rsync strategy is used. -# shellcheck disable=SC2086 -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Set up remote host and root elastic backup directory based on config -host="$GHE_HOSTNAME" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Verify rsync is available. -if ! rsync --version 1>/dev/null 2>&1; then - log_error "rsync not found." 1>&2 - exit 1 -fi - -# Make sure root backup dir exists if this is the first run -mkdir -p "$GHE_SNAPSHOT_DIR/elasticsearch" - -# Verify that the /data/elasticsearch directory exists. -if ! ghe-ssh "$host" -- "[ -d '$GHE_REMOTE_DATA_USER_DIR/elasticsearch' ]"; then - ghe_verbose "* The '$GHE_REMOTE_DATA_USER_DIR/elasticsearch' directory doesn't exist." - exit 0 -fi - -# If we have a previous increment, avoid transferring existing files via rsync's -# --link-dest support. This also decreases physical space usage considerably. -if [ -d "$GHE_DATA_DIR/current/elasticsearch" ]; then - link_dest="--link-dest=../../current/elasticsearch" -fi - -# Transfer ES indices from a GitHub instance to the current snapshot -# directory, using a previous snapshot to avoid transferring files that have -# already been transferred. -ghe_verbose "* Performing initial sync of ES indices ..." -log_rsync "BEGIN elasticsearch rsync" 1>&3 -ghe-rsync -av \ - -e "ghe-ssh -p $(ssh_port_part "$host")" \ - --rsync-path="sudo -u elasticsearch rsync" \ - $link_dest \ - "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch/" \ - "$GHE_SNAPSHOT_DIR/elasticsearch" 1>&3 -log_rsync "END elasticsearch rsync" 1>&3 -# Set up a trap to re-enable flushing on exit and remove temp file -cleanup () { - ghe_verbose "* Enabling ES index flushing ..." - echo '{"index":{"translog.flush_threshold_size":"512MB"}}' | - ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null -} -trap 'cleanup' EXIT -trap 'exit $?' INT # ^C always terminate - -# Disable ES flushing and force a flush right now -ghe_verbose "* Disabling ES index flushing ..." -echo '{"index":{"translog.flush_threshold_size":"1PB"}}' | -ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null -ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null - -# Transfer all ES indices again -ghe_verbose "* Performing follow-up sync of ES indices ..." -log_rsync "BEGIN: elasticsearch followup rsync" 1>&3 -ghe-rsync -av \ - -e "ghe-ssh -p $(ssh_port_part "$host")" \ - --rsync-path="sudo -u elasticsearch rsync" \ - $link_dest \ - "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/elasticsearch/" \ - "$GHE_SNAPSHOT_DIR/elasticsearch" 1>&3 -log_rsync "END: elasticsearch followup rsync" 1>&3 - -# "Backup" audit log migration sentinel file -if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/es-scan-complete"; then - touch $GHE_SNAPSHOT_DIR/es-scan-complete -fi - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-fsck b/share/github-backup-utils/ghe-backup-fsck deleted file mode 100755 index d255e036f..000000000 --- a/share/github-backup-utils/ghe-backup-fsck +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-fsck [--print-nwo] -#/ -#/ Run git fsck on backed up repositories. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -echo "Running git fsck on repos..." - -# Verify git is available. -if ! git --version 1>/dev/null 2>&1; then - log_error "git not found." 1>&2 - exit 1 -fi - -sdir=$1 -repos=0 -errors=0 -log=$(mktemp -t ghe-backup-fsck-XXXXXX) -t_start=$(date +%s) -if git fsck -h | grep -q '\-\-dangling'; then - git_cmd='git fsck --no-dangling' -else - log_warn "ghe-backup-fsck: old git version, --no-dangling not available" 1>&3 - git_cmd='git fsck' -fi - -if [ -z "$sdir" ] || [ ! -d "$sdir" ]; then - print_usage -fi - -if [ ! -d "$sdir/repositories" ]; then - log_error "ghe-backup-fsck: $sdir is not a valid snapshot." >&2 - exit 1 -fi - -# shellcheck disable=SC2044 # Snapshot and repository directory names are safe for find iteration. -for repo in $(find $sdir/repositories/ -type d -name \*.git); do - repos=$(($repos+1)) - before_time=$(date +%s) - - status=$( - set -e - - cd $repo - - nwo="-" - if [ "$2" = "--print-nwo" ] && [ -f info/nwo ]; then - nwo="$(cat info/nwo)" - fi - - if [ ! -f objects/info/alternates ] || grep -q '^\.\.' objects/info/alternates; then - $git_cmd >$log 2>&1 && { - echo "OK $repo $nwo"; exit - } - else - GIT_ALTERNATE_OBJECT_DIRECTORIES=../network.git/objects $git_cmd >$log 2>&1 && { - echo "WARN $repo $nwo (alternates absolute path)"; exit - } - fi - - echo "ERROR $repo $nwo" - ) - - elapsed_time=$(($(date +%s) - before_time)) - - if [[ ! "$status" =~ ^OK ]] || [ $elapsed_time -gt 5 ]; then - echo "$status ${elapsed_time}s" 1>&3 - [ -n "$GHE_VERBOSE" ] && cat $log - fi - - case "$status" in - OK*) - ;; - ERROR*) - errors=$(($errors+1)) - ;; - esac - -done - -log_info "* Repos verified: $repos, Errors: $errors, Took: $(($(date +%s) - $t_start))s" - -rm -f $log - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-git-hooks b/share/github-backup-utils/ghe-backup-git-hooks deleted file mode 100755 index 1763501c7..000000000 --- a/share/github-backup-utils/ghe-backup-git-hooks +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-git-hooks -#/ Take an online, incremental snapshot of custom Git hooks configuration. -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Verify rsync is available. -if ! rsync --version 1>/dev/null 2>&1; then - log_error "rsync not found." 1>&2 - exit 1 -fi - -backup_dir="$GHE_SNAPSHOT_DIR/git-hooks" -# Location of last good backup for rsync --link-dest -backup_current="$GHE_DATA_DIR/current/git-hooks" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Split host:port into parts -port=$(ssh_port_part "$GHE_HOSTNAME") -host=$(ssh_host_part "$GHE_HOSTNAME") - -# Add user / -l option -user="${host%@*}" -[ "$user" = "$host" ] && user="admin" - -hostnames=$host -ssh_config_file_opt= -tempdir=$(mktemp -d -t backup-utils-restore-XXXXXX) -opts="$GHE_EXTRA_SSH_OPTS" - -# git server hostnames under cluster -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt="-F $ssh_config_file" - opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") - ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" -fi - -# Removes the remote sync-in-progress file on exit, re-enabling GC operations -# on the remote instance. -cleanup() { - rm -rf $tempdir -} -trap 'cleanup' EXIT -trap 'exit $?' INT # ^C always terminate - -# Transfer Git hooks data from a GitHub instance to the current snapshot -# directory, using a previous snapshot to avoid transferring files that have -# already been transferred. A set of rsync filter rules are provided on stdin -# for each invocation. -rsync_git_hooks_data () { - port=$(ssh_port_part "$1") - host=$(ssh_host_part "$1") - - subpath=$2 - shift 2 - - # If we have a previous increment and it is not empty, avoid transferring existing files via rsync's - # --link-dest support. This also decreases physical space usage considerably. - if [ -d "$backup_current/$subpath" ] && [ "$(ls -A $backup_current/$subpath)" ]; then - subdir="git-hooks/$subpath" - link_path=".." - while true; do - if [ "$(dirname $subdir)" = "." ]; then - break - fi - - if [ "$(dirname $subdir)" = "/" ]; then - break - fi - - link_path="../$link_path" - subdir=$(dirname $subdir) - done - - local link_dest="--link-dest=../${link_path}/current/git-hooks/$subpath" - fi - - # Ensure target directory exists, is needed with subdirectories - mkdir -p "$backup_dir/$subpath" - log_rsync "BEGIN: git-hooks sync" 1>&3 - ghe-rsync -av \ - -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" $link_dest \ - --rsync-path='sudo -u git rsync' \ - "$host:$GHE_REMOTE_DATA_USER_DIR/git-hooks/$subpath/" \ - "$backup_dir/$subpath" 1>&3 - log_rsync "END: git-hooks sync" 1>&3 -} - -hostname=$(echo $hostnames | awk '{ print $1; }') -if ghe-ssh $ssh_config_file_opt "$hostname:122" -- "sudo -u git [ -d '$GHE_REMOTE_DATA_USER_DIR/git-hooks/environments/tarballs' ]"; then - rsync_git_hooks_data $hostname:122 environments/tarballs -else - ghe_verbose "git-hooks environment tarballs not found. Skipping ..." -fi - -if ghe-ssh $ssh_config_file_opt "$hostname:122" -- "sudo -u git [ -d '$GHE_REMOTE_DATA_USER_DIR/git-hooks/repos' ]"; then - rsync_git_hooks_data $hostname:122 repos -else - ghe_verbose "git-hooks repositories not found. Skipping ..." -fi - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-minio b/share/github-backup-utils/ghe-backup-minio deleted file mode 100755 index bf7a429d4..000000000 --- a/share/github-backup-utils/ghe-backup-minio +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-minio -#/ Take an online, incremental snapshot of all minio data -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$(dirname "${BASH_SOURCE[0]}")/ghe-backup-config" - -bm_start "$(basename "${0}")" - -# Set up remote host and root backup snapshot directory based on config -port="$(ssh_port_part "${GHE_HOSTNAME}")" -host="$(ssh_host_part "${GHE_HOSTNAME}")" -backup_dir="${GHE_SNAPSHOT_DIR}/minio" - -# Verify rsync is available. -if ! command -v rsync 1> /dev/null 2>&1; then - log_error "rsync not found." 1>&2 - exit 1 -fi - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "${host}" - -# Make sure root backup dir exists if this is the first run -mkdir -p "${backup_dir}" - -# If we have a previous increment and it is not empty, avoid transferring existing files via rsync's -# --link-dest support. This also decreases physical space usage considerably. -# Hilariously, this HAS to stay unquoted when you call `rsync` further -# down because when the shell interpolates this out, `rsync` will throw -# an absolute fit if this variable is quoted. Surprise! -if [[ -d "${GHE_DATA_DIR}/current/minio" ]] && - [[ "$(ls -A "${GHE_DATA_DIR}/current/minio")" ]]; then - link_dest="--link-dest=${GHE_DATA_DIR}/current/minio" -fi - -# Transfer all minio data from the user data directory using rsync. -ghe_verbose "* Transferring minio files from ${host} ..." -log_rsync "BEGIN: minio rsync" 1>&3 -ghe-rsync \ - --archive \ - --verbose \ - --rsh="ghe-ssh -p ${port}" \ - --rsync-path='sudo -u minio rsync' \ - --exclude=".minio.sys" \ - ${link_dest} \ - "${host}:${GHE_REMOTE_DATA_USER_DIR}/minio/" \ - "${GHE_SNAPSHOT_DIR}/minio" 1>&3 -log_rsync "END: minio rsync" 1>&3 -bm_end "$(basename "${0}")" diff --git a/share/github-backup-utils/ghe-backup-mssql b/share/github-backup-utils/ghe-backup-mssql deleted file mode 100755 index 0975dea11..000000000 --- a/share/github-backup-utils/ghe-backup-mssql +++ /dev/null @@ -1,363 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-mssql -#/ -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Set up remote host and root backup snapshot directory based on config -backup_dir="$GHE_SNAPSHOT_DIR/mssql" -last_mssql= -backup_command= -backup_type= -full_expire= -diff_expire= -tran_expire= - -# Check if the export tool is available in this version -export_tool_available() { - if [ -z "$GHE_TEST_REMOTE_VERSION" ]; then - ghe_ssh_mssql "test -e /usr/local/bin/ghe-export-mssql" - else - # Always return available for test - return 0 - fi -} - -ghe_ssh_mssql() { - ghe-ssh "${opts[@]}" "${ssh_config_file_opt[@]}" "$GHE_MSSQL_PRIMARY_HOST" "$@" -} - -cleanup() { - rm -rf "$tempdir" -} -trap 'cleanup' EXIT INT - -# use the mssql primary host if GHES cluster configuration contains a mssql-master or use the ghe server if the mssql-master is not available. -GHE_MSSQL_PRIMARY_NODE="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.mssql-master" || true)" -GHE_MSSQL_PRIMARY_HOST="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.$GHE_MSSQL_PRIMARY_NODE.hostname" || true)" - -if [ -z "$GHE_MSSQL_PRIMARY_HOST" ]; then - GHE_MSSQL_PRIMARY_HOST="$GHE_HOSTNAME" -fi - -tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) -ssh_config_file_opt=() -opts=() - -isHA="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.ha" || true)" - -# get server hostnames under cluster and HA -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ] || [ "$isHA" = "true" ] ; then - ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt=("-F" "$ssh_config_file") - opts=("-o" "UserKnownHostsFile=/dev/null" "-o" "StrictHostKeyChecking=no" "-o" "PasswordAuthentication=no") - ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file" -fi - -if ! export_tool_available ; then - log_error "ghe-export-mssql is not available" 1>&2 - exit 1 -fi - -add_minute() { - # Expect date string in the format of yyyymmddTHHMMSS - # Here parse date differently depending on GNU Linux vs BSD MacOS - if date -v -1d > /dev/null 2>&1; then - date -v +"$2"M -ujf'%Y%m%dT%H%M%S' "$1" +%Y%m%dT%H%M%S - else - dt=$1 - date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes" - fi -} - -find_timestamp() { - filename="${1##*/}" - IFS='@' read -ra parts <<< "$filename" - datetime_part=${parts[1]:0:15} - echo "$datetime_part" -} - -actions_dbs() { - all_dbs=$(echo 'set -o pipefail; ghe-mssql-console -y -n -q "SET NOCOUNT ON; SELECT name FROM sys.databases"' | ghe_ssh_mssql /bin/bash) - for db in $all_dbs; do - if [[ ! "$db" =~ ^(master|tempdb|model|msdb)$ ]] && [[ "$db" =~ ^[a-zA-Z0-9_-]+$ ]]; then - echo "$db" - fi - done -} - -ensure_same_dbs() { - locals=() - while read -r file; do - filename=$(basename "$file") - locals+=("$filename") - done < <(find "$1" \( -name "*.bak" -o -name "*.diff" -o -name "*.log" \)) - - for remote in $(actions_dbs); do - remaining_locals=() - for local in "${locals[@]}"; do - if ! [[ "$local" == "$remote"* ]]; then - remaining_locals+=("$local") - fi - done - locals=("${remaining_locals[@]}") - done - - if [[ "${#locals[@]}" -ne 0 ]]; then - log_warn "Warning: Found following ${#locals[@]} backup files that can't be traced back to the specified GHES host." - log_warn "Warning: Did you recently reconfigure the GHES host? Move or delete these backup files if no longer needed." - for local in "${locals[@]}"; do - ghe_verbose "$1/$local" - done - - exit 1 - fi -} - -run_query() { - echo "set -o pipefail; ghe-mssql-console -y -n -q \"SET NOCOUNT ON; $1\"" | ghe_ssh_mssql /bin/bash | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' -} - -get_latest_backup_file() { - backups_dir=$1 - db=$2 - ext=$3 - - latest_full_backup=$(find "$backups_dir" -type f -name "$db*.$ext" | grep -E '[0-9]{8}T[0-9]{6}' | sort | tail -n 1) - latest_full_backup_file="${latest_full_backup##*/}" - echo "$latest_full_backup_file" -} - -get_backup_val() { - db=$1 - filename=$2 - column=$3 - run_query " - SELECT s.$column - FROM msdb.dbo.backupset s - JOIN msdb.dbo.backupmediafamily f - ON s.media_set_id = f.media_set_id - WHERE s.database_name = '$db' AND f.physical_device_name LIKE '%$filename'" -} - -get_backup_checkpoint_lsn() { - get_backup_val "$1" "$2" "checkpoint_lsn" -} - -get_backup_last_lsn() { - get_backup_val "$1" "$2" "last_lsn" -} - -get_next_log_backup_starting_lsn() { - db=$1 - # last_log_backup_lsn: The starting log sequence number of the next log backup - # https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-database-recovery-status-transact-sql - run_query " - SELECT last_log_backup_lsn - FROM sys.database_recovery_status drs - JOIN sys.databases db on drs.database_id = db.database_id - WHERE db.name = '$db'" -} - -get_next_diff_backup_base_lsn() { - db=$1 - # differential_base_lsn: Base for differential backups. Data extents changed after this LSN will be included in a differential backup. - # https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-master-files-transact-sql - run_query " - SELECT differential_base_lsn - FROM sys.master_files mf - WHERE mf.name = '$db'" -} - -last_mssql=$GHE_DATA_DIR/current/mssql - -if [ ! -d "$last_mssql" ] \ - || [ -z "$(find "$last_mssql" -type f -name '*.bak' | head -n 1)" ]; then - ghe_verbose "Taking first full backup" - backup_type="full" -else - ensure_same_dbs "$last_mssql" - - # Check schedule to determine backup type - IFS=',' read -ra cadence <<< "$GHE_MSSQL_BACKUP_CADENCE" - - current=$(date -u +%Y%m%d%H%M%S) - - full=$(find "$last_mssql" -type f -name "*.bak" | head -n 1) - full=$(find_timestamp "$full") - full_expire=$(add_minute "$full" "${cadence[0]}") - full_expire="${full_expire//T}" - - diff=$(find "$last_mssql" -type f -name "*.diff" | head -n 1) - if [ -f "$diff" ]; then - diff=$(find_timestamp "$diff") - diff_expire=$(add_minute "$diff" "${cadence[1]}") - diff_expire="${diff_expire//T}" - else - diff_expire=$(add_minute "$full" "${cadence[1]}") - diff_expire="${diff_expire//T}" - fi - - tran=$(find "$last_mssql" -type f -name "*.log" | grep -E '[0-9]{8}T[0-9]{6}' | sort | tail -1) - tran=$(find_timestamp "$tran") - tran_expire=$(add_minute "$tran" "${cadence[2]}") - tran_expire="${tran_expire//T}" - - ghe_verbose "current $current, full expire $full_expire, \ -diff expire $diff_expire, tran expire $tran_expire" - - # Determine the type of backup to take based on expiry time - if [ "$current" -gt "$full_expire" ]; then - backup_type='full' - elif [ "$current" -gt "$diff_expire" ]; then - backup_type='diff' - elif [ "$current" -gt "$tran_expire" ]; then - backup_type='transaction' - fi - - # Upgrade to a full backup if the diff/transaction backup might not be restorable due to other backup mechanisms interfering - # with the transaction LSN chain or differential base LSN. - if [ "$backup_type" == 'diff' ] || [ "$backup_type" == 'transaction' ]; then - ghe_verbose "Checking for conflicting backups to ensure a $backup_type backup is sufficient" - - for db in $(actions_dbs); do - # Ensure that a diff backup will be based on the full backup file we have (rather than one another backup mechanism took) - if [ "$backup_type" == 'diff' ]; then - full_backup_file=$(get_latest_backup_file "$last_mssql" "$db" "bak") - if [[ "$full_backup_file" == "" ]]; then - log_warn "Taking a full backup instead of a diff backup because for $db a full backup file wasn't found" - backup_type="full" - break - fi - - full_backup_file_checkpoint_lsn=$(get_backup_checkpoint_lsn "$db" "$full_backup_file") - if [[ "$full_backup_file_checkpoint_lsn" = "NULL" ]] || [[ "$full_backup_file_checkpoint_lsn" == "" ]]; then - log_warn "Taking a full backup instead of a diff backup because for $db the checkpoint LSN for $full_backup_file couldn't be determined" - backup_type="full" - break - fi - - next_diff_backup_base_lsn=$(get_next_diff_backup_base_lsn "$db") - if [[ "$next_diff_backup_base_lsn" = "NULL" ]] || [[ "$next_diff_backup_base_lsn" == "" ]]; then - log_warn "Taking a full backup instead of a $backup_type backup because for $db the base LSN for the next diff backup couldn't be determined" - backup_type="full" - break - fi - - # The base of the diff backup we're about to take must exactly match the checkpoint LSN of the full backup file we have - if [[ "$next_diff_backup_base_lsn" -ne "$full_backup_file_checkpoint_lsn" ]]; then - log_warn "Taking a full backup instead of a $backup_type backup because for $db the diff would have base LSN $next_diff_backup_base_lsn yet our full backup has checkpoint LSN $full_backup_file_checkpoint_lsn" - backup_type="full" - break - fi - fi - - # Ensure that a transaction log backup will immediately follow the previous one - latest_log_backup_file=$(get_latest_backup_file "$last_mssql" "$db" "log") - if [[ "$latest_log_backup_file" == "" ]]; then - log_warn "Taking a full backup instead of a $backup_type backup because for $db a previous transaction log backup wasn't found" - backup_type="full" - break - fi - - latest_log_backup_last_lsn=$(get_backup_last_lsn "$db" "$latest_log_backup_file") - if [[ "$latest_log_backup_last_lsn" = "NULL" ]] || [[ "$latest_log_backup_last_lsn" == "" ]]; then - log_warn "Taking a full backup instead of a $backup_type backup because for $db the LSN range for $latest_log_backup_file couldn't be determined" - backup_type="full" - break - fi - - next_log_backup_starting_lsn=$(get_next_log_backup_starting_lsn "$db") - if [[ "$next_log_backup_starting_lsn" = "NULL" ]] || [[ "$next_log_backup_starting_lsn" == "" ]]; then - log_warn "Taking a full backup instead of a $backup_type backup because for $db the starting LSN for the next log backup couldn't be determined" - backup_type="full" - break - fi - - # The starting LSN of the backup we're about to take must be equal to (or before) the last LSN from the last backup, - # otherwise there'll be a gap and the logfiles won't be restorable - if [[ "$next_log_backup_starting_lsn" -gt "$latest_log_backup_last_lsn" ]]; then - log_warn "Taking a full backup instead of a $backup_type backup because for $db a gap would exist between the last backup ending at LSN $latest_log_backup_last_lsn and next backup starting at $next_log_backup_starting_lsn" - backup_type="full" - break - fi - done - fi -fi - -# Make sure root backup dir exists if this is the first run -mkdir -p "$backup_dir" - -# Use hard links to "copy" over previous applicable backups to the new snapshot folder to save disk space and time -if [ -d "$last_mssql" ]; then - for p in "$last_mssql"/* - do - [[ -e "$p" ]] || break - - filename="${p##*/}" - extension="${filename##*.}" - transfer= - - # Copy full backups unless we're taking a new full backup - if [ "$extension" = "bak" ] && [ "$backup_type" != 'full' ]; then - transfer=1 - fi - - # Copy diff backups unless we're taking a new full or diff backup - if [ "$extension" = "diff" ] && [ "$backup_type" != 'full' ] && [ "$backup_type" != 'diff' ]; then - transfer=1 - fi - - # Copy transaction log backups unless we're taking a new full or diff backup - if [ "$extension" = "log" ] && [ "$backup_type" != 'full' ] && [ "$backup_type" != 'diff' ]; then - transfer=1 - fi - - if [ -n "$transfer" ]; then - ghe_verbose "Creating hard link to $filename" - ln "$last_mssql"/"$filename" "$backup_dir"/"$filename" - fi - done -fi - -if [ -n "$backup_type" ]; then - ghe_verbose "Taking $backup_type backup" - - backup_command='ghe-export-mssql' - if [ "$backup_type" = "diff" ]; then - backup_command='ghe-export-mssql -d' - elif [ "$backup_type" = "transaction" ]; then - backup_command='ghe-export-mssql -t' - fi - - backup_failed= - - bm_start "$(basename "$0")" - # record if generating the backup failed, this will allow us to collect any backups that may have been produced, even if they are not complete they are better than nothing - ghe_ssh_mssql -- "$backup_command" || backup_failed='true' - bm_end "$(basename "$0")" - - # Configure the backup cadence on the appliance, which is used for diagnostics - ghe_ssh_mssql "ghe-config mssql.backup.cadence $GHE_MSSQL_BACKUP_CADENCE" - - # Transfer backup files from appliance to backup host - appliance_dir="$GHE_REMOTE_DATA_DIR/user/mssql/backups" - backups=$(echo "set -o pipefail; if sudo test -d \"$appliance_dir\"; then \ - sudo ls \"$appliance_dir\"; fi" | ghe_ssh_mssql /bin/bash) - for b in $backups - do - ghe_verbose "Transferring to backup host $b" - ghe_ssh_mssql "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b" - done - - if [ -n "$backup_failed" ]; then - log_error 'ghe-export-mssql failed to backup at least one mssql database' 1>&2 - exit 1 - fi -fi diff --git a/share/github-backup-utils/ghe-backup-mysql b/share/github-backup-utils/ghe-backup-mysql deleted file mode 100755 index 733051bc4..000000000 --- a/share/github-backup-utils/ghe-backup-mysql +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-mysql -#/ Backup MySQL from a GitHub instance. -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-backup command. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. -ghe_remote_version_required "$GHE_HOSTNAME" - -if is_external_database_target; then - if [ -n "$EXTERNAL_DATABASE_BACKUP_SCRIPT" ]; then - log_info "Backing up external MySQL database using customer-provided script..." - $EXTERNAL_DATABASE_BACKUP_SCRIPT - bm_end "$(basename $0)" - exit 0 - else - if is_binary_backup_feature_on; then - log_warn "Binary backups are configured on the target environment." - log_warn "Binary backup is not supported with an external MySQL database. Backing up using logical backup strategy. Please disable binary backups with 'ghe-config mysql.backup.binary false', or provide a custom backup script using EXTERNAL_DATABASE_BACKUP_SCRIPT" - fi - - ghe-backup-mysql-logical - fi -else - if is_binary_backup_feature_on; then - ghe-backup-mysql-binary - else - # if incremental backups are turned on, we can't do them with - # logical backups, so we need to tell the user and exit - is_inc=$(is_incremental_backup_feature_on) - if [ $is_inc = true ]; then - log_warn "Incremental backups are configured on the target environment." - log_warn "Incremental backup is not supported with a logical MySQL backup. Please disable incremental backups with 'ghe-config mysql.backup.incremental false'" - exit 1 - fi - ghe-backup-mysql-logical - fi -fi - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-mysql-binary b/share/github-backup-utils/ghe-backup-mysql-binary deleted file mode 100755 index 106757c71..000000000 --- a/share/github-backup-utils/ghe-backup-mysql-binary +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-mysql-binary -#/ Backup MySQL from a GitHub instance using binary backup strategy. -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-backup command. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. -ghe_remote_version_required "$GHE_HOSTNAME" - -log_verbose "Backing up MySQL database using binary backup strategy ..." -is_inc=$(is_incremental_backup_feature_on) -if [ $is_inc = true ]; then - log_verbose "Incremental backups are configured on the target environment." - log_info "Performing incremental backup of MySQL database ..." 1>&3 - INC_TYPE=$(full_or_incremental_backup) - INC_LSN="" - if [ "$INC_TYPE" == "full" ]; then - log_info "Incremental backup type: $INC_TYPE" 1>&3 - INC_LSN=0 # 0 means full backup - else - validate_inc_snapshot_data - log_info "Incremental backup type: $INC_TYPE" 1>&3 - INC_LSN=$(retrieve_last_lsn) - fi - echo "set -o pipefail; env INC_BACKUP=$INC_LSN ghe-export-mysql" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" - echo "NO_ADDITIONAL_COMPRESSION" > "$GHE_SNAPSHOT_DIR/mysql-binary-backup-sentinel" - # Ensure that we capture the xtrabackup_checkpoints file from the remote host - log_info "Checking if incremental backup is part of a cluster" - GET_LSN=$(get_cluster_lsn "$GHE_HOSTNAME") - ghe-ssh "$GHE_HOSTNAME" "$GET_LSN" > "$GHE_SNAPSHOT_DIR/xtrabackup_checkpoints" - if [ "$INC_TYPE" == "full" ]; then - log_info "Adding $GHE_SNAPSHOT_DIR to the list of full backups" 1>&3 - update_inc_full_backup "$GHE_SNAPSHOT_DIR" - else - log_info "Adding $GHE_SNAPSHOT_DIR to the list of incremental backups" 1>&3 - update_inc_snapshot_data "$GHE_SNAPSHOT_DIR" - fi - bm_end "$(basename $0)" - exit 0 -fi -# if incremental backup isn't enabled, or we are performing a full backup as part of the process, -# fall through and do a full backup - echo "set -o pipefail; ghe-export-mysql" | - ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" - echo "NO_ADDITIONAL_COMPRESSION" > "$GHE_SNAPSHOT_DIR/mysql-binary-backup-sentinel" - is_inc=$(is_incremental_backup_feature_on) - if [ $is_inc = true ]; then - update_inc_full_backup "$GHE_SNAPSHOT_DIR" - fi -bm_end "$(basename $0)" - diff --git a/share/github-backup-utils/ghe-backup-mysql-logical b/share/github-backup-utils/ghe-backup-mysql-logical deleted file mode 100755 index 77040b8b9..000000000 --- a/share/github-backup-utils/ghe-backup-mysql-logical +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-mysql-logical -#/ Backup MySQL from a GitHub instance using logical backup strategy. -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-backup command. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Perform a host-check and establish the remote version in GHE_REMOTE_VERSION. -ghe_remote_version_required "$GHE_HOSTNAME" - -log_verbose "Backing up MySQL database using logical backup strategy ..." - -echo "set -o pipefail; ghe-export-mysql | pigz" | -ghe-ssh "$GHE_HOSTNAME" -- /bin/bash > "$GHE_SNAPSHOT_DIR/mysql.sql.gz" - -if is_external_database_target; then - echo "LOGICAL_EXTERNAL_BACKUP" > "$GHE_SNAPSHOT_DIR/logical-external-database-backup-sentinel" -fi - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-pages b/share/github-backup-utils/ghe-backup-pages deleted file mode 100755 index 2b79825cf..000000000 --- a/share/github-backup-utils/ghe-backup-pages +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-pages -#/ Take an online, incremental snapshot of all Pages data -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Set up remote host and root backup snapshot directory based on config -host="$GHE_HOSTNAME" -backup_dir="$GHE_SNAPSHOT_DIR/pages" - -# Verify rsync is available. -if ! rsync --version 1>/dev/null 2>&1; then - log_error "rsync not found." 1>&2 - exit 1 -fi - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Split host:port into parts -port=$(ssh_port_part "$GHE_HOSTNAME") -host=$(ssh_host_part "$GHE_HOSTNAME") - -# Add user / -l option -user="${host%@*}" -[ "$user" = "$host" ] && user="admin" - -hostnames=$host -ssh_config_file_opt= -tempdir=$(mktemp -d -t backup-utils-restore-XXXXXX) -opts="$GHE_EXTRA_SSH_OPTS" - -# Pages server hostnames under cluster -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt="-F $ssh_config_file" - opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "pages-server") - ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" -fi - -# Make sure root backup dir exists if this is the first run -mkdir -p "$backup_dir" - -# Removes the remote sync-in-progress file on exit, re-enabling GC operations -# on the remote instance. -cleanup() { - rm -rf $tempdir -} -trap 'cleanup' EXIT INT - -# If we have a previous increment and it is not empty, avoid transferring existing files via rsync's -# --link-dest support. This also decreases physical space usage considerably. -if [ -d "$GHE_DATA_DIR/current/pages" ] && [ "$(ls -A $GHE_DATA_DIR/current/pages)" ]; then - link_dest="--link-dest=../../current/pages" -fi - -count=0 -for hostname in $hostnames; do - bm_start "$(basename $0) - $hostname" - echo 1>&3 - ghe_verbose "* Starting backup for host: $hostname" - # Sync all auxiliary repository data. This includes files and directories like - # HEAD, audit_log, config, description, info/, etc. No refs or object data - # should be transferred here. - echo 1>&3 - ghe_verbose "* Transferring pages files ..." - log_rsync "BEGIN: pages rsync" 1>&3 - # Transfer all data from the user data directory using rsync. - ghe-rsync -av \ - -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ - --rsync-path='sudo -u git rsync' \ - $link_dest \ - "$hostname:$GHE_REMOTE_DATA_USER_DIR/pages/" \ - "$GHE_SNAPSHOT_DIR/pages" 1>&3 - log_rsync "END: pages rsync" 1>&3 - bm_end "$(basename $0) - $hostname" - count=$((count + 1)) -done -increment-progress-total-count $count -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-redis b/share/github-backup-utils/ghe-backup-redis deleted file mode 100755 index b0eb44949..000000000 --- a/share/github-backup-utils/ghe-backup-redis +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-redis -#/ Take a snapshot of all Redis data. This is needed because older versions of -#/ the remote side ghe-export-redis command use a blocking SAVE instead of a -#/ non-blocking BGSAVE. -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-backup command. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$GHE_HOSTNAME" - -# Force a redis BGSAVE, and wait for it to complete. -ghe-ssh "$GHE_HOSTNAME" /bin/bash < /dev/null; then - redis_cli=ghe-redis-cli - redis_arg=--remote - else - redis_cli=redis-cli - redis_arg= - fi - redis_host=\$(ghe-config cluster.redis-master 2>/dev/null || echo "localhost") - timestamp=\$(\$redis_cli \$redis_arg -h \$redis_host LASTSAVE) - - for i in \$(seq 10); do - if ! \$redis_cli \$redis_arg -h \$redis_host BGSAVE | grep -q ERR; then - break - fi - sleep 15 - done - for n in \$(seq 3600); do - if [ "\$(\$redis_cli \$redis_arg -h \$redis_host LASTSAVE)" != "\$timestamp" ]; then - break - fi - sleep 1 - done - [ "\$(\$redis_cli \$redis_arg -h \$redis_host LASTSAVE)" != "\$timestamp" ] # exits 1 if bgsave didn't work - - if [ "\$redis_host" != "localhost" ]; then - ssh \$redis_host sudo cat '$GHE_REMOTE_DATA_USER_DIR/redis/dump.rdb' - else - sudo cat '$GHE_REMOTE_DATA_USER_DIR/redis/dump.rdb' - fi -EOF - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-repositories b/share/github-backup-utils/ghe-backup-repositories deleted file mode 100755 index 4e142e29f..000000000 --- a/share/github-backup-utils/ghe-backup-repositories +++ /dev/null @@ -1,407 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-repositories -#/ Take an online, incremental snapshot of all Git repository data. -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup. -set -e - -# This command is designed to allow for transferring active Git repository data -# from a GitHub instance to a backup site in a way that ensures data is -# captured in a consistent state even when being written to. -# -# - All Git GC operations are disabled on the GitHub instance for the duration of -# the backup. This removes the possibly of objects or packs being removed -# while the backup is in progress. -# -# - In progress Git GC operations are given a cooldown window to complete. The -# script will sleep for up to 60 seconds waiting for GC operations to finish. -# -# - Git repository data is transferred in a specific order: auxiliary files, -# packed refs, loose refs, reflogs, and finally objects and pack files in that -# order. This ensures that all referenced objects are captured. -# -# - Git GC operations are re-enabled on the GitHub instance. -# -# The script uses multiple runs of rsync to transfer repository files. Each run -# includes a list of filter rules that ensure only specific types of files are -# transferred. -# -# See the "FILTER RULES" and "INCLUDE/EXCLUDE PATTERN RULES" sections of the -# rsync(1) manual for more information: -# - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Set up remote host and root backup snapshot directory based on config -host="$GHE_HOSTNAME" -backup_dir="$GHE_SNAPSHOT_DIR/repositories" - -# Location of last good backup for rsync --link-dest -backup_current="$GHE_DATA_DIR/current/repositories" - -# Verify rsync is available. -if ! rsync --version 1>/dev/null 2>&1; then - log_error "rsync not found." 1>&2 - exit 1 -fi - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Split host:port into parts -port=$(ssh_port_part "$GHE_HOSTNAME") -host=$(ssh_host_part "$GHE_HOSTNAME") - -# Add user / -l option -user="${host%@*}" -[ "$user" = "$host" ] && user="admin" - -hostnames=$host -ssh_config_file_opt= -tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) -remote_tempdir=$(ghe-ssh "$GHE_HOSTNAME" -- mktemp -d -t backup-utils-backup-XXXXXX) -routes_list=$tempdir/routes_list -remote_routes_list=$remote_tempdir/remote_routes_list -opts="$GHE_EXTRA_SSH_OPTS" - -# git server hostnames under cluster -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt="-F $ssh_config_file" - opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "git-server") - ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" -fi - -# Replica hostnames for HA -if ghe-ssh "$GHE_HOSTNAME" -- "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - ha_replica_hosts=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes --replica) -fi - -# Make sure root backup dir exists if this is the first run -mkdir -p "$backup_dir" - -# Removes the remote sync-in-progress file on exit, re-enabling GC operations -# on the remote instance. -cleanup() { - for pid in $(jobs -p); do - kill -KILL $pid > /dev/null 2>&1 || true - done - - # Enable remote GC operations - for hostname in $hostnames; do - ghe-gc-enable $ssh_config_file_opt $hostname:$port || { - echo "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 - } - done - - # Enable remote GC operations for HA replica - for replica_host in $ha_replica_hosts; do - echo "set -o pipefail; ssh $replica_host -- 'sudo rm -f $SYNC_IN_PROGRESS_FILE'" | ghe-ssh "$host" /bin/bash || { - echo "Re-enable gc on $replica_host failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 - } - done - - ghe-ssh "$GHE_HOSTNAME" -- rm -rf $remote_tempdir - rm -rf $tempdir -} -trap 'cleanup' EXIT INT - -# Disable remote GC operations -for hostname in $hostnames; do - ghe-gc-disable $ssh_config_file_opt $hostname:$port -done - -# Disable remote GC operations for HA replica -# gc_disable is a function defined in ghe-backup-config -# gc_disable is called on the replica node via the primary node, because replica node is not expected to be reachable from backup host. But replica node is expected to be reachable from primary node. -for replica_host in $ha_replica_hosts; do - echo "set -o pipefail; ssh $replica_host -- '$(declare -f gc_disable); gc_disable \"$SYNC_IN_PROGRESS_FILE\" \"$GHE_GIT_COOLDOWN_PERIOD\"'" | ghe-ssh "$host" /bin/bash || { - echo "Disable gc on $replica_host failed" 1>&2 - } -done - -# If we have a previous increment, avoid transferring existing files via rsync's -# --link-dest support. This also decreases physical space usage considerably. -if [ -d "$backup_current" ]; then - link_dest="--link-dest=../../current/repositories" -fi - -# Calculate sync routes. This will store the healthy repo paths for each node -# -# This gets a repo path and stores the path in the $node.sync file -# a/nw/a8/3f/02/100000855 dgit-node1 >> dgit-node1.sync -# a/nw/a8/bc/8d/100000880 dgit-node3 >> dgit-node3.sync -# a/nw/a5/06/81/100000659 dgit-node2 >> dgit-node2.sync -# ... -# One route per line. -# -# NOTE: The route generation is performed on the appliance as it is considerably -# more performant than performing over an SSH pipe. -# -bm_start "$(basename $0) - Generating routes" -echo "github-env ./bin/dgit-cluster-backup-routes > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash -ghe-ssh "$GHE_HOSTNAME" -- cat $remote_routes_list | ghe_debug -bm_end "$(basename $0) - Generating routes" - -bm_start "$(basename $0) - Fetching routes" -ghe-ssh "$GHE_HOSTNAME" -- gzip -c $remote_routes_list | gzip -d > $routes_list -< $routes_list ghe_debug -bm_end "$(basename $0) - Fetching routes" - -bm_start "$(basename $0) - Processing routes" -if [ "$GHE_BACKUP_STRATEGY" != "cluster" ]; then - server=$host -fi -< $routes_list awk -v tempdir="$tempdir" -v server="$server" '{ for(i=2;i<=NF;i++){ server != "" ? host=server : host=$i; print $1 > (tempdir"/"host".rsync") }}' -ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" -bm_end "$(basename $0) - Processing routes" - -if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - log_warn "no routes found, skipping repositories backup ..." - exit 0 -else - increment-progress-total-count 3 -fi - -# Transfer repository data from a GitHub instance to the current snapshot -# directory, using a previous snapshot to avoid transferring files that have -# already been transferred. A set of rsync filter rules are provided on stdin -# for each invocation. -rsync_repository_data () { - port=$(ssh_port_part "$1") - host=$(ssh_host_part "$1") - - #check if we are syncing from a given file list - if [[ "$2" == *".rsync" ]]; then - files_list="$2" - shift - shift - log_rsync "BEGIN: repositories rsync" 1>&3 - ghe-rsync -avr \ - -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ - $link_dest "$@" \ - --rsync-path='sudo -u git rsync' \ - --include-from=- --exclude=\* \ - --files-from="$files_list" \ - --ignore-missing-args \ - "$host:$GHE_REMOTE_DATA_USER_DIR/repositories/" \ - "$backup_dir" 1>&3 2>&3 - log_rsync "END: repositories rsync" 1>&3 - else - shift - log_rsync "BEGIN: repositories rsync" 1>&3 - ghe-rsync -avr \ - -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ - $link_dest "$@" \ - --rsync-path='sudo -u git rsync' \ - --include-from=- --exclude=\* \ - --ignore-missing-args \ - "$host:$GHE_REMOTE_DATA_USER_DIR/repositories/" \ - "$backup_dir" 1>&3 2>&3 - log_rsync "END: repositories rsync" 1>&3 - fi -} - -sync_data (){ - # Sync all auxiliary repository data. This includes files and directories like - # HEAD, audit_log, config, description, info/, etc. No refs or object data - # should be transferred here. - echo 1>&3 - - log_info "* Transferring auxiliary files ..." 1>&3 - rsync_repository_data $1:122 $2 <&3 - log_info "* Transferring packed-refs files ..." 1>&3 - rsync_repository_data $1:122 $2 <&3 - log_info "* Transferring refs and reflogs ..." 1>&3 - rsync_repository_data $1:122 $2 <&3 - log_info "* Transferring objects and packs ..." 1>&3 - rsync_repository_data $1:122 $2 -H <&3 - -} - -# rsync all the repositories -bm_start "$(basename $0) - Repo sync" -for file_list in $tempdir/*.rsync; do - hostname=$(basename $file_list .rsync) - - repo_num=$(< $file_list wc -l) - ghe_verbose "* Transferring $repo_num repositories from $hostname" - - sync_data $hostname $file_list & -done - -for pid in $(jobs -p); do - wait $pid -done -bm_end "$(basename $0) - Repo sync" - -# Since there are no routes for special data directories, we need to do this -# serially for all hostnames. Good candidate for future optimizations. - -bm_start "$(basename $0) - Special Data Directories Sync" -for h in $hostnames; do - # Sync __special__ data directories, including the __alambic_assets__, - # __hookshot__, and __purgatory__ directories. The __nodeload_archives__, - # __gitmon__, and __render__ directories are excludes since they act only as - # caches. - # - # Under v2.x and greater, only the special __purgatory__ directory remains under - # /data/repositories. All other special user data directories have been moved under - # the /data/user directory. - echo 1>&3 - log_info "* Transferring special data directories from $h..." 1>&3 - rsync_repository_data $h:122 <&3 -done -bm_end "$(basename $0) - Special Data Directories Sync" - -if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then - bm_start "$(basename $0) - Verifying Routes" - for file_lst in $tempdir/*.rsync; do - < $file_lst sort | uniq - done |sort|uniq > $tempdir/source_routes - (cd $backup_dir/ && find * -mindepth 5 -maxdepth 6 -type d -name \*.git | fix_paths_for_ghe_version | uniq | sort | uniq) > $tempdir/destination_routes - - git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more repository networks and/or gists were not found on the source appliance." - increment-progress-total-count 1 - bm_end "$(basename $0) - Verifying Routes" -fi - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-secrets b/share/github-backup-utils/ghe-backup-secrets deleted file mode 100755 index 6d7ab5db6..000000000 --- a/share/github-backup-utils/ghe-backup-secrets +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-secrets -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-backup command. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Grab the host -host="$GHE_HOSTNAME" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - - -# Function to backup a secret setting to a file. -# backup-secret [--best-effort] -backup-secret() { - best_effort=false - description="" - file="" - setting="" - count=0 - - while [ $# -gt 0 ]; do - case "$1" in - --best-effort) - shift 1 - best_effort=true - ;; - *) - case $count in - 0) - description=$1 - ;; - 1) - file=$1 - ;; - 2) - setting=$1 - ;; - *) - >&2 echo "Too many arguments" - ;; - esac - count=$((count+1)) - shift 1 - esac - done - - log_info "* Transferring $description ..." 1>&3 - ghe-ssh "$host" -- ghe-config "$setting" > "$file+" || ( - if [ "$best_effort" = "false" ]; then - echo "Info: $description not set. Skipping..." >&2 - fi - ) - if [ -n "$(cat "$file+")" ]; then - mv "$file+" "$file" - else - unlink "$file+" - fi -} - -bm_start "$(basename $0)" - -# Create the snapshot directory if needed and change into it. -mkdir -p "$GHE_SNAPSHOT_DIR" -cd "$GHE_SNAPSHOT_DIR" - -log_info "* Transferring secrets data ..." 1>&3 - -backup-secret "management console password" "manage-password" "secrets.manage" -backup-secret "password pepper" "password-pepper" "secrets.github.user-password-secrets" -backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hmac-secret" -backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret" - -# backup encryption keying material and create backup value current encryption for GHES 3.7.0 onwards -# this is for forwards compatibility with GHES 3.8.0 onwards -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then - backup-secret "encrypted column encryption keying material" "encrypted-column-encryption-keying-material" "secrets.github.encrypted-column-keying-material" - cat "$GHE_SNAPSHOT_DIR/encrypted-column-encryption-keying-material" | sed 's:.*;::' > "$GHE_SNAPSHOT_DIR/encrypted-column-current-encryption-key" -fi - -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then - backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key" - backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys" - backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key" - backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys" -fi - -if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.11.0)" ]; then - backup-secret "secret scanning encrypted content keys" "secret-scanning-user-content-delimited-encryption-root-keys" "secrets.secret-scanning.secret-scanning-user-content-delimited-encryption-root-keys" -fi - -# Backup argon secrets for multiuser from ghes version 3.8 onwards -if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then - backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret" -fi - -# Backup external MySQL password if running external MySQL DB. -if is_service_external 'mysql'; then - backup-secret "external MySQL password" "external-mysql-password" "secrets.external.mysql" -fi - -# Backup Actions settings. -if ghe-ssh "$host" -- ghe-config --true app.actions.enabled; then - backup-secret "Actions configuration database login" "actions-config-db-login" "secrets.actions.ConfigurationDatabaseSqlLogin" - backup-secret "Actions configuration database password" "actions-config-db-password" "secrets.actions.ConfigurationDatabaseSqlPassword" - backup-secret "Actions framework access token key secret" "actions-framework-access-token" "secrets.actions.FrameworkAccessTokenKeySecret" --best-effort - backup-secret "Actions Url signing HMAC key primary" "actions-url-signing-hmac-key-primary" "secrets.actions.UrlSigningHmacKeyPrimary" - backup-secret "Actions Url signing HMAC key secondary" "actions-url-signing-hmac-key-secondary" "secrets.actions.UrlSigningHmacKeySecondary" - backup-secret "Actions OAuth S2S signing cert" "actions-oauth-s2s-signing-cert" "secrets.actions.OAuthS2SSigningCert" - backup-secret "Actions OAuth S2S signing key" "actions-oauth-s2s-signing-key" "secrets.actions.OAuthS2SSigningKey" - backup-secret "Actions OAuth S2S signing cert thumbprint" "actions-oauth-s2s-signing-cert-thumbprint" "secrets.actions.OAuthS2SSigningCertThumbprint" - backup-secret "Actions primary encryption cert thumbprint" "actions-primary-encryption-cert-thumbprint" "secrets.actions.PrimaryEncryptionCertificateThumbprint" - backup-secret "Actions AAD cert thumbprint" "actions-aad-cert-thumbprint" "secrets.actions.AADCertThumbprint" --best-effort - backup-secret "Actions delegated auth cert thumbprint" "actions-delegated-auth-cert-thumbprint" "secrets.actions.DelegatedAuthCertThumbprint" --best-effort - backup-secret "Actions runtime service principal cert" "actions-runtime-service-principal-cert" "secrets.actions.RuntimeServicePrincipalCertificate" --best-effort - backup-secret "Actions S2S encryption cert" "actions-s2s-encryption-cert" "secrets.actions.S2SEncryptionCertificate" - backup-secret "Actions secondary encryption cert thumbprint" "actions-secondary-encryption-cert-thumbprint" "secrets.actions.SecondaryEncryptionCertificateThumbprint" - backup-secret "Actions service principal cert" "actions-service-principal-cert" "secrets.actions.ServicePrincipalCertificate" --best-effort - backup-secret "Actions SPS validation cert thumbprint" "actions-sps-validation-cert-thumbprint" "secrets.actions.SpsValidationCertThumbprint" - backup-secret "Actions storage container prefix" "actions-storage-container-prefix" "secrets.actions.storage.container-prefix" - - backup-secret "Actions Launch secrets encryption/decryption" "actions-launch-secrets-private-key" "secrets.launch.actions-secrets-private-key" - backup-secret "Actions Launch deployer HMAC key" "actions-launch-deployer-hmac" "secrets.launch.deployer-hmac-secret" - backup-secret "Actions Launch Client id" "actions-launch-client-id" "secrets.launch.client-id" - backup-secret "Actions Launch Client secret" "actions-launch-client-secret" "secrets.launch.client-secret" - backup-secret "Actions Launch receiver webhook secret" "actions-launch-receiver-webhook-secret" "secrets.launch.receiver-webhook-secret" - backup-secret "Actions Launch app private key" "actions-launch-app-private-key" "secrets.launch.app-private-key" - backup-secret "Actions Launch app public key" "actions-launch-app-public-key" "secrets.launch.app-public-key" - backup-secret "Actions Launch app id" "actions-launch-app-id" "secrets.launch.app-id" - backup-secret "Actions Launch app relay id" "actions-launch-app-relay-id" "secrets.launch.app-relay-id" - backup-secret "Actions Launch action runner secret" "actions-launch-action-runner-secret" "secrets.launch.action-runner-secret" - backup-secret "Actions Launch service cert" "actions-launch-azp-app-cert" "secrets.launch.azp-app-cert" - backup-secret "Actions Launch service private key" "actions-launch-app-app-private-key" "secrets.launch.azp-app-private-key" -fi - -if ghe-ssh "$host" -- ghe-config --true app.packages.enabled; then - backup-secret "Packages aws access key" "packages-aws-access-key" "secrets.packages.aws-access-key" - backup-secret "Packages aws secret key" "packages-aws-secret-key" "secrets.packages.aws-secret-key" - backup-secret "Packages s3 bucket" "packages-s3-bucket" "secrets.packages.s3-bucket" - backup-secret "Packages storage service url" "packages-service-url" "secrets.packages.service-url" - backup-secret "Packages blob storage type" "packages-blob-storage-type" "secrets.packages.blob-storage-type" - backup-secret "Packages azure connection string" "packages-azure-connection-string" "secrets.packages.azure-connection-string" - backup-secret "Packages azure container name" "packages-azure-container-name" "secrets.packages.azure-container-name" -fi - -# Backup Chat Integration settings -if ghe-ssh "$host" -- ghe-config --true app.chatops.enabled; then - backup-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id" - backup-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password" - backup-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint" - backup-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle" - backup-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name" - backup-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id" - backup-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id" - backup-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret" - backup-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token" - backup-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token" - backup-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint" - backup-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret" - backup-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token" - backup-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command" - backup-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name" - backup-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode" - backup-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint" - backup-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type" - backup-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams" - backup-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams" - backup-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams" - backup-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams" - backup-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret" - backup-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret" - backup-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack" - backup-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack" - backup-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack" - backup-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack" -fi - -bm_end "$(basename $0)" - -exit 0 diff --git a/share/github-backup-utils/ghe-backup-settings b/share/github-backup-utils/ghe-backup-settings deleted file mode 100755 index f3d262293..000000000 --- a/share/github-backup-utils/ghe-backup-settings +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-settings -#/ Backup settings from a snapshot to the given . -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -bm_start "$(basename $0)" - -# Grab the host -host="$GHE_HOSTNAME" - -# Create the snapshot directory if needed and change into it. -mkdir -p "$GHE_SNAPSHOT_DIR" -cd "$GHE_SNAPSHOT_DIR" - -log_info "* Transferring settings data ..." 1>&3 -ghe-ssh "$host" -- 'ghe-export-settings' > settings.json - -log_info "* Transferring license data ..." 1>&3 -ghe-ssh "$host" -- "sudo cat '$GHE_REMOTE_LICENSE_FILE'" > enterprise.ghl - -if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/idp.crt"; then - log_info "* Transferring SAML keys ..." 1>&3 - ghe-ssh $host -- sudo tar -C $GHE_REMOTE_DATA_USER_DIR/common/ -cf - "idp.crt saml-sp.p12" > saml-keys.tar -fi - -if ghe-ssh "$host" -- "which ghe-export-ssl-ca-certificates 1>/dev/null"; then - log_info "* Transferring CA certificates ..." 1>&3 - ghe-ssh "$host" -- "ghe-export-ssl-ca-certificates" > ssl-ca-certificates.tar -fi - -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - log_info "* Transferring cluster configuration ..." 1>&3 - if ! ghe-ssh "$host" -- "sudo cat $GHE_REMOTE_CLUSTER_CONF_FILE 2>/dev/null" > cluster.conf; then - log_error "Error: Enterprise Cluster is not configured yet, backup will fail" >&2 - exit 1 - fi -else - if ghe-ssh "$host" -- "sudo cat $GHE_REMOTE_DATA_USER_DIR/common/uuid 2>/dev/null" > uuid; then - log_info "* Transferring UUID ..." 1>&3 - fi -fi - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-storage b/share/github-backup-utils/ghe-backup-storage deleted file mode 100755 index c80c39a29..000000000 --- a/share/github-backup-utils/ghe-backup-storage +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-storage -#/ Take an online, incremental snapshot of all Alambic Storage data using the -#/ calculated routes method. -#/ -#/ Note: This command typically isn't called directly. It's invoked by -#/ ghe-backup. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -# Set up remote host and root backup snapshot directory based on config -host="$GHE_HOSTNAME" -backup_dir="$GHE_SNAPSHOT_DIR/storage" - -# Verify rsync is available. -if ! rsync --version 1>/dev/null 2>&1; then - log_error "rsync not found." 1>&2 - exit 1 -fi - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Split host:port into parts -port=$(ssh_port_part "$GHE_HOSTNAME") -host=$(ssh_host_part "$GHE_HOSTNAME") - -# Add user / -l option -user="${host%@*}" -[ "$user" = "$host" ] && user="admin" - -hostnames=$host -ssh_config_file_opt= -tempdir=$(mktemp -d -t backup-utils-backup-XXXXXX) -remote_tempdir=$(ghe-ssh "$GHE_HOSTNAME" -- mktemp -d -t backup-utils-backup-XXXXXX) -routes_list=$tempdir/routes_list -remote_routes_list=$remote_tempdir/remote_routes_list -opts="$GHE_EXTRA_SSH_OPTS" - -# storage server hostnames under cluster -if [ "$GHE_BACKUP_STRATEGY" = "cluster" ]; then - ssh_config_file="$tempdir/ssh_config" - ssh_config_file_opt="-F $ssh_config_file" - opts="$opts -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no" - hostnames=$(ghe-cluster-find-nodes "$GHE_HOSTNAME" "storage-server") - ghe-ssh-config "$GHE_HOSTNAME" "$hostnames" > "$ssh_config_file" -fi - -# Replica hostnames for HA -if ghe-ssh "$GHE_HOSTNAME" -- "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - ha_replica_hosts=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes --replica) -fi - -# Make sure root backup dir exists if this is the first run -mkdir -p "$backup_dir" - -# Removes the remote sync-in-progress file on exit, re-enabling GC operations -# on the remote instance. -cleanup() { - # Enable remote maintenance operations - for hostname in $hostnames; do - ghe-gc-enable $ssh_config_file_opt $hostname:$port || { - log_warn "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 - } - done - - # Enable remote GC operations for HA replica - for replica_host in $ha_replica_hosts; do - echo "set -o pipefail; ssh $replica_host -- 'sudo rm -f $SYNC_IN_PROGRESS_FILE'" | ghe-ssh "$host" /bin/bash || { - echo "Re-enable gc on $replica_host failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2 - } - done - - ghe-ssh "$GHE_HOSTNAME" -- rm -rf $remote_tempdir - rm -rf $tempdir -} -trap 'cleanup' EXIT INT - -# Disable remote maintenance operations -for hostname in $hostnames; do - ghe-gc-disable $ssh_config_file_opt $hostname:$port -done - -# Disable remote GC operations for HA replica -# gc_disable is a function defined in ghe-backup-config -# gc_disable is called on the replica node via the primary node, because replica node is not expected to be reachable from backup host. But replica node is expected to be reachable from primary node. -for replica_host in $ha_replica_hosts; do - echo "set -o pipefail; ssh $replica_host -- '$(declare -f gc_disable); gc_disable \"$SYNC_IN_PROGRESS_FILE\" \"$GHE_GIT_COOLDOWN_PERIOD\"'" | ghe-ssh "$host" /bin/bash || { - echo "Disable gc on $replica_host failed" 1>&2 - } -done - -# If we have a previous increment and it is not empty, avoid transferring existing files via rsync's -# --link-dest support. This also decreases physical space usage considerably. -if [ -d "$GHE_DATA_DIR/current/storage" ] && [ "$(ls -A $GHE_DATA_DIR/current/storage)" ]; then - link_dest="--link-dest=../../current/storage" -fi - -# Calculate sync routes. This will store the healthy object paths for each node -# -# This gets a repo path and stores the path in the $node.sync file -# a/nw/a8/3f/02/100000855 storage-server-node1 >> storage-server-node1.sync -# a/nw/a8/bc/8d/100000880 storage-server-node3 >> storage-server-node3.sync -# a/nw/a5/06/81/100000659 storage-server-node2 >> storage-server-node2.sync -# ... -#one route per line. -# -# NOTE: The route generation is performed on the appliance as it is considerably -# more performant than performing over an SSH pipe. -# -bm_start "$(basename $0) - Generating routes" -echo "github-env ./bin/storage-cluster-backup-routes > $remote_routes_list" | ghe-ssh "$GHE_HOSTNAME" -- /bin/bash -ghe-ssh "$GHE_HOSTNAME" -- cat $remote_routes_list | ghe_debug -bm_end "$(basename $0) - Generating routes" - -bm_start "$(basename $0) - Fetching routes" -ghe-ssh "$GHE_HOSTNAME" -- gzip -c $remote_routes_list | gzip -d > $routes_list -cat $routes_list | ghe_debug -bm_end "$(basename $0) - Fetching routes" - -bm_start "$(basename $0) - Processing routes" -if [ "$GHE_BACKUP_STRATEGY" != "cluster" ]; then - server=$host -fi -cat $routes_list | awk -v tempdir="$tempdir" -v server="$server" '{ for(i=2;i<=NF;i++){ server != "" ? host=server : host=$i; print $1 > (tempdir"/"host".rsync") }}' -ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')" -bm_end "$(basename $0) - Processing routes" - -if [ -z "$(find "$tempdir" -maxdepth 1 -name '*.rsync')" ]; then - log_warn "no routes found, skipping storage backup ..." - exit 0 -else - increment-progress-total-count 2 -fi - -# rsync all the storage objects -bm_start "$(basename $0) - Storage object sync" -for file_list in $tempdir/*.rsync; do - hostname=$(basename $file_list .rsync) - storage_user=$(ghe-ssh $ssh_config_file_opt $hostname:$port -- stat -c %U /data/user/storage || echo git) - - object_num=$(cat $file_list | wc -l) - ghe_verbose "* Transferring $object_num objects from $hostname" - log_rsync "BEGIN: storage rsync" 1>&3 - ghe-rsync -avr \ - -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ - $link_dest "$@" \ - --rsync-path="sudo -u $storage_user rsync" \ - --files-from="$file_list" \ - --ignore-missing-args \ - --size-only \ - "$hostname:$GHE_REMOTE_DATA_USER_DIR/storage/" \ - "$backup_dir" 1>&3 & - log_rsync "END: storage rsync" 1>&3 -done - -for pid in $(jobs -p); do - wait $pid -done -bm_end "$(basename $0) - Storage object sync" - -if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then - bm_start "$(basename $0) - Verifying Routes" - - cat $tempdir/*.rsync | uniq | sort | uniq > $tempdir/source_routes - (cd $backup_dir/ && find * -mindepth 3 -maxdepth 3 -type f -print | uniq | sort | uniq) > $tempdir/destination_routes - - git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more storage objects were not found on the source appliance." - - increment-progress-total-count 1 - bm_end "$(basename $0) - Verifying Routes" -fi - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-store-version b/share/github-backup-utils/ghe-backup-store-version deleted file mode 100755 index 6faffff99..000000000 --- a/share/github-backup-utils/ghe-backup-store-version +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-store-version -#/ Stores information about the used version of backup-utils on -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0)" - -version_info="$BACKUP_UTILS_VERSION" -if [ -d $GHE_BACKUP_ROOT/.git ]; then - ref=$(git --git-dir=$GHE_BACKUP_ROOT/.git rev-parse HEAD || true) - if [ -n "$ref" ]; then - version_info="$version_info:$ref" - fi -fi - -echo "$version_info" | - ghe-ssh "$GHE_HOSTNAME" -- "sudo dd of=$GHE_REMOTE_DATA_USER_DIR/common/backup-utils-version >/dev/null 2>&1" - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-backup-strategy b/share/github-backup-utils/ghe-backup-strategy deleted file mode 100755 index b9a919f3c..000000000 --- a/share/github-backup-utils/ghe-backup-strategy +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-strategy -#/ -#/ Determine the backup strategy that will be used. -#/ -#/ The rsync strategy should be used for single VMs and all HA configurations. -#/ -#/ The cluster strategy should be used to backup GHE clusters. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -if ghe-ssh "$GHE_HOSTNAME" -- \ - "[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ] && [ ! -f '$GHE_REMOTE_ROOT_DIR/etc/github/repl-state' ]"; then - echo "cluster" -else - echo "rsync" -fi diff --git a/share/github-backup-utils/ghe-backup-userdata b/share/github-backup-utils/ghe-backup-userdata deleted file mode 100755 index d7c7dc233..000000000 --- a/share/github-backup-utils/ghe-backup-userdata +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-backup-userdata -#/ Take an online, incremental snapshot of a user data directory. This is used -#/ for a number of different simple datastores kept under /data/user on the -#/ remote appliance, including: hookshot, alambic_assets, and pages data. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -bm_start "$(basename $0) - $1" - -# Verify rsync is available. -if ! rsync --version 1>/dev/null 2>&1; then - log_error "rsync not found." 1>&2 - exit 1 -fi - -# Grab the host and /data/user directory name. -host="$GHE_HOSTNAME" -dirname="$1" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$host" - -# Verify that the user data directory exists. Bail out if not, which may be due -# to an older version of GHE or no data has been added to this directory yet. -ghe-ssh "$host" -- "sudo -u git [ -d '$GHE_REMOTE_DATA_USER_DIR/$dirname' ]" || exit 0 - -# If we have a previous increment and it is not empty, avoid transferring existing files via rsync's -# --link-dest support. This also decreases physical space usage considerably. -if [ -d "$GHE_DATA_DIR/current/$dirname" ] && [ "$(ls -A $GHE_DATA_DIR/current/$dirname)" ]; then - - subdir=$dirname - link_path=".." - while true; do - if [ "$(dirname $subdir)" = "." ]; then - break - fi - - if [ "$(dirname $subdir)" = "/" ]; then - break - fi - - link_path="../$link_path" - subdir=$(dirname $subdir) - done - - link_dest="--link-dest=../${link_path}/current/$dirname" -fi - -# Ensure target directory exists, is needed with subdirectories -mkdir -p "$GHE_SNAPSHOT_DIR/$dirname" -log_rsync "BEGIN: userdata rsync" 1>&3 -# Transfer all data from the user data directory using rsync. -ghe-rsync -av \ - -e "ghe-ssh -p $(ssh_port_part "$host")" \ - --rsync-path='sudo -u git rsync' \ - $link_dest \ - "$(ssh_host_part "$host"):$GHE_REMOTE_DATA_USER_DIR/$dirname/" \ - "$GHE_SNAPSHOT_DIR/$dirname" 1>&3 -log_rsync "END: userdata rsync" 1>&3 -bm_end "$(basename $0) - $1" diff --git a/share/github-backup-utils/ghe-cluster-find-nodes b/share/github-backup-utils/ghe-cluster-find-nodes deleted file mode 100755 index 2a1f7ef48..000000000 --- a/share/github-backup-utils/ghe-cluster-find-nodes +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-cluster-find-nodes -#/ -#/ Finds all nodes of the cluster using the config on . -#/ If it is a 2.8 and later cluster version the results are returned as -#/ prefix-uuid, otherwise the configured hostnames are returned. -#/ Also filters nodes based on the prefix role. -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-backup-* and ghe-restore-* commands in cluster environments. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Check if the REMOTE DATA USER directory is set -if [ -z $GHE_REMOTE_DATA_USER_DIR ]; then - log_error "Env variable GHE_REMOTE_DATA_USER_DIR is not set. Exiting" - exit 1 -fi - -# Show usage and bail with no arguments -[ -z "$*" ] && print_usage - -GHE_HOSTNAME="$1" -prefix="$2" -role=$(echo "$prefix" | cut -d '-' -f1) - -if ghe-ssh "$GHE_HOSTNAME" test -f $GHE_REMOTE_ROOT_DIR/etc/github/cluster; then - node_uuids=$(ghe-ssh "$GHE_HOSTNAME" ghe-cluster-nodes -r "$role" -u | cut -f 2) - hostnames='' - for uuid in $node_uuids; do - hostnames+="$prefix-$uuid " - done -else - uuid=$(ghe-ssh "$GHE_HOSTNAME" cat $GHE_REMOTE_DATA_USER_DIR/common/uuid) - hostnames="$prefix-$uuid" -fi - -echo "$hostnames" diff --git a/share/github-backup-utils/ghe-detect-leaked-ssh-keys b/share/github-backup-utils/ghe-detect-leaked-ssh-keys deleted file mode 100755 index a71fd812e..000000000 --- a/share/github-backup-utils/ghe-detect-leaked-ssh-keys +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-detect-leaked-ssh-key [-s ] -#/ -#/ This utility will check each snapshot's existing SSH host keys against the list -#/ of known leaked SSH host keys from GitHub Enterprise packages. -#/ -#/ OPTIONS: -#/ -h | --help Show this message. -#/ -s |--snapshot Scan the snapshot with the given id. -#/ Available snapshots may be listed under the data directory. -#/ -set -e - -usage() { - grep '^#/' < "$0" | cut -c 4- - exit 2 -} - -TEMPDIR=$(mktemp -d) - -while [ $# -gt 0 ]; do - case "$1" in - -h|--help) - usage - ;; - -s|--snapshot) - snapshot=$2 - shift - ;; - *) - usage - ;; - esac - shift -done - -ppid_script=$(ps -o args= $PPID 2>/dev/null | awk '{print $2}') -if [ -n "$ppid_script" ]; then - ppid_name=$(basename $ppid_script) -fi - -sshkeygen_multiple_hash_formats=false -if (ssh-keygen -E 2>&1 | head -1 | grep -q 'option requires an argument'); then - sshkeygen_multiple_hash_formats=true -fi - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -FINGERPRINT_BLACKLIST="${FINGERPRINT_BLACKLIST:-$(cat "$GHE_BACKUP_ROOT/share/github-backup-utils/ghe-ssh-leaked-host-keys-list.txt")}" - -keys="ssh_host_dsa_key.pub ssh_host_ecdsa_key.pub ssh_host_ed25519_key.pub ssh_host_rsa_key.pub" - -# Get all the host ssh keys tar from all snapshots directories -if [ -n "$snapshot" ]; then - if [ ! -d "$snapshot" ]; then - echo "Invalid snapshot directory: $snapshot" >&2 - exit 1 - fi - ssh_tars=$(find "$snapshot" -maxdepth 1 -type f -iname 'ssh-host-keys.tar') -else - ssh_tars=$(find "$GHE_DATA_DIR" -maxdepth 2 -type f -iname 'ssh-host-keys.tar') -fi - -# Store the current backup snapshot folder -if [ -L "$GHE_DATA_DIR/current" ]; then - current_dir=$(cd "$GHE_DATA_DIR/current"; pwd -P) -fi - -leaked_keys_found=false -leaked_keys_skippedcheck=false -current_bkup=false -for tar_file in $ssh_tars; do - for key in $keys; do - if tar -tvf "$tar_file" $key &>/dev/null; then - tar -C $TEMPDIR -xvf "$tar_file" $key &>/dev/null - if $sshkeygen_multiple_hash_formats; then - fingerprint=$(ssh-keygen -l -E md5 -f $TEMPDIR/$key | cut -d ' ' -f 2 | cut -f2- -d':') - else - fingerprint=$(ssh-keygen -lf $TEMPDIR/$key | cut -d ' ' -f 2) - fi - if [ -z "$fingerprint" ]; then - leaked_keys_skippedcheck=true - elif echo "$FINGERPRINT_BLACKLIST" | grep -q "$fingerprint"; then - leaked_keys_found=true - if [ "$current_dir" == "$(dirname "$tar_file")" ]; then - current_bkup=true - log_warn "* Leaked key found in current backup snapshot." - else - log_warn "* Leaked key found in backup snapshot." - fi - echo "* Snapshot file: $tar_file" - echo "* Key file: $key" - echo "* Key: $fingerprint" - echo - fi - fi - done -done - -if $leaked_keys_found; then - if echo "$ppid_name" | grep -q 'ghe-restore'; then - echo - echo "* The snapshot that is being restored contains a leaked SSH host key." - echo "* We recommend rolling the SSH host keys after completing the restore." - echo "* Roll the keys either manually or with ghe-ssh-roll-host-keys on the appliance." - echo "* (An upgrade may be required)" - echo - elif echo "$ppid_name" | grep -q 'ghe-backup'; then - echo "* The current backup contains leaked SSH host keys." - echo "* We strongly recommend rolling your SSH host keys and making a new backup." - echo "* Roll the keys either manually or with ghe-ssh-roll-host-keys on the appliance." - echo "* (An upgrade may be required)" - else - if $current_bkup; then - echo "* The current backup contains leaked SSH host keys." - echo "* Current backup directory: $current_dir" - echo "* We strongly recommend rolling your SSH host keys and making a new backup." - echo "* Roll the keys either manually or with ghe-ssh-roll-host-keys on the appliance." - echo "* (An upgrade may be required)" - fi - echo - echo "* One or more older backup snapshots contain leaked SSH host keys." - echo "* No immediate action is needed but when you use one of these older snapshots for a restore, " - echo "* please make sure to roll the SSH host keys after restore." - echo "* Roll the keys either manually or with ghe-ssh-roll-host-keys on the appliance." - echo "* (An upgrade may be required)" - echo - fi -else - if $leaked_keys_skippedcheck; then - log_info "* No result - check not performed since host key fingerprint was empty" - else - log_info "* No leaked keys found" - fi -fi - -# Cleanup temp dir -rm -rf $TEMPDIR diff --git a/share/github-backup-utils/ghe-docker-init b/share/github-backup-utils/ghe-docker-init deleted file mode 100755 index 76e6086b8..000000000 --- a/share/github-backup-utils/ghe-docker-init +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -e - -PATH=$PATH:/backup-utils/bin - -mkdir -p /etc/github-backup-utils - -touch /etc/github-backup-utils/backup.config - -env | grep ^GHE_ | sed -r "s/(.[^=]+)=(.*)/\1=\"\2\"/g" >> /etc/github-backup-utils/backup.config - -exec "$@" diff --git a/share/github-backup-utils/ghe-gc-disable b/share/github-backup-utils/ghe-gc-disable deleted file mode 100755 index 67cdef6d4..000000000 --- a/share/github-backup-utils/ghe-gc-disable +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-gc-disable [