You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci: pin setup-envtest and gate go.mod/go.sum tidiness
Two independent hardening items found while adopting the DGXC Go proxy
(#2372), neither of which belongs to that work.
Pin setup-envtest. `go install ...setup-envtest@latest` was the only
unpinned tool install of the four in CI; apidiff, addlicense, and
go-licenses all take a version from .settings.yaml via load-versions. It
runs in the merge gate, so an upstream release could change what every PR
is tested against with no commit here. Now pinned through the same path,
under testing_tools.setup_envtest with a renovate annotation.
Pinned to v0.24.1, which is what @latest resolves to today and matches
sigs.k8s.io/controller-runtime v0.24.1 in go.mod. The envtest control-plane
binaries it fetches are matched to the controller-runtime the tests link
against, so the two should move together. Behaviorally a no-op right now;
that is the point.
Add `go mod tidy -diff`. Nothing verified that go.mod and go.sum are
correct for the source. The existing check only proves vendor/ matches
those manifests, which it cannot fail on a wrong manifest: `go mod vendor`
regenerates from whatever go.mod says, so a bad manifest produces a vendor
tree that matches it perfectly. A requirement nothing imports, or a stale
go.sum entry, passed CI.
`-diff` prints the needed changes and exits non-zero without writing,
which is what makes it usable as a gate. Verified clean on main before
wiring it (rc=0, no output), so it does not turn the gate red on landing.
Also picks up the license header make license added to the probe
workflow, and documents the new required input in .github/actions/README.md.
Signed-off-by: Mark Chmarny <mark@chmarny.com>
-`helm_version` (required): Helm version from `load-versions`
25
+
-`setup_envtest_version` (required): setup-envtest version from `load-versions`
25
26
-`apidiff_version` (optional): apidiff version from `load-versions`; when set, installs apidiff and runs `make api-diff` (default: empty, which skips both steps)
26
27
27
28
Callers that set `apidiff_version` must check out full history with
Copy file name to clipboardExpand all lines: .github/actions/go-test/action.yml
+29-1Lines changed: 29 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,9 @@ inputs:
34
34
description: 'Optional apidiff version pinned in .settings.yaml (linting.apidiff, via load-versions); leave empty to skip the SDK API compatibility check'
35
35
required: false
36
36
default: ''
37
+
setup_envtest_version:
38
+
description: 'setup-envtest version pinned in .settings.yaml (testing_tools.setup_envtest, via load-versions)'
39
+
required: true
37
40
38
41
runs:
39
42
using: 'composite'
@@ -48,6 +51,24 @@ runs:
48
51
vendor/modules.txt
49
52
check-latest: true
50
53
54
+
# Two different questions, checked in dependency order.
55
+
#
56
+
# `go mod tidy -diff` asks whether go.mod/go.sum are correct for the source:
57
+
# no requirement the code does not import, none missing, no stale go.sum
58
+
# entries. It prints the needed changes and exits non-zero without writing.
59
+
# Nothing checked this before, so a requirement could be added to go.mod
60
+
# that nothing imports and CI stayed green.
61
+
#
62
+
# The vendor check then asks whether vendor/ matches those manifests. It
63
+
# cannot answer the first question: `go mod vendor` regenerates from
64
+
# whatever go.mod says, so a wrong manifest yields a vendor tree that
65
+
# matches it perfectly.
66
+
- name: Verify go.mod and go.sum are tidy
67
+
shell: bash
68
+
run: |
69
+
go mod tidy -diff \
70
+
|| { echo "go.mod/go.sum are not tidy; run 'make tidy' and commit the result" >&2; exit 1; }
71
+
51
72
- name: Verify vendor is in sync
52
73
shell: bash
53
74
run: |
@@ -65,10 +86,17 @@ runs:
65
86
install_helm: 'true'
66
87
helm_version: '${{ inputs.helm_version }}'
67
88
89
+
# Pinned, not @latest: this runs in the merge gate, so an unpinned install
90
+
# lets an upstream release change what every PR is tested against with no
91
+
# commit here. Kept in step with sigs.k8s.io/controller-runtime in go.mod.
0 commit comments