@@ -106,14 +106,20 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
106106 CACHE_IMAGE_TAG=${REGISTRY} /${REGISTRY_USERNAME} /rust-ci-cache:${cksum}
107107
108108 # Docker build arguments.
109- build_args=" build --rm -t rust-ci -f $dockerfile $context "
109+ build_args=(
110+ " build"
111+ " --rm"
112+ " -t" " rust-ci"
113+ " -f" " $dockerfile "
114+ " $context "
115+ )
110116
111117 # If the environment variable SCRIPT is defined,
112118 # set the build argument SCRIPT_ARG to SCRIPT.
113119 # In this way, we run the SCRIPT defined in CI,
114120 # instead of the one defined in the Dockerfile.
115121 if [ -n " ${SCRIPT+x} " ]; then
116- build_args= " ${build_args} --build-arg \ " SCRIPT_ARG=${SCRIPT} \" "
122+ build_args+=( " --build-arg" " SCRIPT_ARG=\" ${SCRIPT} \" " )
117123 fi
118124
119125 # On non-CI jobs, we try to download a pre-built image from the rust-lang-ci
@@ -126,7 +132,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
126132 docker tag " ${IMAGE_TAG} " rust-ci
127133 else
128134 echo " Building local Docker image"
129- retry docker ${build_args}
135+ retry docker " ${build_args[@]} "
130136 fi
131137 # On PR CI jobs, we don't have permissions to write to the registry cache,
132138 # but we can still read from it.
@@ -138,7 +144,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
138144 # Build the image using registry caching backend
139145 retry docker \
140146 buildx \
141- ${build_args} \
147+ " ${build_args[@]} " \
142148 --cache-from type=registry,ref=${CACHE_IMAGE_TAG} \
143149 --output=type=docker
144150 # On auto/try builds, we can also write to the cache.
@@ -154,7 +160,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
154160 # Build the image using registry caching backend
155161 retry docker \
156162 buildx \
157- ${build_args} \
163+ " ${build_args[@]} " \
158164 --cache-from type=registry,ref=${CACHE_IMAGE_TAG} \
159165 --cache-to type=registry,ref=${CACHE_IMAGE_TAG} ,compression=zstd \
160166 --output=type=docker
0 commit comments