Commit f29d597d authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #25052 from ixdy/build-image-name-in-docker

Automatic merge from submit-queue Use HOSTNAME in Docker build image tag hash Fixes #24661 by including `$HOSTNAME` when generating the build image tag hash. When running the verification checks under Docker, the `$KUBE_ROOT` will be identical across builds, so tags will collide unless we add additional uniqueness. By default, the hostname inside a Docker container is its ID, which should be unique enough for us. I also deleted a misleading error message from the same check. @kubernetes/sig-testing
parents 9ded9cd9 83ac3ea0
......@@ -154,7 +154,7 @@ function kube::build::verify_prereqs() {
fi
kube::build::ensure_docker_daemon_connectivity || return 1
KUBE_ROOT_HASH=$(kube::build::short_hash "$KUBE_ROOT")
KUBE_ROOT_HASH=$(kube::build::short_hash "${HOSTNAME:-}:${KUBE_ROOT}")
KUBE_BUILD_IMAGE_TAG="build-${KUBE_ROOT_HASH}"
KUBE_BUILD_IMAGE="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_TAG}"
KUBE_BUILD_CONTAINER_NAME="kube-build-${KUBE_ROOT_HASH}"
......
......@@ -36,10 +36,12 @@ for APIROOT in ${APIROOTS}; do
cp -a "${KUBE_ROOT}/${APIROOT}" "${_tmp}/${APIROOT}"
done
# We would like to use "sudo" when running on Travis and
# not use "sudo" when running on Jenkins.
SUDO="sudo"
sudo -h > /dev/null || SUDO=""
# If not running as root, we need to use sudo to restore the original generated
# protobuf files.
SUDO=""
if [[ "$(id -u)" != '0' ]]; then
SUDO="sudo"
fi
"${KUBE_ROOT}/hack/update-generated-protobuf.sh"
for APIROOT in ${APIROOTS}; do
......
......@@ -31,7 +31,7 @@ function prereqs() {
fi
kube::build::ensure_docker_daemon_connectivity || return 1
KUBE_ROOT_HASH=$(kube::build::short_hash "$KUBE_ROOT/go-to-protobuf")
KUBE_ROOT_HASH=$(kube::build::short_hash "${HOSTNAME:-}:${REPO_DIR:-${KUBE_ROOT}}/go-to-protobuf")
KUBE_BUILD_IMAGE_TAG="build-${KUBE_ROOT_HASH}"
KUBE_BUILD_IMAGE="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_TAG}"
KUBE_BUILD_CONTAINER_NAME="kube-build-${KUBE_ROOT_HASH}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment