Skip to content

Commit 32f80f8

Browse files
committed
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>
1 parent 270278c commit 32f80f8

6 files changed

Lines changed: 56 additions & 1 deletion

File tree

.github/actions/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ executable bits or `./script.sh` invocation.
2222
- `coverage_report` (optional): Whether to generate a coverage report (default: "false")
2323
- `coverage_threshold` (optional): Minimum coverage percentage (default: empty)
2424
- `helm_version` (required): Helm version from `load-versions`
25+
- `setup_envtest_version` (required): setup-envtest version from `load-versions`
2526
- `apidiff_version` (optional): apidiff version from `load-versions`; when set, installs apidiff and runs `make api-diff` (default: empty, which skips both steps)
2627

2728
Callers that set `apidiff_version` must check out full history with
@@ -382,6 +383,7 @@ jobs:
382383
with:
383384
go_version: ${{ steps.versions.outputs.go }}
384385
helm_version: ${{ steps.versions.outputs.helm }}
386+
setup_envtest_version: ${{ steps.versions.outputs.setup_envtest }}
385387
apidiff_version: ${{ steps.versions.outputs.apidiff }}
386388
coverage_report: 'true'
387389
- uses: ./.github/actions/go-lint

.github/actions/go-test/action.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ inputs:
3434
description: 'Optional apidiff version pinned in .settings.yaml (linting.apidiff, via load-versions); leave empty to skip the SDK API compatibility check'
3535
required: false
3636
default: ''
37+
setup_envtest_version:
38+
description: 'setup-envtest version pinned in .settings.yaml (testing_tools.setup_envtest, via load-versions)'
39+
required: true
3740

3841
runs:
3942
using: 'composite'
@@ -48,6 +51,24 @@ runs:
4851
vendor/modules.txt
4952
check-latest: true
5053

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+
5172
- name: Verify vendor is in sync
5273
shell: bash
5374
run: |
@@ -65,10 +86,17 @@ runs:
6586
install_helm: 'true'
6687
helm_version: '${{ inputs.helm_version }}'
6788

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.
6892
- name: Install envtest binaries
6993
shell: bash
94+
env:
95+
SETUP_ENVTEST_VERSION: ${{ inputs.setup_envtest_version }}
7096
run: |
71-
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
97+
[ -n "${SETUP_ENVTEST_VERSION}" ] \
98+
|| { echo "setup_envtest_version input is required" >&2; exit 1; }
99+
go install "sigs.k8s.io/controller-runtime/tools/setup-envtest@${SETUP_ENVTEST_VERSION}"
72100
setup-envtest use --print path >/dev/null 2>&1
73101
74102
- name: Install API-diff tool

.github/actions/load-versions/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ outputs:
5252
tilt:
5353
description: 'Tilt version'
5454
value: ${{ steps.versions.outputs.tilt }}
55+
setup_envtest:
56+
description: 'setup-envtest version'
57+
value: ${{ steps.versions.outputs.setup_envtest }}
5558
helm:
5659
description: 'Helm version'
5760
value: ${{ steps.versions.outputs.helm }}
@@ -191,6 +194,7 @@ runs:
191194
echo "nvkind=$(yq eval '.testing_tools.nvkind' .settings.yaml)" >> $GITHUB_OUTPUT
192195
echo "ctlptl=$(yq eval '.testing_tools.ctlptl' .settings.yaml)" >> $GITHUB_OUTPUT
193196
echo "tilt=$(yq eval '.testing_tools.tilt' .settings.yaml)" >> $GITHUB_OUTPUT
197+
echo "setup_envtest=$(yq eval '.testing_tools.setup_envtest' .settings.yaml)" >> $GITHUB_OUTPUT
194198
echo "helm=$(yq eval '.testing_tools.helm' .settings.yaml)" >> $GITHUB_OUTPUT
195199
echo "helmfile=$(yq eval '.testing_tools.helmfile' .settings.yaml)" >> $GITHUB_OUTPUT
196200
echo "helmfile_sha256_linux_amd64=$(yq eval '.testing_tools.helmfile_checksums.linux_amd64' .settings.yaml)" >> $GITHUB_OUTPUT

.github/workflows/dgxc-goproxy-probe.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
---
216
# Proves the DGXC Go proxy path works before any production job depends on it.
317
#

.github/workflows/qualification.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
go_version: ${{ steps.versions.outputs.go }}
6565
coverage_report: ${{ inputs.coverage_report }}
6666
coverage_threshold: ${{ steps.versions.outputs.coverage_threshold }}
67+
setup_envtest_version: ${{ steps.versions.outputs.setup_envtest }}
6768
helm_version: ${{ steps.versions.outputs.helm }}
6869
apidiff_version: ${{ steps.versions.outputs.apidiff }}
6970

.settings.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ testing_tools:
8080
ctlptl: '0.9.4'
8181
# renovate: datasource=github-releases depName=tilt-dev/tilt depType=testing_tools
8282
tilt: '0.37.7'
83+
# Keep in step with sigs.k8s.io/controller-runtime in go.mod: setup-envtest is
84+
# released from that repo under the tools/setup-envtest/vX.Y.Z tag series, and
85+
# the envtest control-plane binaries it fetches are matched to the
86+
# controller-runtime the tests link against.
87+
# renovate: datasource=go depName=sigs.k8s.io/controller-runtime/tools/setup-envtest depType=testing_tools
88+
setup_envtest: 'v0.24.1'
8389
# renovate: datasource=github-releases depName=helm/helm depType=testing_tools
8490
helm: 'v4.2.4'
8591
# renovate: datasource=github-releases depName=databus23/helm-diff depType=testing_tools

0 commit comments

Comments
 (0)