Skip to content

Pin calico/base to release tags #9867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ endif
python:3 \
bash -c '/usr/local/bin/python release/get-contributors.py >> /code/AUTHORS.md'

update-pins: update-go-build-pin
update-pins: update-go-build-pin update-calico-base-pin
Copy link
Contributor Author

@hjiawei hjiawei Feb 19, 2025

Choose a reason for hiding this comment

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

Normally, we update calico/base together with calico/go-build before each release. This update-pins target will be triggered once we have a new calico/go-build release. Both calico/go-build and calico/base versions will be updated to the latest.


###############################################################################
# Post-release validation
Expand Down
28 changes: 24 additions & 4 deletions lib.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ ifeq ($(BUILDARCH),amd64)
# *-amd64 tagged images for etcd are not available until v3.5.0
ETCD_IMAGE = quay.io/coreos/etcd:$(ETCD_VERSION)
endif
UBI_IMAGE ?= registry.access.redhat.com/ubi8/ubi-minimal:$(UBI_VERSION)
UBI_IMAGE ?= registry.access.redhat.com/ubi8/ubi-minimal:latest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do microdnf upgrade when building the container image. It essentially moves the tag to latest. We are not really pinning to the UBI_VERSION defined in metadata.mk.


ifeq ($(GIT_USE_SSH),true)
GIT_CONFIG_SSH ?= git config --global url."ssh://git@github.com/".insteadOf "https://github.com/";
Expand Down Expand Up @@ -265,7 +265,7 @@ CERTS_PATH := $(REPO_ROOT)/hack/test/certs
ifdef USE_UBI_AS_CALICO_BASE
CALICO_BASE ?= $(UBI_IMAGE)
else
CALICO_BASE ?= calico/base
CALICO_BASE ?= calico/base:$(CALICO_BASE_VER)
endif

ifndef NO_DOCKER_PULL
Expand Down Expand Up @@ -355,12 +355,12 @@ define get_go_build_version
$(shell git ls-remote --tags --refs --sort=-version:refname $(GO_BUILD_REPO) | head -n 1 | awk -F '/' '{print $$NF}')
endef

# update_go_build updates the GO_BUILD_VER in metadata.mk or Makefile.
# update_go_build_pin updates the GO_BUILD_VER in metadata.mk or Makefile.
# for annotated git tags, we need to remove the trailing `^{}`.
# for the obsoleted vx.y go-build version, we need to remove the leading `v` for bash string comparison to work properly.
define update_go_build_pin
$(eval new_ver := $(subst ^{},,$(call get_go_build_version)))
$(eval old_ver := $(subst v,,$(shell grep -E "^GO_BUILD_VER" $(1) | cut -d'=' -f2 | xargs)))
$(eval old_ver := $(shell grep -E "^GO_BUILD_VER" $(1) | cut -d'=' -f2 | xargs | sed 's/^v//'))

@echo "current GO_BUILD_VER=$(old_ver)"
@echo "latest GO_BUILD_VER=$(new_ver)"
Expand All @@ -374,6 +374,23 @@ define update_go_build_pin
fi'
endef

# update_calico_base_pin updates the CALICO_BASE_VER in metadata.mk.
define update_calico_base_pin
$(eval new_ver := $(shell curl -s "https://hub.docker.com/v2/repositories/calico/base/tags/?page_size=100" | jq -r '.results[].name' | grep -E "^ubi8-[0-9]+$$" | sort -r | head -n 1))
$(eval old_ver := $(shell grep -E "^CALICO_BASE_VER" $(1) | cut -d'=' -f2 | xargs))

@echo "current CALICO_BASE_VER=$(old_ver)"
@echo "latest CALICO_BASE_VER=$(new_ver)"

bash -c '\
if [[ "$(new_ver)" > "$(old_ver)" ]]; then \
Copy link
Member

Choose a reason for hiding this comment

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

today I learned that this "just works" for strings

sed -i "s/^CALICO_BASE_VER[[:space:]]*=.*/CALICO_BASE_VER=$(new_ver)/" $(1); \
echo "CALICO_BASE_VER is updated to $(new_ver)"; \
else \
echo "no need to update CALICO_BASE_VER"; \
fi'
endef

GIT_REMOTE?=origin
API_BRANCH?=$(PIN_BRANCH)
API_REPO?=github.com/projectcalico/calico/api
Expand Down Expand Up @@ -433,6 +450,9 @@ replace-cni-pin:
update-go-build-pin:
$(call update_go_build_pin,$(GIT_GO_BUILD_UPDATE_COMMIT_FILE))

update-calico-base-pin:
$(call update_calico_base_pin,$(GIT_GO_BUILD_UPDATE_COMMIT_FILE))

git-status:
git status --porcelain

Expand Down
6 changes: 3 additions & 3 deletions metadata.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# This file contains Makefile configuration parameters and metadata for this branch.
#################################################################################################

# The version of github.com/projectcalico/go-build to use.
# The version of calico/go-build and calico/base to use.
GO_BUILD_VER=1.24.0-llvm18.1.8-k8s1.31.5-2
CALICO_BASE_VER=ubi8-1739912267

# Env var to ACK Ginkgo deprecation warnings, may need updating with go-build.
ACK_GINKGO=ACK_GINKGO_DEPRECATIONS=1.16.5

Expand All @@ -17,8 +19,6 @@ GHR_VERSION=v0.17.0
HELM_VERSION=v3.11.3
KINDEST_NODE_VERSION=v1.31.4
KIND_VERSION=v0.25.0
PROTOC_VER=v0.1
UBI_VERSION=8.10

# Configuration for Semaphore/Github integration. This needs to be set
# differently for a forked repo.
Expand Down