diff --git a/build/Dockerfile.k8s-cloud-builder b/build/Dockerfile.k8s-cloud-builder index 2b7f68bf20a..34c38c690ea 100644 --- a/build/Dockerfile.k8s-cloud-builder +++ b/build/Dockerfile.k8s-cloud-builder @@ -1,7 +1,7 @@ # To rebuild and publish this container run: # gcloud builds submit --config update_build_container.yaml . -FROM ubuntu +FROM ubuntu:16.04 # Install packages RUN apt-get -q update && apt-get install -qqy apt-transport-https \ @@ -47,7 +47,5 @@ RUN \ stable edge" && \ apt-get -y update -# As of 2018-04-10, leaving this pinned to 17.09 due to image pull issues -# with 17.12 -ARG DOCKER_VERSION=17.09.0~ce-0~ubuntu +ARG DOCKER_VERSION=18.06.0~ce~3-0~ubuntu RUN apt-get install -y docker-ce=${DOCKER_VERSION} unzip diff --git a/lib/releaselib.sh b/lib/releaselib.sh index ab144c65aad..f53ea165640 100644 --- a/lib/releaselib.sh +++ b/lib/releaselib.sh @@ -904,6 +904,7 @@ release::docker::release () { local -a new_tags local new_tag local binary + local -A manifest_images if [[ "$registry" == "$GCRIO_PATH_PROD" ]]; then # Switch to the push alias if using the $GCRIO_PATH_PROD alias @@ -924,28 +925,33 @@ release::docker::release () { fi binary=${BASH_REMATCH[1]} - # If amd64, tag both the legacy tag and -amd64 tag - if [[ "$arch" == "amd64" ]]; then - # binary may or may not already contain -amd64, so strip it first - new_tags=(\ - "$push_registry/${binary/-amd64/}:$version" - "$push_registry/${binary/-amd64/}-amd64:$version" - ) - else - new_tags=("$push_registry/$binary:$version") - fi + new_tag="$push_registry/${binary/-$arch/}" + new_tag_with_arch=("$new_tag-$arch:$version") + manifest_images["${new_tag}"]+=" $arch" logrun docker load -qi $tarfile - for new_tag in ${new_tags[@]}; do - logrun docker tag $orig_tag $new_tag - logecho -n "Pushing $new_tag: " - # TODO: Use docker direct when fixed later - #logrun -r 5 -s docker push "$new_tag" || return 1 - logrun -r 5 -s $GCLOUD docker -- push "$new_tag" || return 1 - done - logrun docker rmi $orig_tag ${new_tags[@]} || true + logrun docker tag $orig_tag ${new_tag_with_arch} + logecho -n "Pushing ${new_tag_with_arch}: " + # TODO: Use docker direct when fixed later + #logrun -r 5 -s docker push "${new_tag_with_arch}" || return 1 + logrun -r 5 -s $GCLOUD docker -- push "${new_tag_with_arch}" || return 1 + logrun docker rmi $orig_tag ${new_tag_with_arch} || true + + done + done + for image in "${!manifest_images[@]}"; do + local archs=$(echo "${manifest_images[$image]}" | sed -e 's/^[[:space:]]*//') + local manifest=$(echo $archs | sed -e "s~[^ ]*~$image\-&:$version~g") + # This command will push a manifest list: "${registry}/${image}-ARCH:${version}" that points to each architecture depending on which platform you're pulling from + logecho "Creating manifest image ${image}:${version}..." + logrun -r 5 -s docker manifest create --amend ${image}:${version} ${manifest} || return 1 + for arch in ${archs}; do + logecho "Annotating ${image}-${arch}:${version} with --arch ${arch}..." + logrun -r 5 -s docker manifest annotate --arch ${arch} ${image}:${version} ${image}-${arch}:${version} || return 1 done + logecho "Pushing manifest image ${image}:${version}..." + logrun -r 5 -s docker manifest push ${image}:${version} || return 1 done # Always reset back to $GCP_USER