Skip to content

✨ (go/v4): Pin the ENVTEST version in the scaffold, now supported starting with controller-runtime release v0.24.0#5684

Open
v47 wants to merge 1 commit into
kubernetes-sigs:masterfrom
v47:feat/pin-envtest-version-to-semver
Open

✨ (go/v4): Pin the ENVTEST version in the scaffold, now supported starting with controller-runtime release v0.24.0#5684
v47 wants to merge 1 commit into
kubernetes-sigs:masterfrom
v47:feat/pin-envtest-version-to-semver

Conversation

@v47
Copy link
Copy Markdown
Contributor

@v47 v47 commented May 8, 2026

Description:
Previously, ENVTEST_VERSION in the scaffolded Makefile was computed by stripping the patch version from the controller-runtime semver and converting it to a release branch name (e.g. v0.20.1release-0.20). This meant go install resolved to whatever HEAD of that branch was at download time - not a reproducible, pinned version.

Changes:

  • Now that setup-envtest publishes proper semver tags, the scaffold uses the full semver directly (e.g. v0.20.1), making builds reproducible and go install fully deterministic.
  • The change updates the go/v4 Makefile template and regenerates all affected testdata and docs sample projects.

Fixes #5679

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 8, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: v47
Once this PR has been reviewed and has the lgtm label, please assign varshaprasad96 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 8, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @v47. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 8, 2026
@camilamacedo86
Copy link
Copy Markdown
Member

Because it is a change that impact end users we should use emoji ✨
I hope that you do not mind I am changing the title for we have a nice release notes.

@camilamacedo86 camilamacedo86 changed the title 🌱 pin ENVTEST_VERSION to semver instead of release branch ✨ (go/v4): Pin the ENVTEST version in the scaffold, now supported starting with controller-runtime release v0.21.0 May 11, 2026
@camilamacedo86 camilamacedo86 changed the title ✨ (go/v4): Pin the ENVTEST version in the scaffold, now supported starting with controller-runtime release v0.21.0 ✨ (go/v4): Pin the ENVTEST version in the scaffold, now supported starting with controller-runtime release v0.24.0 May 11, 2026
@camilamacedo86 camilamacedo86 requested a review from Copilot May 11, 2026 17:26
Copy link
Copy Markdown

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 updates the go/v4 scaffold to make setup-envtest installation reproducible by pinning ENVTEST_VERSION to the full sigs.k8s.io/controller-runtime semver (instead of converting it to a moving release-x.y branch), and regenerates the affected testdata/docs Makefile snippets.

Changes:

  • Update Makefile scaffolding logic to use the full controller-runtime module version for ENVTEST_VERSION (no release-x.y conversion).
  • Regenerate go/v4 testdata Makefiles to match the new envtest pinning behavior.
  • Update docs snippets to show the pinned-semver ENVTEST_VERSION approach.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go Switches ENVTEST_VERSION derivation from release-x.y to full semver for deterministic go install of setup-envtest.
testdata/project-v4/Makefile Regenerated scaffold output reflecting the new ENVTEST_VERSION behavior.
testdata/project-v4-with-plugins/Makefile Regenerated scaffold output reflecting the new ENVTEST_VERSION behavior.
testdata/project-v4-multigroup/Makefile Regenerated scaffold output reflecting the new ENVTEST_VERSION behavior.
docs/book/src/reference/envtest.md Updates the documented Makefile snippet to use the full controller-runtime semver for ENVTEST_VERSION.
docs/book/src/reference/artifacts.md Updates the documented Makefile snippet to use the full controller-runtime semver for ENVTEST_VERSION.
docs/book/src/getting-started/testdata/project/Makefile Regenerated tutorial testdata Makefile reflecting the new ENVTEST_VERSION behavior.
docs/book/src/cronjob-tutorial/testdata/project/Makefile Regenerated tutorial testdata Makefile reflecting the new ENVTEST_VERSION behavior.
docs/book/src/multiversion-tutorial/testdata/project/Makefile Regenerated tutorial testdata Makefile reflecting the new ENVTEST_VERSION behavior.

CONTROLLER_TOOLS_VERSION ?= {{ .ControllerToolsVersion }}

#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
Comment thread testdata/project-v4/Makefile Outdated
CONTROLLER_TOOLS_VERSION ?= v0.20.1

#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
CONTROLLER_TOOLS_VERSION ?= v0.20.1

#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
Comment thread testdata/project-v4-multigroup/Makefile Outdated
CONTROLLER_TOOLS_VERSION ?= v0.20.1

#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
Comment thread docs/book/src/reference/envtest.md Outdated
Comment on lines +22 to +23
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime)
Comment thread docs/book/src/reference/artifacts.md Outdated
Comment on lines +55 to +56
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime)
CONTROLLER_TOOLS_VERSION ?= v0.20.1

#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
CONTROLLER_TOOLS_VERSION ?= v0.20.1

#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
CONTROLLER_TOOLS_VERSION ?= v0.20.1

#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
#ENVTEST_VERSION is the version of controller-runtime to use for setup-envtest (i.e. v0.20.0)
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 11, 2026
@v47 v47 force-pushed the feat/pin-envtest-version-to-semver branch from f79d08c to c5e35f6 Compare May 11, 2026 19:26
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 11, 2026
@v47 v47 force-pushed the feat/pin-envtest-version-to-semver branch from c5e35f6 to 6e639e6 Compare May 11, 2026 19:44
@v47 v47 force-pushed the feat/pin-envtest-version-to-semver branch from 6e639e6 to a407366 Compare May 11, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change scaffold since now is possible to ping envtest release

4 participants