Commit graph

3106 commits

Author SHA1 Message Date
Alexander Todorov
33fda9ba50 Update centos-stream-10 repo snapshots to 20240701 2024-07-16 11:30:13 +02:00
Alexander Todorov
207648549c There is no EPEL for EL10 yet so use a custom repository 2024-07-16 11:30:13 +02:00
Alexander Todorov
60d4f56b54 Use CentOS-Stream-10-20240703.2 runner images 2024-07-16 11:30:13 +02:00
Alexander Todorov
3bbf05243c Start building RPMs on CentOS Stream 10 for testing
Related: COMPOSER-2226
2024-07-16 11:30:13 +02:00
Tomáš Hozza
143677f5d9 Tests: force checkout manifest-db
Manifest tests on Fedora 39 sometimes fail, because checking out the
specific manifest-db commit fails with:

"error: The following untracked working tree files would be
overwritten by checkout"

Use --force when checking out the ref, which will hopefully solve any
error like this.

[1] https://gitlab.com/redhat/services/products/image-builder/ci/osbuild/-/jobs/7317097983

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-15 11:06:10 +02:00
Gianluca Zuccarelli
24c26e7787 stages/oscap.remediation: small import adjustment
This is a small adjustment to how the `osbuild.util.mnt.mount` fuction
is imported. While adding unit tests, the tests failed when trying to
patch the function, this commit fixes the issue.
2024-07-11 12:26:13 +02:00
Gianluca Zuccarelli
a1beb4d295 stages/oscap.remediation: setup env helper
Add a small helper function to setup the mountpoints and symlink for the
stage. This will help in making the stage easier to test.
2024-07-11 12:26:13 +02:00
Michael Vogt
9bef57d5a6 sources(curl): disable curl --parallel by default
Disable `curl --parallel` by default until the failure in
https://github.com/osbuild/osbuild-composer/pull/4247

is fully understood. It can be enabled via the environment:
```
OSBUILD_SOURCES_CURL_USE_PARALLEL=1
```
in the osbuild-composer test.
2024-07-08 18:00:59 +02:00
Michael Vogt
4697a3fb84 sources: do not use %{json} when generating curl output
We cannot use `curl --write-out %{json}` because older curl
(7.76 from RHEL9/Centos9) will write `{"http_connect":000}`
which python cannot parse.
2024-07-04 11:53:40 +02:00
Michael Vogt
018c15aae8 sources: run all tests for curl with both old and new curl
To ensure there are no regressions with the old curl make
sure to run all tests that fetch_all() with both old and
new curl.
2024-07-04 11:53:40 +02:00
Michael Vogt
0d3a153c78 sources: add new _fetch_all_new_curl() helper
When using a modern curl we can download download multiple urls
in parallel which avoids connection setup overhead and is generally
more efficient. Use when it's detected.

TODO: ensure both old and new curl are tested automatically via
the testsuite.
2024-07-04 11:53:40 +02:00
Michael Vogt
974c8adff9 source: add helper to detect if curl parallel download is available
Modern curl (7.68+) has a --parallel option that will download
multiple sources in parallel. This commit adds detection for this
feature as it is only available after RHEL 8.

In addition we need some more feature to properly support --parallel,
i.e. `--write-out` with json and exitcode options. This bumps the
requirements to 7.75+ which is still fine, centos9/RHEL9 have
7.76.
2024-07-04 11:53:40 +02:00
Michael Vogt
d20713d7af curl: add gen_curl_download_config() and use in download
Instead of passing the url and options on the commandline this
commit moves it into a config file. This is not useful just yet
but it will be once we download multiple urls per curl instance.
2024-07-04 11:53:40 +02:00
Nikita Dubrovskii
cb978d3c72 stages: add stage for creating dm-verity partitions
Co-authored-by: Michael Vogt <michael.vogt@gmail.com>
2024-07-03 16:54:32 +02:00
schutzbot
8507b32a87 Post release version bump
[skip ci]
2024-07-03 08:16:19 +00:00
Sanne Raymaekers
2e5a9335c9 sources/curl: use --user-agent option to set the user-agent
Setting the user-agent using `--header` is broken in combination with
`--location`, `--proxy`, and an https endpoint which redirects. The
user-agent sent to the proxy changes after the client is redirected,
tripping up proxies.

For more information see https://issues.redhat.com/browse/RHEL-45364
2024-07-02 16:15:56 +02:00
Tomáš Hozza
8db6b8985a schutzbot/mockbuild.sh: let mock bootstrap chroot
Don't instruct mock to not bootstrap the chroot. This is making builds
to fail on F40 due to DNF5. The error message suggests to bootstrap
chroot.

Example:
https://gitlab.com/redhat/services/products/image-builder/ci/osbuild/-/jobs/7239614060#L1363

Note that e.g. osbuild-composer does not specify the
--no-bootstrap-chroot option either.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-02 09:46:45 +02:00
Tomáš Hozza
4c806cbe34 Schutzfile: update Fedora repo overrides
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-02 09:46:45 +02:00
Tomáš Hozza
cdb6c6711a Schutzfile: remove repo overrides for GA RHEL 9.4 and 8.10
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-02 09:46:45 +02:00
Tomáš Hozza
897a5ed065 Gitlab CI: update RHEL runners
Update RHEL runners to the same versions that correspond to the actual
state of which release is currently GA and which is in development
(nightly). Specifically, run jobs only on:

 - RHEL-8.10 GA
 - RHEL-9.4 GA
 - RHEL-9.5 nightly

 This is the same set of RHEL workers, as used by 'manifest-db'

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-02 09:46:45 +02:00
Tomáš Hozza
ae33fe4e65 Schutzbot: update terraform ref
Update to the latest 'main' HEAD, so that all the latest RHEL GA runners
are available.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-02 09:46:45 +02:00
Tomáš Hozza
79ab1c2784 Schutzfile: update manifest-db ref
Update manifest-db ref to the latest one. This should solve the problem
with GCP el8 repos being gone in the old manifests.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-02 09:46:45 +02:00
Michael Vogt
f7d56b3d7e tests: update l2hash for the fc40 move
Similar to what was explained in 2e6d49fbe this commit updates
the l2hash in test_assemblers to the new values from fc40 images.

Sadly it is hard to derive them from first principles (see the
other commit) and given that this is legacy code it is probably
fine this way.
2024-07-02 09:46:45 +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
Paweł Poławski
92e5e43794 CI: Add testing based on Centos containers
In the release loop upstream changes are merged to Centos every two
weeks. This creates a delay in error detection when new tests
being added upstream.

Running tests in Centos based containers on top of the upstream code
more frequently should speed up error detection.
2024-06-24 20:25:04 +02:00
Alexander Todorov
0b62ec08ad Update snapshots for rhel-9.5 to make them in sync with osbuild-composer
Related: COMPOSER-2227
2024-06-24 16:27:03 +02:00
schutzbot
477a164492 Post release version bump
[skip ci]
2024-06-19 08:15:53 +00:00
Florian Schüller
41f528eeb2 osbuild/monitor.py: improve naming of progress 2024-06-18 16:00:55 +02:00
Tomáš Hozza
86cd09b121 Packit: build RPMs in COPR for c10s and c9s on all arches
Newly add building of RPMs for c10s on all supported arches.
Extend the c9s config to build RPMs for all supported arches.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-06-17 11:43:40 +02:00
Gianluca Zuccarelli
faaa0bf508 tools/tree-diff: use null for timestamped files
The `tree-diff` tool is used by the `gen-stage-diff` tool to generate
the stage `diff.json` files. A few of these stages have timestamped
files that need to be edited after the tool is run to replace the
`sha256` content hash with `null` so the stage diff tests ignore these
files.

This commit updates the `tree-diff` tool to check through a list of the
files that contain timestamps and to use the `null` value rather than
the `sha256` content hash so the stage tests don't fail.
2024-06-06 15:41:49 +01: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
schutzbot
49b86f0b5a Post release version bump
[skip ci]
2024-06-05 08:15:18 +00:00
Tomáš Hozza
ab711cb630 Schutzfile: update manifest-db ref
The new ref does not contain F39 manifests, which can't be built.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-06-04 19:39:39 +02: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
Tomáš Hozza
c06fda60b6 Test/stages: update udev.rules test case to not use F34
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-06-04 19:39:39 +02:00
Tomáš Hozza
7aff6c9d3c Drop testing on F37 and F38, which are EOL
F37 and F38 are EOL and repositories are no longer working. Drop
building and testing on F37 and F38.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-06-04 19:39:39 +02:00
Tomáš Hozza
067e002490 Drop testing on c8s, which is EOL
c8s is EOL and repositories are no longer working. Drop building and
testing on c8s.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-06-04 19:39:39 +02:00
Gianluca Zuccarelli
8985155157 test: test autotailor json import
Add a test to ensure that json tailoring import is supported for the
`oscap.autotailor` stage.
2024-05-31 19:51:46 +01:00
Gianluca Zuccarelli
5ec5c892bf stages/oscap.autotailor: add json import unit test
Add a small unit test for the json tailoring file import.
2024-05-31 19:51:46 +01:00
Gianluca Zuccarelli
4db6d4c1b4 stages/oscap.autotailor: add json tailoring
With the `oscap-utils-1.3.10` release, the `autotailor` command now
supports importing a JSON tailoring file[1] that is then converted to the
XML tailoring file which is consumed by the `oscap` command in the
remediation stage.

[1] https://github.com/ComplianceAsCode/schemas/blob/main/tailoring/schema.json
2024-05-31 19:51:46 +01:00
Gianluca Zuccarelli
ad265a519d test: update stage diffs for snapshot 20240514
Since updating the snapshots the diffs for some stage tests have
changed. This commit updates the diffs accordingly.

I followed the same steps used in 1148a6e.
2024-05-31 19:51:46 +01:00
Gianluca Zuccarelli
3f92d91fbf manifest/fedora-vars: update snapshot
We need a minimum version of `oscap-utils-1.3.10` which is available
in the `20240508` updates snapshot.
2024-05-31 19:51:46 +01:00
Achilleas Koutsou
484130b678 tools/osbuild-depsolve-dnf: ignore optional-metadata for old dnf
The optional_metadata_types option isn't available in older versions of
dnf.  We could version-guard the option, but let's be more explicit and
check if it exists instead.

If it doesn't we can safely ignore it and rely on dnf's default
behaviour.
2024-05-31 09:00:24 +02:00
Tomáš Hozza
13035e6f4e Test/manifests: use SHA256 signed GPG key for c9s
The original CentOS Stream GPG key uses SHA-1 in its signature. However,
SHA-1 is by default not allowed by the c10s / el10 crypto policy. As a
result, running the stage tests which use c9s on c10s / el10 are failing
when rpmkeys tries to import the key.

As part of CS-1616 [1], the CS GPG key has been resigned using SHA256,
however only in c10s for now. Let's use the SHA256 signed GPG key from
c10s for c9s manifests, to make tests pass also on c10s / el10.

[1] https://issues.redhat.com/browse/CS-1616

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-05-30 20:56:33 +02:00
Achilleas Koutsou
a7955e6af3 tools/test: check for *filelists* in depsolve repodata
When the filelists are enabled in the optional metadata, the local cache
for the depsolve will include a filelist file for each repository.
Count the files matching *filelists* using glob() and compare them with
the number of repositories when the option is enabled.
When the option is not enabled, there should be no filelists.
2024-05-29 01:39:05 +02:00
Achilleas Koutsou
5c171f0e8c tools/test: use a new cache for each depsolve
Use a fresh cache for each depsolve in tests.  This will let us check if
filelists are downloaded or not according to the option.
2024-05-29 01:39:05 +02:00
Achilleas Koutsou
8a9dac5258 tools/test: include optional metadata in tests
Run depsolve tests both with and without adding filelists to optional
metadata.
2024-05-29 01:39:05 +02:00
Achilleas Koutsou
31362772dd tools/osbuild-depsolve-dnf5: support optional metadata
We originally enabled filelists unconditionally in dnf5.  Let's make it
optional as part of the 'optional-metadata' option in the arguments so
that the caller can decide if it's needed, for example when using dnf5
with older repositories that have packages with file dependencies, but
don't download them when they're not needed, since the filelists are
quite large.
2024-05-29 01:39:05 +02:00
Achilleas Koutsou
806a1caba7 tools/osbuild-depsolve-dnf: support optional metadata
Filelist repo metadata is required when using newer versions of libdnf
with old repositories or packages that specify dependencies on files.
For example, depsolving with RHEL 9.3 repos on Fedora 40 fails to
resolve platform-python with the message

  nothing provides /usr/libexec/platform-python needed by platform-python-...

Not loading filelists is beneficial because it greatly reduces the size
of the metadata to download.  Filelists were downloaded by default for
repositories in the past, but with newer versions of dnf/libdnf (in
Fedora 40), they are downloaded on-demand (e.g. when running a query
that requires file information).  Newer package guidelines prohibit
depending on file paths, so filelists are not needed for package
depsolving with newer distro repositories.

Add an 'optional-metadata' property to the 'arguments' object of the
depsolve request, so that callers can enable any optional metadata they
need.

Further reading:
- https://libdnf.readthedocs.io/en/stable/tutorial-py/#case-for-loading-the-filelists
- https://github.com/rpm-software-management/dnf/releases/tag/4.19.0
- https://dnf.readthedocs.io/en/stable/user_faq.html#starting-with-fedora-40-i-noticed-repository-metadata-is-synchronized-much-faster-what-happened
2024-05-29 01:39:05 +02:00
Michael Vogt
ad13333f36 test: tweak test_osbuild_mount_failure_msg() for tmt/fc40
The `test_osbuild_mount_failure_msg` currently fails on fc40 when
run in tmt, see:
https://artifacts.dev.testing-farm.io/c6588a82-a2cb-46df-8ca8-85dd809465f2/

This is because the failure output is slightly different between
a container and a VM/real-machine. The test ensures that we capture
the output of mount and present to the user (for easier debugging).
So this commit updates this test once more for the error string
(that part of the error comes directly from the kernels fsconfig).

If we need another update of the string we should reconsider this
test and e.g. just use `testutil.mock_command()` for this. But
for now it's easier to just add this one more failure string.
2024-05-23 14:56:41 +02:00