Commit graph

387 commits

Author SHA1 Message Date
Sanne Raymaekers
4e803af8cd cloudapi: get rid of localSave check in local target
The local target shouldn't require any specific configuration and should
just be available always.
2025-01-24 15:26:15 +01:00
Sanne Raymaekers
7bfcac30dd cloudapi: support worker server target artifact retrieval
In order to get the artifact location from the cloudapi, add a helper
function in the worker server.
2025-01-24 15:26:15 +01:00
Brian C. Lane
df16f7fc63 v2_test: Add testing for cloudapi /depsolve/blueprint
Test the depsolve using a mocked response, test for mismatched
distributions, and for unsupported architectures.
2025-01-23 11:39:53 -08:00
Brian C. Lane
f377c5e3eb v2_test: Add a test-distro-1 repository
This also adds an actual repository json file for the test-disro.
Without this the repo.ListDistros() function doesn't return any actual
distros.

Related: RHEL-60125
2025-01-23 11:39:53 -08:00
Brian C. Lane
02d0b8ec01 cloudapi: Request depsolve from osbuild-worker
and return the response to the client. This uses the worker to depsolve
the requested packages. The result is returned to the client as a list
of packages using the same PackageMetadata schema as the ComposeStatus
response.  It will also time out after 5 minutes and return an error,
using the same timeout constant as depsolving during manifest
generation.

Related: RHEL-60125
2025-01-23 11:39:53 -08:00
Brian C. Lane
e06e62ca03 cloudapi: Add /depsolve/blueprint route
This will allow depsolving blueprints and returning package metadata for
the dependencies.

Related: RHEL-60125
2025-01-23 11:39:53 -08:00
Brian C. Lane
4f3c93ef1e cloudapi: Make sigmd5 in PackageMetadata optional
In order to reuse PackageMetadata with DepsolveResponse and not include
unused fields this changes the sigmd5 entry to an optional field. This
doesn't effect the use of PackageMetadata in the Compose response since
it is always set, and it allows it to be omitted in the response for
depsolving.

Also adds a basic test for stagesToPackageMetadata

Related: RHEL-60125
2025-01-23 11:39:53 -08:00
Brian C. Lane
08dc5f3041 cloudapi: Move GetCustomizationsFromBlueprintRequest
This function only depends on the Blueprint (cloudapi request type, not
the internal/blueprint) so move it to a function on that so that it can
be reused by other users of the cloudapi Blueprint.

Related: RHEL-60125
2025-01-23 11:39:53 -08:00
Sanne Raymaekers
425581fcc1 cloudapi/v2: support local upload target
The target validation rework broke the local upload target, which is
needed for cockpit-image-builder.
2025-01-22 13:54:40 +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
Lukas Zapletal
d531f62488 blueprint: add cacert customization 2025-01-10 10:26:54 +01:00
Lukas Zapletal
4b55bc2825 cloudapi: carry ostree MTLS secret over 2024-12-03 13:59:45 +01:00
Sanne Raymaekers
8fd36225be cloudapi/v2: support HyperV generation in Azure upload options 2024-11-21 11:22:20 +01:00
Florian Schüller
992f876da0 cloudapi/v2/server: rephrase error message 2024-11-19 13:55:38 +01:00
Florian Schüller
02778b5361 cloudapi/v2/server: assure order of fail-calls
by avoiding map but rather using a slice the
order of SetFailed is maintained
2024-11-19 13:55:38 +01:00
Florian Schüller
2f4d7d3140 internal/cloudapi/v2/server: remove osbuild job explicitly set "failed"
osbuild job is a dependency of the resolve and manifest jobs so
leaving the state and it will fail as a depency is also fine
2024-11-19 13:55:38 +01:00
Florian Schüller
d3e3474fb7 internal/worker/server: return an error on depsolve timeout HMS-2989
Fixes the special case that if no worker is available and we
generate an internal timeout and cancel the depsolve including all
followup jobs, no error was propagated.
2024-11-19 13:55:38 +01:00
Lukas Zapletal
64f479092d osbuild-worker: use the new ostree resolver API 2024-11-07 16:17:56 +01:00
Tomáš Hozza
efc251fa02 CloudAPI: test /sboms endpoint for Koji composes
Extend the API unit test for Koji composes, to verify that the newly
added /sboms endpoint works correctly.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-20 17:02:09 +02:00
Tomáš Hozza
cf79bf677b CloudAPI: test /sboms endpoint for regular composes
Extend the unit test for regular (non-Koji) composes, to verify that
 the newly added /sboms endpoint works correctly.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-20 17:02:09 +02:00
Tomáš Hozza
6e8f0418a6 CloudAPI: add new /composes/{id}/sboms endpoint
Add a new /sboms API endpoint, for getting SBOM documents for a given
compose ID. The endpoint returns an array of SBOM documents for each
image built as part of the compose. For each image, there is an SBOM
document for each osbuild pipeline, which installs RPM packages. This is
usually one 'buildroot' and one 'image' pipeline.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-20 17:02:09 +02:00
Tomáš Hozza
102d06774c CloudAPI: extend manifestJobResultsFromJobDeps() to also return JobInfo
Extend the `manifestJobResultsFromJobDeps()` function to also return the
manifest `JobInfo`. This will be useful to inspect the job dependencies
and eliminate the need to add a specialized function for getting only
the `JobInfo`.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-20 17:02:09 +02:00
Tomáš Hozza
4ae35a0ed9 Worker/osbuild: depend on depsolve job for Koji composes
For Koji composes, all files are uploaded to Koji as part of the osbuild
job (specifically as part of handling the Koji target). So in order to
be able to upload SBOM documents to Koji as part of Koji compose, the
osbuild job needs to to be able to access the depsolve job result, which
contains the SBOM documents. For this, the osbuild job must depend on
the depsolve job.

For Koji composes, make sure that osbuild job depends on the depsolve
job and set the DepsolveDynArgsIdx.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-20 17:02:09 +02:00
Tomáš Hozza
f8d231d024 CloudAPI: request SBOM documents in depsolve jobs
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-20 17:02:09 +02: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
Achilleas Koutsou
4248564a55 cloudapi: update expected image type test for gcp-rhui
gce-rhui is now gone from RHEL 9 [1] and the old name simply aliases to
gce.  gcp-rhui in the cloudapi now resolves to 'gce' in RHEL 9 and
'gce-rhui' in RHEL 8.

[1] https://github.com/osbuild/images/pull/857
2024-09-17 23:33:44 +02:00
Sanne Raymaekers
b21f24e751 cloudapi/v2: populate openscap related rhsm facts
Also adds the policy id to the blueprint, this doesn't have any effect
on the openscap step, it just puts in place the rhsm fact so instances
registered to insights will appear under that policy.
2024-09-06 11:39:35 +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
Tomáš Hozza
f8c5595413 Delete EOL F37 and F38 repos
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-23 13:10:53 +02:00
Sanne Raymaekers
b10bbc0fb0 cloudapi/v2: 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
Tomáš Hozza
c3680ca0a7 Update osbuild/images to v0.75.0
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-13 15:52:44 +02:00
Gianluca Zuccarelli
2da3a73308 cloudapi: json tailoring options
Add support for json tailoring files in the cloudapi. Expand the tests
to check that the options returned are okay and that tailoring options
and json tailoring options can't be provided at the same time.
2024-08-07 12:06:28 +02:00
Gianluca Zuccarelli
4c225f7d66 cloudapi: openscap tailoring tests
Add an initial test for OpenSCAP tailoring customizations since we will
be expanding the tailoring options to support json tailoring.
2024-08-07 12:06:28 +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
Andrea Waltlova
7c830e90b0 Add password to User schema
Make sure password is encrypted
Update tests

Signed-off-by: Andrea Waltlova <awaltlov@redhat.com>
2024-07-22 09:11:36 +02:00
Sanne Raymaekers
ca19a5b5ed cloudapi/v2: add test for errors 2024-06-25 17:27:28 +02:00
Sanne Raymaekers
86fd957c9d cloudapi/v2: add details for non-service errors
In case Echo throws an error, or in case even echo doesn't manage to
catch an underlying error and wrap it, return as many details as
possible.
2024-06-25 17:27:28 +02:00
Sanne Raymaekers
39d2068d31 cloudapi/v2: detach HTTPErrorHandler from Server struct 2024-06-25 17:27:28 +02:00
Sanne Raymaekers
135dd94de5 cloudapi/v2: include details in case internal error is set
In case details aren't explicitly given, and the internal error is set,
include the internal error message in the details.
2024-06-25 17:27:28 +02:00
Lukas Zapletal
5ce8f65a58 cloudapi: propagate operation/external id
Signed-off-by: Lukas Zapletal <lzap+git@redhat.com>
2024-06-25 13:58:53 +02:00
Brian C. Lane
66c5c5ecf9 cloudapi: Add UploadTypesLocal for local_save status reports
This allows the compose status to reflect that it was saved locally, not
uploaded to a remote service. Without this it returns an error of
'Compose has unknown upload target'
2024-05-13 13:27:12 -07:00
Sanne Raymaekers
dc7bc4763c cloudapi/v2: pass repoconfigs when serializing manifests 2024-04-17 10:27:08 +02:00
Achilleas Koutsou
809f2544ad deps: update images to v0.54.0
Update images dependency and adjust import paths for distro package
changes.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2024-04-11 16:43:40 +02:00
Brian C. Lane
d3fc53bdec cloudapi: Override the request distro with the blueprint distro
When the blueprint sets a specific distribution it should be used
instead of the distribution from the compose request.

Includes a test to make sure it uses repositories from the blueprint,
not the request.
2024-03-22 19:12:24 +01:00
Achilleas Koutsou
8f78171f83 cloudapi: add installer customizations to the API
Adding both as a traditional compose request customization and in the
new blueprint customizations.
2024-03-20 11:45:08 +01:00
Brian C. Lane
57ebfb4011 cloudapi: Use distro repos if none included in imageRequest
In order to support cloudapi blueprint requests from the cmdline using
composer-cli it needs to select the repositories based on the selected
distribution instead of requiring the user to include them with the
request.

If the image request includes repositories they are used, which matches
the current behavior. If the repository list is empty it will use the
distribution name to select from the repositories shipped with
osbuild-composer.
2024-03-11 03:04:54 -07:00
Brian C. Lane
01ba674cac cloudapi: Pass the RepoRegistry to the cloudapi Server 2024-03-11 03:04:54 -07:00
Gianluca Zuccarelli
c480d79e95 cloudapi: enable masked services
Extend the cloudapi to accept masked systemd services as a
customization.
2024-02-29 20:57:39 +01:00