Skip to content

build: assert the helm on PATH matches .tool-versions before regenerating goldens #6903

Description

@eamonnmoloney

Problem

Nothing asserts that the helm binary on PATH matches the version pinned in
.tool-versions. Every golden-regeneration target shells out to whichever helm
resolves first, so a contributor with a different Helm silently produces goldens
that disagree with CI — and the output looks entirely plausible.

Affected targets (Makefile):

  • go.update-golden-only (L123) and go.update-golden-only-lite (L109)
  • go.update-registry-golden (L117)
  • go.test (L88), go.test-golden-updated (L96), go.update-golden-only-cleanup (L100)
  • helm.schema-update (L277) and precommit.chores (L381), which calls the -lite variant

tools.asdf-install installs the pinned version, but installing it is not the
same as using it: a Homebrew (or other) helm earlier on PATH wins over the
asdf shim, and asdf gives no warning.

How this surfaced

.tool-versions pins helm 4.2.4. /opt/homebrew/bin/helm was 4.2.3 and
shadowed the asdf shim. Helm 4.2.3 drops a trailing-whitespace line at the end of
the connectors application.yaml block that 4.2.4 emits, so
TestGoldenDefaultsTemplateConnectors failed locally. Regenerating with
make go.update-golden-only "fixed" the test by deleting a line CI legitimately
renders.

The failure mode is what makes this worth fixing: the local test went green, the
diff was one plausible line in a generated file, and there was no signal pointing
at the toolchain. It took a distro-ci[bot] chores commit re-adding the line —
reducing the PR to changed_files=0 — to expose it. See #6901, closed as invalid.

A patch-level Helm difference was enough. This is not an exotic mismatch.

Suggested fix

A .helm-version-check prerequisite on the targets above: compare
helm version --short against the helm line in .tool-versions and fail with
the two versions and a pointer to make tools.asdf-install when they differ.

Two details worth deciding deliberately:

  • Fail vs warn. Fail for the golden/schema-regeneration targets, where wrong
    output gets committed. go.test could arguably warn instead, so a contributor
    on a mismatched Helm can still run tests — though a mismatch there produces
    false failures, which is how this started.
  • Where the pin is read. Parse .tool-versions rather than hardcoding, so the
    check cannot drift from the pin it is enforcing.

Worth checking whether the same gap applies to the other pinned tools the
generation targets depend on (yq, jq, go).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/choreIndicates a maintenance chore (updating docs, etc)likelihood/midObserved occasionallyseverity/midMarks a bug as having a noticeable impact but with a known workaroundtriage:completed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions