Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the _ placeholder #971

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

LecrisUT
Copy link
Contributor

Copy link
Contributor

docs/configuration/index.md Outdated Show resolved Hide resolved
Copy link
Contributor

docs/configuration/jobs.md Outdated Show resolved Hide resolved
softwarefactory-project-zuul bot added a commit to packit/packit that referenced this pull request Nov 15, 2024
Add a yaml placeholder

Users can use this placeholder to put anchors that would otherwise be invalid keys in the config file, e.g.
_:
  internal-test: &internal-test
    job: tests
    use_internal_tf: True
jobs:
  - <<: *internal-test
    targets: [ fedora-latest ]
    tmt_plan: "/plans/core"
  - <<: *internal-test
    targets: [ epel-9 ]
    require:
      label:
        present:
          - full
Notice how in this example we cannot create a reusable anchor from either the fedora or the epel job because it would automatically inherit either tmt_plan or require.* values. Allowing a placeholder where one could define some definitions for later usage would make designing the yaml file a bit easier in some cases.
Feel free to propose any naming convention for this placeholder

TODO:

 Write new tests or update the old ones to cover new functionality.
 Update or write new documentation in packit/packit.dev.
packit/packit.dev/pull/971



Fixes
Related to
Merge before/after

RELEASE NOTES BEGIN
Packit configuration file can now have a placeholder top-level key _ that is ignored when read.
This is useful for storing yaml anchors in complex config files, e.g.:
_:
  base-test: &base-test
    job: tests
    fmf_path: .distro
jobs:
  - <<: *base-test
    trigger: pull_request
    manual_trigger: true
  - <<: *internal-test
    trigger: commit
    use_internal_tf: true
RELEASE NOTES END

Reviewed-by: Matej Focko
Reviewed-by: Laura Barcziová
Copy link
Contributor

@mfocko mfocko added the mergeit When set, zuul wil gate and merge the PR. label Nov 15, 2024
Copy link
Contributor

Build succeeded (gate pipeline).
https://softwarefactory-project.io/zuul/t/packit-service/buildset/ec11e86574b84070a2ca79c0eb19e418

✔️ pre-commit SUCCESS in 1m 23s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 1718cd4 into packit:main Nov 15, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit When set, zuul wil gate and merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants