Skip to content

Commit d451e4c

Browse files
streamline the CCM image build process (#2240)
Signed-off-by: Prajyot-Parab <[email protected]>
1 parent 1656309 commit d451e4c

File tree

3 files changed

+12
-32
lines changed

3 files changed

+12
-32
lines changed

hack/ccm/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
ARG TARGETPLATFORM=linux/amd64
18-
ARG ARCH=amd64
17+
ARG TARGETARCH
1918

2019
# Build IBM cloud controller manager binary
2120
ARG golang_image

hack/ccm/Makefile

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,15 @@ IMG=powervs-cloud-controller-manager
2323
POWERVS_CLOUD_CONTROLLER_COMMIT?=6256ccf
2424
TAG?=$(POWERVS_CLOUD_CONTROLLER_COMMIT)
2525

26-
build-image-linux-amd64: init-buildx
26+
build-image: init-buildx
2727
{ \
28-
set -e ; \
29-
docker buildx build \
30-
--build-arg golang_image=$(GO_CONTAINER_IMAGE) \
31-
--build-arg TARGETPLATFORM=linux/amd64 --build-arg ARCH=amd64 \
32-
--build-arg POWERVS_CLOUD_CONTROLLER_COMMIT=$(POWERVS_CLOUD_CONTROLLER_COMMIT) \
33-
-t $(REGISTRY)/$(IMG):$(TAG)_linux_amd64 . --load --target centos-base; \
34-
}
35-
36-
build-image-linux-ppc64le: init-buildx
37-
{ \
38-
set -e ; \
39-
docker buildx build \
40-
--build-arg golang_image=$(GO_CONTAINER_IMAGE) \
41-
--build-arg TARGETPLATFORM=linux/ppc64le --build-arg ARCH=ppc64le \
42-
--build-arg POWERVS_CLOUD_CONTROLLER_COMMIT=$(POWERVS_CLOUD_CONTROLLER_COMMIT) \
43-
-t $(REGISTRY)/$(IMG):$(TAG)_linux_ppc64le . --load --target centos-base; \
44-
}
45-
46-
build-image-and-push-linux-amd64: build-image-linux-amd64
47-
docker push $(REGISTRY)/$(IMG):$(TAG)_linux_amd64
48-
49-
build-image-and-push-linux-ppc64le: build-image-linux-ppc64le
50-
docker push $(REGISTRY)/$(IMG):$(TAG)_linux_ppc64le
28+
set -e ; \
29+
docker buildx build \
30+
--platform=linux/amd64,linux/ppc64le --pull \
31+
--build-arg golang_image=$(GO_CONTAINER_IMAGE) \
32+
--build-arg POWERVS_CLOUD_CONTROLLER_COMMIT=$(POWERVS_CLOUD_CONTROLLER_COMMIT) \
33+
-t $(REGISTRY)/$(IMG):$(TAG) . --push --target centos-base; \
34+
}
5135

5236
init-buildx:
5337
# Ensure we use a builder that can leverage it (the default on linux will not)
@@ -57,8 +41,3 @@ init-buildx:
5741
# Register gcloud as a Docker credential helper.
5842
# Required for "docker buildx build --push".
5943
gcloud auth configure-docker --quiet
60-
61-
62-
build-and-push-multi-arch: build-image-and-push-linux-amd64 build-image-and-push-linux-ppc64le
63-
docker manifest create --amend $(REGISTRY)/$(IMG):$(TAG) $(REGISTRY)/$(IMG):$(TAG)_linux_amd64 $(REGISTRY)/$(IMG):$(TAG)_linux_ppc64le
64-
docker manifest push $(REGISTRY)/$(IMG):$(TAG)

hack/ccm/cloudbuild.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
timeout: 3000s
33
options:
44
substitution_option: ALLOW_LOOSE
5+
machineType: 'E2_HIGHCPU_8'
56
steps:
67
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20241111-71c32dbdcc'
78
dir: 'hack/ccm'
89
entrypoint: make
910
env:
1011
- PULL_BASE_REF=${_PULL_BASE_REF}
1112
- HOME=/root
13+
- DOCKER_BUILDKIT=1
1214
args:
13-
- build-and-push-multi-arch
15+
- build-image
1416
substitutions:
1517
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
1618
# can be used as a substitution

0 commit comments

Comments
 (0)