Skip to content

Commit 853214b

Browse files
authored
Merge branch 'master' into Luke-J-Reid-patch-1
2 parents 030580f + f0a969e commit 853214b

File tree

9 files changed

+39
-5
lines changed

9 files changed

+39
-5
lines changed

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
janky-token: '${{ secrets.API_AUTH_TOKEN }}'
3838
job-name: '${{ matrix.jankyJobName }}'
3939
branch-name: '${{ env.SOURCE_BRANCH }}'
40+
force : 'false'
4041
# enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release)
4142
envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ env.TARGET_BRANCH }}"
4243

@@ -63,5 +64,6 @@ jobs:
6364
janky-token: '${{ secrets.API_AUTH_TOKEN }}'
6465
job-name: '${{ matrix.jankyJobName }}'
6566
branch-name: '${{ env.SOURCE_BRANCH }}'
67+
force : 'false'
6668
# enterprise2 target branch is same as target branch for PR (either master or enterprise-[0-9]*.[0-9]*-release)
6769
envVars: "JANKY_ENV_BACKUP_UTILS_BRANCH=${{ env.SOURCE_BRANCH }},JANKY_ENV_ENTERPRISE2_BRANCH=${{ env.TARGET_BRANCH }}"

bin/ghe-backup

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ cleanup () {
118118

119119
rm -rf "$failures_file"
120120
rm -f "${GHE_DATA_DIR}/in-progress-backup"
121+
rm -rf /tmp/backup-utils-progress/*
121122

122123
# Cleanup SSH multiplexing
123124
ghe-ssh --clean

bin/ghe-restore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ cleanup () {
139139
log_error "Failed to remove in-progress file" 1>&3
140140
fi
141141

142+
# Remove progress files
143+
rm -rf /tmp/backup-utils-progress/*
144+
142145
bm_end "$(basename $0)"
143146
}
144147

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,24 @@ ghe_parse_remote_version() {
462462
export GHE_VERSION_MAJOR GHE_VERSION_MINOR GHE_VERSION_PATCH
463463
}
464464

465+
# In 3.11 we started to install 2 different version parallel(s)
466+
# moreutils parallel and GNU parallel. When gnu parallel is installed,
467+
# it renames moreutils parallel to parallel.moreutils
468+
# set $PARALLEL_CMD envvar to be used in place of parallel commands
469+
ghe_remote_parallel() {
470+
if [ -z "$GHE_REMOTE_VERSION" ]; then
471+
echo "Error: ghe_remote_version_required needs to be invoked before ghe_remote_parallel" 1>&2
472+
exit 1
473+
fi
474+
475+
if [ "$GHE_VERSION_MINOR" -lt 11 ]; then
476+
PARALLEL_CMD="parallel"
477+
else
478+
PARALLEL_CMD="parallel.moreutils"
479+
fi
480+
export PARALLEL_CMD
481+
}
482+
465483
# Parses the <host> part out of a "<host>:<port>" or just "<host>" string.
466484
# This is used primarily to break hostspecs with non-standard ports down for
467485
# rsync commands.

share/github-backup-utils/ghe-restore-pages

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ fi
3535

3636
# Perform a host-check and establish GHE_REMOTE_XXX variables.
3737
ghe_remote_version_required "$GHE_HOSTNAME"
38+
ghe_remote_parallel
3839

3940
# Split host:port into parts
4041
port=$(ssh_port_part "$GHE_HOSTNAME")
@@ -156,7 +157,7 @@ if $CLUSTER; then
156157
ghe-ssh "$GHE_HOSTNAME" -- /bin/bash >&3 <<EOF
157158
split -l 1000 $remote_routes_list $remote_tempdir/chunk
158159
chunks=\$(find $remote_tempdir/ -name chunk\*)
159-
parallel -i /bin/sh -c "cat {} | github-env ./bin/dpages-cluster-restore-finalize" -- \$chunks
160+
$PARALLEL_CMD -i /bin/sh -c "cat {} | github-env ./bin/dpages-cluster-restore-finalize" -- \$chunks
160161
EOF
161162
increment-progress-total-count 1
162163
bm_end "$(basename $0) - Finalizing routes"

share/github-backup-utils/ghe-restore-repositories

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ fi
3636

3737
# Perform a host-check and establish GHE_REMOTE_XXX variables.
3838
ghe_remote_version_required "$GHE_HOSTNAME"
39+
ghe_remote_parallel
3940

4041
# Generate SSH config for forwarding
4142
# Split host:port into parts
@@ -210,7 +211,7 @@ if $CLUSTER; then
210211
ghe-ssh "$GHE_HOSTNAME" -- /bin/bash >&3 <<EOF
211212
split -l 1000 $remote_to_restore $remote_tempdir/chunk
212213
chunks=\$(find $remote_tempdir/ -name chunk\*)
213-
parallel -i /bin/sh -c "cat {} | github-env ./bin/dgit-cluster-restore-finalize 2>>$remote_warnings" -- \$chunks
214+
$PARALLEL_CMD -i /bin/sh -c "cat {} | github-env ./bin/dgit-cluster-restore-finalize 2>>$remote_warnings" -- \$chunks
214215
EOF
215216
increment-progress-total-count 1
216217
bm_end "$(basename $0) - Finalizing routes"

share/github-backup-utils/ghe-restore-repositories-gist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ fi
3535

3636
# Perform a host-check and establish GHE_REMOTE_XXX variables.
3737
ghe_remote_version_required "$GHE_HOSTNAME"
38+
ghe_remote_parallel
3839

3940
# Generate SSH config for forwarding
4041
# Split host:port into parts
@@ -159,7 +160,7 @@ if $CLUSTER; then
159160
ghe-ssh "$GHE_HOSTNAME" -- /bin/bash >&3 <<EOF
160161
split -l 1000 $remote_to_restore $remote_tempdir/chunk
161162
chunks=\$(find $remote_tempdir/ -name chunk\*)
162-
parallel -i /bin/sh -c "cat {} | github-env ./bin/gist-cluster-restore-finalize 2>>$remote_warnings" -- \$chunks
163+
$PARALLEL_CMD -i /bin/sh -c "cat {} | github-env ./bin/gist-cluster-restore-finalize 2>>$remote_warnings" -- \$chunks
163164
EOF
164165
increment-progress-total-count 1
165166
bm_end "$(basename $0) - Finalizing routes"

share/github-backup-utils/ghe-restore-storage

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ fi
3939

4040
# Perform a host-check and establish GHE_REMOTE_XXX variables.
4141
ghe_remote_version_required "$GHE_HOSTNAME"
42+
ghe_remote_parallel
4243

4344
# Split host:port into parts
4445
port=$(ssh_port_part "$GHE_HOSTNAME")
@@ -171,7 +172,7 @@ if $CLUSTER; then
171172
ghe-ssh "$GHE_HOSTNAME" -- /bin/bash >&3 <<EOF
172173
split -l 1000 $remote_routes_list $remote_tempdir/chunk
173174
chunks=\$(find $remote_tempdir/ -name chunk\*)
174-
parallel -i /bin/sh -c "cat {} | github-env ./bin/storage-cluster-restore-finalize" -- \$chunks
175+
$PARALLEL_CMD -i /bin/sh -c "cat {} | github-env ./bin/storage-cluster-restore-finalize" -- \$chunks
175176
EOF
176177
increment-progress-total-count 1
177178
bm_end "$(basename $0) - Finalizing routes"

share/github-backup-utils/track-progress

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
#/ track-progress: track progress of backup or restore tasks
33

44
progress(){
5-
5+
## Those progress files should be created by init_progress function
6+
## If they are not present (e.g., individual script is being invoked directly),
7+
## we will not track progress
8+
if [ -f "/tmp/backup-utils-progress/progress" ] &&
9+
[ -f "/tmp/backup-utils-progress/total" ] &&
10+
[ -f "/tmp/backup-utils-progress/type" ]; then
611
PROGRESS=$(cat /tmp/backup-utils-progress/progress)
712
PROGRESS_TOTAL=$(cat /tmp/backup-utils-progress/total)
813
PROGRESS_TYPE=$(cat /tmp/backup-utils-progress/type)
914
PROGRESS_PERCENT=$( echo "scale = 2; ($PROGRESS / $PROGRESS_TOTAL) * 100" | bc)
1015
echo $((PROGRESS + 1)) > /tmp/backup-utils-progress/progress
1116
echo "${PROGRESS_TYPE} progress: $PROGRESS_PERCENT % ($PROGRESS / $PROGRESS_TOTAL ) $1 " > /tmp/backup-utils-progress/info
17+
fi
1218
}

0 commit comments

Comments
 (0)