Commit graph

265 commits

Author SHA1 Message Date
Ondřej Budai
3e77ed579b schutzbot: fix the name of koji-osbuild repository
It's confusing in the logs.
2020-12-02 19:04:30 +01:00
Lars Karlitski
d9cb6217ef test/integration.sh: bump nightly
The current one is not available anymore. We cannot use rpmrepo for this
yet, because the podman-plugins package is too new.
2020-12-01 10:48:08 +01:00
Christian Kellner
c282b9b1f0 test: replace docker.io with fedora's registry
In order to avoid running into docker.io's new download limit,
use the container directly from registry.fedoraproject.org.
2020-11-22 23:53:38 +01:00
Lars Karlitski
b936e1e9f1 mockbuild: use mock to build source rpm
Running `meson build` on the host can have different results from
building the SRPM in mock.
2020-11-20 19:37:45 +01:00
Lars Karlitski
5bd74d3fa2 koji-osbuild.spec: don't generate from .in file
Remove koji-osbuild.spec.in and the bits in meson.build that generate
the final spec file out of it. Pull in the changelog from how Ondřej
Budai does it in osbuild-composer, because it's adorable.

When releasing, the version now has to be bumped in the spec file.

This is to make it consistent with other osbuild projects, and to
simplify reverse dependency testing.
2020-11-20 19:37:45 +01:00
Lars Karlitski
1c13e8106f mockbuild: move installing dependencies down
These don't need to run when we're not building anything.
2020-11-20 19:37:45 +01:00
Lars Karlitski
acfc50788a mockbuild: don't build repository when it already exists
This avoids doing unnecessary work and speeds up restarting tests.
2020-11-20 19:37:45 +01:00
Lars Karlitski
2ac9a5b73c schutzbot: don't copy dnf repo file between stages
Repository URLs are predictable. There's no need to use Jenkins' stash
feature to pass the repo file between stages.

Instead, simply create the repo file where it is needed, in deploy.sh.
2020-11-20 19:37:45 +01:00
Lars Karlitski
cc2de53747 mockbuild: change repository path
Change the repository path on S3 to a more predictable one, mirroring
the pattern we're using for osbuild-composer.

Notably, don't use short commit ids. The length of these is not
predictable. It depends on the shortest unique prefix in the repository
and git configuration.

For example, koji-osbuild commit $SHA for fedora-33 on x86_64 will
result in this URL:

koji-osbuild/fedora-33/x86_64/$SHA
2020-11-20 19:37:45 +01:00
Lars Karlitski
758dc70d85 mockbuild: remove unused variable 2020-11-20 19:37:45 +01:00
Lars Karlitski
444c1cc006 mockbuild: remove unused logs
These logs are not preserved, just remove them.
2020-11-20 19:37:45 +01:00
Ondřej Budai
d9742a669c schutzbot: bump the osbuild-composer version to 25 2020-11-19 22:18:04 +01:00
Christian Kellner
8d40d9ae54 3
This completes the development of koji-osbuild version 3.
2020-11-19 14:38:32 +01:00
Christian Kellner
5147599093 NEWS.md: prepare for release version 3
Lots of new features and improvements to testing. New `tests`
sub-package.
2020-11-19 14:38:32 +01:00
Christian Kellner
d0216a7ef0 test: copy the plugin in the run scripts
If called from within the source directory, i.e. the local plugin
exists, copy those to the share directory so they can be picked
up by the entry point scripts, in case the rpms are not found.
2020-11-19 11:22:54 +00:00
Christian Kellner
b74e440028 test/make-tags: add Fedora-IoT to f32-candidate
This is just for local testing of Fedora IoT commits, which should
be named properly.
2020-11-19 11:22:54 +00:00
Christian Kellner
8705c0aa68 test/container: ensure koji plugin paths exist
When using the local plugin, ensure the destination plugin path
exists before copying, otherwise it will fail.
2020-11-19 11:22:54 +00:00
Christian Kellner
ba25e0f3d7 test: use absolute path in run-builder.sh
In case `TEST_PATH` was not specified as command line argument,
it was falling back to `test`. Make the latter an absolute path,
by pre-pending `PWD`, otherwise podman complains about the name
of the volume.
2020-11-19 11:22:54 +00:00
Christian Kellner
c826db38e7 test: match container version to host
Instead of just using the "latest" container everywhere, which will
change every time a new release is made, add a build argument to
specify the version and then match that version to the host in all
the build scripts. This will make it possible to use the tests for
gating, and ensure that we test the plugins on the OS version that
is targeted.
2020-11-19 11:22:54 +00:00
Christian Kellner
d60dd9f362 test: make hub container self contained
Instead of building on the existing quay.io/osbuild/koji:v1, and
then replacing a lot of it (entry point), move the packages and
the dnf.conf change over from the former base and then directly
depend on Fedora. This gives us more control, especially over
what Fedora version is being used.
2020-11-19 11:22:54 +00:00
Lars Karlitski
16f762c2ed test: move to koji-osbuild-tests package
This is similar to how other osbuild packages are testing: everything
that's needed for testing is included in the tests package or a
dependency of it. The test runner then runs every executable in
/usr/libexec/tests/<packagename>. This gives a simple test API to
projects depending on this package (notably osbuild-composer).

The local development workflow described in HACKING.md is meant to
continue to work. To ensure this, all relevant scripts gained a
TEST_DATA variable, which defaults to `./test`, but is set from $1 to
the installed path from integration.sh.
2020-11-19 09:28:28 +01:00
Lars Karlitski
ade02b0c9a test: pull podman-plugins from internal RHEL repo
Instead of taking podman-plugins from the source directory, use the one
that will be released into RHEL 8.3.1.

This will simplify moving tests into an rpm.
2020-11-19 09:28:28 +01:00
Christian Kellner
c2b5bd7060 builder: attach koji init/import logs
De-serialize the koji init and import logs, required fields in the
ComposeLogs, and if non-empty, attach them to the task.
Update the tests to check for the presence of these logs.
2020-11-17 16:05:39 +01:00
Christian Kellner
68309e4b5a builder: use koji_build_id from ComposeStatus
Instead of getting the `koji_build_id` from the direct reply of
the compose request call, use the one returned in the compose
status.
The reason behind this is that composer was changed so that the
CGInitBuild call to koji is now being done by a worker and not
composer itself. This means that once the compose request call
returns, the build id is not yet known. In composer release 24,
the compose request call internally waits for the worker that
does the CGInitBuild API call, but that will be changed, and
the koji_build_id will then not be returned from the compose
request API call anymore. This prepares for that. The tests are
also adapted to simulate the new behavior.

NB: this makes composer 24 a dependency, since the build id is
taken from the ComposeStatus, which was only added there.
2020-11-17 13:35:52 +00:00
Christian Kellner
3adccb716c ci: update container to use 'main'
There is no 'master' branch anymore, use 'main' instead.
2020-11-17 13:35:52 +00:00
Christian Kellner
ff1fd7a38e schutzbot: prepare for master → main rename
Prepare for the rename of the master branch to main.
2020-11-16 19:43:26 +01:00
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