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-
|
PREFIX=centos-rdo-
|
||||||
NAMESPACE=kollaglue
|
NAMESPACE=kollaglue
|
||||||
[ -f $WORKDIR/.buildconf ] && . $WORKDIR/.buildconf
|
[ -f $WORKDIR/.buildconf ] && . $WORKDIR/.buildconf
|
||||||
|
[ -n "${FORCE_PREFIX}" ] && PREFIX="${FORCE_PREFIX}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function has_changed {
|
function has_changed {
|
||||||
@ -137,6 +138,7 @@ A wrapper to build-docker-image that build all images in order.
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
|
--prefix <image_prefix>
|
||||||
--from <git-revision>
|
--from <git-revision>
|
||||||
--to <git-revision>
|
--to <git-revision>
|
||||||
|
|
||||||
@ -149,7 +151,7 @@ trap 'interrupted' INT
|
|||||||
|
|
||||||
|
|
||||||
ARGS=$@
|
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"
|
eval set -- "$PARSED_ARGS"
|
||||||
|
|
||||||
@ -160,6 +162,10 @@ while :; do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(--prefix) shift
|
||||||
|
FORCE_PREFIX="$1"
|
||||||
|
;;
|
||||||
|
|
||||||
(--namespace|-n)
|
(--namespace|-n)
|
||||||
shift
|
shift
|
||||||
FORCE_NAMESPACE="$1"
|
FORCE_NAMESPACE="$1"
|
||||||
|
@ -20,6 +20,7 @@ Usage: $0 [options]
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
|
--prefix <image_prefix>
|
||||||
--private-registry, -r <registry_address[:port]>
|
--private-registry, -r <registry_address[:port]>
|
||||||
--namespace, -n <namespace>
|
--namespace, -n <namespace>
|
||||||
--tag, -t <tag>
|
--tag, -t <tag>
|
||||||
@ -35,7 +36,7 @@ EOF
|
|||||||
[ -f $TOPDIR/.buildconf ] && . $TOPDIR/.buildconf
|
[ -f $TOPDIR/.buildconf ] && . $TOPDIR/.buildconf
|
||||||
[ -f $IMGDIR/.buildconf ] && . $IMGDIR/.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"
|
eval set -- "$ARGS"
|
||||||
|
|
||||||
@ -46,6 +47,10 @@ while :; do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(--prefix) shift
|
||||||
|
FORCE_PREFIX="$1"
|
||||||
|
;;
|
||||||
|
|
||||||
(--release) MODE=release
|
(--release) MODE=release
|
||||||
NAMESPACE=$RELEASE_NAMESPACE
|
NAMESPACE=$RELEASE_NAMESPACE
|
||||||
TAG=$RELEASE_TAG
|
TAG=$RELEASE_TAG
|
||||||
@ -105,9 +110,15 @@ if [ "$NAMESPACE" = "$RELEASE_NAMESPACE" ] \
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${PREFIX}" && -n "${FORCE_PREFIX}" ]]; then
|
||||||
|
PREFIX="${FORCE_PREFIX}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ -n $REGISTRY ]]; then
|
if [[ -n $REGISTRY ]]; then
|
||||||
NAMESPACE="${REGISTRY}/${NAMESPACE}"
|
NAMESPACE="${REGISTRY}/${NAMESPACE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IMAGE="${PREFIX}${IMGDIR##*/}"
|
IMAGE="${PREFIX}${IMGDIR##*/}"
|
||||||
FULLIMAGE="${NAMESPACE}/${IMAGE}${TAG:+:${TAG}}"
|
FULLIMAGE="${NAMESPACE}/${IMAGE}${TAG:+:${TAG}}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user