Skip to content

Conversation

@hjiawei
Copy link
Collaborator

@hjiawei hjiawei commented Dec 5, 2025

Pick #745 into the go1.25 release branch.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for UBI10 (Universal Base Image 10) to the calico/base images by refactoring the build process to handle multiple UBI versions through parameterization rather than separate build targets.

Key changes:

  • Parameterized the main Dockerfile to accept a UBI_VERSION build argument for flexible UBI version selection
  • Refactored the Makefile to use a pattern rule that dynamically builds images for ubi8, ubi9, and ubi10
  • Simplified the CD process by using a loop over UBI versions instead of hardcoded commands

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
images/calico-base/Dockerfile Added UBI_VERSION ARG and parameterized the base image reference to support multiple UBI versions
images/Makefile Refactored build targets to use pattern rules and loops for building/pushing multiple UBI versions (ubi8, ubi9, ubi10)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.PHONY: calico-base-image-%
calico-base-image-%: register
$(eval DOCKERFILE := $(if $(filter ubi8,$*),Dockerfile.ubi8,Dockerfile))
$(DOCKER_BUILD) --build-arg LDSONAME=$(LDSONAME) --build-arg=UBI_VERSION=$* -t $(CALICO_BASE):$*-latest-$(ARCH) -f calico-base/$(DOCKERFILE) calico-base/
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The build argument UBI_VERSION=$* is being passed for all UBI versions, including ubi8. However, Dockerfile.ubi8 doesn't declare an ARG UBI_VERSION parameter, which means this build argument will be ignored for ubi8 builds. While this won't cause a build failure, it creates an inconsistency in the build arguments between different UBI versions.

Consider either:

  1. Adding ARG UBI_VERSION to Dockerfile.ubi8 (even if unused), or
  2. Conditionally passing the UBI_VERSION build arg only for ubi9 and ubi10
Suggested change
$(DOCKER_BUILD) --build-arg LDSONAME=$(LDSONAME) --build-arg=UBI_VERSION=$* -t $(CALICO_BASE):$*-latest-$(ARCH) -f calico-base/$(DOCKERFILE) calico-base/
$(if $(filter ubi8,$*), \
$(DOCKER_BUILD) --build-arg LDSONAME=$(LDSONAME) -t $(CALICO_BASE):$*-latest-$(ARCH) -f calico-base/$(DOCKERFILE) calico-base/, \
$(DOCKER_BUILD) --build-arg LDSONAME=$(LDSONAME) --build-arg=UBI_VERSION=$* -t $(CALICO_BASE):$*-latest-$(ARCH) -f calico-base/$(DOCKERFILE) calico-base/ \
)

Copilot uses AI. Check for mistakes.
@hjiawei hjiawei requested a review from tianfeng92 December 8, 2025 18:30
@hjiawei hjiawei merged commit d21cb65 into go1.25 Dec 8, 2025
11 checks passed
@hjiawei hjiawei deleted the ubi10-base-go1.25 branch December 8, 2025 18:32
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