Commit graph

389 commits

Author SHA1 Message Date
Christian Kellner
00cffce22f schutzbot: use predictable dnf repo
Now that osbuild and osbuild-composer use predictable destinations
for their dnf repositories, those can be used and auto-generated
from the environment and a specific git commit (identified by
the hash).
This will make updating easier, because the only thing we need to
change is the commit hash.
For osbuild-composer the latest release is used, for osbuild the
predictable repos were introduced after the latest release, so
the commit that introduced the feature is used.
2020-11-16 19:43:26 +01:00
Christian Kellner
d7bfaee189 plugins: ability to skip the tagging
Add a new command line option `--skip-tag` that will skip tagging
after a successful build. The help text is copied from the same
option of other sub-commands in the koji client. The hub plugin's
jsonschema was updated accordingly, and the builder plugin will
skip the tag if the option was requested.
Tests were added or augmented for all three plugins to test the
new option.
2020-11-16 17:00:40 +01:00
Christian Kellner
a21c732ce0 README.md: add call schemata
Add a diagram that shows the integration points of the three
plugins and how API calls are made between them and composer.
2020-11-16 13:23:34 +00:00
Christian Kellner
4290a3123c test/builder: check compose-status.json uploads
Check that the compose-status.json is indeed uploaded.
2020-11-13 11:06:10 +01:00
Christian Kellner
ae90d5f2c7 builder: log compose-status.json during the build
Instead of just uploading the compose-status.json at the very end
of the build, keep updating it every time it is fetch. This makes
it easier to follow along, especially if there are multiple image
request being built.
2020-11-13 11:06:10 +01:00
Christian Kellner
800682c9bb builder: upload the compose json
Upload the final compose status as JSON, so it can be inspected,
which could be especially handy if multiple image requests were
made and only one of them failed, to quickly pin down the one
that failed, without having to go through all the logs.
2020-11-13 11:06:10 +01:00
Christian Kellner
0d9dc2b72d builder: break list comprehension over two lines
Small syntactic change to make it easier to read.
2020-11-13 11:06:10 +01:00
Christian Kellner
cedb982593 builder: support compose status json serialization
Add a '.as_dict()' method to ComposeStatus, which can be used to
serialize the object as JSON or properly log it. Indeed use it
in the debug log to avoid a useless message that contains:
<_koji_plugin__osbuild.ComposeStatus object at 0x7fb80172b820>
2020-11-13 11:06:10 +01:00
Christian Kellner
5d309bd86d plugin/builder: more generic upload_json method
Rename "upload_meta_data" to "upload_json" and re-use that method
from "attach_logs", removing the duplicated code there.
2020-11-13 11:06:10 +01:00
Christian Kellner
7cc225716c test/builder: check log fetching
For each compose, mock also the "compose/<id>/logs" API endpoint
and just return some string. Add a feature to be able to control
the http status of the route though, so we can simulate failures
during log fetching.
2020-11-13 11:06:10 +01:00
Christian Kellner
e81ac2d946 builder: fetch and attach build logs
Use the new log API introduced in osbuild-composer >= 24, to fetch
the logs for the compose and attach them to the task. It is a non-
fatal error if fetching the logs fails; in that case a warning is
emitted. NB: logs are attached no matter the compose result.
Logs are per image-request, the content is JSON, but otherwise not
further specified.
2020-11-13 11:06:10 +01:00
Christian Kellner
9e10eb58eb builder: keep order of requested architectures
Preserve the order of architectures in the image requests inside
the compose requests, i.e. don't transform 'arches' into a set,
which has random order. It is not that anyone should really
depend on it, but there is also no need to mess with the order,
potentially making it harder for humans to match requested arches
with compose request content and logs.
2020-11-13 11:06:10 +01:00
Christian Kellner
bb992ab688 test/builder: fix image status route response
The correct response is one status object for each image request.
2020-11-13 11:06:10 +01:00
Christian Kellner
3f51470d9c test/builder: use multiple arches in build check
In the builder unit test that checks a successful compose, use
more than one architecture, and check that an image request was
created for all of those. This should expose bugs multi-arch
specific bugs.
2020-11-13 11:06:10 +01:00
Christian Kellner
630d09f6c4 ci: generate koji certs with SAN in make-certs.sh
Generate the certificate to be used for koji in make-certs.sh by
the same CA that also generates the composer and client certs.
Create a single certificate that uses the SubjectAltName (SAN)
extension to cover two domains: localhost, org.osbuild.koji.koji,
which previously was done via two separate certificates; this is
the legacy usage which stopped working with go 1.15 (see previous
commit). As a consequence the apache config is modified to use
only one virtual host with a ServerAlias directive.
2020-11-12 13:13:55 +01:00
Christian Kellner
6f439dc34f ci: rework ssl cert generation (SAN usage)
Rework the generation of certificates, in order to make use of
the SubjectAltName (SAN) extension, that is required for modern
usage of TLS (see RFC 2818, or [1]) and now enforced by default
for go version 1.15[2] (Fedora 33). For this a different config
file is used, originally written by Lars, and assign SANs to
the server and client certificates. Additionally, the correct
extensions are used for each of those, so that their usage is
limited to the server or client use case. The client certificate
is renamed from "worker" to "client".
The lifetime of the certificates is increased, as a side effect of
the new config file.

[1] https://github.com/urllib3/urllib3/issues/497
[2] https://golang.org/doc/go1.15#commonname

Co-authored-by: Lars Karlitski <lars@karlitski.net>
2020-11-12 13:13:55 +01:00
Christian Kellner
f529ffe394 test: use quay mirror for the postgres container
The official postgres container image is fetched from docker.io,
which recently introduced rate limiting, which makes introduces
possible CI error if we run into this limit.
Instead use a custom mirror[1] of the official image, hosted on
quay.io[2]. As a side effect this updates the posgres version
from 12 to 13.

[1] osbuild/containers@7db3c68
[2] quay.io/osbuild/postgres:v1
2020-11-10 13:26:06 +01:00
Christian Kellner
2c37256f65 ci: use api socket, not koji socket
Instead of installing and enabling the koji socket, use the new
api socket. The koji socket is not properly wired up anymore
and any attempt to actually use it with hang.
2020-11-10 12:31:08 +01:00
Christian Kellner
f6b493f60c ci: update composer to release 23 for Fedora 32
Also update the Fedora CI to osbuild 23, so that it is in sync
with the RHEL ci. This is important since the koji socket has
been deprecated by the api socket and the koji socket actually
does not work anymore.
2020-11-10 12:31:08 +01:00
Ondřej Budai
90945ee509 composer: update to osbuild-composer 23 2020-11-10 12:31:08 +01:00
Ondřej Budai
67ee36d24d schutzbot: update the repository directory to RHEL 8.3
Schuztbot now uses RHEL 8.3 image. It's needed to change the repository
directory from 8.2 to 8.3 to accommodate the switch.
2020-11-10 12:31:08 +01:00
Christian Kellner
180cdefbad test/cli: check for release command line arg
Check that specifying `--release` results in the corresponding
entry (`release`) in the options dictionary (`opts`).
2020-11-03 20:40:36 +01:00
Christian Kellner
58f6a60e15 test/cli: check for repo command line argument
Check that specifying `--repo` multiple times results in the
corresponding options dictionary (`opts`) entry, called `repo`.
2020-11-03 20:40:36 +01:00
Christian Kellner
f69ce030db test/cli: specify expected argument values
In the basic invocation test, specify the expected argument values
not only their type. With the exception of the default image type
they correspond to the various command line arguments given.
2020-11-03 20:40:36 +01:00
Christian Kellner
51bda2671d HACKING.md: fix client plugin install instructions
Make the destination of the link be an absolute path, but more
importantly fix the actual path the plugin gets installed in.
2020-11-03 19:40:54 +01:00
Christian Kellner
1078ec427e 2
This completes the development of koji-osbuild version 2
2020-11-03 12:15:47 +01:00
Christian Kellner
969b74bf4c NEWS.md: prepare for release version 2
This is a bug fix release.
2020-11-03 12:15:47 +01:00
Christian Kellner
d38ea07ab5 NEWS.md: delete some extra whitespaces
No need for the extra spacing. This format is now consistent with
the one in osbuild.
2020-11-03 12:15:47 +01:00
Christian Kellner
c2107b4798 ci: spell check source via codespell
Integrate the codespell github action to spell check the source
code in CI.
2020-11-03 11:31:29 +01:00
Christian Kellner
a37fe00b05 container: fix spelling in hub/kojiweb.conf
Found by codespell.
2020-11-03 11:31:29 +01:00
Christian Kellner
50a0b09b5d README.md: fix links to example configs
Remove extra "`" chars that broke the link.
2020-11-03 11:31:29 +01:00
Christian Kellner
0b4a13e8c7 test/builder: more architectures in build tag
Add more supported build architectures to the standard build tag.
This will check the logic for (un-)supported build architectures
in the builder plugin. If we only have one arch, which is the
requested arch, it will not catch logic errors, that invert the
supported vs requested architectures.
2020-11-03 10:54:04 +01:00
Tomas Kopecek
9d6d278ffb builder: invert missing arch support logic
The builder plugin checks that all of the requested architectures
are indeed supported, which is determined via the build tag. It
does that by constructing two sets, the requested architectures
and the supported architectures, and then constructing the set
of (asymmetric) differences between the one and the other. This
difference was meant to be "requested" - "supported", which then
will contain architectures that have been requested but are not
supported, or be empty in case all requested architectures are
indeed supported (the good case). However, previously the diff
was done the other way around ("supported" - "requested"), which
will then return a set of architectures that are supported but
were not requested, which is not what we want to check for.

Invert that the argument of the difference to indeed end up with
"requested" - "supported", which results in the correct check.
2020-11-03 10:54:04 +01:00
Christian Kellner
12a7793900 spec: require python3-jsonschema (hub plugin)
The hub plugin uses jsonschema, so it must explicitly depend on
it. The dependency is installed "by hand" in the container since
by default, the plugin is not installed via the RPM, but copied
from the source repository and thus all dependencies must be
present already.
2020-11-03 09:20:03 +01:00
Christian Kellner
8d40baedf8 test/builder: avoid using list in keyword argument
Although in that specific use case it was fine, since the list
was copied before usage, pylint in newer versions was unhappy.
2020-10-29 17:12:03 +01:00
Christian Kellner
f5564c5f1f ci: explicitly install the dnsname podman plugin
On RHEL a pre-compiled version is currently installed from the
vendor directory (see the README.md there). On Fedora it is
packaged in podman-plugins and that used to be installed
without explicitly asking for it, but that seems to have changed.
Explicitly install it on Fedora to ensure it is present.

Symptom of the dns plugin missing is that the koji hub container
will not start because it will block waiting for the postgres
container forever.
2020-10-28 21:48:44 +01:00
Christian Kellner
768c25744f NEWS.md: add news entries for release 1
More of a description of the project and existing functionality
than highlights.
2020-09-30 15:17:03 +02:00
Christian Kellner
58f23204fc README.md: Fix cli plugin sub-command in intro
It is `osbuild-image` not `osbuild-command`.
2020-09-30 15:17:03 +02:00
Christian Kellner
4a23652ed8 README.md: add installation instructions 2020-09-30 15:17:03 +02:00
Christian Kellner
8772ee5acf README.md: explain what this is about a bit more
Also some white-space changes to the source more readable.
2020-09-30 15:17:03 +02:00
Christian Kellner
8fccf0857f spec: change upstream URL to new location
The project now is located at https://github.com/gicmo/koji-osbuild
2020-09-30 15:17:03 +02:00
Christian Kellner
57347fbbb7 editorconfig: add markdown settings 2020-09-30 15:17:03 +02:00
Christian Kellner
e6f9721276 test/run-builder: use command -v instead of which
The latter is non-standard according to ShellCheck. Let's use the
standard one.
2020-09-29 21:40:25 +01:00
Christian Kellner
b1b7425ca6 test/make-tags.sh: KOJI_SERVER env variable
Introduce KOJI_SERVER that can be set outside, defaulting to
http://localhost:8080/kojihub for local testing.
2020-09-29 21:40:25 +01:00
Christian Kellner
30aa71563c test: DATA_DIR can be externally defined
Change the use of DATA_DIR across all scripts so that it will
only be set if it does not yet exist. This makes it possible
to change the location of it across all scripts at once.
2020-09-29 21:40:25 +01:00
Christian Kellner
4dd2e6d814 test: SHARE_DIR can be externally defined
Change the use of SHARE_DIR across all scripts so that it will
only be set if it does not yet exist. This makes it possible
to change the location of it across all scripts at once.
2020-09-29 21:40:25 +01:00
Christian Kellner
aa8513c20d test: move container/ into test/
Move the container directory, containing the container definitions
for all the test containers, to test/, where all the other test-
related files are located (with the exception of `Schutzbot`).
Use `test/build-container.sh` to build the container, instead of
replicating that in `test-integration.sh`.
2020-09-29 21:40:25 +01:00
Christian Kellner
b625f96c2b test: move run-builder into test/
Move the run-builder.sh helper into the `test/` sub-directory. It
is mainly needed for testing together with the other test scripts.
2020-09-29 21:40:25 +01:00
Christian Kellner
660f0f2700 test: move run-koji-container.sh to test/
Move the run-koji-container.sh helper into the `test/` sub-directory.
It is mainly needed for testing together with the other test scripts.
2020-09-29 21:40:25 +01:00
Christian Kellner
05f1ecac8e test: move make-tags.sh into test/
Move the make-tags.sh helper into the `test/` sub-directory. It is
mainly needed for testing together with the other test scripts.
2020-09-29 21:40:25 +01:00