From 733bb2c31d84f8d1c153d7115a21d5d5c7607cc7 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Fri, 2 Jun 2017 21:12:18 -0400 Subject: [PATCH] Add git branch to make build short hash unique KUBE_ROOT_HASH depends just on the host name and directory path. So when working with branches, it could lead to some confusion since the hash is the same even when you switch from branch to branch. Let us use the git branch information when we compute the short hash Fixes #1801 --- build/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/common.sh b/build/common.sh index 9ec643b1d98..67b0a4927d8 100755 --- a/build/common.sh +++ b/build/common.sh @@ -178,7 +178,8 @@ function kube::build::verify_prereqs() { fi fi - KUBE_ROOT_HASH=$(kube::build::short_hash "${HOSTNAME:-}:${KUBE_ROOT}") + KUBE_GIT_BRANCH=$(git symbolic-ref --short -q HEAD 2>/dev/null || true) + KUBE_ROOT_HASH=$(kube::build::short_hash "${HOSTNAME:-}:${KUBE_ROOT}:${KUBE_GIT_BRANCH}") KUBE_BUILD_IMAGE_TAG_BASE="build-${KUBE_ROOT_HASH}" KUBE_BUILD_IMAGE_TAG="${KUBE_BUILD_IMAGE_TAG_BASE}-${KUBE_BUILD_IMAGE_VERSION}" KUBE_BUILD_IMAGE="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_TAG}"