From e88b81c1badd60cbb0e35796111a9a55d667d8fc Mon Sep 17 00:00:00 2001 From: zouyee Date: Mon, 23 Sep 2019 17:46:47 +0800 Subject: [PATCH] fix docker_build_opts bound variable Signed-off-by: Zou Nengren --- build/lib/release.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/build/lib/release.sh b/build/lib/release.sh index 141a933362d..525dd7344a9 100644 --- a/build/lib/release.sh +++ b/build/lib/release.sh @@ -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}"