This repository has been archived by the owner on Dec 3, 2024. It is now read-only.
generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 30
/
cloudbuild.yaml
39 lines (39 loc) · 2.08 KB
/
cloudbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# K8s infra build example: https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md
# GCloud build docs: https://cloud.google.com/cloud-build/docs/build-config
# Builds go to https://console.cloud.google.com/gcr/images/k8s-staging-sig-storage/GLOBAL
# Build logs in https://testgrid.k8s.io/sig-storage-image-build
timeout: 3000s
options:
substitution_option: 'ALLOW_LOOSE'
machineType: 'E2_HIGHCPU_8'
substitutions:
# K8s provides custom substitutions _GIT_TAG and _PULL_BASE_REF:
# https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md#custom-substitutions
_GIT_TAG: '12345' # e.g., vYYYYMMDD-hash, vYYYYMMDD-tag, or vYYYYMMDD-tag-n-ghash
_PULL_BASE_REF: 'master' # e.g., master or release-0.2 for a PR merge, or v0.2 for a tag
# COSI substitutions:
_IMAGE: objectstorage-sidecar
_PLATFORMS: linux/amd64,linux/arm64 # add more platforms here if desired
steps:
# based on k8s infra build example and modified to use docker buildx
# buildx refs: https://github.com/docker/buildx/blob/master/docs/reference/buildx.md
- id: set-up-multi-arch-builder-as-default
name: gcr.io/cloud-builders/docker
args: ["buildx", "create", "--use", "--name", "multi-arch", "--platform=${_PLATFORMS}"]
- id: bootstrap-multi-arch-builder
name: gcr.io/cloud-builders/docker
args: ["buildx", "inspect", "--bootstrap"]
- id: do-multi-arch-build
name: gcr.io/cloud-builders/docker
args:
- buildx
- build
- --push # --load doesn't work with multi-platform builds, so just push from docker build
- --platform=${_PLATFORMS}
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:${_GIT_TAG}
# using _PULL_BASE_REF as a tag will often just build and overwrite the same 'master' tag,
# BUT! if the commit has a git tag, it will build that tag instead. this mechanism allows
# creating the semver-tagged images that will be auto-promoted to release
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:${_PULL_BASE_REF}
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:latest
- .