diff options
| author | Martin André <martin.andre@kvhasia.com> | 2015-05-05 12:33:37 +0900 |
|---|---|---|
| committer | Martin André <martin.andre@kvhasia.com> | 2015-05-05 12:45:11 +0900 |
| commit | 047683d12c96f3b1cfddd906a515fd01bc122aa1 (patch) | |
| tree | d01d65af89101b363bd69bbcc8a6d49fc2abc598 | |
| parent | 844d710a48f858533cf67256cd81f051ae35533a (diff) | |
| download | kolla-047683d12c96f3b1cfddd906a515fd01bc122aa1.tar.gz kolla-047683d12c96f3b1cfddd906a515fd01bc122aa1.zip | |
Initial support for taggable dependencies
Introduce a new --no-use-released-parent option to `build-docker-image`
that allows specifying whether the parent image uses the same tag as
the one that's currently build or the release tag.
Default is to use the release tag for parent image, however
`build-all-docker-images` script forces it to be the current tag.
Change to Dockerfile is coming next.
Change-Id: Ief11c9abb722c181ca85f38ee11800dbf4332a5f
| -rwxr-xr-x | tools/build-all-docker-images | 5 | ||||
| -rwxr-xr-x | tools/build-docker-image | 19 |
2 files changed, 19 insertions, 5 deletions
diff --git a/tools/build-all-docker-images b/tools/build-all-docker-images index 74aa80fb8..c890b872b 100755 --- a/tools/build-all-docker-images +++ b/tools/build-all-docker-images @@ -27,7 +27,7 @@ function warn { } function set_defaults { - PREFIX=fedora-rdo- + PREFIX=centos-rdo- NAMESPACE=kollaglue } @@ -56,7 +56,7 @@ function build_image { if [ -x "$dir/build" ]; then printf "\n" info "Building image in $dir" - if $dir/build $ARGS; then + if $dir/build $ARGS --no-use-released-parent; then success "Successfully built image in $dir" status[$image]="rebuilt" else @@ -78,6 +78,7 @@ function init_image { local base_image=$(cat $img_dir/Dockerfile | gawk 'match($0, /^\s*FROM\s+(\S+)/, matches) {print matches[1]}' ) base_image=${base_image//%%KOLLA_NAMESPACE%%/$NAMESPACE} base_image=${base_image//%%KOLLA_PREFIX%%/$PREFIX} + base_image=${base_image//:%%KOLLA_TAG%%/} img_dirs[$image]=$img_dir dependency[$image]=$base_image diff --git a/tools/build-docker-image b/tools/build-docker-image index adffdf875..974c5a5eb 100755 --- a/tools/build-docker-image +++ b/tools/build-docker-image @@ -7,6 +7,7 @@ RELEASE_NAMESPACE=kollaglue NAMESPACE=kollaglue PREFIX=centos-rdo- TAG=$(git rev-parse --short HEAD) +RELEASE_TAG=icehouse usage () { cat <<EOF @@ -19,13 +20,14 @@ Options: --push, -p --no-cache, -N --release +--no-use-released-parent EOF } [ -f $TOPDIR/.buildconf ] && . $TOPDIR/.buildconf [ -f $IMGDIR/.buildconf ] && . $IMGDIR/.buildconf -ARGS=$(getopt -o hn:t:pN -l help,namespace:,push,release,tag:,no-cache -- "$@") || { usage >&2; exit 2; } +ARGS=$(getopt -o hn:t:pN -l help,namespace:,push,release,tag:,no-cache,no-use-released-parent -- "$@") || { usage >&2; exit 2; } eval set -- "$ARGS" @@ -38,7 +40,7 @@ while :; do (--release) MODE=release NAMESPACE=$RELEASE_NAMESPACE - TAG=latest + TAG=$RELEASE_TAG ;; (--tag|-t) shift @@ -57,6 +59,10 @@ while :; do NAMESPACE="$1" ;; + (--no-use-released-parent) + USE_CURRENT_TAG=1 + ;; + (--) break ;; @@ -65,8 +71,14 @@ while :; do shift done +if [[ $USE_CURRENT_TAG = 1 ]]; then + PARENT_TAG=$TAG +else + PARENT_TAG=$RELEASE_TAG +fi + if [ "$NAMESPACE" = "$RELEASE_NAMESPACE" ] \ - && [ "$TAG" = "latest" ] \ + && [ "$TAG" = "$RELEASE_TAG" ] \ && ! [ "$MODE" = "release" ]; then echo "ERROR: use --release to build a release image" >&2 @@ -94,6 +106,7 @@ cp -aL $IMGDIR/* $TMPDIR # versions of sed behave differently otherwise sed -i.bak "s/%%KOLLA_NAMESPACE%%/${NAMESPACE}/g" $TMPDIR/Dockerfile sed -i.bak "s/%%KOLLA_PREFIX%%/${PREFIX}/g" $TMPDIR/Dockerfile +sed -i.bak "s/%%KOLLA_TAG%%/${PARENT_TAG}/g" $TMPDIR/Dockerfile if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $TMPDIR; then echo "ERROR: failed to build $FULLIMAGE" |
