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

Commit 0a9dc4d

Browse files
committed
use buildx from cloudbuild directly
It is simpler and likely easier to maintain to have the cloudbuild use `docker buildx build ...` directly rather than to rely on a make target. This makes the build tooling more transparent with fewer layers between the build config and the Dockerfile. Signed-off-by: Blaine Gardner <[email protected]>
1 parent ea45f32 commit 0a9dc4d

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

Diff for: container-object-storage-interface-controller/Makefile

+1-9
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ PLATFORM ?= linux/$(GOARCH)
1717
BUILDX_PLATFORMS ?= linux/amd64,linux/arm64
1818

1919
## Image tag for all builds
20-
IMAGE_TAG ?= local/cosi-controller:latest
21-
22-
## Add additional build args if desired
23-
BUILD_ARGS ?=
20+
IMAGE_TAG ?= cosi-controller:latest
2421

2522
##
2623
## === TARGETS === #
@@ -31,11 +28,6 @@ build:
3128
# $(DOCKER) build --platform $(PLATFORM) --tag $(IMAGE_TAG) .
3229
true # return true temporarily to allow prow to succeed
3330

34-
.PHONY: buildx
35-
## Build cross-platform image for release
36-
buildx:
37-
$(DOCKER) buildx build --platform $(BUILDX_PLATFORMS) $(BUILD_ARGS) --tag $(IMAGE_TAG) .
38-
3931
.PHONY: test
4032
## Test packages
4133
test:
+14-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# GCloud build docs: https://cloud.google.com/cloud-build/docs/build-config
2-
# Build console:
3-
# https://console.cloud.google.com/gcr/images/k8s-staging-test-infra/global/objectstorage-controller
2+
# Builds go to: https://console.cloud.google.com/gcr/images/k8s-staging-test-infra/global/
43
timeout: 3000s
54
options:
65
substitution_option: 'ALLOW_LOOSE'
@@ -10,19 +9,20 @@ substitutions:
109
# 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
13-
_GIT_TAG: '12345'
14-
_PULL_BASE_REF: 'master'
12+
_GIT_TAG: '12345' # e.g., vYYYYMMDD-hash, vYYYYMMDD-tag, or vYYYYMMDD-tag-n-ghash
13+
_PULL_BASE_REF: 'master' # e.g., master or release-0.2 for a PR merge, or v0.2 for a tag
1514
steps:
16-
# it is extremely unclear in GCR docs whether standard gcr.io/cloud-builders/docker builds allow
17-
# building multi-arch image manifests as 'docker buildx build' does; therefore, use make buildx
18-
# target to be certain multi-arch images are released
19-
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20230522-312425ae46'
20-
entrypoint: make
21-
args: ['buildx']
22-
env:
23-
- BUILDX_PLATFORMS='linux/amd64,linux/arm64'
24-
- IMAGE_TAG='gcr.io/k8s-staging-sig-storage/objectstorage-controller:${_GIT_TAG}'
25-
- BUILD_ARGS='--tag "gcr.io/k8s-staging-sig-storage/objectstorage-controller:latest"'
15+
# based on simple build example
16+
# https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md
17+
- name: gcr.io/cloud-builders/docker
18+
# entrypoint: # docker by default
19+
args:
20+
- buildx
21+
- build
22+
- --platform="linux/amd64,linux/arm64"
23+
- --tag=gcr.io/k8s-staging-sig-storage/objectstorage-controller:${_GIT_TAG}
24+
- --tag=gcr.io/k8s-staging-sig-storage/objectstorage-controller:latest
25+
- .
2626
images:
2727
- gcr.io/k8s-staging-sig-storage/objectstorage-controller:${_GIT_TAG}
2828
- gcr.io/k8s-staging-sig-storage/objectstorage-controller:latest

0 commit comments

Comments
 (0)