aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMartin André <martin.andre@kvhasia.com>2015-05-26 10:59:49 +0900
committerMartin André <martin.andre@kvhasia.com>2015-05-26 14:20:51 +0900
commit2844a2510249a200f87d8d173ce5da9f1361757c (patch)
treea86fcfffe456ea40a117e7f5c4cfe1e887f31688 /tools
parent9249ed0d1d6dc1ce3d61f5be0a0b3853619404b1 (diff)
downloadkolla-2844a2510249a200f87d8d173ce5da9f1361757c.tar.gz
kolla-2844a2510249a200f87d8d173ce5da9f1361757c.zip
Always provide a tag when building with build-all-docker-images
When we're not providing a tag, the build script will use one based on the short SHA of the tip of the current git branch. Make the `build-all-docker-images` script always provide a tag to `build-docker-image` in order to prevent issues with Docker not being able to find the base image when changing branches during an ongoing build. Closes-Bug: #1458739 Change-Id: Id6925b792f46d14b20a7dbebfaf0d351ddec6538
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build-all-docker-images17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/build-all-docker-images b/tools/build-all-docker-images
index ed8c526da..945fd2480 100755
--- a/tools/build-all-docker-images
+++ b/tools/build-all-docker-images
@@ -146,7 +146,7 @@ trap 'interrupted' INT
ARGS=$@
-PARSED_ARGS=$(getopt -q -o hr:n: -l help,namespace:,private-registry:,from:,to:,testmode -- "$@")
+PARSED_ARGS=$(getopt -q -o hr:n:t: -l help,namespace:,release,tag:,private-registry:,from:,to:,testmode -- "$@")
eval set -- "$PARSED_ARGS"
@@ -162,6 +162,15 @@ while :; do
FORCE_NAMESPACE="$1"
;;
+ (--release)
+ RELEASE_SPECIFIED=1
+ ;;
+
+ (--tag|-t)
+ shift
+ TAG_SPECIFIED=1
+ ;;
+
(--private-registry|-r)
shift
REGISTRY="$1"
@@ -199,6 +208,12 @@ BASE=$(echo "${PREFIX}" | cut -d- -f1)
# TYPE == binary, source, rdo
TYPE=$(echo "${PREFIX}" | cut -d- -f2)
+# Ensure a tag is specified otherwise build may fail when changing git branch
+# The release tag is automatically appended when --release flag is used.
+if [[ $RELEASE_SPECIFIED != 1 ]] && [[ $TAG_SPECIFIED != 1 ]]; then
+ TAG=$(git rev-parse --short HEAD)
+ ARGS+=" --tag $TAG"
+fi
# Do a first pass to find images to build and their dependencies
for dockerfile in $(find "${DOCKERDIR}/${BASE}/${TYPE}" -name Dockerfile); do