From 3e5dff06fc72f5ef1c4b65d64ec443335c40f795 Mon Sep 17 00:00:00 2001 From: Luke Meyer Date: Thu, 22 Jun 2017 15:26:05 -0400 Subject: releases: enable build/push with multiple tags --- hack/build-images.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'hack/build-images.sh') diff --git a/hack/build-images.sh b/hack/build-images.sh index ce421178f..6e6d360bf 100755 --- a/hack/build-images.sh +++ b/hack/build-images.sh @@ -47,7 +47,7 @@ if [ "$help" = true ]; then echo " default: openshift/origin-ansible" echo echo " --version=VERSION" - echo " The version used to tag the image" + echo " The version used to tag the image (can be a comma-separated list)" echo " default: latest" echo echo " --no-cache" @@ -62,25 +62,33 @@ if [ "$help" = true ]; then exit 0 fi + if [ "$verbose" = true ]; then set -x fi BUILD_STARTTIME=$(date +%s) comp_path=$source_root/ -docker_tag=${prefix}:${version} + +# turn comma-separated versions into -t args for docker build +IFS=',' read -r -a version_arr <<< "$version" +docker_tags=() +for tag in "${version_arr[@]}"; do + docker_tags+=("-t" "${prefix}:${tag}") +done + echo echo -echo "--- Building component '$comp_path' with docker tag '$docker_tag' ---" -docker build ${options} -t $docker_tag $comp_path -BUILD_ENDTIME=$(date +%s); echo "--- $docker_tag took $(($BUILD_ENDTIME - $BUILD_STARTTIME)) seconds ---" +echo "--- Building component '$comp_path' with docker tag(s) '$version' ---" +docker build ${options} "${docker_tags[@]}" $comp_path +BUILD_ENDTIME=$(date +%s); echo "--- ${version} took $(($BUILD_ENDTIME - $BUILD_STARTTIME)) seconds ---" echo echo echo echo echo "++ Active images" -docker images | grep ${prefix} | grep ${version} | sort +docker images | grep ${prefix} | sort echo -- cgit v1.2.1