Skip to content

fix: source func CLI version from build ldflags - #4029

Merged
knative-prow[bot] merged 1 commit into
knative:mainfrom
pmeida:feat/ci-func-cli-version-from-build
Sep 1, 2026
Merged

fix: source func CLI version from build ldflags#4029
knative-prow[bot] merged 1 commit into
knative:mainfrom
pmeida:feat/ci-func-cli-version-from-build

Conversation

@pmeida

@pmeida pmeida commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Source FuncCliVersion from version.Kver (set via ldflags at build time) instead of a hardcoded string
  • Strip the git describe suffix (e.g. -22-g2871d3bf) so dev builds between releases emit the nearest real release tag
  • Expose FuncCliVersion as a field on WorkflowConfig so library consumers can override it directly
    • this is important because library consumers with no ldflags have empty version.Kver, so it falls back to DefaultFuncCliVersion which may be out of date as it has to be manually updated

/kind bug

Fixes #4028

Release Note

`func config ci` now sources the func CLI version used in generated GitHub Actions workflows from the binary's build-time version (set via ldflags), instead of a hardcoded string. Dev builds between releases emit the nearest real release tag by stripping the git describe suffix.

Docs


@knative-prow knative-prow Bot added kind/bug Bugs size/S 🤖 PR changes 10-29 lines, ignoring generated files. labels Sep 1, 2026
@knative-prow

knative-prow Bot commented Sep 1, 2026

Copy link
Copy Markdown

Hi @pmeida. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow Bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label Sep 1, 2026
@pmeida pmeida changed the title config ci: source func CLI version from build ldflags fix: source func CLI version from build ldflags Sep 1, 2026
@matejvasek

Copy link
Copy Markdown
Contributor

/approve
/lgtm

@knative-prow knative-prow Bot added lgtm 🤖 PR is ready to be merged. approved 🤖 PR has been approved by an approver from all required OWNERS files. labels Sep 1, 2026
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.
@pmeida
pmeida force-pushed the feat/ci-func-cli-version-from-build branch from a6b4f2d to 0cbe88e Compare September 1, 2026 12:38
@knative-prow knative-prow Bot removed the lgtm 🤖 PR is ready to be merged. label Sep 1, 2026
@pmeida

pmeida commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@matejvasek It should be backported to release 4.23 right?

@matejvasek

matejvasek commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Yeah, we will charrypick it to release 1.23.

@matejvasek

Copy link
Copy Markdown
Contributor

/approve
/lgtm

@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label Sep 1, 2026
@knative-prow

knative-prow Bot commented Sep 1, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matejvasek, pmeida

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

@matejvasek

Copy link
Copy Markdown
Contributor

/cherry-pick release-1.23

@knative-prow-robot

Copy link
Copy Markdown

@matejvasek: once the present PR merges, I will cherry-pick it on top of release-1.23 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-1.23

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@matejvasek

Copy link
Copy Markdown
Contributor

/ok-to-test

@knative-prow knative-prow Bot added ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test 🤖 Needs an org member to approve testing labels Sep 1, 2026
@knative-prow
knative-prow Bot merged commit d327dce into knative:main Sep 1, 2026
64 of 71 checks passed
@knative-prow-robot

Copy link
Copy Markdown

@matejvasek: new pull request created: #4030

Details

In response to this:

/cherry-pick release-1.23

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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. kind/bug Bugs lgtm 🤖 PR is ready to be merged. ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/S 🤖 PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

config ci: source func CLI version from build ldflags

3 participants