Commit graph

402 commits

Author SHA1 Message Date
Achilleas Koutsou
7c30cf7280 test/data: update test manifests
Update test manifests by running tools/update-test-manifests.
This bumps the snapshot date for all CentOS Stream 9 test manifests,
which currently is only the authconfig and dnf4.versionlock.
2025-07-31 00:53:54 +02:00
Achilleas Koutsou
5d861870f8 test/data/manifests: fix module-platform-id
A couple of CentOS Stream 9 manifests were setting 'el9' as their
module-platform-id, making the depsolver complain.
Fixed to the correct 'platform:el9'.
2025-07-31 00:53:54 +02:00
Achilleas Koutsou
19a1bd8f4c test: add test manifests for dnf4.versionlock 2025-07-07 17:19:25 +02:00
Leonardo Rossetti
4af53e4c6e add ssh_pwauth to org.osbuild.cloud-init
Signed-off-by: Leonardo Rossetti <lrossett@redhat.com>
2025-07-04 21:52:00 +02:00
Jelle van der Waa
f7ef1d6464 stages/vagrant: add virtualbox support
This adds support generating a virtualbox vagrant image. It differs from
libvirt by requiring an xml file and a vmdk image.

When the provider is set to libvirt it is required to pass a
`virtualbox` configuration section to this stage which must include the
mac address.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-07-04 14:09:47 +02:00
Tomáš Hozza
68b2301daf Test/inline sources: add lzma+base64 success case
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-05-13 10:27:36 +02:00
Tomáš Hozza
c33dfcb43b Test/inline sources: update and rename the base64 success case
Rename the 'success' case to 'base64_success' as a preparation for
adding test case for other encodings.

The test case was originally embedding the tools/inline-source.py
script. Since the script has been updated, let's update the embedded
date in the test case as well.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-05-13 10:27:36 +02:00
Tomáš Hozza
7ff3fe0b50 Stages/waagent.conf: support additional options
Extend the stage to support setting new options:
 - Provisioning.UseCloudInit
 - Provisioning.Enabled

Extend the stage test to use them and add a simple stage unit test for
the schema.

Related to https://github.com/osbuild/images/issues/1416

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-04-14 08:18:04 +02:00
Achilleas Koutsou
7771a39557 test/chrony: add all the new refclock options
Add all the new refclock options to the test manifest.
2025-04-11 09:00:42 +02:00
Tomáš Hozza
c9639c41f9 Stages/rhsm: support setting 'auto_enable_yum_plugins' option
Support setting the `auto_enable_yum_plugins` option in the `rhsm`
section of `rhsm.conf`.

Add a unit test for the stage schema and also adjust the stage test
manifest.

Related to: https://github.com/osbuild/images/issues/1408

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-04-10 12:29:21 +02:00
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
Achilleas Koutsou
961bed0b80 test: add manifest for testing the hmac stage 2025-04-02 13:06:47 +02: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
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
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
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
Dusty Mabe
4e033c305e stages: add more options to qemu vmdk disk type
The CoreOS team uses the compat6 and adapter_type options when creating
a VMDK for AWS.

e1943d6adb/src/cosalib/qemuvariants.py (L48)
2025-02-17 03:41:11 -05:00
Simon de Vlieger
1e70131346 data: include appstream repository metadata
The CentOS Stream 9 repository metadata contains modules; these are
necessary for testing modularity depsolving.

Note that the filelists metadata is kept empty to keep repository size
down.

Co-authored-by: Michael Vogt <michael.vogt@gmail.com>
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-22 18:03:21 +01:00
Achilleas Koutsou
e99dabe467 test: generate container-dev-null test manifests
Generate the manifests from the mpp yaml files.
2025-01-17 10:10:47 +01:00
Achilleas Koutsou
278b9130b0 test: (mpp) manifests for container embed
Add mpp files to create manifests that will embed the container (that
contains /dev/null) in an OS tree and compose an ostree commit from it.

This used to cause the rpm-ostree compose command to fail with:

    error: Writing commit: While writing rootfs to mtree: Not a regular file or symlink: null
2025-01-17 10:10:47 +01:00
Achilleas Koutsou
e2b9d0f3ca test: update rpmrepo snapshots
Required for latest version of rpm-ostree.
2025-01-17 10:10:47 +01:00
Achilleas Koutsou
6b45c81a29 test: create a container with /dev/null
Create a container using the new script and add it to the repo for use
in testing.
2025-01-17 10:10:47 +01:00
Achilleas Koutsou
0507a9807c test: container creation script with /dev/null
Add a script that creates a container image as an oci-archive that
contains /dev/null.
2025-01-17 10:10:47 +01:00
Michael Vogt
a36fca4b34 test: reformat json data to appease linter
This commit just ran:
```
  find -iname "*.json" -print -exec sh -c 'jq --indent 2 . {} | sponge {}' \;
```
to ensure that the new test json data from librepo is in the format
the linter expects.
2025-01-14 08:19:16 +01:00
Brian C. Lane
e2345a6348 test: Add baseurl test for org.osbuild.librepo
These test:

* baseurl success
* baseurl with a bad checksum (or file) which is expected to fail
2025-01-14 08:19:16 +01:00
Brian C. Lane
6045b3ffd6 test: Add mirrorlist test for org.osbuild.librepo
These tests test downloading packages using mirrorlist:

* Using a single mirrorlist repo
* Using two mirrorlist repos
* A bad checksum (or file) from the download which is expected to fail
* Two mirrorlist paths with the first one returning a 404, expected to
  succeed with the 2nd mirrorlist path.
2025-01-14 08:19:16 +01:00
Brian C. Lane
0c340da0a2 test: Add metalink test for org.osbuild.librepo
NOTE: The metalink xml file points to a repomd.xml file which does not
exist. In practice librepo doesn't download this, it only uses the url
to construct the mirror urls, so it is not present.

These tests test downloading packages using metalink:

* Using a single metalink repo
* Using two metalink repos
* A bad checksum (or file) from the download which is expected to fail
* Two metalink paths with the first one returning a 404, expected to
  succeed with the 2nd metalink path.
2025-01-14 08:19:16 +01:00
Jonathan Lebon
0331e6f313 stages: add coreos.live-artifacts.mono stage
This adds a new `org.osbuild.coreos.live-artifacts.mono` stage to build
CoreOS Live ISO/PXE artifacts. The code is heavily based on the
`cmd-buildextend-live` script from coreos-assembler [1], but a lot of
things had to be adapted:
- the stage is provided the deployed oscontainer tree, metal, and
  metal4k images as inputs
- we use chroot instead of supermin to execute some commands in the
  context of the target oscontainer
- a bunch of calls that were wrapped by libguestfs for us (e.g.
  mkfs.vfat, mksquashfs), we now have to call ourselves; to retain
  maximum compatibility, we ensured that we still effectively use the
  same args that libguestfs passed

And various other minor adjustments.

Of course, this is not really in line with the OSBuild philosophy
of having smaller-scoped stages. We have labeled this with a .mono
suffix to denote it is monolithic, similar to the existing
`org.osbuild.bootiso.mono` stage today.

Eventually we may be able to break this stage down if we find it worth
the effort. Alternatively the need for it may go away as we align more
with Image Mode.

[1] 43a9c80e1f/src/cmd-buildextend-live

Co-authored-by: Dusty Mabe <dusty@dustymabe.com>
Co-authored-by: Renata Ravanelli <renata.ravanelli@gmail.com>
2024-12-18 11:09:29 -05:00
Dusty Mabe
b7e3268ef0 manifests: updates for FCOS manifest
There have been a lot of changes to the CoreOS definitions in [1].
Let's update the test manifest here to more closely match what is
running in the field there.

[1] dcd60cfe01/src/osbuild-manifests
2024-12-18 11:09:29 -05:00
Dusty Mabe
aa11ec1ec1 test: add podman to fedora-build-v2 manifest
The org.osbuild.container-deploy stage uses podman. Including it
in the build here will allow that stage to be used with this
pipeline as the buildroot.

Include a workaround here for what I consider to be a bug [1] in that
`podman` will create `/etc/containers/networks` on first run if it
doesn't exist. That dir should just be created by an RPM. If we
don't include this workaround then the stage will fail when `podman`
attempts the `mkdir` because `/etc/containers` is mounted in from
the buildroot readonly.

[1] https://github.com/containers/common/pull/2265
2024-12-18 11:09:29 -05:00
Tomáš Hozza
7699f8134f Add org.osbuild.dnf5.sbom.spdx stage
Add DNF5 version of the `sbom.spdx` stage, which generates an SPDX SBOM
document from a given FS tree using libdnf5 API.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-12-18 05:46:45 +01:00
Renata Ravanelli
07d4f6955d util/osrelease.py: Replaced string stripping with shlex.split()
- Replaced string stripping with `shlex.split()` to properly
handle values in the os-release file;
- This ensures cleaner and more accurate key-value assignments,
follwing a broader set of shell-like parsing rules;
- Add os-release file for Fedora CoreOS 40 for testing.

Signed-off-by: Renata Ravanelli <rravanel@redhat.com>
2024-12-04 14:54:00 -05:00
Tomáš Hozza
76a0d56690 Test/manifests: update fedora manifests to F41
Update the fedora manifest template to F41. This is a preparation for
testing a new `org.osbuild.dnf5.sbom.spdx` stage. In addition to that,
F39 is already EOL and unsupported, so moving to a newer version is
desirable.

Regenerate all testing manifests.

Notes about specific changes:
 - Remove `pcmciautils` package from ostree manifest, because it has
   been deprecated and it is not available on F41 any more.
 - Add `python3-dnf` package to the Fedora build pipeline. The reason
   is that DNF5 is installed by default since F41 and the module is
   needed to test e.g. `org.osbuild.dnf4.sbom.spdx` or
   `org.osbuild.dnf4.mark` stages.
 - Add `python3-libdnf5` package to the Fedora build pipeline. This is a
   preparation for testing a new `org.osbuild.dnf5.sbom.spdx` stage.
 - Install `pam` in `authselect` stage test manifest, because otherwise
   authselect fails on the nonexistence of /etc/pam.d.
 - Adjust the `dnf4.mark` test case to also accept `dnf5` as the marked
   package, because on F41, `dnf` is a virtual provide of it.
 - Adjust stage tests and their diffs as needed.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-11-28 13:29:12 +01:00
Dusty Mabe
85f3bc1f09 test/data/manifests/fedora-coreos-container: fix CI
We updated the container in the registry so we need to update this
manifest to unbreak CI.
2024-11-28 11:53:57 +01:00
Achilleas Koutsou
b9efc1f9bf test/users: modify root's home directory in stage test
Since 9071cd0abb the commands in the
org.osbuild.users stage are run using the osbuild.util.chroot.Chroot
context manager.  This includes mounting /proc into the chroot.

The `usermod` command now fails with

  usermod: user root is currently used by process N

when modifying any property of the root user that requires the user to
not be logged in (like the home directory).

Change the home directory of the root user in the stage test to check
for this issue and catch regressions.
2024-11-26 23:35:04 +01:00
Lukas Zapletal
32b1b91597 test: regenerate X509 test certs 2024-11-22 10:15:50 +01:00
Lukas Zapletal
ef24311f77 sources: MTLS and proxy support for ostree 2024-11-04 16:35:53 +01:00
Simon de Vlieger
12dcf3c6d9 schema: metadata at the top level
Allows a new object under the top-level key `metadata` which contains a
`generators` property. This property is a list of all generators involved
in the creation of a manifest.

Each generator can add its name and version to this list.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2024-10-29 08:24:33 +01:00
Tomáš Hozza
ba70909975 Add org.osbuild.dnf4.sbom.spdx stage
Add a new stage, which allows analyzing the installed packages in a
given filesystem tree using DNF4 API and generating an SPDX v2.3 SBOM
document for it.

One can provide the filesystem tree to be analyzed as a stage input. If
no input is provided, the stage will analyze the filesystem tree of the
current pipeline.

Add tests cases for both usage variants of the stage, as well as the
unit test for stage schema validation.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-18 12:26:36 +02:00
Tomáš Hozza
33a8427dd9 Test SPDX model implementation against spec JSON schema
Verify the documents generated by the internal implementation of SPDX
v2.3 model against the upstream spec JSON schema.

The schema has been downloaded from:
https://github.com/spdx/spdx-spec/blob/development/v2.3.1/schemas/spdx-schema.json

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-18 12:26:36 +02:00
Lukas Zapletal
09da4fff7b stages: add org.osbuild.pki.update-ca-trust
Adds a new stage that calls update-ca-trust tool with extract argument
to extract CA certificates. It is expected that one or more CAs are
placed in the /etc/pki/ca-trust/source/anchors directory in PEM format.
Filenames do not matter but must be unique enough. See the
update-ca-trust man page for more details on what it does.
2024-09-10 19:10:06 +02:00
Michael Vogt
f0f9d8677a test: update the test cert to expire in 100y
When generating the original test certs no `-days` paramter was
passed which resulted in a too low `notAfter` value.

This commit fixes this and uses 100y also updates the README:
```
$ openssl x509 -enddate -noout -in test/data/certs/cert1.pem
notAfter=Aug  2 10:42:40 2124 GMT
$ openssl x509 -enddate -noout -in test/data/certs/cert2.pem
notAfter=Aug  2 10:42:45 2124 GMT
```
This fixes a test failure in https://github.com/osbuild/osbuild/pull/1819
for the `test_curl_download_many_mixed_certs` test.
2024-08-27 09:39:17 +02:00
Achilleas Koutsou
618ec9db2c test/update-crypto-policies: update diff file
With the mounting of /dev (among others) into the chroot for the
update-crypto-policies, the leftover /dev/null is now removed.

This was created by the update-crypto-policies script, running in the
chroot, by multiple output redirects into /dev/null.  Without a /dev fs,
the file was being created in the tree and would remain on the image.
2024-08-21 18:50:05 +02:00
Tomáš Hozza
f9ddab52f5 Update testing c9s BaseOS repodata snapshot
Use the latest c9s BaseOS repodata snapshot, specifically so that it
contains multiple versions of the same packages. This will allow to test
the `osbuild-depsolve-dnf` 'search' command. The previous metadata
contained only single version of each package.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-08 09:58:41 +02:00
Michael Vogt
e535877798 test: add new https_serve_directory() and test certs
This commit adds a new `https_serve_directory()` test helper
and some custom self-signed and worthless certs that are used
during testing. They are not dynamically generated to avoid the
extra compuation time during tests (but they could be).

Generated via:
```
$ openssl req -new -newkey rsa:2048  -nodes -x509  \
   -subj "/C=DE/ST=Berlin/L=Berlin/O=Org/CN=localhost"   \
   -keyout "key1.pem" -out "cert1.pem"
```

This will allow us to test `https` download URLs as well in e.g.
the curl source.
2024-07-29 16:51:48 +02:00
Gianluca Zuccarelli
92bb161501 stages/oscap.autotailor: make profile id required
According to `autotailor(8)` arguments passed in via the cli take
precedence over the JSON tailoring file contents.

Make the `new_profile` a required field for the json tailoring too and
pass it as an option to the `autotailor` command. This approach has some
trade-offs. It allows us to maintain the explicitness of the manifest
that is consumed by `osbuild`. The downside is that it will override the
profile id that is set by the user in the JSON tailoring file.
2024-07-17 13:14:48 +02:00
Gianluca Zuccarelli
2a28acbc85 stages/oscap.autotailor: rename new_profile
Rename the `new_profile` option to `tailoring_profile_id` for clarity.
This also ensures that the change is backwards compatible by falling
back to the `new_profile` option if that was set instead of the
`tailoring_profile` id option.
2024-07-17 13:14:48 +02:00
Tomáš Hozza
d15ce4bb11 Test/assemblers: update manifest to use Fedora 40
Fedora 38 is EOL and unfortunately so are our F38 snapshots. Lets
update the manifest to F40.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-02 09:46:45 +02:00
Gianluca Zuccarelli
8b67b02dfa test/cases: fix users stage
Since the `/etc/shadow` file contains a timestamp we need to add a
`null` value rather than a `sha256` hash to tell the diff tool to ignore
these fields. The issue is that the timestamp will always be different
meaning the tests will pass for a day, but then fail after that.
2024-06-06 14:48:32 +01:00
Tomáš Hozza
1d0952002b Test/stages/users: fix diff.json
I'm not sure what happened, but the test case started failing on the
diff on 'main'. I didn't change anything related to this test case in my
PR. The previous changes adjusted the vars, specifically the Fedora
snapshot date used to generate the manifests, but the test passed on
it.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-06-04 19:39:39 +02:00