Commit graph

1785 commits

Author SHA1 Message Date
AaronH88
cd8f8681ad osbuild: added a configuable timeout for package installation
Also added new command line option for setting the timeout in milliseconds
2021-12-03 14:29:36 +00:00
Jelle van der Waa
76c1b5cf25 osbuild-mpp: ConstructorError was undefined
ConstructorError is part of the yaml.constructor module.
2021-12-02 17:33:46 +01:00
Jelle van der Waa
03af8c632a osbuild-mpp: Apply autopep8
Make the code confirm to PEP8.
2021-12-02 17:33:46 +01:00
Christian Kellner
9c0ae8d9d2 osbuild: enable download only mode
Remove the constraint that either checkpoints or the output directory
has to be supplied on the command line. Now that we have `--export`
and on-demand building it is perfectly fine to supply neither an output
directory nor checkpoints and implicitly no --export` which corresponds
to a download only mode.
2021-12-02 12:51:30 +00:00
Christian Kellner
29f2a68eeb osbuild: on-demand building of pipelines
Use the new Manifest.depsolve function to only build the pipelines that
were explicitly requested and their dependencies, taking into account
what is already present in the store.
Since now not all pipeline will be built, there wont be a result entry
for all the pipelines, thus the format version 2 result formatting was
changed to not require the pipeline to be present in result set.
2021-12-02 12:51:30 +00:00
Christian Kellner
749912c75a manifest: implement pipeline depsolving
New function that take a list of pipelines and return the list of
pipelines that need to be build, i.e. the pipelines and all their
dependencies that are not already present in the store.
Add corresponding test.
2021-12-02 12:51:30 +00:00
Christian Kellner
a2404c9ec9 formats/v1: propagate build pipeline status
When formatting the the result, switch the default to success,
but then properly propagate the status of the build pipeline.
This should ensure that if there are no pipeline results but
a failed build pipeline, the overall status will be 'failed'.
On the other hand, if no pipelines were built, including tree
or build, the overall status will be 'success'.
2021-12-02 12:51:30 +00:00
Christian Kellner
8770bdf10a formats/v1: remove implicit assembler export
When building a version 1 manifest, the assembler would always be
exported, even when not requested via the `--export` command line
option. This was done for backwards compatibility so to not break
tools relying on that behavior. The problem is that support for
this uses a completely different code path and might also now be
confusing behavior. Thus remove the implicit and really only ever
export what was explicitly requested by the caller.
2021-12-02 12:51:30 +00:00
Christian Kellner
17136a70e4 cli: check if exports are valid early
Instead of building everything and then failing if an export is
invalid and could not be found, resolve the exports early and
also ensure that if `--export` is given, `--output-directory`
is present too.
2021-12-02 12:51:30 +00:00
Christian Kellner
80414299cd test/stages: export tree and compare that
Instead of checkpointing the tree and then accessing the generated
tree inside the store via the `map_object` function we not just
export the tree and use that. This better hides the internals of
the store and also allows us to activate on-demand building that
does not rely on checkpoints being implicitly built like exports.
2021-12-02 12:51:30 +00:00
Christian Kellner
d502157d7e test/stages: ensure we always have a tree
Ensure that all our stage tests always have at least one stage,
even it is just a `noop` stage, so that we can checkpoint and
export the `tree`.
2021-12-02 12:51:30 +00:00
Christian Kellner
7ae4a7e785 test: use and require explicit exports
Require all the tests that compile a manifest to either specify
checkpoints or exports. Convert all the tests that were relying
on implicit exports with v1 manifests to use explicit exports.
2021-12-02 12:51:30 +00:00
Ondřej Budai
22d1d46ec1 schutzbot: drop send_webhook.py script
It was used to trigger Jenkins but nowadays, it's useless.
2021-12-02 12:03:51 +00:00
Christian Kellner
7a923efb1d util/rmrf: handle broken symlinks
The current implementation of `rmtree` will try to fix permissions
when it encounters permission errors during its operation. This is
done by opening the target via `os.open` and then adjusting the
immutable flag and the permission bits. This is a problem when the
target is a broken symlink since open will fail with `ENOENT`. A
simple reproducer of this scenario is:
  $ mkdir subdir
  $ ln -s foo subdir/broken
  $ chmod a-w subdir/
  $ python3 -c 'import osbuild; osbuild.util.rmrf.rmtree("subdir")'

Since subdir is not writable, removing `subdir/broken` will fail
with `EPERM` and the `on_error` callback will try to fix it by
invoking `fixperms` on `subdir/broken` which will in `open` since
the target does not exist (broken symlink).

This is fixed by using `O_NOFOLLOW` to open so we will never open
the target. Instead `open` will fail with `ELOOP`; we ignore that
error and in fact we ignore now all errors from `open` since it
does not matter: if fixing the permissions didn't work `unlink`
will just fail (again) with `EPERM` and for symlinks it actually
doesn't matter since "on Linux the permissions of an ordinary
symbolic link are not used in an operations", see symlinks(7).
2021-12-02 11:38:30 +01:00
achilleas-k
9ec635914a Post release version bump
[skip ci]
2021-12-01 13:18:53 +00:00
Christian Kellner
36356342b0 buildroot: mask /proc/cmdline
Since we bind `/proc` inside the container, we leak certain information
that comes with it. One of this is the kernel command line. None of the
decisions done by software running inside the container should depend
on the kernel command line on the host, so overwrite the kernel command
line by creating a temporary directory and mapping it inside the build-
root. For now we default to a simple `root=/dev/osbuild` fake kernel
command line.
Add a simple check for it as well.
2021-11-30 12:01:13 +01:00
Christian Kellner
4c54f7e4a6 test/buildroot: convert to pytest
Semantics should be unchanged.
2021-11-30 12:01:13 +01:00
Christian Kellner
7846fa592b buildroot: create var inside a generic temp dir
Instead of having a temporary directory on the host for `/var` inside 
the container, create a generic temporary directory that can be used
for other things and create the `var` inside that.
2021-11-30 12:01:13 +01:00
Jelle van der Waa
9d7d952ddf stages/grub2.inst: Make grub-mkimage binary configurable
On Arch Linux grub-mkimage is provided by the `grub` package which is
grub2 and grub (1) no longer exists.
2021-11-29 20:28:44 +01:00
Jakub Rusz
8d67396ff3 tests: enable testing on aarch64 RHEL
Also update osbuild-composer version.

debug: skip openstack boot on aarch64
2021-11-29 14:46:09 +01:00
Jelle van der Waa
1b797dfcff gitignore: Ignore generated man pages 2021-11-26 19:39:42 +00:00
Christian Kellner
0fec32e079 stages/ostree.fillvar: fill the correct var
The idea behind the stage is to provision `var` of the stateroot,
i.e. the `var` the is shared amongst all deployments for a given
os (indicated by `osname`, e.g. `fedora`, `centos`, ...).
For `systemd-tmpfiles` to infer the correct paths, it needs to be
run on the deployment. The `var` of the latter needs to be bind-
mounted to the `var` of the stateroot, because it is shared. This
was always the intention but not what the code did. Fix this by
getting the `var` of the stateroot and bind it to the `var` of
the deployment.
NB: In reality this never mattered since systemd-tmpfiles is also
run during system startup.
2021-11-26 17:20:11 +01:00
Alexander Larsson
eefc52333e osbuild-mpp: Allow mpp-define-image nodes to use formating
We just process the formats after removing the mpp node, just like
we do in e.g. mpp-depsolv.
2021-11-26 11:51:42 +00:00
Alexander Larsson
4901e97236 osbuild-mpp: Allow included files to define partitions too 2021-11-26 11:51:42 +00:00
Alexander Larsson
ba8bc3a60a osbuild-mpp: Support nested includes
This moves the handling of includes to the manifest loader, thus
supporting nested includes. search_dirs is moved to a property of the
Manifest so that it can be tracked during loads.

In addition we need to fix Manifest.path to the actual path that was
loaded instead of whatever the parent include said, so that relative
includes are handled from the proper location of the loaded manifest.
2021-11-26 11:51:42 +00:00
Alexander Larsson
12335f9e5f osbuild-mpp: Be more careful about keys existing
In process_embed_files(), it assumed that a stage had a "type" field,
which breaks if a stage is e.g. a `mpp-if` node, so use .get() instead
of raw dict lookups.
2021-11-26 11:51:42 +00:00
Alexander Larsson
bfa619f1a2 osbuild-mpp: Fix default value for ManifestV2.pipelines
This should be [], not {}. This  was probably from copying the V1
value which is {} (for `pipeline`).
2021-11-26 11:51:42 +00:00
Alexander Larsson
29ecb1df67 osbuild-mpp: Support mpp-pipelines to include all or a subset of the pipelines
This makes a lot of sense, as some include could be built in a way the
includer doesn't know about that requires sub-pipelines.
2021-11-26 11:51:42 +00:00
Jakub Rusz
180e853c23 mockbuild: remove beta from rhel-9 template
Beta is out already, switch template to RHEL-9.
2021-11-24 13:26:54 +01:00
Jakub Rusz
de94251a32 ci: switch to rhel-9 runners
RHEL-9-Beta is no longer being developed. Switching to RHEL-9 instead.
Currently testing is not run there because of issues linked in the
comment.
2021-11-24 13:26:54 +01:00
Christian Kellner
d2d3d6d59e spec: require python3-pyyaml for osbuild-tools
osbuild-mpp has learned to read yaml files but with it gained a
hard dependency on python3-pyyaml. Specify so in the spec file.
2021-11-19 21:14:06 +01:00
Alexander Larsson
52c3cb12ba osbuild-mpp: Support loading yaml as well as json files
yaml files are essentially compatible with json files, although
they have some advantages, like allowing comments and being easier
for humans to read/write.

This changes the reading of the file to use a yaml parser instead of
a json parser, but still produces json at the end. I tried manually
converting a json file to yaml and running osbuild-mpp, and it produced
an identical file.

By default the yaml parser doesn't respect order so i had to tweak
the loader a bit to use OrderedDict.
2021-11-19 13:35:12 +01:00
Christian Kellner
04423e8a6a ci: update to latest osbuild ci image
Needed to get `cryptsetup` package needed for testing the luks2
related stages and devices.
2021-11-19 00:19:05 +00:00
Christian Kellner
bf655b9464 setup: disable new pylint warnings
For now disable some new warnings from pylint:
    - `consider-using-from-import`
    - `consider-using-with`
It probably makes sense to re-enable these in the future but
for now lets keep the code as is.
2021-11-19 00:19:05 +00:00
Christian Kellner
03232f1899 test/stages: basic gunzip stage test
Add a simple check for the new `org.osbuild.gunzip` stage.
2021-11-19 00:16:04 +00:00
Alexander Larsson
079598fa4f osbuild: Add org.osbuild.gunzip stage
This stage the same args and formats as org.osbuild.untar (and as such
much code is just copied from that stage), except it runs gunzip
instead.  I need this to uncompress the aarch64 kernel when directly
uefi-booting it.
2021-11-19 00:16:04 +00:00
Alexander Larsson
10333fa8ba osbuild-mpp: Report the path of the json file when parsing fails
This makes it a lot easier to understand failures when files are
including other files.
2021-11-18 21:00:13 +01:00
Ondřej Budai
d1ad772284 packit: enable copr builds for CS9 on main
I forgot to enable CS9 builds on main previously, let's fix that.
2021-11-18 19:46:46 +01:00
Christian Kellner
ac529563c3 test: use new mpp-embed in tests
This is to showcase it as much as to test its functionality. For this
the tar and xz stage tests have been converted. NB: only the mpp file
for each test is changed but the corresponding manifest is not.
The `sources/org.osbuild.inline` section has been kept otherwise the
ordering in the result manifest would change.
2021-11-18 13:41:06 +01:00
Christian Kellner
15759dd205 tools/osbuild-mpp: add ability to embed data
Add a new pre-processor directive to MPP that allows to define
`org.osbuild.inline` sources on the fly by embedding data or
files into the manifest.
2021-11-18 13:41:06 +01:00
Christian Kellner
22e670050f osbuild-mpp: extract finding files and opening
Extract the code that finds a file and opens it from the existing
method that find manifests and opens them. This is so that the
former code can be re-used.
2021-11-18 13:41:06 +01:00
Alexander Larsson
ffdbdf6235 osbuild-mpp: Support mpp-if
This allows optional manifest json values like "if blah, add stage foo",
or selecting between possible nodes, "if blah, stage is foo, else bar".
2021-11-18 11:33:57 +01:00
Alexander Larsson
04d880852a osbuild-mpp: Break out helper function
This breaks out the fakeroot handling used to rewrite a single node.
We'll use this in some new cases later.
2021-11-18 11:33:57 +01:00
kingsleyzissou
7fe8b922b4 Post release version bump
[skip ci]
2021-11-17 10:53:44 +00:00
Ondřej Budai
332e83b5cc packit: enable copr build for CS9 2021-11-15 18:40:00 +00:00
Christian Kellner
280aca8f07 test/lvm2: use LoopControl.loop_for_fd
Instead of having custom code that basically duplicates the
functionality of `LoopControl.loop_for_fd` use that instead.
Additionally, the version used in the test had a bug where
it did not re-create the Loop device in the main loop when
it was close due to an error, leading errors in subsequent
usages of the device that would often manifest in CI runs:
  fcntl.ioctl(self.fd, self.LOOP_SET_FD, fd)
  ValueError: file descriptor cannot be a negative integer (-1)
2021-11-12 17:40:00 +01:00
Simon Steinbeiss
2e9ffaf517 packit: Use upstream github release description
Setting this option enables packit to use the Github upstream release
description for the specfile instead of just using all commit messages.
2021-11-11 00:54:33 +00:00
ochosi
40bc216127 Post release version bump 2021-11-08 20:40:13 +00:00
Tom Gundersen
f7bf23faba stages/authconfig: run authconfig
This applies the default authconfig settings to the tree.

Note that the `/backups` directory is removed. The tool creaset
this, and by default it should not exist, so this should be a
noop. However, if you run this on a tree with existing backups,
they would be lost.
2021-11-08 20:43:51 +01:00
Ondřej Budai
306fd3ed96 stages/yum.config: add an option to configure langpacks plugin
The new stage enables users to configure the langpacks plugin of YUM.
Currently, only locales option is supported.
2021-11-08 17:17:02 +01:00