Commit graph

3531 commits

Author SHA1 Message Date
Achilleas Koutsou
52a822075e stages/systemd.unit.create: support StandardOutput
Add support for the StandardOutput option in the [Service] section of
systemd units.

https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#StandardOutput=
2025-04-08 12:43:28 +02:00
schutzbot
5c42636a7c Schutzfile: Update images dependency ref to latest 2025-04-07 14:05:42 +02:00
Michael Vogt
f52aeb0676 osbuild: add experimental flag debug-qemu-user
This commit adds support for more debug for `qemu-user` options.
When settings:
```
$ sudo IMAGE_BUILDER_EXPERIMENAL=debug-qemu-user bootc-image-builder ...
```
extra debug will be printed. This hopefully helps to track down
the root cause of
https://github.com/podman-desktop/extension-bootc/issues/1475
2025-04-03 10:49:06 +02:00
Michael Vogt
ba0d9df68e util: add new util.experimentalflags.get_{bool,string} helpers
This commit adds two new helpers:
- util.experimentalflags.get_bool()
- util.experimentalflags.get_string()
similar to what we added in the images library in PR:
https://github.com/osbuild/images/pull/1248

The idea is that we provide experimentalflags for osbuild via
an environment like `OSBUILD_EXPERIMENTAL` and for those we
make no API promises. This will be initially used for better
debug of qemu-user.
2025-04-03 10:49:06 +02:00
luizademelo
cda3c43b2c stages: fix description for org.osbuild.containers.unit.create
Fixes #2053
2025-04-03 02:25:31 +02:00
Achilleas Koutsou
961bed0b80 test: add manifest for testing the hmac stage 2025-04-02 13:06:47 +02:00
Achilleas Koutsou
5b77ff6f65 stages: add new stage org.osbuild.hmac
The new org.osbuild.hmac stage can be used to calculate hmac digests to
be stored alongside files for verification.
2025-04-02 13:06:47 +02:00
schutzbot
7b843dc83e Post release version bump
[skip ci]
2025-04-01 13:54:43 +00:00
Neal Gompa
6433436178 runners: Add AlmaLinux runner links to permit AlmaLinux as a host
As part of AlmaLinux shipping the OSBuild stack, allow osbuild to
recognize AlmaLinux as a valid host.
2025-04-01 10:35:18 +02:00
schutzbot
69d95ddcf5 Schutzfile: Update images dependency ref to latest 2025-03-31 11:29:53 +02:00
schutzbot
140abb03b0 Post release version bump
[skip ci]
2025-03-26 08:33:10 +00:00
schutzbot
2b41f804a5 Schutzfile: Update images dependency ref to latest 2025-03-25 11:36:37 +01:00
Tom Koscielniak
5260d753f3 tests/CI: Upgrade rhel 9.4 GA to 9.5 GA 2025-03-25 10:54:37 +01:00
Tom Koscielniak
1668c78cfb tests/CI: Add rhel 9.7 and 10.1 nightly runners 2025-03-20 14:27:44 +01:00
Dusty Mabe
5a19d41f3e stages/coreos.live-artifacts: loosen requirements on modules dir
We originally required there to be only one kernel modules directory
since we typically only have one kernel installed. Change this check
up a bit since some kernel module RPMs aren't delivering a new kernel
but do deliver kmods that were built against a different kernel.

For example v4l2loopback from https://elrepo.org/

```
bash-5.1# rpm -ql kmod-v4l2loopback
/etc/depmod.d/kmod-v4l2loopback.conf
/lib/modules/5.14.0-427.13.1.el9_4.x86_64
/lib/modules/5.14.0-427.13.1.el9_4.x86_64/extra
/lib/modules/5.14.0-427.13.1.el9_4.x86_64/extra/v4l2loopback
/lib/modules/5.14.0-427.13.1.el9_4.x86_64/extra/v4l2loopback/v4l2loopback.ko
/usr/share/doc/kmod-v4l2loopback-0.12.7
/usr/share/doc/kmod-v4l2loopback-0.12.7/GPL-v2.0.txt
/usr/share/doc/kmod-v4l2loopback-0.12.7/greylist.txt
```

This patch now allows an image built from a Containerfile like the
following to work as input to the live artifacts stage.

```
FROM rhcos
RUN <<EOF
    set -eux -o pipefail
    dnf install -y https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm
    dnf install -y v4l2loopback
    dnf clean all
    ostree container commit
EOF
```
2025-03-19 22:25:59 +01:00
schutzbot
74d6eb37bd Schutzfile: Update images dependency ref to latest 2025-03-18 15:34:32 +01:00
schutzbot
bf29dfbb2b Schutzfile: Update images dependency ref to latest 2025-03-17 19:54:13 +01:00
rverdile
a62276c7dc stages: add insights-client config stage 2025-03-17 19:34:16 +01:00
Michael Vogt
e93cd75e5b test/rpm: add schema validation test for boot_root 2025-03-13 13:47:43 +01:00
Achilleas Koutsou
2e45963aed test: add rpm stage test for boot_root
Add a stage build test for the boot_root option of the org.osbuild.rpm
stage.  The test defined two manifests that both install the
kernel-uki-virt kernel but differ in the value of the boot_root option.
The diff shows the effect of the value on the install location of the
kernel.
2025-03-13 13:47:43 +01:00
Achilleas Koutsou
305a54f1a2 stages/rpm: add new kernel_install_env options
Add support for setting environment variables for kernel-install and its
plugins.  These can be used to control the behaviour of kernel-install
during the kernel rpm installation.  Currently, we only add support for
$BOOT_ROOT, which we need to control the path where the kernel should be
installed.

Normally, kernel-install scripts will detect the correct path based on
the filesystem layout, specifically the ESP path.  However, during our
installation the filesystem is not yet set up, so with this option, we
can control the installation path based on the location we know the ESP
will be mounted in the final image.

This is a very similar override to what we do with the
org.osbuild.fix-bls stage.

The stage option is added under a kernel_install_env object so we can
potentially support more of the known env vars in the future.
2025-03-13 13:47:43 +01:00
Achilleas Koutsou
7be822d6e9 stages/rpm: set encoding for subprocess.run()
Printing 'owner' in an fstring triggers the mypy warning 'str-bytes-safe'

  Error: If x = b'abc' then f"{x}" or "{}".format(x) produces "b'abc'",
  not "abc".

We can't yet use the nicer run() argument, 'text=True', because we still
target the RHEL 7 build root which only has Python 3.6 and 'text' was
introduced in Python 3.7.
2025-03-13 13:47:43 +01:00
schutzbot
8daf928b62 Post release version bump
[skip ci]
2025-03-12 08:33:19 +00:00
Achilleas Koutsou
f2ab07cf85 stages/grub2.inst: grub2-mkimage in tmpdir
Use a temporary directory for the output of grub2-mkimage.

This makes the stage clean up the grub2-core.img from the build root
after its done.  It also has the nice side-effect that unit tests that
call the stage are independent.  Previously, a bug in the stage *might*
have been missed if a certain configuration of the stage was not
creating the grub2-core.img.  One unit test could create an image at the fixed path
(/var/tmp/grub2-core.img) and then another one could call the stage with
the buggy configuration but the `shutil.copyfile()` call at the end of
the stage would succeed because it would find the image from the
previous stage run.

To accommodate for this change, the unit test with the mocked run call
is adjusted to intercept the random tmp output path and use it to create
a fake file for the stage to succeed.
2025-03-08 02:30:32 +01:00
Michael Vogt
dc24a131e9 stages: add mock test for grub-mkimage for regression test
This commit adds a test that mocks subprocess.run() so that we
can regression test the arguments passed to "grub-mkimage".

This is a regression test for
https://github.com/osbuild/osbuild/issues/2037
2025-03-08 02:30:32 +01:00
Achilleas Koutsou
67070cc316 stages/grub2.inst: fix format for non-x86_64 image
When writing the grub2 core image, the format should be set based on the
platform.  This was accidentally changed to be `i386-pc` for all
platforms except when building ISOs.

Set the format to the platform and only change it to `i386-pc-eltorito`
when building ISOs.
2025-03-08 02:30:32 +01:00
Simon de Vlieger
563153ac6f tools: support zstd in image-info
We have images that are zstd-compresed now so `image-info` needs to be
able to deal with them.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-03-07 16:00:57 +01:00
schutzbot
9b72d9ee50 schutzfile: Update snapshots to 20250304 2025-03-07 16:00:57 +01:00
schutzbot
c08271120a Schutzfile: Update images dependency ref to latest 2025-03-07 16:00:57 +01:00
Achilleas Koutsou
b347c38179 test: extend systemd.unit.create stage test
Extend the manifest for the systemd.unit.create stage to create one of
each type of systemd unit currently supported.
2025-03-04 20:34:43 +01:00
Achilleas Koutsou
30d8a16e41 stages/systemd.unit.create: support .swap units
Add support for .swap systemd units.
2025-03-04 20:34:43 +01:00
Achilleas Koutsou
8b2ae24de9 stages: add .socket to systemd.unit.create test
Add .socket unit tests and replace the second .mount example with a
.socket example in the systemd.unit.create stage tests.
2025-03-04 20:34:43 +01:00
schutzbot
a287d90d8e schutzfile: Update snapshots to 20250301 2025-03-03 09:07:45 +01:00
Tomáš Hozza
8f4813e273 Test/tools/depsolve: reword function doc text
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 17:44:44 +01:00
Tomáš Hozza
6c9c314b48 CI: update osbuild-ci container to latest-202502250751
The main reason is that it comes with license_expression python package
needed for newly added SBOM test cases.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
551d1f4ef2 sbom/spdx: always use license ref IDs as is
Always return License ref IDs as is, if used as package license,
regardless if license_expression package is available. This will prevent
wrapping them again as extracted license info and generating yet another
license ref ID.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
35993fe256 tools/test/depsolve/SBOM: test solver config with custom license db
Extend the depsolve SBOM test case to also cover the case when a custom
license DB file is provided.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
a07431bb34 osbuild-depsolve-dnf: allow passing custom license index db file
Allow passing a custom license index db file for SBOM generation by
specifying it in the solver configuration.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
99a7047173 tools/osbuild-depsolve-dnf: extend default config with loaded
Instead of completely overriding the default solver configuration with
the one loaded from a file, just extend the default config. This will
allow to specify just desired config options and keeping the defaults
for the rest.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
cce8ee31c4 test/sbom/spdx: test using custom license index file
Add unit test for testing the use of custom license index file with
`SpdxLicenseExpressionFactory`.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
dbb7aa0051 test/sbom/spdx: move importorskip to relevant test case
Move the call to `pytest.importorskip()` function into a specific test
case that relies on imported modules. This will make test cases in the
same file to be run, even if importing the modules fail.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
f24d5c843f SPEC/Fedora/-depsolve-dnf: recommend python3-license-expression
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
a3428e282d sbom/spdx: use compliant license expressions
Introduce a new class `SpdxLicenseExpressionCreator`, responsible for
converting license texts extracted from packages, into an SPDX-compliant
license expressions. If the `license_expression` Python package is
available on the system, it is used to determine the license text
extracted from a package is a valid SPDX license expression. If it is,
it's returned as is back to the caller. If it is not, or of the package
is not available on the system, the license text is wrapped in a
`ExtractedLicensingInfo` instance.

The `SpdxLicenseExpressionCreator` object keeps track of all generated
`ExtractedLicensingInfo` instances and de-duplicates them based on the
license text. This means that if two packages use the same
SPDX-non-compliant license text, they will be wrapped by an
`ExtractedLicensingInfo` instance with the same `LicenseRef-` ID.

The reason for fallback when `license_expression` package is not
available is that it is not available on RHEL and CentOS Stream. This
implementation allows us to ship the functionality in RHEL and
optionally enabling it by installing `license_expression` from a 3rd
party repository. In any case, the generated SBOM document will always
contain valid SPDX license expressions.

Extend unit tests to cover the newly added functionality.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>

FIXUP: sbom/spdx: use compliant license expressions

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
0174173175 test/data/spdx: add README describing each file
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
aaa6d8ec84 sbom/spdx2/model: support ExtractedLicensingInfo
Extend the SPDX v2 model to support referencing extracted licensing
information, which is either not in the SPDX license list or can't be
expressed by the SPDX-compliant license expression.

Cover the new functionality by unit tests.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
schutzbot
39bfe3ce2d Post release version bump
[skip ci]
2025-02-26 08:32:13 +00:00
schutzbot
a6f935e939 Schutzfile: Update images dependency ref to latest 2025-02-24 13:19:36 +01:00
Michael Vogt
530ce4f80c stages: ensure dirs for dracut-conf stage are available
If the dracut config stage runs early the directory for the
dracut config may not be available yet. So just create it.
2025-02-24 13:18:33 +01:00
schutzbot
0849f4842c schutzfile: Update snapshots to 20250218 2025-02-20 16:48:52 +01:00
Tomáš Hozza
e7d9446023 tools/test/depsolve: remove checks for errors where unnecessary
Requests in some test cases are expected to always succeed. Don't check
for errors in such test cases.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-18 10:50:19 +01:00