Skip to content

Conversation

@AmberArcadia
Copy link
Member

@AmberArcadia AmberArcadia commented Aug 13, 2025

Summary

  • Adds a new pre-commit hook check-pipeline-name-only-steps that validates pipeline step formatting in melange YAML files
  • Catches the common mistake where name: is used instead of uses: for pipeline steps (e.g., - name: test/go-fips-check instead of - uses: test/go-fips-check)
  • Thanks to @OddBloke for the idea!

What it checks

The hook validates that pipeline steps don't have only a name field without uses or other details. It checks:

  • Main pipeline steps
  • Test pipeline steps
  • Subpackage pipeline steps
  • Subpackage test pipeline steps

Example of issues it catches

pipeline:
  - name: test/go-fips-check  # ❌ Should be 'uses' not 'name'
  - uses: test/go-fips-check  # ✅ Correct

Test plan

  • Added test data files in test-data/ directory with examples of both valid and invalid configurations
  • Tested locally with pre-commit try-repo against both good and bad YAML files
  • Verified it correctly identifies all 4 types of pipeline issues (main, test, subpackage, subpackage test)

🤖 Generated with Claude Code

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 <[email protected]>
yaml = ruamel.yaml.YAML(typ="safe")


def check_pipeline_steps(melange_cfg: dict[str, Any]) -> tuple[bool, list[str]]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

melange requires that the main package has a pipeline, so I have created packages with name-only steps. See cuda-stub-meta.yaml in extra-packages as an example. That's likely a melange bug of course, but it's reality today.

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