bin/_tag.sh: Fix shellcheck issues (#4436)

Signed-off-by: Joakim Roubert <joakimr@axis.com>
This commit is contained in:
Joakim Roubert 2020-05-19 23:49:07 +02:00 committed by GitHub
parent a457936045
commit 6f1654a65d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -84,7 +84,6 @@ jobs:
! -name lint \ ! -name lint \
! -name _log.sh \ ! -name _log.sh \
! -name minikube-start-hyperv.bat \ ! -name minikube-start-hyperv.bat \
! -name _tag.sh \
! -name test-cleanup \ ! -name test-cleanup \
! -name _test-run.sh \ ! -name _test-run.sh \
! -name *.nuspec \ ! -name *.nuspec \

View File

@ -17,7 +17,7 @@ clean_head() {
} }
named_tag() { 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"} tag=${tag%"^0"}
echo "${tag}" echo "${tag}"
} }
@ -26,7 +26,7 @@ head_root_tag() {
if clean_head ; then if clean_head ; then
clean_head_root_tag clean_head_root_tag
else else
name=$(echo $USER | sed 's/[^[:alnum:].-]//g') name=${USER//[^[:alnum:].-]/}
echo "dev-$(git_sha_head)-$name" echo "dev-$(git_sha_head)-$name"
fi fi
} }
@ -34,7 +34,7 @@ head_root_tag() {
clean_head_root_tag() { clean_head_root_tag() {
if clean_head ; then if clean_head ; then
if [ "$(named_tag)" != undefined ]; then if [ "$(named_tag)" != undefined ]; then
echo "$(named_tag)" named_tag
else else
echo "git-$(git_sha_head)" echo "git-$(git_sha_head)"
fi fi
@ -57,9 +57,9 @@ validate_tag() {
dockerfile_tag=$(grep -oe "$image"':[^ ]*' "$file") || true dockerfile_tag=$(grep -oe "$image"':[^ ]*' "$file") || true
deps_tag="$image:$sha" deps_tag="$image:$sha"
if [ -n "$dockerfile_tag" ] && [ "$dockerfile_tag" != "$deps_tag" ]; then if [ -n "$dockerfile_tag" ] && [ "$dockerfile_tag" != "$deps_tag" ]; then
echo "Tag in "$file" does not match source tree:" echo "Tag in \"$file\" does not match source tree:
echo $dockerfile_tag" ("$file")" $dockerfile_tag (\"$file\")
echo $deps_tag" (source)" $deps_tag (source)"
return 3 return 3
fi fi
} }