Commit graph

1093 commits

Author SHA1 Message Date
Tomas Hozza
a860652ae1 Makefile: mark '$(TEST_MANIFESTS_GEN)' target as .PHONY
Mark '$(TEST_MANIFESTS_GEN)' target as .PHONY.

Currently the `test-data` make target does not always trigger
regenerating of manifests used for testing various osbuild parts,
although it is marked as .PHONY. The reason that its dependency
'$(TEST_MANIFESTS_GEN)' is not marked as .PHONY and therefore it is not
run if the files already exist in repository.

Due to the above reason, CI is actually running `make --always-make
test-data` to always regenerate manifests.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-01-15 13:57:49 +01:00
Christian Kellner
262877091f osbuild: flatten the pipeline
Instead of having build pipelines nested within the pipeline it is
the build pipeline for, the nested structure is transferred into a
flat list of pipelines. As a result the recursion is gone and all
the pipelines and trees are build one after the other. This is now
possible since floating objects are kept alive by the store itself
and all trees that are being built are transparently via them.
The immediate result dictionary changed accordingly. To keep the
JSON output of osbuild the same, the result is now routed through
a format specific converter.
Additionally, the v1 format module gained a function to retrieve
the global tree_id and output_id. With the new models those global
ids will go away eventually and thus need to go through the format
specific code.
2021-01-15 13:20:31 +01:00
Christian Kellner
54761e8a13 pipeline: introduce generic pipeline id
This is a step towards generic pipelines, i.e. replacing assemblers
with pipelines, thus creating an acyclic graph of pipelines. There
the pipeline id will be what is now the tree_id. For now though the
generic id is either the output_id or the tree_id.
2021-01-15 13:20:31 +01:00
Christian Kellner
76e72b1c3f objectstore: keep strong reference of objects
The objectstore always tracked all objects that were returned from
it, but it did so via weak references, which means it did not keep
the objects alive itself. With the introduction of identifiers for
temporary objects (floating objects), it makes sense to keep all
created objects alive so that they can in fact be used.
2021-01-15 13:20:31 +01:00
Christian Kellner
e5b12e55f4 objectstore: transparant access for floating objs
A "floating" object is a temporary object that is identified, i.e.
has an `id` and is thus also locked, but is not committed to the
store.
The `contains` and `get` methods of ObjectStore will now return such
floating objects as if they were committed ones, provind transparent
access to object that have been built during the exectuin of osbuild.
2021-01-15 13:20:31 +01:00
Christian Kellner
e24dfbd23f pipeline: don't use a non-existing base for trees
The current pipeline code used to set a base for a tree object
that might or might not exist. Depending on it it would either
use that object or reset its base. Avoid doing that because it
prohibits us from properly interpreting the `id` of an object
if the latter is also set when `base_id` is assigned, since
that base might not exist and thus the `id` would not actually
mean that the the contents of tree associated with the object.
Therefore we use `ObjectStore.get` and return the result if it
is not None or a fresh Object otherwise.
2021-01-15 13:20:31 +01:00
Christian Kellner
b039761544 pipeline: identify tree objects during build
Every time a stage has been successfully built, the contents of
the tree now corresponds to the stage and can thus be identified
via the id of the stage.
When the tree is being written to, i.e. on consecutive attempts
of stage builds, the `id` of the tree object will automatically
be reset.
2021-01-15 13:20:31 +01:00
Christian Kellner
f7bcec60f4 objectstore: make objects identifyable
This adds a new `id` property to the ObjectStore.Object, that is
meant to reflect the identifer of the Stage to build the contents
of it. This will help to transparently access objects that have
been built but not committed to the store.
Setting the `base_id` of an object will also set its `id`. When
the object is then modified via write() the `id` will be set to
None, since no the content and the id are out of sync. In the
same way, restting an object will reset its `id` to None.
2021-01-15 13:20:31 +01:00
Christian Kellner
a8783761a1 pipeline: don't eagerly clean up the final object
The object in question will be cleaned when the store goes out of
context, which happens soon after the manual cleanup anyway and
the eager cleanup does not gain us much.
More importantly, it removes the special case for the assembler
output object, since trees build by the stages are not cleaned
up manually already.
2021-01-15 13:20:31 +01:00
Christian Kellner
f38c48086e pipeline: run method takes store object not dir
Instead of passing the store directory to Pipeline.run, pass an
already initialized ObjectStore object. This binds the lifetime
of the store and its (temporary) objects to the run of osbuild
not the run of the pipeline.
This prepares re-using the stores with multiple (non-nested)
pipelines.
2021-01-15 13:20:31 +01:00
Christian Kellner
8d2c7f8160 osbuild: move mark_checkpoints to manifest
Make the checkpoint marking logic a method of the Manifest class.
2021-01-09 18:09:47 +01:00
Christian Kellner
d25936a028 formats: describe now takes a manifest
Instead of a pipeline, describe now takes a Manifest instance.
The reason is that a manifest fully describes the build, which
includes the sources. Now that the describe function takes the
manifest, the sources can be included as well.
Adapt the tests to refelect that change.
2021-01-09 18:09:47 +01:00
Christian Kellner
945914b195 osbuild: introduce Manifest class
The 'Manifest' class represents what to build and the necessary
sources to do so. For now thus it is just a combination of the
pipeline the source options.
2021-01-09 18:09:47 +01:00
Christian Kellner
acef7aa4a9 main_cli: rename manifest → desc
Prepare for having a dedicate manifest class by renaming the
description of the manifest in a given format to "desc".
2021-01-09 18:09:47 +01:00
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