From e1ad10e1f4a23aa375f9e537f51a1d036b22066d Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Tue, 6 Jul 2021 17:23:19 -0400 Subject: [PATCH 1/5] fix: shellcheck source for env vars --- mangle/validate_repos | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mangle/validate_repos b/mangle/validate_repos index 88dd2e3..e6e69fc 100755 --- a/mangle/validate_repos +++ b/mangle/validate_repos @@ -1,8 +1,10 @@ #!/usr/bin/env bash # Source mangle vars +# shellcheck source=./common source "$(dirname "$0")/common" # Source sync / migrate vars for repository information +# shellcheck source=../sync/common source "$(dirname "$0")/../sync/common" # How many From ad69c93623c4ec2bb69de2e094accd26ae15fc5e Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Tue, 6 Jul 2021 17:32:25 -0400 Subject: [PATCH 2/5] maybe shellcheck will work --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ mangle/{common => common.sh} | 0 mangle/validate_repos | 8 ++++---- sync/{common => common.sh} | 0 sync/minor-release-sync-to-staging.sh | 2 +- sync/prep-staging-8.sh | 2 +- sync/sync-to-prod.sh | 2 +- sync/sync-to-staging-sig.sh | 2 +- sync/sync-to-staging.sh | 2 +- 9 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 .gitlab-ci.yml rename mangle/{common => common.sh} (100%) rename sync/{common => common.sh} (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..1f46319 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,22 @@ +# you can delete this line if you're not using Docker +#image: busybox:latest + +shellcheck: + stage: test + image: registry.gitlab.com/pipeline-components/shellcheck:latest + variables: + CUSTOM_ENV_CI_REGISTRY: git.rockylinux.org + CUSTOM_ENV_CI_REGISTRY_USER: neil + tags: + - container + script: + # anything ending on .sh, should be shell script + - | + find . -name .git -type d -prune -o -type f -name \*.sh -print0 | + xargs -0 -P $(nproc) -r -n1 shellcheck + # magic, any file with a valid shebang should be scanned aswell + - | + find . -name .git -type d -prune -o -type f -regex '.*/[^.]*$' -print0 | + xargs -0 -P $(nproc) -r -n1 sh -c 'FILE="$0"; if head -n1 "$FILE" |grep -q "^#\\! \?/.\+\(ba|d|k\)\?sh" ; then shellcheck "$FILE" ; else /bin/true ; fi ' + + diff --git a/mangle/common b/mangle/common.sh similarity index 100% rename from mangle/common rename to mangle/common.sh diff --git a/mangle/validate_repos b/mangle/validate_repos index e6e69fc..f34477f 100755 --- a/mangle/validate_repos +++ b/mangle/validate_repos @@ -1,11 +1,11 @@ #!/usr/bin/env bash # Source mangle vars -# shellcheck source=./common -source "$(dirname "$0")/common" +# shellcheck source=./common.sh +source "$(dirname "$0")/common.sh" # Source sync / migrate vars for repository information -# shellcheck source=../sync/common -source "$(dirname "$0")/../sync/common" +# shellcheck source=../sync/common.sh +source "$(dirname "$0")/../sync/common.sh" # How many ARG1=${1} diff --git a/sync/common b/sync/common.sh similarity index 100% rename from sync/common rename to sync/common.sh diff --git a/sync/minor-release-sync-to-staging.sh b/sync/minor-release-sync-to-staging.sh index dccd422..4170acc 100644 --- a/sync/minor-release-sync-to-staging.sh +++ b/sync/minor-release-sync-to-staging.sh @@ -3,7 +3,7 @@ # other scripts in this directory to assist. # Source common variables # shellcheck disable=SC2046,1091,1090 -source $(dirname "$0")/common +source $(dirname "$0")/common.sh # sync all pieces of a release, including extras, nfv, etc diff --git a/sync/prep-staging-8.sh b/sync/prep-staging-8.sh index bc7f20d..3125b24 100644 --- a/sync/prep-staging-8.sh +++ b/sync/prep-staging-8.sh @@ -13,7 +13,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common" +source "$(dirname "$0")/common.sh" echo "** Updating source repos" for y in "${ALL_REPOS[@]}"; do diff --git a/sync/sync-to-prod.sh b/sync/sync-to-prod.sh index 4edf198..8fd918a 100644 --- a/sync/sync-to-prod.sh +++ b/sync/sync-to-prod.sh @@ -3,7 +3,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common" +source "$(dirname "$0")/common.sh" REV=${1} diff --git a/sync/sync-to-staging-sig.sh b/sync/sync-to-staging-sig.sh index 2741f19..e47be39 100644 --- a/sync/sync-to-staging-sig.sh +++ b/sync/sync-to-staging-sig.sh @@ -2,7 +2,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common" +source "$(dirname "$0")/common.sh" # Major Version (eg, 8) MAJ=${1} diff --git a/sync/sync-to-staging.sh b/sync/sync-to-staging.sh index 07d8652..1f5438e 100644 --- a/sync/sync-to-staging.sh +++ b/sync/sync-to-staging.sh @@ -2,7 +2,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common" +source "$(dirname "$0")/common.sh" # Major Version (eg, 8) MAJ=${1} From a0848baae4d87f3be79a2bdda1ec2da9af76c6ea Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Tue, 6 Jul 2021 17:34:26 -0400 Subject: [PATCH 3/5] Revert "maybe shellcheck will work" This reverts commit ad69c93623c4ec2bb69de2e094accd26ae15fc5e. --- .gitlab-ci.yml | 22 ---------------------- mangle/{common.sh => common} | 0 mangle/validate_repos | 8 ++++---- sync/{common.sh => common} | 0 sync/minor-release-sync-to-staging.sh | 2 +- sync/prep-staging-8.sh | 2 +- sync/sync-to-prod.sh | 2 +- sync/sync-to-staging-sig.sh | 2 +- sync/sync-to-staging.sh | 2 +- 9 files changed, 9 insertions(+), 31 deletions(-) delete mode 100644 .gitlab-ci.yml rename mangle/{common.sh => common} (100%) rename sync/{common.sh => common} (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 1f46319..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,22 +0,0 @@ -# you can delete this line if you're not using Docker -#image: busybox:latest - -shellcheck: - stage: test - image: registry.gitlab.com/pipeline-components/shellcheck:latest - variables: - CUSTOM_ENV_CI_REGISTRY: git.rockylinux.org - CUSTOM_ENV_CI_REGISTRY_USER: neil - tags: - - container - script: - # anything ending on .sh, should be shell script - - | - find . -name .git -type d -prune -o -type f -name \*.sh -print0 | - xargs -0 -P $(nproc) -r -n1 shellcheck - # magic, any file with a valid shebang should be scanned aswell - - | - find . -name .git -type d -prune -o -type f -regex '.*/[^.]*$' -print0 | - xargs -0 -P $(nproc) -r -n1 sh -c 'FILE="$0"; if head -n1 "$FILE" |grep -q "^#\\! \?/.\+\(ba|d|k\)\?sh" ; then shellcheck "$FILE" ; else /bin/true ; fi ' - - diff --git a/mangle/common.sh b/mangle/common similarity index 100% rename from mangle/common.sh rename to mangle/common diff --git a/mangle/validate_repos b/mangle/validate_repos index f34477f..e6e69fc 100755 --- a/mangle/validate_repos +++ b/mangle/validate_repos @@ -1,11 +1,11 @@ #!/usr/bin/env bash # Source mangle vars -# shellcheck source=./common.sh -source "$(dirname "$0")/common.sh" +# shellcheck source=./common +source "$(dirname "$0")/common" # Source sync / migrate vars for repository information -# shellcheck source=../sync/common.sh -source "$(dirname "$0")/../sync/common.sh" +# shellcheck source=../sync/common +source "$(dirname "$0")/../sync/common" # How many ARG1=${1} diff --git a/sync/common.sh b/sync/common similarity index 100% rename from sync/common.sh rename to sync/common diff --git a/sync/minor-release-sync-to-staging.sh b/sync/minor-release-sync-to-staging.sh index 4170acc..dccd422 100644 --- a/sync/minor-release-sync-to-staging.sh +++ b/sync/minor-release-sync-to-staging.sh @@ -3,7 +3,7 @@ # other scripts in this directory to assist. # Source common variables # shellcheck disable=SC2046,1091,1090 -source $(dirname "$0")/common.sh +source $(dirname "$0")/common # sync all pieces of a release, including extras, nfv, etc diff --git a/sync/prep-staging-8.sh b/sync/prep-staging-8.sh index 3125b24..bc7f20d 100644 --- a/sync/prep-staging-8.sh +++ b/sync/prep-staging-8.sh @@ -13,7 +13,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common.sh" +source "$(dirname "$0")/common" echo "** Updating source repos" for y in "${ALL_REPOS[@]}"; do diff --git a/sync/sync-to-prod.sh b/sync/sync-to-prod.sh index 8fd918a..4edf198 100644 --- a/sync/sync-to-prod.sh +++ b/sync/sync-to-prod.sh @@ -3,7 +3,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common.sh" +source "$(dirname "$0")/common" REV=${1} diff --git a/sync/sync-to-staging-sig.sh b/sync/sync-to-staging-sig.sh index e47be39..2741f19 100644 --- a/sync/sync-to-staging-sig.sh +++ b/sync/sync-to-staging-sig.sh @@ -2,7 +2,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common.sh" +source "$(dirname "$0")/common" # Major Version (eg, 8) MAJ=${1} diff --git a/sync/sync-to-staging.sh b/sync/sync-to-staging.sh index 1f5438e..07d8652 100644 --- a/sync/sync-to-staging.sh +++ b/sync/sync-to-staging.sh @@ -2,7 +2,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common.sh" +source "$(dirname "$0")/common" # Major Version (eg, 8) MAJ=${1} From c929e736af5513552d764c6ead762f2a109d8fc3 Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Tue, 6 Jul 2021 17:34:43 -0400 Subject: [PATCH 4/5] fix: we need this guy in here --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..1f46319 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,22 @@ +# you can delete this line if you're not using Docker +#image: busybox:latest + +shellcheck: + stage: test + image: registry.gitlab.com/pipeline-components/shellcheck:latest + variables: + CUSTOM_ENV_CI_REGISTRY: git.rockylinux.org + CUSTOM_ENV_CI_REGISTRY_USER: neil + tags: + - container + script: + # anything ending on .sh, should be shell script + - | + find . -name .git -type d -prune -o -type f -name \*.sh -print0 | + xargs -0 -P $(nproc) -r -n1 shellcheck + # magic, any file with a valid shebang should be scanned aswell + - | + find . -name .git -type d -prune -o -type f -regex '.*/[^.]*$' -print0 | + xargs -0 -P $(nproc) -r -n1 sh -c 'FILE="$0"; if head -n1 "$FILE" |grep -q "^#\\! \?/.\+\(ba|d|k\)\?sh" ; then shellcheck "$FILE" ; else /bin/true ; fi ' + + From 0980c9a58774a8dfc843a5d4865458d617c86981 Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Tue, 6 Jul 2021 17:46:20 -0400 Subject: [PATCH 5/5] get rid of shellcheck errors --- mangle/validate_repos | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mangle/validate_repos b/mangle/validate_repos index e6e69fc..a845cff 100755 --- a/mangle/validate_repos +++ b/mangle/validate_repos @@ -1,10 +1,10 @@ #!/usr/bin/env bash # Source mangle vars -# shellcheck source=./common +# shellcheck source=./common disable=SC1091,1090 source "$(dirname "$0")/common" # Source sync / migrate vars for repository information -# shellcheck source=../sync/common +# shellcheck source=../sync/common disable=SC1091,1090 source "$(dirname "$0")/../sync/common" # How many