Add --prefix to override .buildconf
Add in the ability to override the prefix in .buildconf files removing the requirement to set the prefix in a .buildconf to limit the number of images built. Partially Implements: blueprint refactor-base-image-layout Change-Id: I1da1559e660adc2fe9eaf5e17ce427c89645a8b7
This commit is contained in:
parent
b87f16fac5
commit
4a899d754f
@ -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 <image_prefix>
|
||||
--from <git-revision>
|
||||
--to <git-revision>
|
||||
|
||||
@ -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"
|
||||
|
@ -20,6 +20,7 @@ Usage: $0 [options]
|
||||
|
||||
Options:
|
||||
|
||||
--prefix <image_prefix>
|
||||
--private-registry, -r <registry_address[:port]>
|
||||
--namespace, -n <namespace>
|
||||
--tag, -t <tag>
|
||||
@ -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}}"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user