Commit graph

2791 commits

Author SHA1 Message Date
Lubomír Sedlář
004f357acb Make requests instrumentation optional
Even if basic otel dependencies are available, this instrumentor is a
separate dependency which may be missing.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-04-07 13:32:35 +02:00
Lubomír Sedlář
5731cce190 Fix incorrect log line
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-04-03 09:59:18 +00:00
Lubomír Sedlář
e135042967 Release 4.9.1
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-04-03 08:15:22 +00:00
Lubomír Sedlář
ab4b221e64 util: Fix typo in regex for container digests
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-04-03 10:05:32 +02:00
Lubomír Sedlář
3ed09991c1 Resolve container tags to digests
When the compose is configured to include any container image, it just
followed the provided URL. This is not particularly reproducible. If the
image spec contains a tag, it may point to different images at different
time.

This commit adds a step to validating the configuration that will query
the registry and replace the tag with a digest.

This makes it more reproducible, and also fixes a problem where changing
container image would not stop ISO reuse. There's still a chance of
non-container file changing and not forcing the reuse, but that is not
very common.

JIRA: RHELCMP-14381
JIRA: RHELCMP-14465
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-03-31 15:00:40 +02:00
Lubomír Sedlář
252044a911 kojiwrapper: Remove unused code
These methods were used in the live_images phase that doesn't exist
anymore.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-03-20 13:46:08 +01:00
Lubomír Sedlář
c15ddbc946 Add basic telemetry support
This patch adds support for Opentelemetry. If
OTEL_EXPORTER_OTLP_ENDPOINT env variable is defined, it will send traces
there. Otherwise there is no change.

The whole compose is wrapped in a single span. Nested under that are
spans for operations that involve a remote server.

* Talking to CTS
* Sending API requests to Koji
* Any git repo clone

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-03-17 10:58:40 +01:00
Haibo Lin
b3e0b6d7b7 Reorder ostree and ostree_installer phases
osbuild phase needs to wait for ostree phase in some cases, this patch
makes the various image build phases waiting for ostree phase, it may
introduce some slowdown, but it's still faster than the version before
PR#1790.

JIRA: RHELCMP-14349
Fixes: https://pagure.io/pungi/issue/1816
Signed-off-by: Haibo Lin <hlin@redhat.com>
2025-03-06 09:50:10 +08:00
Lubomír Sedlář
6a9c8551d2 Fix test data generation script
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-02-27 14:30:19 +01:00
Lubomír Sedlář
cb0399238e extra_isos: Mention all extra files in the manifest
When container-images are downloaded, they would be skipped from the
extra_files.json manifest. This patch fixes that by enumerating all
files rather than relying on the getter to return a list.

JIRA: RHELCMP-14406
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-02-24 15:05:37 +01:00
Lubomír Sedlář
b99bcfb5ee scm: Add retries to container-image download
If all retries fail, let's also log the error output.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-02-18 10:06:50 +01:00
Lubomír Sedlář
e33ac15d99 Release 4.9.0
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-02-13 13:37:07 +01:00
Haibo Lin
1a594e4148 scm: Fix git clone issue for git+http protocol
`git clone` failed if the URL is specified as git+http.

    git: 'remote-git+http' is not a git command. See 'git --help'.

JIRA: RHELCMP-14340
Signed-off-by: Haibo Lin <hlin@redhat.com>
2025-02-13 12:31:46 +00:00
Lubomír Sedlář
fc0de97c5e Make black happy
The latest version seems to want escape sequences written in lowercase.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-02-13 13:22:24 +01:00
Lubomír Sedlář
3c6298ee28 buildinstall: Add support for rootfs-type lorax option
JIRA: ENGCMP-5117
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-01-28 13:32:45 +01:00
Lubomír Sedlář
b3a316776e scm: Stop trying to download src arch
This simplifies configuring extra isos to avoid failing on downloading
non-existing images.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-01-27 09:30:29 +00:00
Lubomír Sedlář
46d6c48e0a extra_isos: Provide arch to extra files getter
The getter is already running once per architecture, it just doesn't
make the information available to the scm wrapper.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-01-27 09:30:29 +00:00
Lubomír Sedlář
e4d1bd4783 Move temporary buildinstall download to work/
The files should always be cleaned up immediately after the archive is
extracted, but we are seeing them being left behind for some reason.

With this page, even if the data is not cleaned up, it will not clog up
/tmp and be eventually deleted together with the compose.

JIRA: RHELCMP-14319
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-01-23 10:00:41 +01:00
Adam Williamson
2d16a3af00 Protect against decoding errors with subprocess text mode
All these are calling subprocess in 'text mode', where it will
try to decode stdout/stderr using the default encoding (utf-8
for us). If it doesn't decode, subprocess will raise an exception
and kobo doesn't handle it, it just passes it along to us, so
things blow up - see https://pagure.io/releng/issue/12474 . To
avoid this, let's set `errors="replace"`, which tells the decoder
to replace invalid data with ? characters. This way we should get
as much of the output as can be read, and no crashes.

We also replace `universal_newlines=True` with `text=True` as
the latter is shorter, clearer, and what Python 3 subprocess
wants us to use, it considers `universal_newlines` to just be
a backwards-compatibility thing - "The universal_newlines argument
is equivalent to text and is provided for backwards compatibility"

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Merges: https://pagure.io/pungi/pull-request/1812
2025-01-16 09:20:27 +01:00
Adam Williamson
98e3b3f8c4 Revert "Avoid to crash on unicode decoding errors"
This reverts commit 7d8f3b4b9b. It
doesn't really fix the problem. A better fix follows.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-01-16 09:15:17 +01:00
Lubomír Sedlář
3d5348a672 Download extra files from container registry
This could be useful for handling flatpak applications in the installer.

All of the specified containers are downloaded into a single oci
layout.

JIRA: RHELCMP-14302
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2025-01-10 16:34:34 +01:00
Haibo Lin
7d8f3b4b9b Avoid to crash on unicode decoding errors
As kobo.shortcuts.run can't handle binary output correctly, it causes
pungi-make-ostree crashed when rpm-ostree outputs unexpected characters.

JIRA: RHELCMP-14253
Fixes: https://pagure.io/releng/issue/12474
Signed-off-by: Haibo Lin <hlin@redhat.com>
2024-12-20 15:29:32 +08:00
Lubomír Sedlář
b058f64abe Remove python 2.7 dependencies from setup.py
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-12-19 14:16:56 +01:00
Lubomír Sedlář
8a36744f02 util: Drop dead code
These functions were only used in the legacy pungi.gather module that
has since been removed.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-12-19 14:16:56 +01:00
Adam Williamson
3cb8992d56 Use new container and bootable-container productmd types
In https://github.com/release-engineering/productmd/pull/181 I
added new `bootable-container` and `container` types to
productmd. This makes pungi always use the bootable-container
type for ostree_container images (previously 'ociarchive'), and
default to using the container type for Kiwi-built oci.tar.xz
container images (previously 'docker').

This is a significant change for anything that relies on
productmd/fedfind conventions to 'identify' images, as these
images will now have a different identity. But I think it's a
valuable improvement in their identities. 'ociarchive' never made
any sense as an image 'type' - it's a format - and 'docker'
wasn't a very good type for images that are explicitly OCI
container images, not Docker-native ones. We also can now easily
distinguish between 'regular' container images and ones that are
intended to be bootable.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-12-11 17:52:40 -08:00
Lubomír Sedlář
3987688de6 Directly import mock from unittest
It is not a separate package since Python 3.3

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-12-02 09:32:08 +00:00
Lubomír Sedlář
7d51229361 Release 4.8.0
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-29 13:53:49 +01:00
Lubomír Sedlář
bca660cd67 Drop spec file
The file became stale, and it likely won't work on any useful system.
Rather than trying to keep it up to date, let's admit it is not useful
and drop it completely.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-29 09:43:50 +01:00
Lubomír Sedlář
af10ab312b Remove python 2.7 from tox configuration
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-29 09:33:52 +01:00
Lubomír Sedlář
989a9c2565 Remove forgotten multilib module for yum
There's no more yum anymore. This was also the only user of the
pathmatch module, which is thus also removed.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-29 09:33:52 +01:00
Lubomír Sedlář
b34de57813 Drop usage of six
We no longer need to support Python 2, so there's no point in this
compatibility layer.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-29 09:29:20 +01:00
Lubomír Sedlář
8558b74d78 Ensure ostree phase threads are stopped
The ostree phase now runs in parallel with a lot of other stuff. If
there's any error while the phase is running, the compose would be
aborted but the ostree threads wouldn't be stopped automatically. With
the threads left alive, the process would never finish.

This patch makes sure that whatever happens in the other code, we always
stop the ostree phases.

Fixes: https://pagure.io/pungi/issue/1799
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-29 09:24:53 +01:00
Lubomír Sedlář
6d1428ab89 scm: Clone git submodules
If the repo contains .gitmodules file, run the commands to clone all
submodules.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-26 16:47:44 +01:00
Lubomír Sedlář
d95d1f59e2 Drop unittest2
The library is imported if available, but we never build it in any
environment where the package would be installed. It was last used for
RHEL 6 builds.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-22 13:54:46 +01:00
Adam Williamson
eb4ba5f637 kiwibuild: extend productmd type/format detection for FEX images
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-11-19 16:49:30 -08:00
Lubomír Sedlář
f5702e4c9d Remove pungi/gather.py and associated code
This commit completly drops support for Yum as a depsolving/repoclosure
backend.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-19 14:23:15 +01:00
Adam Williamson
3bc35a9a27 Reduce legacy pungi script to gather phase only (#1792)
This reduces the legacy 'pungi' script to only its gather phase,
and removes related stuff in gather.py. The gather phase is used
in the yum path through phases/gather/methods/method_deps.py, so
it cannot be entirely removed until all users of that are gone.
But we can at least get rid of the non-Koji support for creating
install trees, ISOs and repos.

Merges: https://pagure.io/pungi/pull-request/1793
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-11-19 14:23:15 +01:00
Adam Williamson
c8fe99b1aa pkgset: optimize cache check (saves 20 minutes)
The pkgset phase takes around 35 minutes in current composes.
Around 20 minutes of that is spent creating these per-arch
subsets of the global package set. In a rather roundabout way
(see #1794 ), I figured out that almost all of this time is
spent in this cache check, which is broken for a subtle reason.

Python's `in` keyword works by first attempting to call the
container's magic `__contains__` method. If the container does
not implement `__contains__`, it falls back to iteration - it
tries to iterate over the container until it either hits what
it's looking for, or runs out. (If the container implements
neither, you get an error).

The FileCache instance's `file_cache` is a plain Python dict.
dicts have a very efficient `__contains__` implementation, so
doing `foo in (somedict)` is basically always very fast no matter
how huge the dict is. FileCache itself, though, implements
`__iter__` by returning an iterator over the `file_cache` dict's
keys, but it does *not* implement `__contains__`. So when we do
`foo in self.file_cache`, Python has to iterate over every key
in the dict until it hits foo or runs out. This is massively
slower than `foo in self.file_cache.file_cache`, which uses the
efficient `__contains__` method.

Because these package sets are so huge, and we're looping over
*one* huge set and checking each package from it against the cache
of another, increasingly huge, set, this effect becomes massive.
To make it even worse, I ran a few tests where I added a debug log
if we ever hit the cache, and it looks like we never actually do -
so every check has to iterate through the entire dict.

We could probably remove this entirely, but changing it to check
the dict instead of the FileCache instance makes it just about as
fast as taking it out, so I figured let's go with that in case
there's some unusual scenario in which the cache does work here.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-11-19 00:22:09 -08:00
Lubomír Sedlář
bc60af794d Install dnf4 into test image
The fedora:latest image is now based on 41, and contains dnf5. This is
causing some tests to fail due to failing imports of dnf version 4.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-11-07 13:25:44 +01:00
Lubomír Sedlář
83f56da0f1 Update phase diagram
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-10-15 09:48:19 +02:00
Adam Williamson
18bda22fcb Don't block main image build phase on ostree_install phase
I did a time map of a Fedora compose today, and noticed that we
spend about an hour waiting for the ostree_install phase to
complete before we start up the compose_images_phase which does
all the other image builds.

This is unnecessary. Nothing else depends on ostree_install; it
should be fine to start up the extra_phase (which contains
compose_images_phase) while the ostree stuff is still running.

This implements that by splitting the ostree phases out of the
essentials_phase which contains the real precursors to the
extra_phase. We start the essentials and ostree phases together,
but only wait for the essentials phase to complete before
kicking off extra_phase, so it can start while the ostree
phase is still running.

One tweak we have to make to accommodate this is to move
image_checksum_phase out of extra_phase, to avoid it potentially
running before all ostree installer images are built. The
checksum phase is quite fast - it takes about five minutes -
and any time benefit of running it in parallel with the osbs and
repoclosure phases seems like it must be smaller than the time
loss of waiting for ostree_install before kicking off extra.

Merges: https://pagure.io/pungi/pull-request/1790
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-10-15 09:47:43 +02:00
Adam Williamson
aea8da5225 ostree_container: make filename configurable, include arch
The default base name is probably fine in most cases, but there
are some where we might want to tweak it. We already allow this
for other phases (e.g. the livemedia phase).

Also, we should include the arch in the image filename. Not doing
this doesn't blow up the compose as, while they have identical
filenames, the images for different arches are in different paths,
but it's confusing for people who actually download and use the
images.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-10-09 16:33:48 -07:00
Adam Williamson
391a5eaed5 Correct subvariant handling for ostree_container phase
The image metadata construction code allows for subvariant to be
set in the image config dict, but checks.py doesn't expect it;
fix that. Also, when a subvariant is set, use it in the image
name template rather than the variant; otherwise you can't
build more than one subvariant in any variant (they will have
identical names, which isn't alllowed).

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-10-09 16:28:54 -07:00
Adam Williamson
739062ed3c image_build: drop .tar.gz as an expected extension for docker
Koji's image-build command has not been capable of producing a
docker image with .tar.gz as its extension since 2015:

https://pagure.io/koji/c/b489f282bee7a008108534404dd2e78efb2256e7?branch=master

as that commit message implies, the files have not actually been
gzip-compressed for even longer:

https://pagure.io/koji/c/82a405c7943192e3bba3340efe7a8d07a0e26b70?branch=master

so there's no point to having this any more. It is causing the
wrong productmd 'type' to be set for GCE cloud images, which *do*
have the .tar.gz extension - because docker appears in this dict
before tar-gz, their type is being set as 'docker' not 'tar-gz'.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-09-19 23:03:58 -07:00
Adam Williamson
5338d3098c move osbuild/kiwi-specific EXTENSIONS to each phase
The image-build phase's EXTENSIONS dict is meant to exactly
mirror the 'formats' that exist in the context of the command
`koji image-build`, which is driven by this phase. That nice
association was lost, however, by adding a couple of items to it
which exist for the purposes of the osbuild phase (and in the
case of .iso, also the kiwibuild phase), which import this dict
and uses it for image identification.

To make the association 1:1 again and more clearly show what's
going on here, let's move those entries out into the osbuild and
kiwi phases. osbuild now has its own dict which starts out as a
copy of the image-build one before being extended. And let's
update the relevant comments.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-09-19 23:03:15 -07:00
Lubomír Sedlář
225f04cf43 Drop compatibility helper for dnf.Package.source_name
The bug that caused the attribute to have wrong value has been fixed in
DNF a long time ago.

Fixes: https://pagure.io/pungi/issue/1786
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-09-09 10:30:00 +02:00
Lubomír Sedlář
cd2ae81e3c kiwibuild: Allow setting metadata type explicitly
It is not possible to reliably detect what the type for an image should
be in the metadata. This commit adds an option for user to explicitly
provide it.

It can only be configured on the specific image, not globally.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-08-29 08:46:10 +02:00
Lubomír Sedlář
d9d21d3cf4 kiwibuild: Fix location and metadata for ISOs
When Kiwi builds an ISO, it is always supposed to be bootable and should
be located in the iso/ subdirectory.

Any other kind of image should still land in images/ and be listed as
not bootable in the metadata.

Relates: https://pagure.io/pungi-fedora/issue/1342
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-08-28 13:07:12 +02:00
Lubomír Sedlář
d351773dab kiwibuild: Add options for version and repo_releasever
The version follows the same rules as versioning for live media etc.
That means it's always going to be set. The precedence goes like this:

 * image specific option
 * `kiwibuild_version`
 * `global_version`
 * `release_version` or `<release_version>_<label_milestone>`.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-08-26 08:53:10 +02:00
Lubomír Sedlář
a8dbd77f7f Release 4.7.0
JIRA: RHELCMP-13991
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2024-08-20 14:49:59 +02:00