Commit graph

1030 commits

Author SHA1 Message Date
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
Lars Karlitski
c2cec04b7c test/data/stages/hostname: 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
ac02b79222 test/data/stages/groups: 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
3554575659 test/data/stages/fstab: 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
8904398b50 test/data/stages/firewall: 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
49d1c09653 test/data/stages/copy: 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
abaa49b8ae test/data/stages/chrony: 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
8110e69d4a Makefile: also convert %.mpp.json in stage tests
Stage tests (test/run/test_stage.py) currently use hard-coded pipelines
from `test/data/stages`. These could benefit from the mpp tools to make
them easier to understand and update to newer versions of Fedora.

Future commits will do so.
2020-10-19 17:37:46 +01:00
Lars Karlitski
651c5b5461 tools/mpp-depsolve: make use of dnf's per-user cache
Use dnf's per-user cache when `--dnf-cache` is not given. This speeds up
repeated invocations of `mpp-depsolve` considerably, without having to
specify a cache location.
2020-10-19 17:37:46 +01:00
Lars Karlitski
792b2ac5fc tools/mpp-depsolve: ensure canonical urls
Technically, a few extra "/"s don't matter, but in practice, it
sometimes does. In particular, rpmrepo returns `500 Internal Server
Error` when a path contains additional "/"s.
2020-10-19 17:37:46 +01:00
Lars Karlitski
423e38cf5d tools/mpp-depsolve: also support baseurl and mirrorlist repositories 2020-10-19 17:37:46 +01:00
Lars Karlitski
2066d0fb3b test: switch to rpmrepos' repository snapshots
These are more stable, and closer to where the tests are run (in the
same AWS region).

https://www.osbuild.org/rpmrepo/
2020-10-19 17:37:46 +01:00
Lars Karlitski
d9ef44eb6d test: rename mpp-*.json to *.mpp.json
This simplifies the `test-data` rules in `Makefile` considerably. Also,
it allows adding `*.mpp.json` files in other directories without needing
to copy rules. (make's pattern-based rules only allow a single `%`).

Adjust test/data/README.md accordingly.
2020-10-19 17:37:46 +01:00
Christian Kellner
c11459c626 22
This completes the development of osbuild version 22.
2020-10-09 15:41:24 +02:00
Christian Kellner
e268f33dae NEWS.md: update for osbuild version 22
Highlights are a new RHEL 8.4 runner as well as a new internal
API for structured logging of exceptions in modules.
2020-10-09 15:41:24 +02:00
Christian Kellner
3318480460 test/stages: re-use downloaded files between runs
Create a cache directory with the scope of the stage test suit and
after each test is run cache the downloaded files for the `files`
source via the new `OSBuild.copy_source_data` method. Initialize
OSBuild with that cache directory, so previously downloaded files
get used between different stage tests.
2020-10-09 15:32:31 +02:00
Christian Kellner
9e5e179128 test: add method to copy source data from cache
Add a new method that will copy the downloaded data for a specified
source to a directory, creating a directory structure so that the
target directory can then be used to initialize the osbuild cache,
i.e. the target directory be used for the `cache_from` parameter in
the `test.OSBuild` constructor.
The main reason why this is done per source, and not for all sources,
is that not all source can be copied via a plain `cp` operation or
easily added to, in case that the `target` directory already contains
data. The `org.osbuild.ostree` source is such an example.
2020-10-09 15:32:31 +02:00
Christian Kellner
0e6b4749f7 runner: use osbuild.api.exception_handler
Wrap all calls to the various setup functions in the new exception
handler provided by `osbuild.api`. This will make sure that any
exception is properly printed to stderr, as well as communicated
to osbuild in a structured and machine readable way.
2020-10-09 10:47:44 +02:00
Christian Kellner
71f7bf8930 test/api: assert return code for api.exception
Check that the exit code for `api.exception`, called via the
`api.exception_handler` helper, is the correct one.
2020-10-09 10:47:44 +02:00
Christian Kellner
aaa51e22a6 api: properly serialize the exception's traceback
Use `traceback.print_tb()` to serialize the exceptions' backtrace.
The previously used expression `str(e.__traceback__)` will just
give `<traceback object at 0x…>`, which is not very helpful.
Add a test to check that the method name that raises the exception,
also called `exception`, is in the traceback.
2020-10-09 10:47:44 +02:00
Christian Kellner
7a112c27cb test/api: fix white-space error
No double space between class methods, so say the scriptures.
2020-10-09 10:47:44 +02:00
Christian Kellner
f8de164413 api: properly encode exception type
When using `str(type(exception))` this ends up to be something like
`<class 'ValueError'>` for a `ValueError` exception. Get the vanilla
name of the exception type via `type(exception).__name__`.
Add a test to ensure that we encode this properly.
2020-10-09 10:47:44 +02:00
Christian Kellner
f5d00dd043 api: use more generic error member for exceptions
Rename the `API.exception` member to `API.error`, to make it more
generic, so it can also be used for other sort of errors in the
future. Also add a layer of additional structure with `type` and
`data` members so different types of errors apart. Currently only
`exception` is used.
Adapt the tests in test/mod/test_api.py to check for the new
structure and its content.
2020-10-09 10:47:44 +02:00
Christian Kellner
17fbe41b03 test/api: check api.exception exits the process
The `api.exception` method, which is internally also used by
`api.exception_handler` helper, calls `sys.exit` and this no
statement after a call to either method should be reached.
Add an assertion to make sure of that.
2020-10-09 10:47:44 +02:00
Christian Kellner
78d72eded9 api: whitespaces fixes
No semantic change, just more spaces between functions to make it
more PEP-8 compliant.
2020-10-09 10:47:44 +02:00
Lars Karlitski
938f2e0ba8 schutzbot: enable EPEL in RHEL
The osbuild-composer-tests package recently started to list its actual
dependencies, which include packages from EPEL. Enable EPEL in
deploy.sh.

Based on this patch by Ondřej Budai <obudai@redhat.com>:

  https://github.com/osbuild/osbuild-composer/pull/1022
2020-10-08 11:22:18 +02:00
Christian Kellner
2902d0945b ci: check spelling via codespell
Use the github action[1] provided by the codespell project to
check the spelling on every PR.

[1] https://github.com/codespell-project/actions-codespell
2020-10-06 14:41:00 +02:00
Christian Kellner
cbcb335b3e osbuild: fix spelling mistakes found by codespell
Run codespell on the source ('codespell -f -L msdos -S coverity
-S rpmbuild -S samples') and fix all uncovered mistakes.
2020-10-06 14:41:00 +02:00
Jacob Kozol
549499d2fb runners: add rhel 84
A runner for rhel 8.4 is added. This runner is a sym link to the rhel82
runner as was done for the rhel83 runner.
2020-10-05 18:20:14 +02:00