-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1888 - Template Component Fields into Components on Zarf.yaml (#1923)
## Description This PR allows for templating component name during package create and give the ability to template with more fields in the component struct. While the PR is roughly similar to [FindYamlTemplates](https://github.com/defenseunicorns/zarf/blob/02150cfda1a32d5c6ebb4c446d731dc217e3961e/src/pkg/utils/yaml.go#L164) there is extra complexity in components that required a new function [FindComponentTemplatesAndReload](https://github.com/defenseunicorns/zarf/blob/9b3e396abc39a395ceb7999565bfb09088cd39c5/src/pkg/utils/yaml.go#L166). Each component may have a different name that the string map would overwrite. Due to this nature, the straightforward path was a new function to mutate in place, FindComponentTemplatesAndReload. It operates on the ZarfPackage object passed in by interface by iterating over the Components and mutating by updating the templated files. This opens up the possibility to template more fields in components rather than just [component names](https://github.com/defenseunicorns/zarf/blob/9b3e396abc39a395ceb7999565bfb09088cd39c5/src/pkg/utils/yaml.go#L186). Currently there is a place-holder example of [Component-Name-Template](https://github.com/defenseunicorns/zarf/blob/1888/examples/component-name-template/zarf.yaml) which will need to be changed before removing draft status from PR. This PR is in a holding pattern while waiting from feedback from @Racer159 ## Related Issue Fixes <!-- or --> Relates to #1888 ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) ## Checklist before merging - [x] Test, docs, adr added or updated as needed - [x] [Contributor Guide Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow) followed --------- Signed-off-by: Case Wylie <[email protected]> Co-authored-by: razzle <[email protected]>
- Loading branch information
Showing
3 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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