Skip to content

Commit

Permalink
don't push manifest by default on oci-buildx
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Aug 15, 2023
1 parent 50f402d commit c4e2193
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build operator image
run: SKIP_TESTS=true make oci-build
run: |
SKIP_TESTS=true PLATFORMS=linux/amd64,linux/arm64 MANIFEST_PUSH=true make oci-buildx
- name: Tag image
id: tag-image
run: |
Expand Down
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -275,23 +275,26 @@ oci-build: manifests generate fmt vet test-envtest
# - install qemu-user-static.
# To properly provided solutions that supports more than one platform you should use this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
MANIFEST_PUSH ?= false
.PHONY: oci-buildx
oci-buildx: manifests generate fmt vet test-envtest ## Build OCI image for the manager for cross-platform support
ifeq ($(IMAGE_BUILDER), docker)
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder
docker buildx use project-v3-builder
- docker buildx build --push --platform=$(PLATFORMS) --tag $(OPERATOR_IMG) -f Dockerfile.cross .
- docker buildx rm project-v3-builder
- $(IMAGE_BUILDER) buildx create --name project-v3-builder
$(IMAGE_BUILDER) buildx use project-v3-builder
- $(IMAGE_BUILDER) buildx build --push --platform=$(PLATFORMS) --tag $(OPERATOR_IMG) -f Dockerfile.cross .
- $(IMAGE_BUILDER) buildx rm project-v3-builder
rm Dockerfile.cross
else ifeq ($(IMAGE_BUILDER), podman)
for platform in $$(echo $(PLATFORMS) | sed "s/,/ /g"); do \
os=$$(echo $${platform} | cut -d/ -f 1); \
arch=$$(echo $${platform} | cut -d/ -f 2); \
BUILDAH_FORMAT=docker podman buildx build --manifest $(OPERATOR_IMG) --platform $${platform} --build-arg TARGETOS=$${os} --build-arg TARGETARCH=$${arch} . ; \
BUILDAH_FORMAT=docker $(IMAGE_BUILDER) buildx build --manifest $(OPERATOR_IMG) --platform $${platform} --build-arg TARGETOS=$${os} --build-arg TARGETARCH=$${arch} . ; \
done
podman manifest push $(OPERATOR_IMG) $(OPERATOR_IMG)
if [ "${MANIFEST_PUSH}" = "true" ] ; then \
$(IMAGE_BUILDER) manifest push $(OPERATOR_IMG) $(OPERATOR_IMG) ; \
fi
else
$(error unsupported IMAGE_BUILDER: $(IMAGE_BUILDER))
endif
Expand Down

0 comments on commit c4e2193

Please sign in to comment.