Skip to content

rpmmd/reporegistry: allow on-disk repository format to also be yaml#2095

Merged
supakeen merged 2 commits intoosbuild:mainfrom
supakeen:allow-repositories-as-yaml
Jan 6, 2026
Merged

rpmmd/reporegistry: allow on-disk repository format to also be yaml#2095
supakeen merged 2 commits intoosbuild:mainfrom
supakeen:allow-repositories-as-yaml

Conversation

@supakeen
Copy link
Member

@supakeen supakeen commented Dec 16, 2025

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? :)

rpmmd: deserialize with YAML

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.
reporegistry: also load from yaml

Adjust the reporegistry to look for both .json and .yaml files. The
latter is only tried when the .json file did *not* exist.

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>
@supakeen supakeen requested a review from a team as a code owner December 16, 2025 09:28
@supakeen supakeen force-pushed the allow-repositories-as-yaml branch 2 times, most recently from 1e54a13 to 2b5880b Compare December 16, 2025 09:36
@lzap
Copy link
Contributor

lzap commented Dec 16, 2025

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? :)

What is the value when we keep suffering the JSON edits? Go ahead and convert it.

lzap
lzap previously approved these changes Dec 16, 2025
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>
@supakeen
Copy link
Member Author

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? :)

What is the value when we keep suffering the JSON edits? Go ahead and convert it.

I think there's automated tooling for (some of) those files that might not understand YAML.

supakeen added a commit to supakeen/image-builder-cli that referenced this pull request Dec 16, 2025
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>
@lzap
Copy link
Contributor

lzap commented Dec 16, 2025

I think there's automated tooling for (some of) those files that might not understand YAML.

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.

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

One nitpick: since .json is preferred over .yaml, it may be good to unit test this scenario.

@supakeen supakeen enabled auto-merge December 17, 2025 10:09
@supakeen
Copy link
Member Author

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.

@supakeen supakeen requested review from achilleas-k and mvo5 December 17, 2025 10:16
Copy link
Contributor

@lzap lzap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@supakeen supakeen added this pull request to the merge queue Dec 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 18, 2025
@supakeen supakeen added this pull request to the merge queue Dec 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 19, 2025
@thozza thozza added this pull request to the merge queue Dec 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 19, 2025
@supakeen supakeen added this pull request to the merge queue Dec 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 19, 2025
@lzap lzap added this pull request to the merge queue Jan 2, 2026
@lzap
Copy link
Contributor

lzap commented Jan 2, 2026

I think main CICD pipeline is currently broken, I am taking a look at #2103

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 2, 2026
@supakeen
Copy link
Member Author

supakeen commented Jan 5, 2026

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 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.

@supakeen supakeen added this pull request to the merge queue Jan 6, 2026
@lzap
Copy link
Contributor

lzap commented Jan 6, 2026

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. :-)

Merged via the queue into osbuild:main with commit 08fa3f7 Jan 6, 2026
23 checks passed
@supakeen supakeen deleted the allow-repositories-as-yaml branch January 6, 2026 10:18
supakeen added a commit to supakeen/image-builder-cli that referenced this pull request Jan 19, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants