Commit graph

1058 commits

Author SHA1 Message Date
Lars Karlitski
f5bfb22355 schutzbot: pin osbuild-composer
Pin the osbuild-composer that schutzbot runs a reverse dependency test
against. This allows to control which exact version to test against, and
ensures that PRs against osbuild always run against the same version.

Now that osbuild-composer's CI uploads RPMs to a predictable destination
(the same one that osbuild uses), we can use that instead of rebuilding
osbuild-composer on every CI run. This should speed up the mockbuild
stage considerably.

Pin it to v24 now.
2020-11-15 13:53:45 +00:00
Lars Karlitski
6c325811ed schutzbot/deploy.sh: drop upgrading dnf
According to the comment, this addressed priority bugs that dnf had in
fedora-31. We're not testing on that anymore, because it is end of life.
2020-11-15 13:53:45 +00:00
Lars Karlitski
3405a648f5 schutzbot/deploy.sh: drop dnf overrides
Drop setting fastestmirror, disabling weak dependencies, and removal of
modular repositories.

Try to install as close to what people do in production, which means
sticking to the defaults.
2020-11-15 13:53:45 +00:00
Lars Karlitski
3b8aa32e9c schutzbot/deploy.sh: drop journald workaround
It is not clear which bug this workaround is addressing. Drop it to find
out if it still necessary.
2020-11-15 13:53:45 +00:00
Lars Karlitski
7c44a142a3 schutzbot/deploy.sh: remove retry function
It was only used once, to retry dnf. This is not necessary, because dnf
already has retrying logic. We're also not using `retry` on any of the
other calls to dnf in this script.
2020-11-15 13:53:45 +00:00
Lars Karlitski
efba431e05 mockbuild: move installing dependencies down
These don't need to run when we're not building anything.
2020-11-14 14:13:07 +00:00
Lars Karlitski
4b084e3b64 mockbuild: drop fastestmirror and weakdependencies
Try to be install as close to what people do in production, which means
sticking to the defaults.
2020-11-14 14:13:07 +00:00
Lars Karlitski
c686dbe03a mockbuild: don't build repository when it already exists
This avoids doing unnecessary work and speeds up restarting tests.
2020-11-14 14:13:07 +00:00
Lars Karlitski
2fa87a0e46 schutzbot: don't copy dnf repo file between stages
Now that the repository URLs are predictable, don't 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-14 14:13:07 +00:00
Lars Karlitski
5aee7b9fa7 mockbuild: 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.

Just use the full one, which also makes it easier to copy the id from
`git log` or GitHub.
2020-11-14 13:48:37 +01:00
Lars Karlitski
5b827cb0d5 mockbuild: change repository path
Change the repository path on S3 to a more predictable one. We really
only need the name of the project (static osbuild for this repository),
the name of the distro (use the same as osbuild-composer's API for
consistency) and the commit SHA.

In particular, drop the PR number / branch name. Also don't remove the
dots from version numbers. All places we're using them in (paths and
URLs) support dots.

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

    osbuild/fedora-33/x86_64/xxxxxxx
2020-11-14 13:48:37 +01:00
Lars Karlitski
e3aec65636 mockbuild: move path logic into separate variable 2020-11-14 13:48:37 +01:00
Lars Karlitski
ad2dc139bb mockbuild: remove unused variable 2020-11-14 13:48:37 +01:00
Lars Karlitski
cf3ae337b0 mockbuild: remove unused logs
These logs are not preserved, just remove them.
2020-11-14 13:48:37 +01:00
Lars Karlitski
c19231c44e mockbuild: remove the "latest" repo
This is not used anywhere and something we want to discourage: these
repos are meant for testing, and one ought to know what one tests
against.
2020-11-14 13:48:37 +01:00
Lars Karlitski
cb1823579a mockbuild: rename POST_MERGE_SHA
Jenkins has been configured to use the latest commit on a pull request
(instead of merging to master) for a long time now. Rename the variable
to reflect that.
2020-11-14 13:48:37 +01:00
Lars Karlitski
7228d79003 master → main 2020-11-14 12:03:31 +00:00
Lars Karlitski
ea7acf7051 schutzbot: drop RHEL 8.3 stages
RHEL 8.3 is already GA therefore we don't need to test it anymore!

Based on osbuild-composer 543f1f4 by Ondřej Budai <obudai@redhat.com>.
2020-11-14 12:03:31 +00:00
Christian Kellner
cd1f248dca util/jsoncomm: chain the BufferError in recv
Explicit re-raise the BufferError exception in recv from the orignal
JSONDecodeError, so the latter gets recorded as the underlying cause.

Uncovered by pylint 2.6.0: W0707: "Not using raise from makes the
traceback inaccurate, because the message implies there is a bug in
the exception-handling code itself, which is a separate situation
than wrapping an exception."
2020-10-30 17:28:31 +01:00
Christian Kellner
373f474769 loop: use python 3 style base class initialization
Use the canonical Python3 usage of "super" without any arguments.
pylint 2.6.0 started to actually warn about this.
2020-10-30 17:28:31 +01:00
Christian Kellner
d9168ee625 buildroot: continuously stream log data to monitor
All runners stopped calling `api.setup_stdio` (commit c40b414), and
thus all output of runners and also modules is now redirected to a
pipe (created via Popen and subprocess.PIPE for stdout).
Text was read from that pipe via `stdout.read(4096)`, which means
that it is now buffered in chunks of 4096, where it previously was
line buffered in the case that osbuild was run in the terminal and
--json was not specified. This is very annoying for anyone wanting
to follow osbuild's output in real-time.
Restore the previous behavior by using `os.read`, which should be
a small wrapper around read(3), which does not block until all the
requested data is available but returns early (short reads). This
means, new text will be forwarded as soon is it is available in the
pipe. Increase the read buffer to 32768 while at it, which is what
Popen is using in Python 3.9.
2020-10-28 14:28:07 +01:00
Lars Karlitski
f7949d9993 test: add test for osbuild executable
Add two simple tests to check that the osbuild executable fails with the
right exit codes when passed an invalid manifest or checkpoint.

This reuses test.OSBuild, which is extended to raise CalledProcessError
if needed.
2020-10-27 22:04:09 +01:00
Lars Karlitski
a5d4a8a926 osbuild: always return exit code
osbuild_cli() sometimes returned an exit code, but at the end called
sys.exit() directly. The idea was probably to always return the code
with which the executable should exit.

Make this consistent and call sys.exit() in __main__.py, with the value
returned by osbuild_cli().
2020-10-27 22:04:09 +01:00
Lars Karlitski
4c34b2c501 schutzbot: drop collecting AVC logs
This was never in osbuild-composer and fails CI when the log is empty.
2020-10-27 21:37:33 +01:00
Christian Kellner
afafd46393 23
This completes the development of osbuild version 23.
2020-10-23 16:29:50 +02:00
Christian Kellner
d047a89873 NEWS.md: update for osbuild version 23
Highlights are metadata fields are return for packages in the rpm
stage, the spec file has been fixed to not mangle shebangs anymore.
Generally, CI and testing has been improved.
2020-10-23 16:29:50 +02:00
Christian Kellner
61b4e5ef80 editorconfig: include markdown specifications
The markdown files in this project use spaces instead of tabs and
usually have an indent of 2.
2020-10-23 16:29:50 +02:00
Christian Kellner
0037e4bdf5 stages/rpm: document returned metadata
Document what metadata we return from the stage via the metadata
osbuild API.
2020-10-22 22:47:22 +01:00
Christian Kellner
452e9ddb9e stages/rpm: include sigpgp, siggpg in metadata
Return the SIGPGP, SIGGPG fields, if available, in the packages
metadata. This is needed for the koji integration.
2020-10-22 22:47:22 +01:00
Christian Kellner
f42f3d87e7 stages/rpm: remove duplicated line in docs
Left over from conversion of stage information to doc strings.
2020-10-22 22:47:22 +01:00
Christian Kellner
d9ae219e19 api: transfer metadata context via fd
Metadata information can easily become very big, like in the case
of the package metadata of the org.osbuild.rpm stage, quite likely
exceeding the configured maximum package length of the underlying
socket. To avoid potential issues here, transfer the actual data
by writing it to a temporary file and sending a open fd over.
2020-10-22 22:47:22 +01:00
Christian Kellner
7596bdf5e2 ci: start testing on Fedora 33
Now that Fedora 33 is about to be released and support is present
in composer, start testing it.
2020-10-22 19:49:59 +02:00
Christian Kellner
be0765a992 ci: drop testing Fedora 31
osbuild composer upstream has dropped support for Fedora 31 since
this is very close to end-of-life. Since we use composer master
in our CI this change actually broke it.
2020-10-22 19:49:59 +02:00
Christian Kellner
7081f43153 ci: use s3cmd from repositories instead of pip
s3cmd does not work properly with python 3.9 (used on Fedora 33):
  Problem: <class 'AttributeError: 'xml.etree.ElementTree.Element'
            object has no attribute 'getchildren'
  S3cmd:   2.1.0
  python:  3.9.0rc1 (default, Aug 12 2020, 00:00:00)

Use the one from the official repositories, which in case of F33
has a downstream fix for the error.

See rhbz#1884607 and s3tools/s3cmd#1137

Patch based on osbuild-composer commit 1a69a891 by Ondřej Budai.
2020-10-22 19:49:59 +02:00
Christian Kellner
d7d84a8eb1 test/mod: use proper host runner
Instead of hard-coding the use of the "org.osbuild.linux" runner,
use the new `osbuild.pipeline.detect_host_runner` function to
dynamically detect the runner for the host system. That should fix
the tests on RHEL systems, where python3 is by default not present
and even if it is manually installed, is an indirection via
alternatives (i.e. a link to /etc/alternatives), which must be
explicitly configured in the build root container for the host.
2020-10-21 11:13:28 +02:00
Christian Kellner
25662fbfbc test/buildroot: more lenient output test checking
In `test_output`, require that the test string is found in the
output, not equal to the output. Other warnings or log messages
might be printed by the runner.
2020-10-21 11:13:28 +02:00
Christian Kellner
9ef642228f test: adapt 'libdir' argument for BuildRoot's ctor
As of commit 1e3c0ae "unified libdir handling", the libdir argument
for the BuildRoot constructor is not a keyword argument anymore.
Adapt the argument accordingly.
2020-10-21 11:13:28 +02:00
Christian Kellner
e919f66609 pipeline: use osrelease.DEFAULT_PATHS
Use the newly defined constant that contains the well known paths
for where to look for `os-release` file.
2020-10-21 11:13:28 +02:00
Christian Kellner
807090f4c8 pipeline: introduce detect_host_runner helper
Extract the existing code that creates the runner for the host
build container into a small helper method, so it can be re-used
in other places, like the tests.
2020-10-21 11:13:28 +02:00
Christian Kellner
3010d247ea util/osrelease: add default os-release paths
Add a new `DEFAULT_PATHS` constant, a list of all well known paths
where `os-release` can be found, as per os-release(5).
2020-10-21 11:13:28 +02:00
Lars Karlitski
bb137837bb osbuild.spec: don't mangle shebangs
Stop the rpm post install script from mangling shebangs for runners,
stages, and assemblers on RHEL. This breaks running them in osbuild
build roots, which might contain a different operating system than the
host, and thus not have platform-python.

This was always the intended behavior, and cb265e8b5 was a step in that
direction.

In effect, this changes a requirement on build roots, because when
building RHEL on RHEL, all current stages and assemblers now have a
python3 shebang. Thus, this means all build roots must have python3
explicitly installed.

Fixes #354
2020-10-19 21:39:06 +02:00
Lars Karlitski
88aed72933 test/run/test_stages: respect OSBUILD_TEST_STORE
This environment variable is already used in test_objecttore.py. It's
useful for quick iteration while testing locally.
2020-10-19 17:37:46 +01:00
Lars Karlitski
78c251d332 test/data/stages/zipl: use mpp to generate manifests
Also, upgrade the test to fedora-32 from https://osbuild.org/rpmrepo.

Changed a.json to not include a zipl stage with empty options. This
breaks the test, because the osbuild run of b.json is relying on a
checkpoint of the result of a.json. If that's not present, the rpm
database (and other generated files) are marked as differing, because
the whole pipeline is generated again. This might have worked before,
because the previous package list happened to be deterministic.
2020-10-19 17:37:46 +01:00
Lars Karlitski
ec07482040 test/data/stages/users: use mpp to generate manifests
Also, upgrade the test to fedora-32 from https://osbuild.org/rpmrepo.
2020-10-19 17:37:46 +01:00
Lars Karlitski
8acadfc23e test/data/stages/systemd: use mpp to generate manifests
Also, upgrade the test to fedora-32 from https://osbuild.org/rpmrepo.
2020-10-19 17:37:46 +01:00
Lars Karlitski
064dd5fee0 test/data/stages/rpm: use mpp to generate manifests
Also, upgrade the test to fedora-32 from https://osbuild.org/rpmrepo.
2020-10-19 17:37:46 +01:00
Lars Karlitski
6f8f623918 test/data/stages/timezone: use mpp to generate manifests
Also, upgrade the test to fedora-32 from https://osbuild.org/rpmrepo.
2020-10-19 17:37:46 +01:00
Lars Karlitski
147a6a29fb test/data/stages/locale: use mpp to generate manifests
Also, upgrade the test to fedora-32 from https://osbuild.org/rpmrepo.
2020-10-19 17:37:46 +01:00
Lars Karlitski
a4da6e0041 test/data/stages/keymap: use mpp to generate manifests
Also, upgrade the test to fedora-32 from https://osbuild.org/rpmrepo.
2020-10-19 17:37:46 +01:00
Lars Karlitski
7aa8500174 test/data/stages/kernel-cmdline: use mpp to generate manifests
Also, upgrade the test to fedora-32 from https://osbuild.org/rpmrepo.

Changed a.json to not include a kernel-cmdline stage with empty options.
This breaks the test, because the osbuild run of b.json is relying on a
checkpoint of the result of a.json. If that's not present, the rpm
database (and other generated files) are marked as differing, because
the whole pipeline is generated again. This might have worked before,
because the previous package list happened to be deterministic.
2020-10-19 17:37:46 +01:00