Skip to content

Instantly share code, notes, and snippets.

@bookwar
Created May 11, 2023 12:46
Show Gist options
  • Save bookwar/d17f3810cdc8ee17818f6f9919801a62 to your computer and use it in GitHub Desktop.
Save bookwar/d17f3810cdc8ee17818f6f9919801a62 to your computer and use it in GitHub Desktop.
Playing with public API of Stream Koji
import koji
from pprint import pprint
mytag = "c9s-build"
mybuild = "glibc-2.34-8.el9"
event_id = '627803'
session = koji.ClientSession("https://kojihub.stream.centos.org/kojihub")
build_info = session.getBuild(mybuild)
pprint(build_info)
tag_info = session.getTag(mytag)
pprint(tag_info)
repo_info = session.getRepo(mytag, event=event_id)
# By specifying event_id I get the repo object associated with the repo at that time
pprint(repo_info)
{'build_id': 15009,
'cg_id': None,
'cg_name': None,
'completion_time': '2021-11-03 15:59:13.452434+00:00',
'completion_ts': 1635955153.45243,
'creation_event_id': 627803,
'creation_time': '2021-11-03 15:31:34.405909+00:00',
'creation_ts': 1635953494.40591,
'epoch': None,
'extra': {'source': {'original_url': 'git+https://gitlab.com/redhat/centos-stream/rpms/glibc#faf38262bfb8c98798f8891a45bb90f534764d2f'}},
'id': 15009,
'name': 'glibc',
'nvr': 'glibc-2.34-8.el9',
'owner_id': 51,
'owner_name': 'fweimer',
'package_id': 401,
'package_name': 'glibc',
'release': '8.el9',
'source': 'git+https://gitlab.com/redhat/centos-stream/rpms/glibc#faf38262bfb8c98798f8891a45bb90f534764d2f',
'start_time': '2021-11-03 15:31:34.401751+00:00',
'start_ts': 1635953494.40175,
'state': 1,
'task_id': 760745,
'version': '2.34',
'volume_id': 0,
'volume_name': 'DEFAULT'}
{'arches': 'aarch64 ppc64le i686 x86_64 s390x',
'extra': {'mock.new_chroot': 0,
'mock.package_manager': 'dnf',
'rhpkg_dist': 'el9',
'rpm.macro.dist': '%{!?distprefix0:%{?distprefix}}%{expand:%{lua:for '
'i=0,9999 do print("%{?distprefix" .. i .."}") '
'end}}.el9%{?with_bootstrap:%{__bootstrap}}'},
'id': 5,
'locked': False,
'maven_include_all': False,
'maven_support': False,
'name': 'c9s-build',
'perm': None,
'perm_id': None}
{'create_event': 627756,
'create_ts': 1635953078.54734,
'creation_time': '2021-11-03 15:24:38.547344+00:00',
'dist': False,
'id': 39042,
'state': 3,
'task_id': None}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment