Skip to content

Commit 363ed20

Browse files
authored
Merge branch 'master' into spelling
2 parents e40faed + 8683e1c commit 363ed20

31 files changed

+241
-93
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "docker" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "github-actions" # See documentation for possible values
14+
directory: "/" # Location of package manifests
15+
schedule:
16+
interval: "weekly"

.github/workflows/docker-image.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
11+
build-docker:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Build the Debian Docker image
18+
run: docker build . --file Dockerfile --tag backup-utils-debian:${GITHUB_RUN_ID}
19+
- name: Build the Alpine Docker image
20+
run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID}
21+
- name: Run tests in Debian Docker image
22+
run: docker run backup-utils-debian:${GITHUB_RUN_ID} ghe-backup --version
23+
- name: Run tests in Alpine Docker image
24+
run: docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version
25+

.github/workflows/lint.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
name: Lint Code Base
22

33
on:
4+
push:
5+
branches-ignore: [master]
46
pull_request:
5-
branches-ignore:
6-
- 'master'
7+
branches: [master]
78

89
jobs:
9-
build:
10+
lint:
1011
name: Lint Code Base
1112
runs-on: ubuntu-latest
1213
steps:
1314
- name: Checkout Code
14-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
16+
with:
17+
# Full git history is needed to get a proper list of changed files within `super-linter`
18+
fetch-depth: 0
1519
- name: Lint Code Base
16-
uses: docker://github/super-linter:v2.1.1
20+
uses: github/super-linter@v4
1721
env:
1822
VALIDATE_ALL_CODEBASE: false
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
build:
77
strategy:
88
matrix:
9-
os: ['ubuntu-20.04', 'ubuntu-18.04', 'macos-latest']
9+
os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04', 'macos-latest']
1010
fail-fast: false
1111
runs-on: ${{ matrix.os }}
1212
steps:
@@ -20,11 +20,11 @@ jobs:
2020
if: matrix.os != 'macos-latest'
2121
- name: Install Dependencies (macOS)
2222
run: |
23-
brew install gnu-tar shellcheck jq pigz coreutils gnu-sed gnu-getopt
23+
brew install gnu-tar shellcheck jq pigz coreutils gnu-sed gnu-getopt wget
2424
brew install moreutils gawk
2525
if: matrix.os == 'macos-latest'
2626
- name: Get Sources
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2828
- name: Test
2929
run: |
3030
export PATH="$PATH:/snap/bin"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:stretch-slim
1+
FROM debian:buster-slim
22

33
RUN apt-get -q -y update && \
44
apt-get install -y --no-install-recommends \

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,33 @@
33
This repository includes backup and recovery utilities for
44
[GitHub Enterprise Server][1].
55

6-
**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.
6+
**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.
77

88
**Note**: the [GitHub Enterprise Server version requirements][2] have
99
changed starting with Backup Utilities v2.13.0, released on 27 March 2018.
1010

11-
### Features
11+
## Features
1212

1313
Backup Utilities implement a number of advanced capabilities for backup
1414
hosts, built on top of the backup and restore features already included in
1515
GitHub Enterprise Server.
1616

17-
- Complete GitHub Enterprise Server backup and recovery system via two simple
17+
- Complete GitHub Enterprise Server backup and recovery system via two simple
1818
utilities:<br>`ghe-backup` and `ghe-restore`.
19-
- Online backups. The GitHub appliance need not be put in maintenance mode for
19+
- Online backups. The GitHub appliance need not be put in maintenance mode for
2020
the duration of the backup run.
21-
- Incremental backup of Git repository data. Only changes since the last
21+
- Incremental backup of Git repository data. Only changes since the last
2222
snapshot are transferred, leading to faster backup runs and lower network
2323
bandwidth and machine utilization.
24-
- Efficient snapshot storage. Only data added since the previous snapshot
24+
- Efficient snapshot storage. Only data added since the previous snapshot
2525
consumes new space on the backup host.
26-
- Multiple backup snapshots with configurable retention periods.
27-
- Backup commands run under the lowest CPU/IO priority on the GitHub appliance,
26+
- Multiple backup snapshots with configurable retention periods.
27+
- Backup commands run under the lowest CPU/IO priority on the GitHub appliance,
2828
reducing performance impact while backups are in progress.
29-
- Runs under most Linux/Unix environments.
30-
- MIT licensed, open source software maintained by GitHub, Inc.
29+
- Runs under most Linux/Unix environments.
30+
- MIT licensed, open source software maintained by GitHub, Inc.
3131

32-
### Documentation
32+
## Documentation
3333

3434
- **[Requirements](docs/requirements.md)**
3535
- **[Backup host requirements](docs/requirements.md#backup-host-requirements)**
@@ -42,7 +42,7 @@ GitHub Enterprise Server.
4242
- **[How does Backup Utilities differ from a High Availability replica?](docs/faq.md)**
4343
- **[Docker](docs/docker.md)**
4444

45-
### Support
45+
## Support
4646

4747
If you find a bug or would like to request a feature in Backup Utilities, please
4848
open an issue or pull request on this repository. If you have a question related
@@ -53,3 +53,4 @@ instead.
5353
[1]: https://github.com/enterprise
5454
[2]: docs/requirements.md#github-enterprise-version-requirements
5555
[3]: https://support.github.com/
56+

backup.config-example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,23 @@ GHE_NUM_SNAPSHOTS=10
6464

6565
# If set to 'yes', ghe-backup jobs will run in parallel. Defaults to 'no'.
6666
#
67-
# WARNING: this feature is in beta.
6867
#GHE_PARALLEL_ENABLED=yes
6968

7069
# Sets the maximum number of jobs to run in parallel. Defaults to the number
7170
# of available processing units on the machine.
7271
#
73-
# WARNING: this feature is in beta.
7472
#GHE_PARALLEL_MAX_JOBS=2
7573

7674
# Sets the maximum number of rsync jobs to run in parallel. Defaults to the
7775
# configured GHE_PARALLEL_MAX_JOBS, or the number of available processing
7876
# units on the machine.
7977
#
80-
# WARNING: this feature is in beta.
8178
# GHE_PARALLEL_RSYNC_MAX_JOBS=3
8279

8380
# When jobs are running in parallel wait as needed to avoid starting new jobs
8481
# when the system's load average is not below the specified percentage. Defaults to
8582
# unrestricted.
8683
#
87-
# WARNING: this feature is in beta.
8884
#GHE_PARALLEL_MAX_LOAD=50
8985

9086
# When running an external mysql database, run this script to trigger a MySQL backup

bin/ghe-host-check

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

132132
# backup-utils 2.13 onwards limits support to the current and previous two releases
133133
# of GitHub Enterprise Server.
134-
supported_minimum_version="3.3.0"
134+
supported_minimum_version="3.5.0"
135135

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

bin/ghe-restore

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ cleanup () {
104104
update_restore_status "$1"
105105
fi
106106

107-
if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then
107+
if $ACTIONS_STOPPED && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then
108108
echo "Restarting Actions after restore ..."
109109
# In GHES 3.3+, ghe-actions-start no longer has a -f (force) flag. In GHES 3.2 and below, we must provide the
110110
# force flag to make sure it can start in maintenance mode. Use it conditionally based on whether it exists
@@ -161,6 +161,9 @@ hostname=$(echo "$GHE_HOSTNAME" | cut -f 1 -d :)
161161
# Show usage with no <host>
162162
[ -z "$GHE_HOSTNAME" ] && print_usage
163163

164+
# Flag to indicate if this script has stopped Actions.
165+
ACTIONS_STOPPED=false
166+
164167
# ghe-restore-snapshot-path validates it exists, determines what current is,
165168
# and if there's any problem, exit for us
166169
GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")"
@@ -282,6 +285,14 @@ fi
282285
# Get GHES release version in major.minor format
283286
RELEASE_VERSION=$(ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --get core.package-version' | cut -d '.' -f 1,2)
284287

288+
# If the backup being restored is from an appliance with Actions disabled, restoring it onto an appliance with Actions enabled will cause
289+
# mismatches in the secrets needed for Actions which ultimately results in Actions not working properly. Note: xargs is to remove whitespace
290+
ACTIONS_ENABLED_IN_BACKUP=$(git config -f $GHE_RESTORE_SNAPSHOT_PATH/settings.json --bool app.actions.enabled | xargs)
291+
if [[ $ACTIONS_ENABLED_IN_BACKUP != true ]] && ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then
292+
echo "Error: Restoring a backup with Actions disabled onto an appliance with Actions enabled is not supported." >&2
293+
exit 1
294+
fi
295+
285296
# Make sure the GitHub appliance has Actions enabled if the snapshot contains Actions data.
286297
# If above is true, also check if ac is present in appliance then snapshot should also contains ac databases
287298
if [ -d "$GHE_RESTORE_SNAPSHOT_PATH/mssql" ] || [ -d "$GHE_RESTORE_SNAPSHOT_PATH/actions" ]; then
@@ -399,6 +410,9 @@ fi
399410

400411
if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then
401412
echo "Stopping Actions before restoring databases ..."
413+
# We mark Actions as stopped even if the `ghe-actions-stop`
414+
# fails to ensure that we cleanly start actions when performing cleanup.
415+
ACTIONS_STOPPED=true
402416
ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3
403417

404418
echo "Restoring MSSQL databases ..."

debian/changelog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
github-backup-utils (3.7.0) UNRELEASED; urgency=medium
2+
3+
4+
-- Devin Dooley <[email protected]> Tue, 25 Oct 2022 00:35:38 +0000
5+
6+
github-backup-utils (3.6.0) UNRELEASED; urgency=medium
7+
8+
9+
-- Joe Franks <[email protected]> Wed, 17 Aug 2022 19:20:54 +0000
10+
111
github-backup-utils (3.5.0) UNRELEASED; urgency=medium
212

313
* Simplify complex redirects for ghe-rsync #881

0 commit comments

Comments
 (0)