Skip to content

Conversation

@Devansh-ops
Copy link

Changes

How to publish multi-arch images (same pattern as root)

  • Prereqs: docker buildx available and logged into quay.io.
  • Version tag: make -C backup/pvc docker-buildx IMG=quay.io/jenkins-kubernetes-operator/backup-pvc:v0.4.4
  • Latest tag: make -C backup/pvc docker-buildx IMG=quay.io/jenkins-kubernetes-operator/backup-pvc:latest

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Introduce PLATFORMS default (arm64, amd64, s390x, ppc64le) and a
docker-buildx target to build and push multi-arch images (IMG=...).
The target generates a Dockerfile.cross with platform support, creates
and uses a buildx builder, passes UID/GID build args, and cleans up.
Mirrors the root Makefile to enable cross-arch image builds.

Fixes jenkinsci#1124
Update VERSION.txt and the Helm chart (README, values.yaml) to use
quay.io/jenkins-kubernetes-operator/backup-pvc:v0.4.4 so docs and defaults
match the new release.

bumping the version as part of fixing jenkinsci#1124 based on comment
jenkinsci#1124 (comment)
@Devansh-ops Devansh-ops marked this pull request as ready for review October 7, 2025 17:58
.PHONY: docker-buildx
docker-buildx: check-env ## Build and push multi-arch image (set IMG=quay.io/...:tag)
@echo "+ $@"
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need of doing this, take a look on how we do the whole flow in the root project makefile:

.PHONY: container-runtime-build-%
container-runtime-build-%: ## Build the container
@echo "+ $@"
$(CONTAINER_RUNTIME_COMMAND) buildx build \
--output=type=docker --platform linux/$* \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg CTIMEVAR="$(CTIMEVAR)" \
--tag quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY):$(GITCOMMIT)-$* . \
--file Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS)
.PHONY: container-runtime-build
container-runtime-build: check-env deepcopy-gen container-runtime-build-amd64 container-runtime-build-arm64
.PHONY: container-runtime-images
container-runtime-images: ## List all local containers
@echo "+ $@"
$(CONTAINER_RUNTIME_COMMAND) images $(CONTAINER_RUNTIME_EXTRA_ARGS)
define buildx-create-command
$(CONTAINER_RUNTIME_COMMAND) buildx create \
--driver=docker-container \
--use
endef
## Parameter is version
define container-runtime-push-command
$(CONTAINER_RUNTIME_COMMAND) buildx build \
--output=type=registry --platform linux/amd64,linux/arm64 \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg CTIMEVAR="$(CTIMEVAR)" \
--tag quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY):$(1) . \
--file Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS)
endef
.PHONY: container-runtime-push
container-runtime-push: check-env deepcopy-gen ## Push the container
@echo "+ $@"
$(call buildx-create-command)
$(call container-runtime-push-command,$(BUILD_TAG))
.PHONY: container-runtime-snapshot-push
container-runtime-snapshot-push: check-env deepcopy-gen
@echo "+ $@"
$(call buildx-create-command)
$(call container-runtime-push-command,$(GITCOMMIT))
.PHONY: container-runtime-release-version
container-runtime-release-version: check-env deepcopy-gen ## Release image with version tag (in addition to build tag)
@echo "+ $@"
$(call buildx-create-command)
$(call container-runtime-push-command,$(VERSION_TAG))
.PHONY: container-runtime-release-latest
container-runtime-release-latest: check-env deepcopy-gen ## Release image with latest tags (in addition to build tag)
@echo "+ $@"
$(call buildx-create-command)
$(call container-runtime-push-command,$(LATEST_TAG))
.PHONY: container-runtime-release
container-runtime-release: container-runtime-release-version container-runtime-release-latest ## Release image with version and latest tags (in addition to build tag)
@echo "+ $@"

also in this file we already have a docker-* commands, let's resume those, ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants