diff --git a/tools/build-all-docker-images b/tools/build-all-docker-images index 86046fa471..dfd970426e 100755 --- a/tools/build-all-docker-images +++ b/tools/build-all-docker-images @@ -30,6 +30,7 @@ function set_defaults { PREFIX=centos-rdo- NAMESPACE=kollaglue [ -f $WORKDIR/.buildconf ] && . $WORKDIR/.buildconf + [ -n "${FORCE_PREFIX}" ] && PREFIX="${FORCE_PREFIX}" } function has_changed { @@ -137,6 +138,7 @@ A wrapper to build-docker-image that build all images in order. Options: +--prefix --from --to @@ -149,7 +151,7 @@ trap 'interrupted' INT ARGS=$@ -PARSED_ARGS=$(getopt -q -o hr:n:t: -l help,namespace:,release,tag:,private-registry:,from:,to:,testmode -- "$@") +PARSED_ARGS=$(getopt -q -o hr:n:t: -l help,prefix:,namespace:,release,tag:,private-registry:,from:,to:,testmode -- "$@") eval set -- "$PARSED_ARGS" @@ -160,6 +162,10 @@ while :; do exit 0 ;; + (--prefix) shift + FORCE_PREFIX="$1" + ;; + (--namespace|-n) shift FORCE_NAMESPACE="$1" diff --git a/tools/build-docker-image b/tools/build-docker-image index cc23abe1af..0f698af39c 100755 --- a/tools/build-docker-image +++ b/tools/build-docker-image @@ -20,6 +20,7 @@ Usage: $0 [options] Options: +--prefix --private-registry, -r --namespace, -n --tag, -t @@ -35,7 +36,7 @@ EOF [ -f $TOPDIR/.buildconf ] && . $TOPDIR/.buildconf [ -f $IMGDIR/.buildconf ] && . $IMGDIR/.buildconf -ARGS=$(getopt -o hr:n:t:pfuN -l help,namespace:,push,pull,private-registry:,release,tag:,force-rm,no-cache,no-use-released-parent -- "$@") || { usage >&2; exit 2; } +ARGS=$(getopt -o hr:n:t:pfuN -l help,prefix:,namespace:,push,pull,private-registry:,release,tag:,force-rm,no-cache,no-use-released-parent -- "$@") || { usage >&2; exit 2; } eval set -- "$ARGS" @@ -46,6 +47,10 @@ while :; do exit 0 ;; + (--prefix) shift + FORCE_PREFIX="$1" + ;; + (--release) MODE=release NAMESPACE=$RELEASE_NAMESPACE TAG=$RELEASE_TAG @@ -105,9 +110,15 @@ if [ "$NAMESPACE" = "$RELEASE_NAMESPACE" ] \ exit 1 fi +if [[ -n "${PREFIX}" && -n "${FORCE_PREFIX}" ]]; then + PREFIX="${FORCE_PREFIX}" +fi + + if [[ -n $REGISTRY ]]; then NAMESPACE="${REGISTRY}/${NAMESPACE}" fi + IMAGE="${PREFIX}${IMGDIR##*/}" FULLIMAGE="${NAMESPACE}/${IMAGE}${TAG:+:${TAG}}"