fix docker_build_opts bound variable

Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
This commit is contained in:
zouyee 2019-09-23 17:46:47 +08:00
parent 8249e483f4
commit e88b81c1ba

View File

@ -345,6 +345,15 @@ function kube::release::create_docker_images_for_server() {
return 1
fi
# provide `--pull` argument to `docker build` if `KUBE_BUILD_PULL_LATEST_IMAGES`
# is set to y or Y; otherwise try to build the image without forcefully
# pulling the latest base image.
local DOCKER_BUILD_OPTS=()
if [[ "${KUBE_BUILD_PULL_LATEST_IMAGES}" =~ [yY] ]]; then
DOCKER_BUILD_OPTS+=("--pull")
fi
local -r docker_build_opts="${DOCKER_BUILD_OPTS[@]}"
for wrappable in "${binaries[@]}"; do
local oldifs=$IFS
@ -375,15 +384,7 @@ EOF
echo "COPY nsswitch.conf /etc/" >> "${docker_file_path}"
fi
# provide `--pull` argument to `docker build` if `KUBE_BUILD_PULL_LATEST_IMAGES`
# is set to y or Y; otherwise try to build the image without forcefully
# pulling the latest base image.
local -a docker_build_opts=()
if [[ "${KUBE_BUILD_PULL_LATEST_IMAGES}" =~ [yY] ]]; then
docker_build_opts+=("--pull")
fi
echo "'${DOCKER[@]}' build '${docker_build_opts[@]}' -q -t '${docker_image_tag}' '${docker_build_path}' >/dev/null"
"${DOCKER[@]}" build "${!docker_build_opts[@]}" -q -t "${docker_image_tag}" "${docker_build_path}" >/dev/null
"${DOCKER[@]}" build ${docker_build_opts} -q -t "${docker_image_tag}" "${docker_build_path}" >/dev/null
# If we are building an official/alpha/beta release we want to keep
# docker images and tag them appropriately.
local -r release_docker_image_tag="${KUBE_DOCKER_REGISTRY-$docker_registry}/${binary_name}-${arch}:${KUBE_DOCKER_IMAGE_TAG-$docker_tag}"