Skip to content

feat(ci): self-test json-schema-validation against a fixture chart - #262

Merged
piontec merged 4 commits into
mainfrom
add-json-schema-validation-selftest
Aug 11, 2026
Merged

feat(ci): self-test json-schema-validation against a fixture chart#262
piontec merged 4 commits into
mainfrom
add-json-schema-validation-selftest

Conversation

@piontec

@piontec piontec commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Part of giantswarm/giantswarm#37347Lack of schema testing in github-workflows lets bugs pass

Why

verify-helm-schema was bumped to v2.6.2 in #258 and JSON schema validation broke in every cluster app repo (example).

The cause was not the install-binary-action v3.0.0 → v4.1.0 bump in the same commit — that action's default download_url is unchanged, and unarchived binaries have been supported since v3.1.0.

It was schemalint's release assets changing under a download_url that still asked for the old name. The <repo>-v<version>-<platform>.tar.gz assets are built by this repo, in create-release.yaml's create_and_upload_build_artifacts job, which only runs when the caller passes build-release-artifacts: true. schemalint#319 (chore: align files according to platform standards) removed that input, so from v2.6.2 on the tarball was simply never built — while action.yml was still requesting it via install-binary-action's default URL → Unexpected HTTP response: 404.

It was live org-wide about a minute after merge, because this repo is consumed at @main. schemalint v2.6.3 fixed it with an explicit download_url and #261 pinned it, so the outage window was 14:39–16:05 UTC on 2026-08-04.

Nothing here could have caught it. Validate GitHub workflows runs yamllint, action-validator and zizmor — all static, none of which ever executes a pinned action.

What

A check that calls the real reusable workflow against a fixture chart, so the pins under test are exactly the ones that ship — there is no second copy of the pins to drift out of sync.

  • helm/selftest-cluster-app/values.schema.json — schemalint's own pkg/lint/rulesets/testdata/cluster_azure.json (its rulesets_test.go asserts zero errors under cluster-app), passed through schemalint normalize, which verify also checks.
  • helm/selftest-cluster-app/values.yaml — exact stdout of helm-values-gen, so the generate job's diff passes.
  • The fixture has to live at the repo root: both composite actions locate input with find ./helm -maxdepth 2 -name values.schema.json, and a workflow_call job cannot be given a working directory.
  • renovate.json5ignorePaths: ['helm/**'] so the helm-values manager leaves the fixture alone.

The paths filter means upstream rule-set churn can only redden PRs touching this workflow or the fixture, never unrelated ones — and a renovate pin bump does touch json-schema-validation.yaml, which is exactly the case that broke.

Drive-by: both actions/checkout steps now set persist-credentials: false per the repo's action rules. Neither job uses git.

Verification

Locally, with schemalint 2.6.3 and helm-values-gen 1.0.4:

  • schemalint verify helm/selftest-cluster-app/values.schema.json --rule-set cluster-app → valid JSON Schema, normalized, valid against cluster-app (the ~90 recommendations are advisory and do not fail).
  • diff helm/selftest-cluster-app/values.yaml <(helm-values-gen …) → empty.
  • Repo yamllint → no new errors, only the pre-existing truthy warning that every workflow here already has.

A negative test is pushed to this branch and then reverted, to show the check actually fails when the pin is broken.

🤖 Generated with Claude Code

Renovate bumped `verify-helm-schema` to v2.6.2 (#258) and broke JSON schema
validation in every cluster app repo. schemalint's release pipeline had moved
to architect 9.x, which publishes raw binaries instead of tarballs, while its
action still relied on install-binary-action's default tarball URL - so the
install 404'd. This repo is consumed at `@main`, so the breakage was live
org-wide about a minute after merge.

None of the existing checks could have caught it: yamllint, action-validator
and zizmor are all static and never execute the pinned actions.

Add a check that calls the real reusable workflow against a fixture chart, so
the pins under test are exactly the ones that ship. The fixture schema comes
from schemalint's own cluster-app testdata, normalized as `verify` requires,
with values.yaml generated by helm-values-gen so the `generate` job's diff
passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@piontec
piontec requested a review from a team as a code owner August 5, 2026 11:20
piontec and others added 2 commits August 5, 2026 13:26
Proves the self-test actually catches the 404. Reverted in the next commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… v2.6.2"

Negative test done: run 31001492199 failed with the same
"Unexpected HTTP response: 404" on
schemalint-v2.6.2-linux-amd64.tar.gz that cluster-aks hit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@piontec

piontec commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Negative test done, as promised in the description.

Pinned verify-helm-schema back to the broken v2.6.2 SHA (c2280a5a) in commit 43848fd. The self-test went red in 7s with the identical failure cluster-aks hit:

download_url: https://github.com/giantswarm/${binary}/releases/download/v${version}/${binary}-v${version}-linux-amd64.tar.gz
download URL: https://github.com/giantswarm/schemalint/releases/download/v2.6.2/schemalint-v2.6.2-linux-amd64.tar.gz
##[error]Unexpected HTTP response: 404

Run 31001492199 — reverted in 3beba60, and all checks are green again on the current head.

Two things came out of the investigation behind this PR:

Also worth correcting the record: my initial reading blamed the install-binary-action v3→v4 bump in the same schemalint commit. That was wrong — v4.1.0's default download_url is unchanged, and extension-less URLs have worked since v3.1.0. The real cause is the align-files template dropping build-release-artifacts: true, which is what actually builds those tarballs (in create-release.yaml, right here). Written up in giantswarm/install-binary-action#353.

@piontec
piontec merged commit c586e76 into main Aug 11, 2026
7 checks passed
@piontec
piontec deleted the add-json-schema-validation-selftest branch August 11, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants