@@ -127,7 +127,7 @@ function version-create-effective-file() {
127127 local version_file=" $dir /VERSION"
128128 local build_datetime=${BUILD_DATETIME:- $(date -u +' %Y-%m-%dT%H:%M:%S%z' )}
129129
130- if [ -f " $version_file " ]; then
130+ if [[ -f " $version_file " ] ]; then
131131 # shellcheck disable=SC2002
132132 cat " $version_file " | \
133133 sed " s/\(\$ {yyyy}\|\$ yyyy\)/$( date --date=" ${build_datetime} " -u +" %Y" ) /g" | \
@@ -167,9 +167,9 @@ function docker-get-image-version-and-pull() {
167167 # match it by name and version regex, if given.
168168 local versions_file=" ${TOOL_VERSIONS:= $(git rev-parse --show-toplevel)/ .tool-versions} "
169169 local version=" latest"
170- if [ -f " $versions_file " ]; then
170+ if [[ -f " $versions_file " ] ]; then
171171 line=$( grep " docker/${name} " " $versions_file " | sed " s/^#\s*//; s/\s*#.*$//" | grep " ${match_version:- " .*" } " )
172- [ -n " $line " ] && version=$( echo " $line " | awk ' {print $2}' )
172+ [[ -n " $line " ] ] && version=$( echo " $line " | awk ' {print $2}' )
173173 fi
174174
175175 # Split the image version into two, tag name and digest sha256.
@@ -178,7 +178,7 @@ function docker-get-image-version-and-pull() {
178178
179179 # Check if the image exists locally already
180180 if ! docker images | awk ' { print $1 ":" $2 }' | grep -q " ^${name} :${tag} $" ; then
181- if [ " $digest " != " latest" ]; then
181+ if [[ " $digest " != " latest" ] ]; then
182182 # Pull image by the digest sha256 and tag it
183183 docker pull \
184184 --platform linux/amd64 \
@@ -222,19 +222,19 @@ function _replace-image-latest-by-specific-version() {
222222 local dockerfile=" ${dir} /Dockerfile.effective"
223223 local build_datetime=${BUILD_DATETIME:- $(date -u +' %Y-%m-%dT%H:%M:%S%z' )}
224224
225- if [ -f " $versions_file " ]; then
225+ if [[ -f " $versions_file " ] ]; then
226226 # First, list the entries specific for Docker to take precedence, then the rest but exclude comments
227227 content=$( grep " docker/" " $versions_file " ; grep -v " docker/" " $versions_file " || : | grep -v " ^#" )
228228 echo " $content " | while IFS= read -r line; do
229- [ -z " $line " ] && continue
229+ [[ -z " $line " ] ] && continue
230230 line=$( echo " $line " | sed " s/^#\s*//; s/\s*#.*$//" | sed " s;docker/;;" )
231231 name=$( echo " $line " | awk ' {print $1}' )
232232 version=$( echo " $line " | awk ' {print $2}' )
233233 sed -i " s;\(FROM .*\)${name} :latest;\1${name} :${version} ;g" " $dockerfile "
234234 done
235235 fi
236236
237- if [ -f " $dockerfile " ]; then
237+ if [[ -f " $dockerfile " ] ]; then
238238 # shellcheck disable=SC2002
239239 cat " $dockerfile " | \
240240 sed " s/\(\$ {yyyy}\|\$ yyyy\)/$( date --date=" ${build_datetime} " -u +" %Y" ) /g" | \
@@ -292,9 +292,9 @@ function _get-git-branch-name() {
292292
293293 local branch_name=$( git rev-parse --abbrev-ref HEAD)
294294
295- if [ -n " ${GITHUB_HEAD_REF:- } " ]; then
295+ if [[ -n " ${GITHUB_HEAD_REF:- } " ] ]; then
296296 branch_name=$GITHUB_HEAD_REF
297- elif [ -n " ${GITHUB_REF:- } " ]; then
297+ elif [[ -n " ${GITHUB_REF:- } " ] ]; then
298298 # shellcheck disable=SC2001
299299 branch_name=$( echo " $GITHUB_REF " | sed " s#refs/heads/##" )
300300 fi
0 commit comments