Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix VRP image push #12715

Merged
merged 2 commits into from
Aug 19, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions ci/docker_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ IMAGES_TO_SAVE=()
build_images() {
TYPE=$1
BUILD_TAG=$2
BASE=$3

use_builder "${TYPE}"
ARGS="$(build_args ${TYPE})"
Expand All @@ -57,7 +56,11 @@ build_images() {
PLATFORM="$(build_platforms ${TYPE} | tr ',' ' ')"
# docker buildx load cannot have multiple platform, load individually
for ARCH in ${PLATFORM}; do
IMAGE_TAG="${BUILD_TAG}-${ARCH/linux\//}"
if [[ "${ARCH}" == "linux/amd64" ]]; then
IMAGE_TAG="${BUILD_TAG}"
else
IMAGE_TAG="${BUILD_TAG}-${ARCH/linux\//}"
fi
docker buildx build --platform "${ARCH}" -f ci/Dockerfile-envoy"${TYPE}" ${ARGS} -t "${IMAGE_TAG}" . --load
IMAGES_TO_SAVE+=("${IMAGE_TAG}")
done
Expand All @@ -66,12 +69,13 @@ build_images() {
push_images() {
TYPE=$1
BUILD_TAG=$2
BASE=$3

use_builder "${TYPE}"
ARGS="$(build_args ${TYPE})"
PLATFORM="$(build_platforms ${TYPE})"
docker buildx build --platform "${PLATFORM}" -f ci/Dockerfile-envoy"${TYPE}" ${ARGS} -t ${BUILD_TAG} . --push
# docker buildx doesn't do push with default builder
docker buildx build --platform "${PLATFORM}" -f ci/Dockerfile-envoy"${TYPE}" ${ARGS} -t ${BUILD_TAG} . --push || \
docker push "${BUILD_TAG}"
}

MASTER_BRANCH="refs/heads/master"
Expand Down Expand Up @@ -122,11 +126,11 @@ fi
docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD"

for BUILD_TYPE in "${BUILD_TYPES[@]}"; do
push_images "${BUILD_TYPE}" "${DOCKER_IMAGE_PREFIX}${BUILD_TYPE}${IMAGE_POSTFIX}:${IMAGE_NAME}" "${BASE_IMAGE}"
push_images "${BUILD_TYPE}" "${DOCKER_IMAGE_PREFIX}${BUILD_TYPE}${IMAGE_POSTFIX}:${IMAGE_NAME}"

# Only push latest on master builds.
if [[ "${AZP_BRANCH}" == "${MASTER_BRANCH}" ]]; then
push_images "${BUILD_TYPE}" "${DOCKER_IMAGE_PREFIX}${BUILD_TYPE}${IMAGE_POSTFIX}:latest" "${BASE_IMAGE}"
push_images "${BUILD_TYPE}" "${DOCKER_IMAGE_PREFIX}${BUILD_TYPE}${IMAGE_POSTFIX}:latest"
fi

# Push vX.Y-latest to tag the latest image in a release line
Expand Down