Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit 25cd40b

Browse files
authored
Merge pull request #85 from BlaineEXE/cloudbuild-create-multiarch-builder-for-use
set up cloudbuild multi-arch builder before use
2 parents 6c05a79 + 90227d2 commit 25cd40b

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

Diff for: cloudbuild.yaml

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# K8s infra build example: https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md
12
# GCloud build docs: https://cloud.google.com/cloud-build/docs/build-config
23
# Builds go to https://console.cloud.google.com/gcr/images/k8s-staging-test-infra/global/
34
# Build logs in https://testgrid.k8s.io/sig-storage-image-build
@@ -6,29 +7,36 @@ options:
67
substitution_option: 'ALLOW_LOOSE'
78
machineType: 'E2_HIGHCPU_8'
89
substitutions:
9-
# GCloud provides som built-in substitution vars:
10-
# https://cloud.google.com/build/docs/configuring-builds/substitute-variable-values
1110
# K8s provides custom substitutions _GIT_TAG and _PULL_BASE_REF:
1211
# https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md#custom-substitutions
1312
_GIT_TAG: '12345' # e.g., vYYYYMMDD-hash, vYYYYMMDD-tag, or vYYYYMMDD-tag-n-ghash
1413
_PULL_BASE_REF: 'master' # e.g., master or release-0.2 for a PR merge, or v0.2 for a tag
14+
# COSI substitutions:
15+
_IMAGE: objectstorage-controller
16+
_PLATFORMS: linux/amd64,linux/arm64 # add more platforms here if desired
1517
steps:
16-
# based on simple build example
17-
# https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md
18-
- name: gcr.io/cloud-builders/docker
19-
# entrypoint: # docker by default
18+
# based on k8s infra build example and modified to use docker buildx
19+
# buildx refs: https://github.com/docker/buildx/blob/master/docs/reference/buildx.md
20+
- id: set-up-multi-arch-builder-as-default
21+
name: gcr.io/cloud-builders/docker
22+
args: ["buildx", "create", "--use", "--name", "multi-arch", "--platform=${_PLATFORMS}"]
23+
- id: bootstrap-multi-arch-builder
24+
name: gcr.io/cloud-builders/docker
25+
args: ["buildx", "inspect", "--bootstrap"]
26+
- id: do-multi-arch-build
27+
name: gcr.io/cloud-builders/docker
2028
args:
2129
- buildx
2230
- build
23-
- --platform=linux/amd64,linux/arm64
24-
- --tag=gcr.io/k8s-staging-sig-storage/objectstorage-controller:${_GIT_TAG}
31+
- --platform=${_PLATFORMS}
32+
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:${_GIT_TAG}
2533
# using _PULL_BASE_REF as a tag will often just build and overwrite the same 'master' tag,
2634
# BUT! if the commit has a git tag, it will build that tag instead. this mechanism allows
2735
# creating the semver-tagged images that will be auto-promoted to release
28-
- --tag=gcr.io/k8s-staging-sig-storage/objectstorage-controller:${_PULL_BASE_REF}
29-
- --tag=gcr.io/k8s-staging-sig-storage/objectstorage-controller:latest
36+
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:${_PULL_BASE_REF}
37+
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:latest
3038
- .
3139
images:
32-
- gcr.io/k8s-staging-sig-storage/objectstorage-controller:${_GIT_TAG}
33-
- gcr.io/k8s-staging-sig-storage/objectstorage-controller:${_PULL_BASE_REF}
34-
- gcr.io/k8s-staging-sig-storage/objectstorage-controller:latest
40+
- gcr.io/k8s-staging-sig-storage/${_IMAGE}:${_GIT_TAG}
41+
- gcr.io/k8s-staging-sig-storage/${_IMAGE}:${_PULL_BASE_REF}
42+
- gcr.io/k8s-staging-sig-storage/${_IMAGE}:latest

0 commit comments

Comments
 (0)