Skip to content

feat: pin func-utils image to a per-release-branch tag - #3994

Draft
gauron99 wants to merge 1 commit into
knative:mainfrom
gauron99:pin-func-utils-per-release
Draft

feat: pin func-utils image to a per-release-branch tag#3994
gauron99 wants to merge 1 commit into
knative:mainfrom
gauron99:pin-func-utils-per-release

Conversation

@gauron99

@gauron99 gauron99 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

proposal: pin func-utils img per release so that atleast per branch we have a more stable func-utils so we are not constantly breaking older functions because of the dynamic tag we currently have everywhere

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@knative-prow

knative-prow Bot commented Aug 6, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow Bot added do-not-merge/work-in-progress 🤖 PR should not merge because it is a work in progress. approved 🤖 PR has been approved by an approver from all required OWNERS files. labels Aug 6, 2026
@knative-prow
knative-prow Bot requested review from dsimansk and jrangelramos August 6, 2026 20:57
@knative-prow knative-prow Bot added the size/L 🤖 PR changes 100-499 lines, ignoring generated files. label Aug 6, 2026
@gauron99

Copy link
Copy Markdown
Contributor Author

@matejvasek @lkingland WDYT?

@gauron99
gauron99 requested review from lkingland and matejvasek and removed request for dsimansk and jrangelramos August 30, 2026 19:08
@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label Aug 31, 2026
@knative-prow

knative-prow Bot commented Aug 31, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauron99, lkingland

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The current release-branch detection in the Makefile can fall back to v2 in detached-HEAD CI checkouts, undermining the intended per-branch pinning behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR makes func embed a more stable func-utils image tag per release branch/minor version to avoid older released CLIs being broken by changes published under a floating tag.

Changes:

  • Derive FUNC_UTILS_IMG from either an exact release KVER or a release-X.Y branch, otherwise defaulting to v2.
  • Align local e2e image publishing (hack/images.sh) with the embedded image tag via a new make func-utils-image helper.
  • Update docs and CI so func-utils images are published as v2 on main and X.Y on release-X.Y branches.
File summaries
File Description
Makefile Derives and embeds a per-release-branch/per-minor func-utils image tag; adds func-utils-image helper target.
hack/images.sh Publishes locally built func-utils images using the same tag embedded into the built func binary.
docs/README.md Adds documentation link for the func-utils image policy.
docs/func-utils-image.md Documents tag scheme and compatibility policy for func-utils.
.github/workflows/functions.yaml Publishes func-utils as v2 on main and X.Y on release-X.Y, including manual dispatch support.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Makefile
Comment on lines +55 to +62
FUNC_UTILS_TAG := $(shell \
if echo "$(KVER)" | grep -qE '^(knative-)?v[0-9]+\.[0-9]+\.[0-9]+$$'; then \
echo "$(KVER)" | sed -E 's/^(knative-)?v([0-9]+\.[0-9]+)\.[0-9]+$$/\2/'; \
elif git branch --show-current 2>/dev/null | grep -qE '^release-[0-9]+\.[0-9]+$$'; then \
git branch --show-current | sed -e 's/^release-//'; \
else \
echo v2; \
fi)
@matejvasek

Copy link
Copy Markdown
Contributor

Automated Code Review

🤖 This review was generated by Claude Code (AI). Treat findings as suggestions to verify, not verdicts.

This PR pins the func-utils image to a per-release-branch tag. It's well-constructed — the findings below are mostly low-severity robustness/consistency issues.

Findings

1. Broad release-branch gate vs. strict tag regex.github/workflows/functions.yaml
The job-level if accepts any refs/heads/release-* ref, but the "Derive Image Tag" step only accepts ^release-([0-9]+\.[0-9]+)$ and exit 1s otherwise. A push to release-1.24.0, release-v1.24, or release-next passes the gate, runs the full build + e2e, then hard-fails at derive — turning the workflow red instead of cleanly skipping.

2. Detached-HEAD fallback yields floating v2Makefile
Release-tag pinning falls back to git branch --show-current, which is empty in detached-HEAD checkouts (git worktree, SHA checkout, Prow's non-TAG_RELEASE path). This silently embeds ghcr.io/knative/func-utils:v2 into a release-branch binary, defeating the pin. Official releases are safe only because release.sh passes an exact KVER.

3. workflow_dispatch republishes utils but skips CLI image.github/workflows/functions.yaml
publish-image (ko func CLI image) gates on push && main only, while build and publish-utils-image also allow workflow_dispatch. A manual dispatch on main republishes the utils image but silently skips the CLI image.

4. FUNC_UTILS_IMG repo-path override breaks mirror mappinghack/images.sh
images.sh reuses only the tag from make func-utils-image and hardcodes registry.localtest.me/knative/func-utils. A FUNC_UTILS_IMG override that changes the repo/registry path (the documented "always wins" override) makes the binary embed one path while images.sh pushes to another — in-cluster e2e pulls fail to resolve.

5. Scope creep: deleted "Fork CI note".github/workflows/functions.yaml
The PR removes the unrelated comment documenting why codecov no-ops on forks (Hamr#395 / Functions#57). Rationale is lost and unrelated to the func-utils pin.

6. Redundant if duplicated from needs.github/workflows/functions.yaml
publish-utils-image's new if duplicates the identical condition on build, which it already declares in needs. When build skips, the job skips via needs anyway. Two copies to keep in sync.

7. Inaccurate KVER commentMakefile
The comment says Prow passes KVER as v1.24.0, but hack/release.sh passes KVER="${TAG}" (the knative-vX.Y.Z form). No functional impact — the regex tolerates both — but the comment could mislead.


Highest-value items: #1 (workflow fails red instead of skipping) and #2 (pin silently defeated in detached-HEAD builds).

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

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress 🤖 PR should not merge because it is a work in progress. lgtm 🤖 PR is ready to be merged. size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants