On Tue, 2021-10-12 at 20:40 +0200, Frantisek Zatloukal wrote:
> Hi,
> 
> in testcloud (
> https://pagure.io/testcloud/blob/master/f/testcloud/util.py#_100 ), I am
> using adam's openqa nightlies.json for rawhide/branched:
> https://openqa.fedoraproject.org/nightlies.json (this isn't a "stable api")
> 
> and https://getfedora.org/releases.json for stable releases.
> 
> For programmatically determining which are the current fedora releases, I
> am using oraculum's
> https://packager-dashboard.fedoraproject.org/api/v1/releases (this wouldn't
> change nor break).
> 
> Hope it helped at least a bit!

Oh, that's what you're using it for? Hmm. Well, that's a bit
indirect...

Both of those sources are ultimately getting the data via my fedfind
tool:

https://pagure.io/fedora-qa/fedfind

so unless you actually need the extra information nightlies adds (i.e.
whether the images passed openQA tests), you might as well just use
fedfind directly.

fedfind's current source of truth for "what are the current releases"
is a JSON blob I maintain by hand:

https://fedorapeople.org/groups/qa/metadata/release.json

which you could also just query directly (to figure out the Rawhide
release number, add one to the otherwise highest release number). There
are alternative sources of truth for this, but they're all a bit
problematic. I have a speech I can give on this if you'd like to hear
it. :D

To go back to Neal's original question, there more or less *is* an API
for this, yes: PDC - https://pdc.fedoraproject.org/

Specifically, you want the compose-images endpoint:
https://pdc.fedoraproject.org/rest_api/v1/compose-images/

you pass it a compose ID, like this:

https://pdc.fedoraproject.org/rest_api/v1/compose-images/Fedora-Rawhide-20211012.n.0/

and get lots of lovely data. What it's actually giving you is the data
produced by pungi and included in the compose tree itself so long as
that's available:

https://kojipkgs.fedoraproject.org/compose/rawhide/Fedora-Rawhide-20211012.n.0/compose/metadata/images.json

but PDC keeps the metadata around forever, while the composes disappear
after a couple of weeks.

Querying stable releases is a mite tricky. For a start, you need to
know the compose ID of the candidate compose that we ultimately
released. fedfind does this by parsing the compose label out of the
image filenames (using a regex with an expected format), then using PDC
to find the compose ID from the label. For a second, the data you get
will be in some senses a lie, because we hack up the compose when we
ship it as a stable release: we throw away some deliverables (so
they'll be in the metadata but you won't be able to find the files
anywhere once they're purged from kojipkgs / stage), and move others
around (so some of the relative paths in the metadata are wrong).
fedfind has some clever-clever logic to kinda meld what it knows about
the actual layout of the stable compose tree with the metadata from PDC
and present a more-or-less correct view of things.

So to answer Neal's question: you can use PDC directly, or you can use
fedfind which will talk to PDC for you, plus do a bunch of other stuff,
like the above, and also synthesizing metadata for pre-Pungi 4 stable
releases so you can interact with them via fedfind using the same
interfaces as post-Pungi 4 composes...

Hanging over all of this is the threat that PDC might go away at some
point, which would be a bit of an inconvenience. In A World Where there
is no PDC, you have to grab the metadata files for composes that still
exist from kojipkgs; there is no record of the metadata for composes
that have been garbage-collected. For stable releases you'd have to
parse whatever metadata you can just out of the actual release tree on
the mirrors.
-- 
Adam Williamson
Fedora QA
IRC: adamw | Twitter: adamw_ha
https://www.happyassassin.net



-- 
Adam Williamson
Fedora QA
IRC: adamw | Twitter: adamw_ha
https://www.happyassassin.net

_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to