From fb4d6aedf8b51fcb71804145d9693c5b590896b4 Mon Sep 17 00:00:00 2001 From: matt korwel Date: Wed, 29 Jan 2020 23:46:33 -0800 Subject: [PATCH 1/4] wip dry up loop version call outside of the loop should greatly reduce time per discussions with @piki this will be related to https://github.com/github/ghes-infrastructure/issues/243 --- .../ghe-backup-repositories-rsync | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-repositories-rsync b/share/github-backup-utils/ghe-backup-repositories-rsync index e89484b01..d3d194f79 100755 --- a/share/github-backup-utils/ghe-backup-repositories-rsync +++ b/share/github-backup-utils/ghe-backup-repositories-rsync @@ -370,11 +370,17 @@ if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then # The list of gists returned by the source changed in 2.16.23, 2.17.14, 2.18.8 & 2.19.3 # so we need to account for this difference here. parse_paths() { + local version_GHE_REMOTE_VERSION=$(version $GHE_REMOTE_VERSION) + local version_2_16_23=$(version 2.16.23) + local version_2_17_14=$(version 2.17.14) + local version_2_18_8=$(version 2.18.8) + local vesrion_2_19_3=$(version 2.19.3) + while read -r line; do - 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)" ]] || \ - [[ "$GHE_REMOTE_VERSION" =~ 2.19 && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.19.3)" ]] && \ + 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" ]] || \ + [[ "$GHE_REMOTE_VERSION" =~ 2.19 && "$version_GHE_REMOTE_VERSION" -ge "$vesrion_2_19_3" ]] && \ (echo "$line" | grep -q "gist"); then echo "$line" else From 2f1b3c2aa1fc3c9938d95c4d82fac26d35854a53 Mon Sep 17 00:00:00 2001 From: matt korwel Date: Thu, 30 Jan 2020 00:03:26 -0800 Subject: [PATCH 2/4] fix ci failures got a linting rule failure for 'share/github-backup-utils/ghe-backup-repositories-rsync:373:11: warning: Declare and assign separately to avoid masking return values. [SC2155]' seeing if it plays nicer with out local. --- .../github-backup-utils/ghe-backup-repositories-rsync | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/github-backup-utils/ghe-backup-repositories-rsync b/share/github-backup-utils/ghe-backup-repositories-rsync index d3d194f79..c1e32d7cc 100755 --- a/share/github-backup-utils/ghe-backup-repositories-rsync +++ b/share/github-backup-utils/ghe-backup-repositories-rsync @@ -370,11 +370,11 @@ if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then # The list of gists returned by the source changed in 2.16.23, 2.17.14, 2.18.8 & 2.19.3 # so we need to account for this difference here. parse_paths() { - local version_GHE_REMOTE_VERSION=$(version $GHE_REMOTE_VERSION) - local version_2_16_23=$(version 2.16.23) - local version_2_17_14=$(version 2.17.14) - local version_2_18_8=$(version 2.18.8) - local vesrion_2_19_3=$(version 2.19.3) + version_GHE_REMOTE_VERSION=$(version $GHE_REMOTE_VERSION) + version_2_16_23=$(version 2.16.23) + version_2_17_14=$(version 2.17.14) + version_2_18_8=$(version 2.18.8) + vesrion_2_19_3=$(version 2.19.3) while read -r line; do if [[ "$GHE_REMOTE_VERSION" =~ 2.16 && "$version_GHE_REMOTE_VERSION" -ge "$version_2_16_23" ]] || \ From 3576b4f810c739544f19f9847c1539663db23123 Mon Sep 17 00:00:00 2001 From: Ronnie Moore Date: Thu, 30 Jan 2020 08:43:24 -0600 Subject: [PATCH 3/4] fixed typo Co-Authored-By: Matthias Wiesen --- share/github-backup-utils/ghe-backup-repositories-rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-repositories-rsync b/share/github-backup-utils/ghe-backup-repositories-rsync index c1e32d7cc..e87f2713f 100755 --- a/share/github-backup-utils/ghe-backup-repositories-rsync +++ b/share/github-backup-utils/ghe-backup-repositories-rsync @@ -374,7 +374,7 @@ if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then version_2_16_23=$(version 2.16.23) version_2_17_14=$(version 2.17.14) version_2_18_8=$(version 2.18.8) - vesrion_2_19_3=$(version 2.19.3) + version_2_19_3=$(version 2.19.3) while read -r line; do if [[ "$GHE_REMOTE_VERSION" =~ 2.16 && "$version_GHE_REMOTE_VERSION" -ge "$version_2_16_23" ]] || \ From abdbd6a4616485f3fc34378ebcb30d7ed3c73607 Mon Sep 17 00:00:00 2001 From: Ronnie Moore Date: Thu, 30 Jan 2020 08:43:38 -0600 Subject: [PATCH 4/4] fix typo Co-Authored-By: Matthias Wiesen --- share/github-backup-utils/ghe-backup-repositories-rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/github-backup-utils/ghe-backup-repositories-rsync b/share/github-backup-utils/ghe-backup-repositories-rsync index e87f2713f..14293dded 100755 --- a/share/github-backup-utils/ghe-backup-repositories-rsync +++ b/share/github-backup-utils/ghe-backup-repositories-rsync @@ -380,7 +380,7 @@ if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then 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" ]] || \ - [[ "$GHE_REMOTE_VERSION" =~ 2.19 && "$version_GHE_REMOTE_VERSION" -ge "$vesrion_2_19_3" ]] && \ + [[ "$GHE_REMOTE_VERSION" =~ 2.19 && "$version_GHE_REMOTE_VERSION" -ge "$version_2_19_3" ]] && \ (echo "$line" | grep -q "gist"); then echo "$line" else