Skip to content

Commit 213ea34

Browse files
authored
Merge pull request #670 from wongma7/release-0.8-cloudbuild
release-0.8: Use buildx in cloudbuild
2 parents ac47252 + 0f151f6 commit 213ea34

File tree

2 files changed

+69
-19
lines changed

2 files changed

+69
-19
lines changed

cloudbuild.yaml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
timeout: 1200s
22
steps:
3-
- name: gcr.io/cloud-builders/docker
4-
args:
5-
- build
6-
- --tag=gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver:$_GIT_TAG
7-
- --tag=gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver:latest
8-
- --target=debian-base
9-
- .
10-
- name: gcr.io/cloud-builders/docker
11-
args:
12-
- build
13-
- --tag=gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver:$_GIT_TAG-amazonlinux
14-
- --tag=gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver:latest-amazonlinux
15-
- --target=amazonlinux
16-
- .
17-
images:
18-
- "gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver:$_GIT_TAG"
19-
- "gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver:latest"
20-
- "gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver:$_GIT_TAG-amazonlinux"
21-
- "gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver:latest-amazonlinux"
3+
- name: gcr.io/k8s-testimages/gcb-docker-gcloud:v20200421-a2bf5f8
4+
entrypoint: ./hack/prow.sh
5+
env:
6+
- GIT_TAG=${_GIT_TAG}
7+
- PULL_BASE_REF=${_PULL_BASE_REF}
8+
- REGISTRY_NAME=gcr.io/${_STAGING_PROJECT}
9+
- HOME=/root
10+
substitutions:
11+
_STAGING_PROJECT: "k8s-staging-provider-aws"

hack/prow.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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

Comments
 (0)