No description
Find a file
Tomáš Hozza a90101bde9 builder: fix missing default value for details in ComposeStatusError
The builder plugin could produce a traceback when image build failed,
but it didn't contain any details.

```
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/koji/daemon.py", line 1468, in runTask
    response = (handler.run(),)
  File "/usr/lib/python3.6/site-packages/koji/tasks.py", line 335, in run
    return koji.util.call_with_argcheck(self.handler, self.params, self.opts)
  File "/usr/lib/python3.6/site-packages/koji/util.py", line 271, in call_with_argcheck
    return func(*args, **kwargs)
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 719, in handler
    status = client.wait_for_compose(cid, callback=self.on_status_update)
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 483, in wait_for_compose
    status = self.compose_status(compose_id)
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 454, in compose_status
    return ComposeStatus.from_dict(res.json())
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 251, in from_dict
    ImageStatus.from_dict(s) for s in data["image_statuses"]
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 251, in <listcomp>
    ImageStatus.from_dict(s) for s in data["image_statuses"]
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 228, in from_dict
    error = ComposeStatusError(error_id=error_id, **error)
TypeError: __init__() missing 1 required positional argument: 'details'
```

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2022-11-21 12:06:35 +01:00
.devcontainer devcontainer: remove trailing comma from JSON 2022-04-13 14:52:32 +02:00
.github ci: Pin Fedora container for pylint 2022-11-16 18:39:41 +01:00
docs README.md: add call schemata 2020-11-16 13:23:34 +00:00
plugins builder: fix missing default value for details in ComposeStatusError 2022-11-21 12:06:35 +01:00
schutzbot ci: add tags to AWS instances 2022-11-10 18:39:30 +01:00
test Hub: support image_type being an array for backwards compatibility 2022-09-02 15:15:21 +02:00
.editorconfig editorconfig: add markdown settings 2020-09-30 15:17:03 +02:00
.gitignore gitignore: ignore vscode files 2021-02-25 16:01:51 +01:00
.gitlab-ci.yml CI: Use Fedora 36, RHEL-8.6 and the latest osbuild and composer 2022-08-22 09:58:06 +02:00
.packit.yaml packit: Enable Bodhi updates workflow 2022-09-01 18:47:45 +02:00
HACKING.md docs: fix error in hacking.md 2022-03-24 09:35:59 +01:00
koji-osbuild.spec Post release version bump 2022-09-02 14:28:16 +00:00
LICENSE LICENSE: add ASL 2.0 2020-09-06 16:02:54 +02:00
meson.build koji-osbuild.spec: don't generate from .in file 2020-11-20 19:37:45 +01:00
meson_options.txt Support for generating rpms via meson 2020-09-08 16:58:06 +02:00
NEWS.md NEWS.md: prepare for release version 3 2020-11-19 14:38:32 +01:00
README.md builder: add support for proxying requests to composer 2022-05-02 12:55:22 +02:00
run-tests.sh run-tests: explicitly specify --cached 2022-01-26 18:02:33 +01:00
setup.cfg pylint: move config to setup.cfg 2022-01-24 23:21:31 +01:00

Koji osbuild

This project provides osbuild integration with Koji. It makes it possible to build images and other OS artifacts via osbuild-composer through koji, This is done via three plugins:

  • Koji hub plugin: Provides a new XMLRPC API endpoint that clients can use to create new osbuildImage Koji tasks.

  • Koji builder plugin: Handles osbuildImage Koji tasks and will talk to osbuild-composer to create new composes via composer's Koji API.

  • Koji cli plugin: Adds a new osbuild-image to the existing koji command line client. This will then use the new XMLRPC API to request a new compose.

The following image visualizes the overall architecture and integration points of koji-osbuild with koji/brew and Composer:

overview

Installation

The plugins need to be installed on the machines running the corresponding services. Installation via RPMs is recommended. The RPMs for the latest git commit of the source can be easily created via meson:

meson . build
ninja -C build rpms

The RPMs should then be in build/rpmbuild. The hub and builder plugin also need to be explicitly enabled in the respective configuration files. The hub plugin configuration file at /etc/koji-hub/hub.conf. The plugin is enabled by adding osbuild to the Plugins directive. The builder: configuration file at /etc/kojid/kojid.conf. Here osbuild needs to be added to the plugin directive. For an example, see the test container configuration files hub.conf for the hub and kojid.conf for the builder.

Additionally, an osbuild-composer instance, at least version 21, with the koji API enabled needs to be running and reachable via TCP from the host running the koji builder.

Configuration

The builder plugin needs to be configured via a builder.conf file that can be located in either /usr/share/koji-osbuild or /etc/koji-osbuild.

[composer]
# The host, port and transport (https vs http) of osbuild composer
# NB: The 'https' transport is required for SSL/TLS authorization
server = https://composer.osbuild.org

# Authorization via client side certificates: can be either a pair of
# certificate and key files separated by comma or a file combining both.
ssl_cert = /share/worker-crt.pem, /share/worker-key.pem

# Verification of the server side: either a boolean (True / False) to
# enable or disable verification, or a path to a CA_BUNDLE file or a
# directory containing certificates of trusted CAs.
ssl_verify = /share/worker-ca.pem

# URI of proxy that's used for all composer requests including requests to
# an OAuth server if OAuth is enabled. Note that this proxy isn't used
# to route any requests for Koji hub.
proxy = http://squid.example.com:3128

[composer:oauth]
# Authorization via OAuth2/SSO, as alternative to client side certs.
# The "Client Credentials Grant" (RFC 6749 section 4.4) flow is used,
# which requires the client id and secret to be specified as well as
# the endpoint of where to obtain tokens.

# String that uniquely identifies the client (RFC 6749, 2.2).
client_id = koji

# Secret corresponding to the client id.
client_secret = koji

# URL to the endpoint that will provide the token.
token_url = https://localhost:8081/token

[koji]
# The URL to the koji hub XML-RPC endpoint
server = https://koji.fedoraproject.org/kojihub

Development

See HACKING.md for how to develop and test this project.