Skip to content

Commit 299c1dc

Browse files
committed
Quote bash variables to prevent globbing
See shellcheck SC2053 https://github.com/koalaman/shellcheck/wiki/SC2053
1 parent a27bfb7 commit 299c1dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hack/docker.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ git_tag=$1
44
docker_tag=edge
55

66
git_commit=$(git rev-parse HEAD)
7-
commit_tag=$(git describe --exact-match ${git_commit} 2>/dev/null)
7+
commit_tag=$(git describe --exact-match "${git_commit}" 2>/dev/null)
88

9-
if [[ ${commit_tag} == ${git_tag} ]]; then
9+
if [[ ${commit_tag} == "${git_tag}" ]]; then
1010
# we're on the exact commit of the tag, use the docker image for the tag
1111
docker_tag=${git_tag//v/}
12-
echo ${docker_tag}
12+
echo "${docker_tag}"
1313
exit 0
1414

1515
else
1616
# we're on a random commit, pull the 'edge' docker image to compare commits
1717
# if it's the latest commit from 'main' the SHA will match the 'revision' of the 'edge' docker image
1818
docker pull nginx/nginx-ingress:${docker_tag} >/dev/null 2>&1
1919
DOCKER_SHA=$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.revision" }}' nginx/nginx-ingress:${docker_tag})
20-
if [[ ${DOCKER_SHA} == ${git_commit} ]]; then
20+
if [[ ${DOCKER_SHA} == "${git_commit}" ]]; then
2121
# we're on the same commit as the latest edge
2222
echo ${docker_tag}
2323
exit 0

0 commit comments

Comments
 (0)