Commit graph

474 commits

Author SHA1 Message Date
Michael Vogt
9ba7f1a8b0 internal: use manifest build/payload pipelines (images#1766)
With the new images library changes to move the pipeline
roles out of the image types into the manifest we need
to tweak osbuild-composer to use the new way of getting
the payload and build pipelines.

This commit implements that new method based on the
manifest instead of the image type. See images pr#1766
for the rational of the change.
2025-08-21 14:05:24 +02:00
Tomáš Hozza
992c6365f0 Use gcp upload implementation from osbuild/images
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-08-14 13:23:49 +02:00
Tomáš Hozza
dd99c0cb78 internal/weldr: remove support for pulp.ostree upload target
It turned out that the target was never adopted by the service, thus it
is being deleted as part of upload code consolidation.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-08-12 19:42:51 +02:00
Achilleas Koutsou
8d9f52cf1f go.mod: update osbuild/images (v0.172.0) and osbuild/blueprint (v1.12.0)
The internal blueprint implementation has been removed from
osbuild/images.  Conversion from osbuild/blueprint blueprints to
osbuild/images blueprints is no longer necessary.
2025-08-07 20:15:33 +02:00
Tomáš Hozza
19dd832876 go.mod: update osbuild/images to v0.171.0
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-08-07 16:33:15 +02:00
Lukas Zapletal
b932daaa76 weldr: remove double import 2025-07-28 20:39:32 +02:00
Tomáš Hozza
93ffcb80cd Test/weldr: adjust expected responses newly omitempty BP properties
The latest version of osbuild/blueprint changed some BP properties
to be 'omitempty', thus the expected API responses need to be adjusted
to account for this change.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-14 17:20:02 +02:00
Tomáš Hozza
7036e2bcb9 Many: expose rhsm.subscription_manager.rhsm.auto_enable_yum_plugins
Expose the ${SUBJ} customization in Cloud API. Weldr API inherited it
automatically with the update of `osbuild/blueprint` to v1.6.0.

Adjust relevant test cases and unit tests to use this new customization.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-04-29 18:22:40 +03:00
Achilleas Koutsou
cf956ff5a6 Delete internal/blueprint/ and import from osbuild/blueprint
Import osbuild/blueprint v1.6.0
2025-04-17 11:17:58 +02:00
Sanne Raymaekers
d6fe9d85cf weldr: adapt tests to modularity 2025-03-20 14:07:52 +01:00
Sanne Raymaekers
52e5fe9627 weldr: add enabled modules to depsolve handler 2025-03-20 14:07:52 +01:00
Michael Vogt
e8a0e8ff49 weldr: update depsolve calls in weldr API
Update the weldr API to work with the new depsolve API.
Update tests to match (adding repo_id).

Co-authored-by: Achilleas Koutsou <achilleas@koutsou.net>
2025-01-29 18:03:11 +01:00
Achilleas Koutsou
dab836de19 weldr/test: fix test run name 2025-01-29 18:03:11 +01:00
Michael Vogt
af0543d27c many: update images Manifest() API for PR#1107
This updates composer to use the updated API in images around the
seed handling for manifests, see images PR#1107 for details.

Note that this has no semantic changes yet. We could now simplfy
some things because images will auto-seed but that is for a followup.
2025-01-20 09:50:49 +01:00
Tomáš Hozza
1f590aa232 Weldr/ComposeRequest: OSTree options nil if not set
Previously, the `OSTree` property in the Weldr API `ComposeRequest`
struct was not a pointer to the `ostree.ImageOptions` type. As a result,
it was initialized to an empty struct, even if not set in the client API
call.

As a result, the `OSTree` property in the `distro.ImageOptions` was
always not `nil`, when initializing the osbuild manifest. However, after
a change in `osbuild/images` [0], providing OSTree options for
non-OSTree image types is no longer considered valid. This caused a
failure to submit a new compose for any non-OSTree image type.

Change the `OSTree` property in Weldr `ComposeRequest` to be a pointer
and mark it as optional.

[0] https://github.com/osbuild/images/pull/1071

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-12-09 09:46:54 +01:00
Lukas Zapletal
64f479092d osbuild-worker: use the new ostree resolver API 2024-11-07 16:17:56 +01:00
Tomáš Hozza
7bdd036395 Update osbuild/images to v0.88.0
Adjust all paces that call `Solver.Depsolve()`, to cope with the changes
that enabled SBOM support.

Fix loading of testing repositories in the CloudAPI unit tests.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-20 17:02:09 +02:00
Tomáš Hozza
d7e59e6eec Worker: move GCE image guest OS features to upload target options
Previously, the worker was determining the GCE image guest OS Features
on its own, based on the OS name. This caused problems, in case the
osbuild-composer was of a newer version than the worker.

Example:
osbuild-composer contained support for c10s GCE image type and its
implementation also contained the proper guest OS Features list for it.
However, when the worker got the osbuild job, it built it and tried to
fetch the guest OS Features for the distro. Since its implementation was
too old, it didn't contain the code that added the actual support for
c10s GCE images and got no guest OS features list (which is the default
for unsupported distros). The image was successfully uploaded and
shared, but it does not boot in GCP, because it does not know that it
should use UEFI to boot it.

This behavior could be considered a bug. The worker should be dumb. It
should not be making decisions about the image features, but instead it
should take them from the upload target options. And composer should be
the authoritative source of truth for this. Because otherwise, we
basically have two components that need to be updated in sync to add
support for GCE images on a new distro.

Move the GCE image guest OS features to the GCP upload target options.
The worker will just take what is specified there and use it when
importing the image to GCP. As a compatibility layer for the case when
the composer would be older than the worker (unlikely, but still),
worker will try to determine the image guest OS features in case the
list in the upload target options is empty.

Extend the GCP functional tests to check that the imported image has at
least some guest OS features set.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-29 17:37:48 +02:00
Sanne Raymaekers
8b0e09ed20 internal/weldr: adapt to aws sdk v2 2024-08-20 15:32:40 +02:00
Tomáš Hozza
768537dba3 Add support for RHSM customizations
Add support for RHSM customizations, which currently allow various
aspects of RHSM. Specifically enabling / disabling DNF plugins shipped
by subscription-manager package and setting a subset of options in the
rhsm.conf.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-13 15:52:44 +02:00
Tomáš Hozza
26dd54a4d7 Add support for RPM customizations
Add support for RPM customizations, which currently allow to import RPM
GPG key from a file installed in the image. This is e.g. done for the
Azure RHUI image type.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-13 15:52:44 +02:00
Michael Vogt
573b349f16 clienterrors: rename WorkerClientError to clienterrors.New
The usual convention to create new object is to prefix `New*` so
this commit renames the `WorkerClientError`. Initially I thought
it would be `NewWorkerClientError()` but looking at the package
prefix it seems unneeded, i.e. `clienterrors.New()` already
provides enough context it seems and it's the only error we
construct.

We could consider renaming it to `clienterror` (singular) too
but that could be a followup.

I would also like to make `clienterror.Error` implement the
`error` interface but that should be a followup to make this
(mechanical) rename trivial to review.
2024-07-31 17:04:58 +02:00
Achilleas Koutsou
dab896dd64 weldr: update expected error messages
Some depsolve-related error messages in osbuild/images changed.  Update
the expected error messages in our tests.
2024-07-04 19:01:07 +02:00
Sanne Raymaekers
1b4935c325 jobqueue: add channel to workers
Stores the channel alongside the worker.
2024-04-19 14:32:07 +02:00
Sanne Raymaekers
d0a6828bd7 osbuild/images update: ignore repoconfigs where appropriate 2024-04-17 10:27:08 +02:00
Sanne Raymaekers
173f37feb8 weldr: pass repoconfigs when serializing manifests 2024-04-17 10:27:08 +02:00
Achilleas Koutsou
356a222b83 weldr: replace use of deprecated rand.Seed with New(NewSource(seed))
"rand.Seed has been deprecated since Go 1.20 and an alternative has been
available since Go 1.0: As of Go 1.20 there is no reason to call Seed
with a random value. Programs that call Seed with a known value to get a
specific sequence of results should use New(NewSource(seed)) to obtain a
local random generator."
2024-04-11 16:39:21 +02:00
Brian C. Lane
b8967d53bc Move RepoRegistry setup into Composer
This is so that both the weldr and cloud api's can use it as the source
of their repositories.
2024-03-11 03:04:54 -07:00
Gianluca Zuccarelli
f6b76cce31 Update osbuild/images to v0.41.0
Multiple blueprint fixes:

- Extend the blueprint service customizations to accept services to be
  masked.

- The `storage-path` and `container-transport` fields were removed in
  imagees 41.0 in order to simplify the way local storage containers are
  handled.
2024-02-29 20:57:39 +01:00
Diaa Sami
76e686df10 switch to images/pkg/dnfjson and remove internal copy
COMPOSER-2068
2024-02-20 15:55:47 +01:00
Tomáš Hozza
b79eaeb78e weldr: don't determine distro name from image type when depsolving
Weldr API used to determine the distro name from the image type, when it
was getting the repositories to use for depsolving and for the actual
depsolving (solver uses the distro name to namespace cache).

This used to be OK, but with the introduction of distro name aliases,
the distro name used to get the distro object may not be the same as the
name returned by the actual distro object. To preserve the current
behavior, the same name used to get the distro object should be used to
also get the repositories for depsolving and to namespace depsolving
cache.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
43e87632fb Drop common.CurrentArch() in favor of osbuild/images
Drop `common.CurrentArch()` implementation and use
`arch.Current().String()` from the osbuild/images instead.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
c4e5ab5aca Drop internal/common/distro.go in favor of osbuild/images
Drop `common.GetHostDistroName()` implementation and use
`distro.GetHostDistroName()` from the osbuild/images instead.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
fb1b27c0ef Move cleaning up old dnfjson cache dirs from composer to Weldr API
Previously, the old dnfjson cache dirs for unsupported distributions
were deleted in the osbuild-composer binary on startup. This is no
longer possible, since the supported distros are determined by loading
available repositories. Loading repositories happens in the Weldr API
constructor. Move the cleanup code there.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
625b1578fa Port osbuild/images v0.33.0 with dot-notation to composer
Update the osbuild/images to the version which introduces "dot notation"
for distro release versions.

 - Replace all uses of distroregistry by distrofactory.
 - Delete local version of reporegistry and use the one from the
   osbuild/images.
 - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single
   `createTestWeldrAPI()` function`.
 - store/fixture: rework fixtures to allow overriding the host distro
   name and host architecture name. A cleanup function to restore the
   host distro and arch names is always part of the fixture struct.
 - Delete `distro_mock` package, since it is no longer used.
 - Bump the required version of osbuild to 98, because the OSCAP
   customization is using the 'compress_results' stage option, which is
   not available in older versions of osbuild.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Ondrej Ezr
4b3b942dde cloudapi: Add module_hotfixes flag
Allow passing module_hotfixes flag through the cloudapi.
This will enable depsolving on repositories that might be affected by modularity filtering.

Refs HMS-3202
2023-12-20 09:02:06 +01:00
Sanne Raymaekers
c6aa7d88d2 internal/weldr: specify architecture of compose
This is useful in environments with multi-arch remote workers.
Defaults to the host architecture.
2023-12-14 21:25:32 +01:00
Sanne Raymaekers
794acd8e34 worker: add ability to track workers serverside
Unresponsive workers (>=1 hour of no status update) are cleaned up.

Several things are enabled by keeping track of workers, in future the
worker server could:
- keep track of how many workers are active
- see if a worker for a specific architecture is available
2023-12-06 17:22:36 +01:00
Brian C. Lane
aca748bc14 Don't Panic in getComposeStatus and skip invalid jobs in fsjobqueue New
This handles corrupt job json files by skipping them. They still exist,
and errors are logged, but the system keeps working.

If one or more of the json files in /var/lib/osbuild-composer/jobs/
becomes corrupt they can stop the osbuild-composer service from
starting, or stop commands like 'composer-cli compose status' from
working because they quit on the first error and miss any job that
aren't broken.
2023-11-20 13:34:40 +01:00
Brian C. Lane
81240f58ba weldr: Add support for PartitioningMode 2023-10-23 14:52:30 +02:00
Achilleas Koutsou
3b8e595351 weldr: define the pulp.ostree upload settings 2023-10-18 21:14:46 +02:00
Brian C. Lane
61c9a66b7e test: Use test_distro.NewTestDistro from images
and move the ResolveContent function from the images test_distro
package. api_test is the only place using it, so it belongs there, not
in images.
2023-09-21 16:56:54 +02:00
Brian C. Lane
0db61e0c21 dnfjson: Add mock checksums to the packages used in testing
Commit 312d87c6d5fab7ffd085a303e27b8db41111c86e adds validation of the
checksums to the ImageType.Manifest call, so it requires a valid looking
checksum, otherwise it will fail with a 'ManifestCreationFailed' error
when running the unit tests.
2023-09-21 16:56:54 +02:00
Brian C. Lane
c675e919fd api_test: Log the path being tested in TestModulesInfo 2023-09-21 16:56:54 +02:00
Achilleas Koutsou
bde2881168 weldr/test: update expected error message
See https://github.com/osbuild/images/pull/91
2023-08-10 12:49:44 +02:00
Tomáš Hozza
0a5c82086a Weldr API: set the image boot mode in OSBuildJob options
Set the image boot mode (as a string value) in the OSBuildJob options.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-08-08 15:53:07 +02:00
Brian C. Lane
e96ed30d4b weldr: Adjust test to use image type's Size(0) method
This will use the default image size which will be changed when images
is pulled in with a default of 1GiB in test_distro instead of 0.
2023-08-05 11:28:29 +02:00
Achilleas Koutsou
0e4a9e586f split: replace internal packages with images library
Remove all the internal package that are now in the
github.com/osbuild/images package and vendor it.

A new function in internal/blueprint/ converts from an osbuild-composer
blueprint to an images blueprint.  This is necessary for keeping the
blueprint implementation in both packages.  In the future, the images
package will change the blueprint (and most likely rename it) and it
will only be part of the osbuild-composer internals and interface.  The
Convert() function will be responsible for converting the blueprint into
the new configuration object.
2023-07-10 21:11:19 +02:00
Achilleas Koutsou
9ed61d021b distro/test: update test distro with new behaviour
Add a checksum as a hash of URL + Ref.
Use the parent ref instead of the image ref when it's set.  This makes
the test distro always behave like ostree commit and container types
(image types that can use an ostree parent) and not raw image or
installers (that use ostree commits as a payload).

Modify the weldr API test with the expected error message.
2023-06-14 11:19:29 +02:00
Achilleas Koutsou
7e2855bbb3 ostree: rewrite Resolve() to take SourceSpec and return CommitSpec
The Resolve() function is now only responsible for resolving a
SourceSpec to a CommitSpec.  It only resolves a checksum if a URL is set
and sets the option for the RHSM secrets.

The Parent has been removed from the SourceSpec.  The SourceSpec is a
simple reference to a single ostree ref and has no connection with the
ostree options.
2023-06-14 11:19:29 +02:00