[release-1.23] fix: source func CLI version from build ldflags - #4030
Conversation
Why CI is failingThe real failure is the Prow check Root cause
The test asserts the generated workflow contains This is a direct consequence of this PR. The FuncCliVersion: gitDescribeSuffix.ReplaceAllString(version.Kver, "")The integration test drives the real command, so the emitted version now depends on Why the GitHub-Actions "Unit Tests (ubuntu-latest)" check passes for the same test: Suggested fixMake the test robust to the build-injected version instead of hardcoding the default. Either:
Unrelated red checks
|
|
/approve |
The func CLI version in generated GitHub workflows was hardcoded to a specific release (knative-v1.22.0), meaning it would silently go stale as new releases shipped. FuncCliVersion is now sourced from version.Kver, which is set via ldflags at build time to the current release tag. The git describe suffix (e.g. "-22-g2871d3bf") is stripped so that dev builds between releases still emit a real, installable tag rather than a ref that does not exist on GitHub releases. When version.Kver is empty (plain go build without ldflags, or the package used as a library), the field falls back to DefaultFuncCliVersion.
The integration test asserted the generated workflow contains github.DefaultFuncCliVersion, but the command now sources the version from version.Kver (injected via -ldflags). On release-1.23 the branch's latest tag is knative-v1.23.1, so the emitted version did not match the compiled-in default (knative-v1.23.0) and the test failed. Pin version.Kver in the test so the output is independent of the build/branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Matej Vašek <matejvasek@gmail.com>
babb322 to
92a41c0
Compare
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: knative-prow-robot, matejvasek The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is an automated cherry-pick of #4029
/kind bug