Repository navigation
Add check-pipeline-name-only-steps hook - #20
Merged
Merged
Conversation
dannf
reviewed
Aug 13, 2025
This hook validates that pipeline steps in melange YAML files don't have only a 'name' field without 'uses' or other details. This catches a common mistake where 'name' is used instead of 'uses' for pipeline steps. The check covers: - Main pipeline steps - Test pipeline steps - Subpackage pipeline steps - Subpackage test pipeline steps Includes test data files demonstrating both valid and invalid configurations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- A `pipeline:` key with no value (YAML null) crashed the hook with TypeError; five files on stereo main have one. Every pipeline and test lookup now falls back to an empty list. - The four copies of the same loop collapse into iter_pipelines(), which yields (label, steps) for the main and subpackage build and test pipelines, and iter_steps(), which also descends into nested `pipeline:` lists so a name-only step inside a grouped step is caught. - The message says what to do: use `uses:`, or fold the name into the next step. - test-data/README.md loses the hard-coded home directory path; the bad fixture gains a nested case and the good fixture a null pipeline. - The hook is listed in example.pre-commit-config.yaml. On stereo main today the hook reports 30 steps in 25 files, none of them the `- name: test/go-fips-check` typo it was written for: 3 are placeholder pipelines in meta packages and 27 are `- name:` headings written as their own list item ahead of an anonymous `- runs:` or `- uses:`. melange runs both as no-ops. Those files are fixed in stereo alongside this change.
AmberArcadia
force-pushed
the
check-pipeline-name-only-steps
branch
from
October 2, 2026 17:52
4037b89 to
ef90f3b
Compare
Member
Author
|
Rebased onto main and pushed ef90f3b: the hook no longer crashes on a null |
AmberArcadia
added a commit
that referenced
this pull request
Oct 23, 2026
…ain, resolve vars Review follow-ups on #18 now that #20 is in: - Move the melange config walkers (iter_steps, iter_pipelines, subpackages, build_steps, test_steps, environment_packages, uses_any) and the load-and-report loop into pre_commit_hooks/melange.py, and rebuild both check-pipeline-name-only-steps and check-for-go-fips-test on it. Each hook is now its check function plus argparse. - Treat every toolchain family test/go-fips-check can verify as FIPS: go-fips and go-fips-md5 (at 1.27 these are meta packages pointing at go-msft-1.27), go-msft, go-geomys and go-openssl. Limiting the rule to go-fips would have exempted the toolchain new FIPS builds are moving to. On stereo main this adds 15 findings, all gitlab-rails FIPS streams that rebuild the devfile gem's Go helper with go-msft and never run go-fips-check. - Resolve ${{vars.NAME}} from the top-level vars: mapping before matching toolchain names, so templated go-package values are visible without a melange compile. var-transforms are left alone. - Repair the rebase onto #20: both hooks keep their full manifest entries and example-config lines, which a keep-both merge had truncated. - Document the go-fips fixtures in test-data/README.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
check-pipeline-name-only-steps, which fails when a pipeline step consists of nothing but aname:. melange runs such a step as a no-op, so it is either a typo foruses:(- name: test/go-fips-check, the case that prompted this; thanks @OddBloke) or a heading that was meant to sit on the following step.Checked: the main pipeline, the main test pipeline, every subpackage pipeline and test pipeline, and nested
pipeline:lists inside steps.Changes since the first review
pipeline:key with no value (YAML null) crashed the hook withTypeError; five files on stereo main have one. Guarded.iter_pipelines()plusiter_steps(), the shape dannf asked for on Add check-for-go-fips-test pre-commit hook #18. Once both hooks are in I will move the helpers into a shared module; keeping them local for now avoids a cross-PR conflict.uses:, or fold the name into the next step.example.pre-commit-config.yaml;test-data/README.mdno longer carries my home directory path.On "melange requires a main pipeline"
dannf pointed at
cuda-stub-meta.yaml, whose whole pipeline was- name: Without this, subpackages don't build.. That file was renamed tocuda-stub-12.4.yaml(stereo b7e108846e7, 2026-08-05) and its placeholder pipeline had already been removed (stereo 6e8d75f76ab, 2026-05-26). Today thecuda-stub-*.yamlfiles have nopipeline:key at all and build, andvalidatePipelinesin melange'spkg/config/config.goenforces no such requirement. Three placeholders remain on stereo main (eco-python-meta,torchaudio-ffmpeg-tarballs,cuda-toolkit-13.0); the stereo PR below drops them.What the hook finds on stereo main
30 steps in 25 files, none of them the
test/go-fips-checktypo. 3 are the placeholders above; 27 are headings written as their own list item, for exampleenterprise-packages/qdrant.yaml:All 25 files are fixed in chainguard-dev/stereo#362436, so enabling the hook there starts clean.
Test
pre-commit try-repo . check-pipeline-name-only-steps --files test-data/pipeline-name-only-bad.yamlreports five findings (main, main test, subpackage, nested, subpackage test); the good fixture, which includes a nullpipeline:, passes.pre-commit run --all-filesis clean.