Skip to content

Commit d82cd7b

Browse files
farazmdBizerNotNull
authored andcommitted
fix CI timeout issue with multi arch builds (kubernetes-sigs#2572)
1 parent dd277e2 commit d82cd7b

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ ARG BUILDER_IMAGE=golang:1.25
44
ARG BASE_IMAGE=gcr.io/distroless/static:nonroot
55

66
## Multistage build
7-
FROM ${BUILDER_IMAGE} AS builder
7+
FROM --platform=${BUILDPLATFORM} ${BUILDER_IMAGE} AS builder
8+
ARG TARGETARCH
89
ENV CGO_ENABLED=0
910
ENV GOOS=linux
10-
ENV GOARCH=amd64
11+
ENV GOARCH=${TARGETARCH}
1112
ARG COMMIT_SHA=unknown
1213
ARG BUILD_REF
1314

bbr.Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ ARG BUILDER_IMAGE=golang:1.25
44
ARG BASE_IMAGE=gcr.io/distroless/static:nonroot
55

66
## Multistage build
7-
FROM ${BUILDER_IMAGE} AS builder
7+
FROM --platform=${BUILDPLATFORM} ${BUILDER_IMAGE} AS builder
8+
ARG TARGETARCH
89
ENV CGO_ENABLED=0
910
ENV GOOS=linux
10-
ENV GOARCH=amd64
11+
ENV GOARCH=${TARGETARCH}
1112
ARG COMMIT_SHA=unknown
1213
ARG BUILD_REF
1314

cloudbuild.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ steps:
1313
- EXTRA_TAG=$_PULL_BASE_REF
1414
- DOCKER_BUILDX_CMD=/buildx-entrypoint
1515
- GIT_COMMIT_SHA=$_PULL_BASE_SHA
16+
- PLATFORMS=linux/amd64,linux/arm64
1617
- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240718-5ef92b5c36
1718
entrypoint: make
1819
args:
@@ -21,6 +22,7 @@ steps:
2122
- GIT_TAG=$_GIT_TAG
2223
- EXTRA_TAG=$_PULL_BASE_REF
2324
- DOCKER_BUILDX_CMD=/buildx-entrypoint
25+
- PLATFORMS=linux/amd64,linux/arm64
2426
- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240718-5ef92b5c36
2527
entrypoint: make
2628
args:
@@ -38,6 +40,7 @@ steps:
3840
- GIT_TAG=$_GIT_TAG
3941
- EXTRA_TAG=$_PULL_BASE_REF
4042
- DOCKER_BUILDX_CMD=/buildx-entrypoint
43+
- PLATFORMS=linux/amd64,linux/arm64
4144
- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240718-5ef92b5c36
4245
entrypoint: make
4346
args:
@@ -48,6 +51,7 @@ steps:
4851
- GIT_TAG=$_GIT_TAG
4952
- EXTRA_TAG=$_PULL_BASE_REF
5053
- DOCKER_BUILDX_CMD=/buildx-entrypoint
54+
- PLATFORMS=linux/amd64,linux/arm64
5155
substitutions:
5256
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
5357
# can be used as a substitution

0 commit comments

Comments
 (0)