Commit graph

1810 commits

Author SHA1 Message Date
Christian Kellner
d8a4f9d063 stages: add new org.osbuild.crypttab stage
New stage to configure /etc/crypttab to setup encrypted block devices.
See the documentation of the stage for more information.
2021-12-09 00:44:21 +00:00
Christian Kellner
2801c17730 stages: add new luks2 stage
New stage to initialize LUKS2 container on a given device, usually a
loopback device bound to a partition. The passphrase and uuid of the
container need to be specified. Optionally the cipher, label, sector
size and sub-label can be specified. Requires the cryptsetup binary
to be install in the build root.
2021-12-09 00:44:21 +00:00
Christian Kellner
0261b96e55 spec: split out lvm2 support into sub-package
The LVM2 support bits, especially the host service, depend on lvm2
tooling. Since not every user of osbuild may want to build images
with LVM2 split that out into its own sub-package and have that it
depend on LVM2.
2021-12-09 00:44:21 +00:00
Christian Kellner
4d9a0b3e9f [skip ci] ci: remove automerge again
Didn't work as expected. :(
2021-12-08 23:02:27 +01:00
Christian Kellner
f26ee9b7dd [skip ci] ci: do not require label for rebase
Allow automerge to update the PR without any labels present.
2021-12-08 16:56:20 +01:00
Christian Kellner
1a4d80447c make: require clean git for make make
Unexpected results otherwise.
2021-12-08 14:22:12 +01:00
Christian Kellner
6066407a89 [skip ci] ci: switch to using automerge
Instead of using merify which seems to not do what we want, use
a combination of mergify and automerge. We let mergify review
dependabot PRs. We let mergify dismiss reviews on updates but
exclude those from Schutzbot. We then let Schutzbot update and
merge the PRs via automerge if the `ci:automerge` label is set.
2021-12-08 14:13:43 +01:00
Christian Kellner
055b0203a0 [skip ci] ci: preserve reviews across rebase
Re-review the PR after rebasing it. Leave a message to make it
clear that it was not the impersonated person but mergify that
did it.
Ideally, if we had premium, we would impersonate Schutzbot so
it is clear who did it and then use mergify to dismiss reviews
on changes but not for Schutzbot.
2021-12-08 12:38:28 +01:00
Christian Kellner
eaa00884be [skip ci] ci: review PRs for dependabot
Instead of directly queuing it, just add an auto-review for
dependabot and then let the normal PR condition do its job.
2021-12-08 12:38:28 +01:00
Tomas Hozza
0df902d6bb sshd.config stage: support PermitRootLogin option
Add support for `PermitRootLogin` option in the
`org.osbuild.sshd.config` stage.

I kept the "yes" and "no" values for consistency with other stage
options. While it will make the implementation in osbuild-composer
harder, it won't be impossible as we already have a precedence for doing
it this way (e.g. in the `org.osbuild.pam.limits.conf`).

Modify the stage unit tests to check the new option.

Remove the empty `org.osbuild.sshd.config` stage from `a.mpp.json`
since it does not add any value and it actually made the `tree-diff`
tool provide a weird tree diff results.

Fix #910

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-07 15:20:50 +00:00
Christian Kellner
60066ee927 main_cli: refine the --stage-timeout help text
Clarify this timeout is per stage, not per image.
2021-12-07 09:47:01 +00:00
Christian Kellner
bd5b60a857 stages: remove org.osbuild.test.timeout
Was only used in `test_buildroot` and got replaced with a direct
call to `sleep`.
2021-12-07 09:47:01 +00:00
Christian Kellner
3958a6140c test/buildroot: test timeout at the run level
Check the timeout functionality at the `Buildroot.run` level not at
the `read_with_timeout` level, which is an implementation detail.
2021-12-07 09:47:01 +00:00
Christian Kellner
73dd612cad pipeline: fix small whitespace issue
David, where are you? Gotta do all those myself now.
2021-12-07 09:47:01 +00:00
Christian Kellner
70634d7578 pipeline: rename stage_timeout in Stage.run
Rename the `stage_timeout` paramter for the `Stage.run` method to
just `timeout`. It is clear from the context that this is the
stage timeout now.
2021-12-07 09:47:01 +00:00
Christian Kellner
fdf3160f49 buildroot: small whitespace fix
Introduce a newline. David, we miss you.
2021-12-07 09:47:01 +00:00
Christian Kellner
c434d7bea2 buildroot: rename stage_timeout to timeout
The build root does not know anything about stages; the stage
concept is one level higher. Therefore rename `stage_timeout`
to `timeout` in the buildroot.
2021-12-07 09:47:01 +00:00
Christian Kellner
daf578b2f1 [skip ci] ci: reviews only for queuing
Require reviews to get into the queue, not out of it.
2021-12-06 23:29:47 +01:00
Christian Kellner
410c047c14 [skip ci] ci: remove label _after_ pr is merged
Don't try to do it in the same action as otherwise the bot will
refuse to actually add it to the queue.
2021-12-06 23:05:30 +01:00
Christian Kellner
a3dc87bd76 [skip ci] ci: accept LGTM neutral (mergify)
Neutral is also ok.
2021-12-06 22:15:12 +01:00
Christian Kellner
0bff008922 [skip ci] ci: don't require branch protection
For dependabot we dont want it anyway (but it is true by default).
Also remove it for "merge via auto-label", so that once all the
conditions are met the PR is queued and the label is removed.
Currently the queuing might not happen because the branch protection
is not met. Therefore we make the condition explicit and remove the
branch protection.
2021-12-06 20:42:38 +01:00
Christian Kellner
43d4b3cf45 ci: initial mergify configuration
Define a merge queue "default", with all current checks (minus the
ostree one) are required to get out of.
Two rules to get into the queue: 1) standard branch protection,
plus packit, plus the ci:automerge
2) dependabot, does not require the standard branch protection
since that implies reviews. Instead the checks are manually
listed.
2021-12-06 17:44:31 +01:00
Christian Kellner
2129f3d68b test/osbuild: add order check for on_demand
Add a check that ensures the order of inputs to `depsolve` is
preserved in the result.
2021-12-03 17:09:33 +00:00
Christian Kellner
b8fb1ec1e9 mounts/ostree.deployment: initialize fields
Initialize `mountpoint` and `check` fields. In case of an error
in `open` not having `mountpoint` or `check` initialized will
cause another exception. So this is mostly important in case of
error, but it is the right thing anyway.
2021-12-03 17:09:33 +00:00
AaronH88
99c739fd60 test: test buildroot read_with_timeout function
- Added a new stage that is stuck in an infinite loop
- Added two tests that use this stage and force a timeout
2021-12-03 14:29:36 +00:00
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