Commit graph

1079 commits

Author SHA1 Message Date
Christian Kellner
4ab52c3764 formats: move pipeline description here
The description of a pipeline is format dependent and thus needs
to be located at the specific format module.
Temporarily remove two tests; they should be added back to a format
specific test suit.
2021-01-09 18:09:47 +01:00
Christian Kellner
a13783f67b formats: load function takes combined manifest
Instead of having the pipeline and the source option as separate
arguments, the load function now takes the full manifest, which
has those two items combined.
2021-01-09 18:09:47 +01:00
Christian Kellner
0b6f36158d osbuild: use load function via the format module
Instead of importing the load, load_build functions into the osbuild
namespace and using it via that, use the load function via the module
that provides them, i.e. the formats.v1 module.
2021-01-09 18:09:47 +01:00
Christian Kellner
b65211a94d formats/v1: move validation logic here
The validation of the manifest descritpion is eo ipso format
specific and thus belongs into the format specific module.
Adapt all usages throughout the codebase to directly use the
version 1 specific function.
2021-01-09 18:09:47 +01:00
Christian Kellner
b49ee53d0a formats/v1: add type hints
Add type hints to most arguments and return types to aid editors
and type checking.
2021-01-09 18:09:47 +01:00
Christian Kellner
aaf61ce9fc formats: extract manifest loading into module
Extract the code that loads a pipeline from a pipeline description,
i.e. a manifest, into a new module inside a new 'formats' package.
The idea is to have different descriptions, i.e. different formats,
for the same internal representation. This allows changing the
internal representation, i.e. data structures, but still having the
same external description.
Later a new description might be added that better matches the new
internal representation.
2021-01-09 18:09:47 +01:00
Christian Kellner
40a716d3ce docs: include note about skipping the build
Add a note explaining that osbuild will not attempt a build at all
if neither --output-directory nor --checkpoint is given.
2020-12-15 13:12:01 +01:00
Christian Kellner
c466b40e14 cli: remove --source command line option
This was deprecated in favor of always having the source in the
manifest. Remove the command line option and the corresponding
code that would override the sources definitions.
Update the docs accordingly.
2020-12-15 13:12:01 +01:00
Christian Kellner
e85d340cd8 ci: send coverage data to codecov
Integrate with codecov. Define a threshold of 5% to pass. Coverage
is cumulative, i.e. all the tests send their coverage to codecov,
which will integrate them all into a total.
2020-12-10 16:14:37 +01:00
Ondřej Budai
b603641a99 runners: add CentOS 8 runner
This runner is used by both CentOS 8 and CentOS Stream. CentOS is kinda weird
because it specifies only number 8 in VERSION_ID in /etc/os-release unlike
RHEL. Also the ID is the same for CentOS 8 and CentOS Stream.

This should work fine for now though:
CentOS 8 is currently based on RHEL 8.3 and CentOS Stream on devel version of
RHEL 8.4. For both RHEL 8.3 and 8.4 we use the RHEL 8.2 runner so it should be
safe to assume that it's OK to base the CentOS 8 runner also on the RHEL 8.2
one.

We might need to tweak this at some point but I suggest dealing with it when
that time comes.
2020-12-09 11:50:48 +01:00
Christian Kellner
0c53e55753 ci: use pytest to test
This has nicer output and will make adding coverage easy in the
near future.
2020-12-04 18:24:48 +01:00
Christian Kellner
7a745e4084 Makefile: use pytest for nicer output
Also prepare to actually use the pytest module from the tests.
2020-12-04 18:24:48 +01:00
Christian Kellner
27d4450352 pipeline: don't create "/run/osbuild" eagerly
The "/run/osbuild" path is used as the default runpath by the
BuildRoot, which creates it on demand. The only other place
is the API (`BaseAPI`) to create the socket directories in,
but that is now also created on-demand. Additionally, the
API are only run after the build root has been set up so that
directory would already exist.
2020-12-04 12:28:30 +01:00
Christian Kellner
35149c6aec api: ensure parent of socket dir exists
When creating the socket directory, i.e. in the case that it was
not specified directly, ensure the parent directories exist.
Make it possible to override that parent directory.
2020-12-04 12:28:30 +01:00
Christian Kellner
ea3dad17fc test/sources: skip if net namespace setup fails
Try to check if we can setup the net namespace and if that fails
skip the test.
2020-12-04 12:28:30 +01:00
Christian Kellner
83aa4a29df test/boot: skip unless we can bind mount
We need to be able to bind-mount in the boot tests, so skip all of
those if we can't (because we are not root).
2020-12-04 12:28:30 +01:00
Christian Kellner
18fc8aa85e test/stages: skip unless we can bind mount
We need to be able to bind-mount in the stages tests, so skip all
of those if we can't (because we are not root).
2020-12-04 12:28:30 +01:00
Christian Kellner
ef5875e1f4 test/assemblers: skip unless we can bind mount
We need to be able to bind-mount in the assembler tests, so skip
all of those if we can't (because we are not root).
2020-12-04 12:28:30 +01:00
Christian Kellner
94cc2cb5a7 Makefile: fix phony declaration for module tests
There is no "test-units"; the correct name is "test-module".
2020-12-04 12:28:30 +01:00
Christian Kellner
b7ae7a01c6 objectstore: fix typo in comment
It is "already" not "alreday".
2020-12-04 12:28:30 +01:00
Christian Kellner
83caf800e5 spec: only disable the dep. generator for runners
We do want to turn the dependency generator off for runners,
because they are tied to the specific platform, which might, if
not disabled, introduce dependencies for that platform to the
general package. An prominent example is platform-python used
by the RHEL runner.
On the other hand, we do want to pick up the dependency for the
stages and assemblers, i.e. /usr/bin/python3, because they need
to be able to run on the host, since the host provides the root
file-system for the initial build container, the build host.
Add an additional comment to the shebang mangling exception to
explain that due to the combination of dependency generator and
the disabling of shebang mangler for assembler and stages an
additionally dependency on /usr/bin/python3 will be added on RHEL,
and that this is what we indeed want.
2020-11-23 15:30:33 +01:00
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