Improvements to the config parser#43
Merged
Merged
Conversation
hnez
force-pushed
the
recursive-merges
branch
2 times, most recently
from
March 3, 2026 06:04
9ccee41 to
a7f8402
Compare
Member
Author
|
Maybe use serde-saphyr instead. |
This is similar to how GitLab CI handles reusable YAML snippets and is (in my opinion) prettier and more flexible than the previous top level `*_snippet`s (which stay usable for backward compatibility reasons). Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
This allows using snippets like these, which already include `<<` merges:
machine-small: &machine-small
setup_template:
path: /etc/forrest/templates/generic
parameters:
RUNNER_VERSION: "2.318.0"
RUNNER_HASH: "28ed88e4cedf0fc93201a901e392a70463dbd0213f2ce9d57a4ab495027f3e2f"
base_image: /srv/forrest/images/debian-12-generic-amd64.raw
cpus: 4
disk: 16G
ram: 4G
machine-medium: &machine-medium
<< : *machine-small
cpus: 8
disk: 32G
ram: 8G
And then using them in e.g. machine definitions, just like one would
expect:
forrest-test:
machines:
test-debian:
<< : *machine-medium
base_machine: hnez/forrest-images/debian-base
This does not work by default in yaml_serde (0.10) because merges in
mappings are not applied recursively.
Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
This makes it easier to write tests in the future. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Member
Author
I like the current solution. a) because it is already there. I have decided to merge it as is. |
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.
We had to work around missing support for recursive YAML merges in our
serde_yaml*/yaml_serdecrates for some time now, by writing the configs in a special way.Work around that once and for all by just applying merges in a loop until they are all resolved.
Also change some other bits and bobs around the config parsing, while at it.
This PR is based on #42 because that switched from
sede_yaml_ngtoyaml_serde.