Commit graph

400 commits

Author SHA1 Message Date
Gianluca Zuccarelli
9cd8fc979b test: fix broken oscap remediation tests
The oscap remediation tests broke with 810a48d. This commit adds the
fixes to get the GitHub actions to go green again.
2023-11-24 14:28:34 +00:00
Simon de Vlieger
e7db40831f test: stage tests -> stage integration tests
Quick rename to have our wording be in-line with the new differences
between stage unit tests and stage integration tests; also being applied
to the guides.
2023-11-24 13:58:04 +01:00
Miguel Martín
f3d740aaf8 stages: add org.osbuild.update-crypto-policies stage
This stage calls `update-crypto-policies` to set the
policy applicable for the various cryptographic back-ends,
such as SSL/TLS libraries.

Signed-off-by: Miguel Martín <mmartinv@redhat.com>
2023-11-15 17:15:10 +01:00
Dusty Mabe
0529ae79d1 tests: add metal output to fedora-coreos-container manifest
Also switch the qcow2 output to be a "qemu" platform image. This
change takes advantage of the recent org.osbuild.kernel-cmdline.bls-append
stage addition to modify kernel arguments in later pipelines.

To get a qemu image output:

- osbuild --output-directory out/ --export qemu test/data/manifests/fedora-coreos-container.json

To get a metal image output:

- osbuild --output-directory out/ --export metal test/data/manifests/fedora-coreos-container.json
2023-11-14 23:58:08 +01:00
Michael Vogt
962887e6bd test: update dract test data to match updated initramfs-6.5.6-200.fc38.x86_64.img for latest snapshot 2023-11-14 10:45:44 -08:00
Michael Vogt
13edad2383 test: update "rpm" test data to match latest fc38 repo snapshot
This was done via:
```
$ sudo osbuild --export tree --output-directory /tmp/devnull test/data/stages/rpm/b.json --json | jq .metadata >test/data/stages/rpm/metadata.json
```
a outlined in `test/data/stages/rpm`.
2023-11-14 10:45:44 -08:00
Michael Vogt
71d1e36472 test: update dnf-automatic.config diff
Moving to the newer fedora 38 snapshot pulled in some changes
to the `/etc/dnf/automatic.conf` (e.g. [0]) when moving from
dnf 4.16.1 to 4.17.0. This commit updates the diff.

[0] a0acc88efc
2023-11-14 10:45:44 -08:00
Michael Vogt
ff01933499 tests: compare content again in authselect diff
The authselect upstream code dropped adding a timestamp to the
auto-geneated content in /etc/authselect [0]. With that the
content diff can be compared again.

[0] 44b9d87f90
2023-11-14 10:45:44 -08:00
Michael Vogt
0fcb8cae44 tests/data: bump snapshot date
The snapshot date was bumped in ca3b831c29
and now all manifests that import `fedora-vars.ipp.yaml` need an update.
2023-11-14 10:45:44 -08:00
Michael Vogt
0b050200dd tests: do not compare /etc/shadow{,-} in tree-diff
Changes in `/etc/shadow` depend on the date, i.e. the last time
the password changed field. So for now exclude them from the
tree diff (until we use `faketime` to fix this :)
2023-11-14 10:45:44 -08:00
Michael Vogt
f4f0c8f004 tests: remove lvm2 from the fedora-boot test manifest
With lvm2 the generated fedora fc38 boot image boots in degraded
mode with the following error:
```
[root@localhost ~]# journalctl -u lvm2-monitor.service|more
Nov 13 12:52:04 localhost.localdomain lvm[431]:   Failed to create /etc/lvm/devi
ces 2
Nov 13 12:52:04 localhost.localdomain lvm[431]:   Failed to set up devices.
Nov 13 12:52:04 localhost.localdomain systemd[1]: lvm2-monitor.service: Main pro
cess exited, code=exited, status=5/NOTINSTALLED
Nov 13 12:52:04 localhost.localdomain systemd[1]: lvm2-monitor.service: Failed w
ith result 'exit-code'.
Nov 13 12:52:04 localhost.localdomain systemd[1]: Failed to start lvm2-monitor.s
ervice - Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress p
olling.
```
This breaks the `test_boot.py` which expects the system after booting
in `running` state  (from `systemd is-system-running`).

It looks like this is some sort of race with our generated image,
potentially related to selinux, see
https://github.com/lvmteam/lvm2/blob/v2_03_18/lib/device/dev-cache.c#L1842
and note the lines around dm_prepare_selinux_context(). Note
also that `lvm2-monitor.service` runs with `DefaultDependencies=no`
(c.f.
https://github.com/lvmteam/lvm2/blob/v2_03_18/scripts/lvm2_monitoring_systemd_red_hat.service.in#L7)

Given that the official fc38 cloud image does not use lvm2 and that
it's not needed for the boot test this commit simply removes it
from the fedora-boot manifest. This fixes the test.
2023-11-14 10:45:44 -08:00
Michael Vogt
330cd0675b test: refresh test/data/manifests/fedora-boot.json 2023-11-14 10:45:44 -08:00
Michael Vogt
efdd3e5411 tests: update diff for authselect stage to use "null" content
The authselect stage will generate timestamps as part of the
update to `/etc/authselect/*`, e.g.:
```
Generate by authselect on Fri Nov 10 16:06:29 2023
...
```
this makes the content diff for those files unusable (until we
start to use faketime which maybe we should ;)
2023-11-14 10:45:44 -08:00
Michael Vogt
eb91e1780d stages: convert kickstart stage v2 manifest 2023-11-14 10:45:44 -08:00
Ondřej Budai
fd82024153 test/data/manifests: remove F34 manifests
They are no longer used anywhere! We are free!
2023-11-14 10:45:44 -08:00
Ondřej Budai
3bb5a00375 test/run/assemblers: convert to a v2 manifest
Instead of using the F34-based manifests, let's switch to F38. I tried my
best to import the vars into the new manifest, but I don't think that's
currently supported.
2023-11-14 10:45:44 -08:00
Ondřej Budai
5adbecba43 test/run/stages: convert test_selinux to a v2 manifest
Let's not depend on f34-base.json anymore, but instead of a separate,
standardized manifest for it. The test was modified so it supports
v2 manifests. Also, the new manifest installs just a very minimal system.
There's no need to install the whole @core.
2023-11-14 10:45:44 -08:00
Ondřej Budai
c8d252f2fd test/data/stages: convert rest of tests to v2 manifests
These are the boring migrations. The manifests were just replaced by the usual
pipelines and diffs don't have any significant changes.
2023-11-14 10:45:44 -08:00
Ondřej Budai
506d6a7256 test/stages/authconfig: Use centos stream 9 as a base
Authconfig was completely retired from Fedora. In order to keep this stage
covered, this commit changes the test to use CentOS Stream 9, which still
ships this package.
2023-11-14 10:45:44 -08:00
Ondřej Budai
367981d6e4 test/stages/dracut: Update to v2 manifest and F38
I haven't found an automated way to generate vanilla.json. :/ Something
for the future.
2023-11-14 10:45:44 -08:00
Ondřej Budai
60a1570383 test/run/rpm: convert to v2 manifest
This gets rid of the old F34 manifest and migrates the to test to the
standardized V2 one based on F38.

Since the metadata format is much saner in V2, I was able to simplify the
assertion quite a lot.
2023-11-14 10:45:44 -08:00
Ondřej Budai
e4933b4fd6 test/run/boot: migrate to a v2 manifest
This commit migrates the test to a brand new V2, F38-based manifest. It's
actually based on osbuild-composer interpretation of the Fedora Cloud Base
image.
2023-11-14 10:45:44 -08:00
Michael Vogt
1eefb9b55d tests: add kickstart stage test
This commits adds a stage based test for the `kickstart`
configuration.
2023-11-03 13:29:04 +01:00
Ondřej Budai
23de60cd23 stages/mkdir: fix its schema
The items of an array are defined under the `items` key, not under `paths`.
Let's fix this.

Btw, this is possible because JSON Schema itself doesn't use
additionalProperties = false. This allows extending the schemas easily, but
is sadly a bit error-prone.

Sadly, since this issue effectively disabled validation of the stage options,
we also need to relax the schema a bit:

We found out that there are manifests in the wild, that use relative paths,
instead of absolute ones. Thus, this commit changes the validation regex to
allow relative paths. However, this now emits a warning and it's strongly
discouraged. The associated stage test was modified to accommodate for this.

Co-authored-by: Tomáš Hozza <thozza@redhat.com>
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-10-30 13:31:15 +01:00
Dusty Mabe
41652343a4 manifests: add fedora-coreos-container example/test
This example shows how to build a qcow2 very similar to the one
delivered by Fedora CoreOS. It uses an input container that has
the Fedora CoreOS OSTree already baked into it, which means that
the OSTree isn't built using this manifest, but taken as an input
from a remote registry.
2023-10-24 13:46:10 -04:00
Dusty Mabe
da07300f38 stages/ostree.deploy: create ostree_commit_deploy function
This drains some of the logic out of `main()` into a
`ostree_commit_deploy()` function. Doing this will make it easier
to diff this stage with the recently added `ostree.deploy.container`
stage.

This commit also changes the `ref` in the schema to be optional,
which is a fixup for 3cc733d. We need to make the ref optional because
the ref could come from the user in the toplevel schema or it could
come from input commit in the schema.
2023-10-24 13:46:10 -04:00
Achilleas Koutsou
dd2aa57987 test: update stage diffs
Diffs for stage tests have changed after the sources were updated.
Update them to match expected behaviour.
2023-10-21 07:34:32 +02:00
Dusty Mabe
ca3b831c29 manifests/fedora-vars: bump snapshot date
This should correspond to the snapshots from 6b85149.
2023-10-21 07:34:32 +02:00
Evgeny Kolesnikov
c4de5389e7 stages/oscap.remediation: Properly utilize offline capabilities
The scanner will now properly react to the chroot environment. Also,
there are some optimizations to logs and results.
2023-10-19 12:43:57 +02:00
Michael Ho
258735d8a6 test/stages/users: make test data date agnostic
The test for this stage is failing because etc/shadow changes content
depending on the date that it runs on (due to the "date of last password
change" field). This causes the checksums to not be constant for our
tests and depends on the date.

This commit removes the checksums for etc/shadow from the test so that
they are not checked as part of the test. This worksaround the test
failure issue for now until a solution to the dynamic contents is
determined.

Signed-off-by: Michael Ho <michael.ho@ieee.org>
2023-10-18 13:56:20 +02:00
Achilleas Koutsou
cf14de3558 test/stages/users: extend to add ssh keys
Added three users to the test to test all combinations of ssh key
definitions:
- a user called `onekey` that has a single key defined in the `key`
  option.
- a user called `multikey` that has a multiple keys defined in the
  `keys` array.
- a user called `bothy` that defines both a single key in the `key`
  option and two other keys in the `keys` array.
2023-10-16 18:05:27 +02:00
Dusty Mabe
3cc733d7cd stages/ostree.deploy: support an ostree input
This will allow a user to specify an input directly to the deploy
stage rather than requiring a ostree.pull stage to be called first.

Adding inputs will also be useful when we soon add support for
deploying from a container rather than just deploying from an existing
ostree commit in a repo.
2023-10-06 15:55:26 +02:00
Maxime Ripard
7af2f1a5c1 Create additional option to setup FS geometry
Some platforms like the TI AM62 require a particular FAT geometry for
their CPU to read the file system (and thus the bootloader). Failing
that the CPU will simply not boot and keep looking for a bootloader.

Let's add some options to enforce a particular filesystem geometry
through the -g option of mkfs.fat.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
2023-10-05 20:17:40 +02:00
Colin Walters
2972949d13 tests/ostree-container: Drop hardcoded max layers
This should just defer to rpm-ostree.
xref https://github.com/coreos/rpm-ostree/issues/4530

(If someone cares about reproducibility here, they can specify it;
 alternatively and more reliably, they can create builder container
 images and pin to those)
2023-08-29 10:56:49 +02:00
Ondřej Budai
546c8267d1 test/run/stage: cover the btrfs stages
A simple test to make sure that our btrfs stages work.
Updating the testing container is needed, because the old version
didn't have btrfs-progs in it.
2023-08-25 12:35:56 +02:00
Ondřej Budai
b94048dfd4 mounts/org.osbuild.btrfs: add support for compression
Also, add it to the sample manifest.
2023-08-25 12:35:56 +02:00
Ondřej Budai
3bbded4607 org.osbuild.mkfs.btrfs: add support for -m argument
Osbuild doesn't support creating btrfs over multiple devices, thus it should
be fine to have only single and dup in the schema (other options are for raid)
2023-08-25 12:35:56 +02:00
Ondřej Budai
dae3f884bc samples/fedora-boot-btrfs: convert to use subvolumes
We now have a full support for subvolumes in osbuild, let's use
it in the sample.

Co-authored-by: Christian Kellner <christian@kellner.me>
2023-08-25 12:35:56 +02:00
Ondřej Budai
f145a877f6 test/data: include bootable fedora image with btrfs
So we have a quick reference how to work with btrfs-based images.

Co-authored-by: Christian Kellner <christian@kellner.me>
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2023-08-25 12:35:56 +02:00
Sayan Paul
61da6124ed stages/systemd:support for user service dropin
systemd unit stage will now be able to add user unit dropin,
this is done by adding an additional field:unit-type
which is set to system by default. It also adds ability
to update the unit config with ConditionPathExists.
Relevant testing updated for the new workflow.

Signed-off-by: Sayan Paul <paul.sayan@gmail.com>
2023-08-16 13:23:16 +02:00
Simon de Vlieger
161fe789af dnf4.mark: mark packages in DNF state database
This adjustment allows the definition of the mark with the RPMs and runs
DNF after installing the RPMs to put the proper markings in the DNF
state database. See #455.

This ensures that packages don't get removed during `autoremove` leading
to broken systems.
2023-08-15 00:37:06 +02:00
Ondřej Budai
c47850b8ae manifests/fedora-ostree-native-container: bump max_layers to 4
rpm-ostree crashes when max_layers is set to <4. Work around that
by bumping the max_layers argument.

See https://github.com/coreos/rpm-ostree/issues/4530
2023-08-08 12:41:17 +02:00
Ondřej Budai
6e254c95af stages/ostree.encapsulate: use new entrypoint on rpm-ostree >=2023.2
rpm-ostree 2023.2 dropped the `rpm-ostree container-encapsulate` entrypoint.
Instead, we have to use `rpm-ostree compose container-encapsulate`.

Adjust the code that it selects the correct entrypoint based on the rpm-ostree
version.

Since the new stage now requires python-yaml, add it to the buildroot and
regenerate all manifests.
2023-08-08 12:41:17 +02:00
Ondřej Budai
09fa9e9def test/data/stages: Document the changes to the tests 2023-08-08 12:41:17 +02:00
Ondřej Budai
fbe6e3ed97 manifests: remove no longer needed f34-build-v2
It's just no longer required by anything, yay!
2023-08-08 12:41:17 +02:00
Ondřej Budai
59edb5ea6c test/data/stages: update to the new structure
This commit changes these manifests to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.

Note that this is currently limited only to stage tests that already use v2
manifests. v1 manifests will come later.

Notes:
The buildroot needs additional packages: zstd and openscap-utils. Thus,
all manifests had to be regenerated.

GPG keys were added where missing.

The oscap.remediation stage now creates a bunch of files with timestamps in
their names under /var/lib/authselect/backups. Thus, the newly introduced
`added_directories` directive is used to handle them.

I reviewed all changes in `diff.json` files, and they all seem sane given
that we jumped 4 releases forward.
2023-08-08 12:41:17 +02:00
Ondřej Budai
f0c5dfb3a3 manifests/fedora-ostree-tarball: update to the new structure
This commit changes this manifest to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.
2023-08-08 12:41:17 +02:00
Ondřej Budai
111fc97035 manifests/fedora-ostree-container: update to the new structure
This commit changes this manifest to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.

We are also able to remove the container manifests from the Makefile,
because they are no longer depending on the old f34-build-v2.json.
2023-08-08 12:41:17 +02:00
Ondřej Budai
9a9834a309 manifests/fedora-ostree-bootiso*: update to the new structure
This commit changes this manifest to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.

An auto-generated ostree ref and isolabel was added to fedora-vars.

smc-meera-fonts was retired, so this commit changes it to rit-meera-new-fonts.
See
a8fe0d2620

icfg and reiserfs-utils are gone too, and they don't seem to be neccessary for
the image, so they were removed as well. Please correct me, if I am wrong.
2023-08-08 12:41:17 +02:00
Ondřej Budai
aeec48619b manifests/fedora-container: update to the new structure
This commit changes this manifest to use the new fedora-vars.ipp and
fedora-build-v2.ipp infrastructure to remove all hardcoded Fedora versions.
2023-08-08 12:41:17 +02:00