#274 Allow generating `fedora-distgits.yaml` programatically.
Opened 11 months ago by ksurma. Modified 9 months ago

I've got a Python script that generates a new fedora-distgits.yaml: https://github.com/befeleme/zuul-config-generator and I think it could be useful to the wider community. If you were interested, I'd be happy to commit it to this repository.

However the generated file hits some problems related to the way PyYAML library creates the file
- indentation of the entries doesn't match the one in the config
- keys are regenerated in an alphabetic order (while the current file is not sorted)
I believe both are just a nuisances which shouldn't have an impact on the config parsing. One time replacement of the config format would save people using the script pointless minutes of by-hand file editing.

Then there's a rpms/systemd entry which doesn't match the rest of the config - I'm not sure why and whether it can be unified with the rest? Or the other way around: do we need to specify the boilerplate

         zuul/include: []
         default-branch: main

for each entry? Could they be a default?

Thanks for any thoughts on that! :)


Since creating the issue I improved two things mentioned above:
- systemd entry is now hacked to match the current file - the question remains in place, maybe it can be done more user friendly?
- indentation of the whole file matches the current file

Not resolved: ordering of the keys. Question in place: if we commited the sorted file once, then the diff for the next addings would hopefully be trivial.

Hi,

Yes, thanks that will be a really good addition ! I would suggest to simply add a new section in this repo README to advertise about the script in a new section perhaps called : "How to add / maintain your packages list". I guess that should be the first thing to appear in the README file before the section "Prepare your workspace to edit Fedora Zuul jobs config".

Then we could add a line to redirect to that new README section here too https://fedoraproject.org/wiki/Zuul-based-ci#Add_the_repository_into_the_Zuul_configuration

Regarding the file format, each packages get
- "zuul/include: []": Tell Zuul to not load any config from .zuul.yaml or zuul.d/ (https://zuul-ci.org/docs/zuul/latest/tenants.html#attr-tenant.untrusted-projects.%3Cproject%3E.include)
- "default-branch: main" purpose is for the Code search service only https://fedora.softwarefactory-project.io/codesearch/ and not really with any zuul config

rpms/systemd repo provides a Zuul config for the "project" config element https://zuul-ci.org/docs/zuul/latest/config/project.html#attr-project.vars (https://src.fedoraproject.org/rpms/systemd/blob/rawhide/f/.zuul.yaml) that's why we cannot exclude Zuul config loading as with other packages. Perhaps we should use zuul/include: ["project"] for systemd package entry.

Then we need to find a way to handle packages that does not follow the common pattern with the script. I don't think that we'll need to handle so many package repos such as systemd that hosts zuul config, thus if the script code handle the exception for systemd that's fine, then we could see later if we need a more user friendly way to handle that.

For the ordering of the keys, yes we can merge a first change to fix the ordering.

I sent the PRs for keys ordering and Readme update, both now merged.
For some reason I can't seem to log in to our Wiki (auth failure, no problems on other Fedora sites), but once I'm in, I'll update the section there.
Thank you for enabling this!

Thank you for your contribution ! Ok for the wiki, let me know later if you still have trouble with the authentication and then I'll do the update.

Login to comment on this ticket.

Metadata