Skip to content

[Proposal] Load YAML anchors declared in external YAML files #743

@h6ah4i

Description

@h6ah4i

I have contributed a PR to enable YAML anchors and aliases in runn. Now, I want to empower the anchors and aliases feature more with the following feature that goccy/go-yaml provides. If we can use the feature effectively, we can write runbooks more DRY way.

  1. Reference elements declared in another file
    https://github.com/goccy/go-yaml?tab=readme-ov-file#2-reference-elements-declared-in-another-file

[Draft] Specs.

  • Add --yaml-references command line option that specifies where to load yaml files that define anchors globally
    • ex.) runn run --yaml-references ./references/**/*.yml ./books/**/*.yml
  • Use the ReferenceReaders() function
    • We can apply the runn's read:parent policy before passing the contents
    • We can use the same glob syntax like testdata/references/**/*.yml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions