Source: koji

The koji push source allows the loading of content from an instance of koji.

Supported content types:

  • RPMs

  • container images (with operator manifests if applicable)

  • modulemd YAML streams (yum repo metadata)

  • virtual machine images

Note that many features of the koji source requires having koji’s volume(s) mounted locally.

koji source URLs

The base form of a Koji source URL is:

koji:koji-xmlrpc-endpoint?contenttype1=...[&contenttype2=...[&...]]

For example, accessing a couple of RPMs from Fedora koji may be achieved by URL:

koji:https://koji.fedoraproject.org/kojihub?rpm=python3-3.7.5-2.fc31.x86_64.rpm,python3-3.7.5-2.fc31.src.rpm

The next subsections provide more detail on specific content types.

Accessing RPMs

Use the rpm parameter to request RPMs by filename.

koji:https://koji.fedoraproject.org/kojihub?rpm=python3-3.7.5-2.fc31.x86_64.rpm

This will yield unsigned RPMs by default. If you require signed RPMs, specify the signing key(s) in the signing_key parameter. You must use the same short key IDs as used on the koji instance, and a fatal error will occur if signed RPMs are not available.

koji:https://koji.fedoraproject.org/kojihub?rpm=python3-3.7.5-2.fc31.x86_64.rpm&signing_key=12c944d0

Accessing modulemd streams

Use the module_build parameter to request modulemd streams from one or more builds. Builds can be specified by NVR. Use the NVR of build(s) containing modulemd text files as archives (shown as “Module Archives” in the Koji UI).

koji:https://koji.fedoraproject.org/kojihub?module_build=flatpak-common-f32-3220200518173809.caf21102

If you want to process only a subset of the modules on the build (i.e. select only certain arches), you may use module_filter_filename to select the desired modulemd files, as in example:

koji:https://koji.fedoraproject.org/kojihub?module_build=flatpak-common-f32-3220200518173809.caf21102&module_filter_filename=modulemd.x86_64.txt,modulemd.s390x.txt

Accessing container images

Use the container_build parameter to request container images from one or more builds. Builds can be specified by NVR. Builds should be produced by OSBS or should use compatible metadata.

koji:https://koji.fedoraproject.org/kojihub?container_build=grafana-7-1

Push items produced in this case may include:

Accessing virtual machine images

Use the vmi_build parameter to request virtual machine images from one or more builds. Builds can be specified by NVR. Builds should be produced by Image Builder or should use compatible metadata.

koji:https://koji.fedoraproject.org/kojihub?vmi_build=fedora-azure-37-1.7

Push items produced in this case may include:

Setting the destination for push items

As koji itself contains no policy regarding where content should be pushed, a koji source by default yields all push items with an empty destination.

If you know ahead of time the destination(s) to which your push items should be distributed, you may include these in the dest parameter, as in example:

koji:https://koji.fedoraproject.org/kojihub?module_build=flatpak-common-f32-3220200518173809.caf21102&dest=target-repo1,target-repo2

Adjusting koji.BASEDIR

Some features of the koji source require read-only access to koji’s working volume(s). The top-level path by default is provided by the koji library as /mnt/koji.

To use a different path, include basedir in the source URL:

koji:https://koji.fedoraproject.org/kojihub?module_build=flatpak-common-f32-3220200518173809.caf21102&basedir=/mnt/my-local-koji

Python API reference

class pushsource.KojiSource(url, dest=None, rpm=None, module_build=None, module_filter_filename=None, container_build=None, vmi_build=None, signing_key=None, basedir=None, threads=4, timeout=1800, cache=None, executor=None)[source]

Uses koji artifacts as the source of push items.

__init__(url, dest=None, rpm=None, module_build=None, module_filter_filename=None, container_build=None, vmi_build=None, signing_key=None, basedir=None, threads=4, timeout=1800, cache=None, executor=None)[source]

Create a new source.

Parameters:
  • url (str) – URL of the XML-RPC endpoint for koji hub.

  • dest (str, list[str]) – The destination(s) to fill in for push items created by this source. If omitted, all push items have empty destinations.

  • rpm (list[str, int]) – RPM identifier(s). Can be koji IDs (integers) or filenames. The source will yield all RPMs identified by this list.

  • module_build (list[str, int]) – Build identifier(s). Can be koji IDs (integers) or build NVRs. The source will yield modulemd files belonging to these build(s), filtered by module_filter_filename (if given).

  • module_filter_filename (list[str]) –

    Filename(s) of modulemd archives to include in output.

    When module_build is given, modulemd files are located as koji archives with names of the form modulemd.<arch>.txt. By default, all of these archives will be processed.

    Providing a non-empty list for module_filter_filename will instead only process modulemd files with those filenames. This can be used to select only certain arches.

    Has no effect if module_build is not provided.

  • container_build (list[str, int]) – Build identifier(s). Can be koji IDs (integers) or build NVRs. The source will yield all container images produced by these build(s), along with associated artifacts such as operator manifest bundles.

  • vmi_build (list[str, int]) – Virtual Machine Image identifier(s). Can be koji build IDs (integers) or build NVRs. The source will yield all VMIs identified by this list.

  • signing_key (list[str]) –

    GPG signing key ID(s). If provided, content must be signed using one of the provided keys. Include None if unsigned should also be permitted.

    Keys should be listed in the order of preference.

  • basedir (str) – Base directory of koji content (e.g. /mnt/koji). This directory must be readable locally.

  • threads (int) – Number of threads used for concurrent queries to koji.

  • timeout (int) – Number of seconds after which an error is raised, if no progress is made during queries to koji.

  • cache (dict) –

    A cache used to retain the results of XML-RPC calls, to avoid repeated calls.

    Providing a cache only gives a benefit if the current process will create more than a single instance of KojiSource. In this case, some calls may be avoided by passing the same cache to each instance.

  • executor (concurrent.futures.Executor) – A custom executor used to submit calls to koji.