|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2019 The Kubernetes Authors. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +set -euxo pipefail |
| 18 | + |
| 19 | +loudecho() { |
| 20 | + echo "###" |
| 21 | + echo "## ${1}" |
| 22 | + echo "#" |
| 23 | +} |
| 24 | + |
| 25 | +loudecho "Register gcloud as a Docker credential helper." |
| 26 | +# Required for "docker buildx build --push". |
| 27 | +# See https://github.com/kubernetes-csi/csi-release-tools/blob/master/prow.sh#L1243 |
| 28 | +gcloud auth configure-docker |
| 29 | + |
| 30 | +loudecho "Set up Docker Buildx" |
| 31 | +# See https://github.com/docker/setup-buildx-action |
| 32 | +# and https://github.com/kubernetes-csi/csi-release-tools/blob/master/build.make#L132 |
| 33 | +DOCKER_CLI_EXPERIMENTAL=enabled |
| 34 | +export DOCKER_CLI_EXPERIMENTAL |
| 35 | +trap "docker buildx rm multiarchimage-buildertest" EXIT |
| 36 | +docker buildx create --use --name multiarchimage-buildertest |
| 37 | + |
| 38 | +loudecho "Set up QEMU" |
| 39 | +# See https://github.com/docker/setup-qemu-action |
| 40 | +docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
| 41 | + |
| 42 | +loudecho "Build and push debian target" |
| 43 | +docker buildx build \ |
| 44 | + --tag="${REGISTRY_NAME}"/aws-ebs-csi-driver:"${GIT_TAG}" \ |
| 45 | + --tag="${REGISTRY_NAME}"/aws-ebs-csi-driver:latest \ |
| 46 | + --platform=linux/arm64,linux/amd64 \ |
| 47 | + --progress=plain \ |
| 48 | + --push=true \ |
| 49 | + --target=debian-base \ |
| 50 | + . |
| 51 | + |
| 52 | +loudecho "Build and push amazonlinux target" |
| 53 | +docker buildx build \ |
| 54 | + --tag="${REGISTRY_NAME}"/aws-ebs-csi-driver:"${GIT_TAG}"-amazonlinux \ |
| 55 | + --tag="${REGISTRY_NAME}"/aws-ebs-csi-driver:latest-amazonlinux \ |
| 56 | + --platform=linux/arm64,linux/amd64 \ |
| 57 | + --progress=plain \ |
| 58 | + --push=true \ |
| 59 | + --target=amazonlinux \ |
| 60 | + . |
0 commit comments