Skip to content

Commit 00f0f7a

Browse files
committed
Merge remote-tracking branch 'private/master' into sync-private-to-public
2 parents 8bbd273 + 6506931 commit 00f0f7a

20 files changed

+479
-66
lines changed

.github/workflows/docker-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v3
1717
- name: Build the Debian Docker image
18-
run: docker build . --file Dockerfile --tag backup-utils-debian:${GITHUB_RUN_ID}
18+
run: docker build . --file Dockerfile --tag backup-utils:${GITHUB_RUN_ID}
1919
- name: Build the Alpine Docker image
2020
run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID}
2121
- name: Run tests in Debian Docker image
22-
run: docker run backup-utils-debian:${GITHUB_RUN_ID} ghe-backup --version
22+
run: docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version
2323
- name: Run tests in Alpine Docker image
2424
run: docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version
2525

.github/workflows/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ name: Test and build
22

33
on: [pull_request]
44

5+
56
jobs:
67
build:
78
strategy:
89
matrix:
9-
os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04', 'macos-latest']
10+
# macos-latest references are kept here for historical purposes. removed macos-latest from the
11+
#matrix as it is not a typical case for users and causes a lot of friction with other linux-based
12+
# installs. Recommend developing on codespaces or using an ubuntu container.
13+
os: ['ubuntu-22.04', 'ubuntu-20.04', 'ubuntu-18.04']
1014
fail-fast: false
1115
runs-on: ${{ matrix.os }}
1216
steps:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
name: 'Close stale support escalation issues'
3+
on:
4+
push:
5+
branches:
6+
- master
7+
schedule:
8+
- cron: '30 1 * * *' # Run each day at 1:30 UTC
9+
10+
permissions:
11+
issues: write
12+
13+
jobs:
14+
stale:
15+
if: github.repository == 'github/ghes' || github.repository == 'github/enterprise2' || github.repository == 'github/backup-utils-private'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/stale@v7
19+
with:
20+
repo-token: ${{ secrets.GITHUB_TOKEN }}
21+
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.'
22+
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.'
23+
days-before-stale: 30
24+
days-before-close: 45
25+
only-labels: 'support-escalation'
26+
stale-issue-label: 'stale'
27+
exempt-issue-labels: 'never-stale,P1,P2,P3'

.github/workflows/stale.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
name: Mark stale issues and pull requests
3+
4+
on:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
8+
jobs:
9+
stale:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/stale@v7
15+
with:
16+
repo-token: ${{ secrets.GITHUB_TOKEN }}
17+
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."
18+
stale-issue-label: "Stale"
19+
exempt-issue-labels: "Keep"
20+
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."
21+
stale-pr-label: "Stale"
22+
exempt-pr-labels: "Keep, epic, initiative, GHAE"
23+
days-before-stale: 30 # 1 month, which accounts for "now" and "next", but anything beyond is "never"
24+
days-before-close: 5
25+
ascending: true

Dockerfile

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

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

RELEASING.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,24 @@ Only repo administrator is allowed to run the release script, otherwise it will
1515
Prior to making a release,
1616

1717
1. Sync any changes that have been merged to backup-utils-private into this repository.
18-
1. Go through the list of open pull requests and merge any that are ready for merging.
19-
1. Go through the list of closed pull requests since the last release and ensure those that should be included in the release notes:
20-
- have a "bug", "enhancement" or "feature" label,
21-
- have a title that clearly describes the changes in that pull request. Reword if necessary.
22-
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.
18+
19+
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.
20+
```
21+
git clone [email protected]:github/backup-utils
22+
cd backup-utils
23+
git checkout master
24+
git checkout -b sync-private-to-public
25+
git remote add private <private-repo>
26+
git fetch private
27+
git merge private/master
28+
git push origin HEAD
29+
```
30+
Then open a pull request on this repository with the changes.
31+
2. Go through the list of open pull requests and merge any that are ready for merging.
32+
3. Go through the list of closed pull requests since the last release and ensure those that should be included in the release notes:
33+
- have a "bug", "enhancement" or "feature" label,
34+
- have a title that clearly describes the changes in that pull request. Reword if necessary.
35+
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.
2336

2437
## Automatic Process from chatops (internal to GitHub only)
2538

bin/ghe-backup

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ done
4444
# Check to make sure moreutils parallel is installed and working properly
4545
ghe_parallel_check
4646

47+
4748
# Used to record failed backup steps
4849
failures=
4950
failures_file="$(mktemp -t backup-utils-backup-failures-XXXXXX)"
@@ -63,7 +64,7 @@ touch "incomplete"
6364
# Exit early if the snapshot filesystem doesn't support hard links, symlinks and
6465
# if rsync doesn't support hardlinking of dangling symlinks
6566
trap 'rm -rf src dest1 dest2' EXIT
66-
mkdir src
67+
mkdir -p src
6768
touch src/testfile
6869
if ! ln -s /data/does/not/exist/hooks/ src/ >/dev/null 2>&1; then
6970
echo "Error: the filesystem containing $GHE_DATA_DIR does not support symbolic links." 1>&2
@@ -105,6 +106,7 @@ cleanup () {
105106
fi
106107

107108
rm -rf "$failures_file"
109+
rm -f ${GHE_DATA_DIR}/in-progress-backup
108110

109111
# Cleanup SSH multiplexing
110112
ghe-ssh --clean
@@ -114,10 +116,15 @@ cleanup () {
114116
trap 'cleanup' EXIT
115117
trap 'exit $?' INT # ^C always terminate
116118

119+
120+
# Check to see if there is a running restore
121+
ghe_restore_check
122+
123+
# Check to see if there is a running backup
117124
if [ -h ../in-progress ]; then
118125
echo "Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2
119126
echo "If there is no backup in progress anymore, please remove" 1>&2
120-
echo "the $GHE_DATA_DIR/in-progress file." 1>&2
127+
echo "the $GHE_DATA_DIR/in-progress file and try again." 1>&2
121128
exit 1
122129
fi
123130

@@ -131,13 +138,15 @@ if [ -f ../in-progress ]; then
131138
unlink ../in-progress
132139
else
133140
echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2
134-
echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2
135-
echo "the $GHE_DATA_DIR/in-progress file and try again." 1>&2
141+
echo 1>&2
142+
echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2
143+
echo " the $GHE_DATA_DIR/in-progress file and try again." 1>&2
136144
exit 1
137145
fi
138146
fi
139147

140148
echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ../in-progress
149+
echo "$GHE_SNAPSHOT_TIMESTAMP $$" > ${GHE_DATA_DIR}/in-progress-backup
141150

142151
START_TIME=$(date +%s)
143152
echo 'Start time:' $START_TIME
@@ -278,3 +287,6 @@ ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true
278287

279288
# Make sure we exit zero after the conditional
280289
true
290+
291+
# Remove in-progress file
292+
ghe_backup_finished

bin/ghe-restore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ cleanup () {
122122

123123
# Cleanup SSH multiplexing
124124
ghe-ssh --clean
125+
# Remove in-progress file
126+
rm -f ${GHE_DATA_DIR}/in-progress-restore
125127
}
126128

127129
# 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() {
152154
# Check to make sure moreutils parallel is installed and working properly
153155
ghe_parallel_check
154156

157+
# Check to make sure another restore process is not running
158+
ghe_restore_check
159+
155160
# Grab the host arg
156161
GHE_HOSTNAME="${GHE_RESTORE_HOST_OPT:-$GHE_RESTORE_HOST}"
157162

@@ -170,6 +175,9 @@ GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")"
170175
GHE_RESTORE_SNAPSHOT=$(basename "$GHE_RESTORE_SNAPSHOT_PATH")
171176
export GHE_RESTORE_SNAPSHOT
172177

178+
# Check to make sure backup is not running
179+
ghe_backup_check
180+
173181
# Detect if the backup we are restoring has a leaked ssh key
174182
echo "Checking for leaked keys in the backup snapshot that is being restored ..."
175183
ghe-detect-leaked-ssh-keys -s "$GHE_RESTORE_SNAPSHOT_PATH" || true
@@ -252,6 +260,8 @@ START_TIME=$(date +%s)
252260
echo 'Start time:' $START_TIME
253261
echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT"
254262
ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..."
263+
# Create an in-progress-restore file to prevent simultaneous backup or restore runs
264+
echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore
255265

256266
# Keep other processes on the VM or cluster in the loop about the restore status.
257267
#
@@ -579,6 +589,7 @@ echo 'End time:' $END_TIME
579589
echo 'Runtime:' $(($END_TIME - $START_TIME)) 'seconds'
580590

581591
echo "Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished."
592+
ghe_restore_finished
582593

583594
if ! $instance_configured; then
584595
echo "To complete the restore process, please visit https://$hostname/setup/settings to review and save the appliance configuration."

ownership.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
version: 1
3+
ownership:
4+
- name: backup-utils-private
5+
long_name: backup-utils-private
6+
description: backup-utils-private is the private fork of backup-utils
7+
kind: code
8+
repo: https://github.com/github/backup-utils-private
9+
qos: critical
10+
team: github/ghes-lifecycle
11+
maintainer: shcorbett
12+
exec_sponsor: scottdensmore
13+
tier: 3
14+
product_manager: davidjarzebowski
15+
sev1:
16+
pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20
17+
tta: 30 minutes
18+
sev2:
19+
issue: https://github.com/github/ghes/issues/new?labels=ghes-lifecycle
20+
tta: 1 business day
21+
sev3:
22+
slack: ghes-dev
23+
tta: 1 week
24+
support_squad:
25+
slack: support-squad-infrastructure
26+
issue: https://github.com/github/support-squad-infrastructure/issues
27+
- name: backup-utils
28+
long_name: backup-utils
29+
description: backup-utils is backup and restore tooling for Github enterprise server
30+
kind: code
31+
repo: https://github.com/github/backup-utils
32+
qos: critical
33+
team: github/ghes-lifecycle
34+
maintainer: shcorbett
35+
exec_sponsor: scottdensmore
36+
tier: 3
37+
product_manager: davidjarzebowski
38+
sev1:
39+
pagerduty: https://github.pagerduty.com/escalation_policies#PBQWK20
40+
tta: 30 minutes
41+
sev2:
42+
issue: https://github.com/github/ghes/issues/new?labels=ghes-lifecycle
43+
tta: 1 business day
44+
sev3:
45+
slack: ghes-dev
46+
tta: 1 week
47+
support_squad:
48+
slack: support-squad-infrastructure
49+
issue: https://github.com/github/support-squad-infrastructure/issues

share/github-backup-utils/ghe-backup-config

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,60 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \
6666
fi
6767
done
6868

69+
GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore")
70+
GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup")
71+
72+
export GHE_RESTORE_IN_PROGRESS
73+
export GHE_BACKUP_IN_PROGRESS
74+
75+
ghe_restore_check() {
76+
if [ -h $GHE_RESTORE_IN_PROGRESS ]; then
77+
echo " Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2
78+
echo " If there is no restore in progress anymore, please remove" 1>&2
79+
echo " the $GHE_RESTORE_IN_PROGRESS file and try again." 1>&2
80+
exit 1
81+
fi
82+
83+
if [ -f $GHE_RESTORE_IN_PROGRESS ]; then
84+
progress=$(cat $GHE_RESTORE_IN_PROGRESS)
85+
pid=$(echo "$progress" | cut -d ' ' -f 2)
86+
echo " Error: A restore of $GHE_HOSTNAME may still be running on PID $pid." 1>&2
87+
echo " If PID $pid is not a process related to the restore utilities, please remove" 1>&2
88+
echo " the $GHE_RESTORE_IN_PROGRESS file and try again." 1>&2
89+
exit 1
90+
fi
91+
}
92+
93+
ghe_backup_check() {
94+
if [ -h $GHE_BACKUP_IN_PROGRESS ]; then
95+
echo " Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2
96+
echo " If there is no backup in progress anymore, please remove" 1>&2
97+
echo " the $GHE_DATA_DIR/$GHE_BACKUP_IN_PROGRESS file and try again." 1>&2
98+
exit 1
99+
fi
100+
101+
if [ -f $GHE_BACKUP_IN_PROGRESS ]; then
102+
progress=$(cat $GHE_BACKUP_IN_PROGRESS)
103+
pid=$(echo "$progress" | cut -d ' ' -f 2)
104+
echo " Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2
105+
echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2
106+
echo " the $GHE_BACKUP_IN_PROGRESS file and try again." 1>&2
107+
exit 1
108+
fi
109+
}
110+
111+
ghe_restore_finished() {
112+
if [ -f $GHE_RESTORE_IN_PROGRESS ]; then
113+
rm -f $GHE_RESTORE_IN_PROGRESS
114+
fi
115+
}
116+
117+
ghe_backup_finished() {
118+
if [ -f $GHE_BACKUP_IN_PROGRESS ]; then
119+
rm -f $GHE_BACKUP_IN_PROGRESS
120+
fi
121+
}
122+
69123
ghe_parallel_check() {
70124
if [ "$GHE_PARALLEL_ENABLED" != "yes" ]; then
71125
return 0

0 commit comments

Comments
 (0)