From 6f1654a65d9a6d22f3b0ed5b01a18af233a4800a Mon Sep 17 00:00:00 2001 From: Joakim Roubert Date: Tue, 19 May 2020 23:49:07 +0200 Subject: [PATCH] bin/_tag.sh: Fix shellcheck issues (#4436) Signed-off-by: Joakim Roubert --- .github/workflows/static_checks.yml | 1 - bin/_tag.sh | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 1a597e335..678ec90e8 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -84,7 +84,6 @@ jobs: ! -name lint \ ! -name _log.sh \ ! -name minikube-start-hyperv.bat \ - ! -name _tag.sh \ ! -name test-cleanup \ ! -name _test-run.sh \ ! -name *.nuspec \ diff --git a/bin/_tag.sh b/bin/_tag.sh index 07ed6ef4f..04d48e65d 100644 --- a/bin/_tag.sh +++ b/bin/_tag.sh @@ -17,7 +17,7 @@ clean_head() { } named_tag() { - tag="$(git name-rev --tags --name-only $(git_sha_head))" + tag="$(git name-rev --tags --name-only "$(git_sha_head)")" tag=${tag%"^0"} echo "${tag}" } @@ -26,7 +26,7 @@ head_root_tag() { if clean_head ; then clean_head_root_tag else - name=$(echo $USER | sed 's/[^[:alnum:].-]//g') + name=${USER//[^[:alnum:].-]/} echo "dev-$(git_sha_head)-$name" fi } @@ -34,7 +34,7 @@ head_root_tag() { clean_head_root_tag() { if clean_head ; then if [ "$(named_tag)" != undefined ]; then - echo "$(named_tag)" + named_tag else echo "git-$(git_sha_head)" fi @@ -57,9 +57,9 @@ validate_tag() { dockerfile_tag=$(grep -oe "$image"':[^ ]*' "$file") || true deps_tag="$image:$sha" if [ -n "$dockerfile_tag" ] && [ "$dockerfile_tag" != "$deps_tag" ]; then - echo "Tag in "$file" does not match source tree:" - echo $dockerfile_tag" ("$file")" - echo $deps_tag" (source)" + echo "Tag in \"$file\" does not match source tree: +$dockerfile_tag (\"$file\") +$deps_tag (source)" return 3 fi }