rpmmd/reporegistry: allow on-disk repository format to also be yaml#2095
rpmmd/reporegistry: allow on-disk repository format to also be yaml#2095supakeen merged 2 commits intoosbuild:mainfrom
Conversation
Instead of deserializing JSON we use the YAML decoder to deserialize (which also understands JSON) through the use of `common.UmarshalJSONviaYAML` to keep code duplication low. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
1e54a13 to
2b5880b
Compare
What is the value when we keep suffering the JSON edits? Go ahead and convert it. |
Adjust the reporegistry to look for both .json and .yaml files. The latter is only tried when the .json file did *not* exist. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2b5880b to
74d1cf5
Compare
I think there's automated tooling for (some of) those files that might not understand YAML. |
With the potential to use YAML for repository file formats let's make sure it's the advertised way [1]. [1]: osbuild/images#2095 Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Well if you ask me, I would vote to switch and refactor what needs to be. I just finished osbuild/image-builder-crc#1742 and damn this was painful, more rich YAML would make the experience nicer. |
thozza
left a comment
There was a problem hiding this comment.
LGTM.
One nitpick: since .json is preferred over .yaml, it may be good to unit test this scenario.
Added this to my post-new years list. |
lzap
left a comment
There was a problem hiding this comment.
I would rather see us doing a full change in git and for backward-compatibility converts those files to JSONs during build time (when RPMs are built) using some tiny command line utility - we are not doing anything crazy and this should be a clean YAML -> JSON conversion script in Python. This feels weird, you are making a change that perhaps 1% of users (including us) will benefit from.
But I guess this is the first step.
|
I think |
I doubt it's 1% of users as we have documented ways of adjusted the repository JSON files on our documentation (and regularly get questions/bugs about it). A follow-up will hopefully convert our built-in JSONs to be YAML as well. |
Maybe implement a little YAML "incude" feature for GPG keys pretty please. :-) |
With the potential to use YAML for repository file formats let's make sure it's the advertised way [1]. [1]: osbuild/images#2095 Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Naive approach to loading repositories from YAML files which will give slightly better ergonomics to write these files, and slightly more consistency across the stack: especially when passing both custom definitions (YAML) and custom repositories (YAML).
When both a .json and a .yaml file exist for a given distro then the .json file is used.
It might be good to ask if we want to convert the default embedded repositories to YAML as well, or if that should be a follow-up? :)