This uses the blueprint and the image type's manifest with a minimal
imageRequest to get the package sets to use for depsolving, instead of
just using the packages in the blueprint.
This does not work with iot image types that require an ostree url.
Depsolving iot commits doesn't make sense anyway, since the blueprint
packages have no effect on it.
Includes simple tests for depsolving with image type, and returning an
error if the image type isn't recognized.
Related: RHEL-60125
The oapi-codegen update to v2.5.0 changed the Details field of the main
Error type to be an empty interface. This requires updates to the error
handling tests to accommodate the new structure.
v1.60 seems to have some issues [1] with something in our dependency
chain. Update to v1.61 and fix all new issues.
New issues are all instances of potential integer overflow from int ->
uint conversions. Added guards where appropriate and disabled the check
when when it's not needed.
[1] https://github.com/osbuild/osbuild-composer/actions/runs/16624417387/job/47037518471
Use the version that contains the updated Koji upload code.
Also bump the version of `osbuild/blueprint` due to the new `uri` field
in file customizations.
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
The most common one is going to be trying to delete a compose before it
is finished, and that is certainly not worthy of a 500 server error
since it is a temporary state.
Two new tests are added, one with valid customizations and another with
invalid customizations.
Invalid customizations will return one of two error types, depending on
where exactly the failures was generated.
When the openapi schema fails to validate a request, it will return
IMAGE-BUILDLER-30.
When the error occurs while converting the openapi customizations to the
blueprint types, it will have the IMAGE-BUILDER-35 type instead.
After converting a Disk customization from the API type to the Blueprint
equivalent, run the validator and return an error if it fails to
validate.
The schema doesn't catch all invalid cases, such as the mountpoint being
required when the fs_type is not "swap", so calling the validator
ensures that any such cases are caught without needing to duplicate the
checks.
The type is required for partitions with a type other than plain.
This commit also adds the empty string to the valid values in the
conversion switch case and is treated like "plain".
Return an HTTP error with the invalid customization message when the
convertDiskCustomizations() function returns an error.
Secondary: The conversion was being run twice by mistake. This has also
been fixed.
This method is not particularly useful anymore. Its purpose was to
initialise the ImageOptions from an ImageRequest with the appropriate
size and partitioning mode. However, the partitioning mode was also
being set later using request.GetPartitioningMode(). More importantly,
setting the size on the ImageOptions caused issues with the interaction
between filesystem and partitioning customizations as well as the image
request size (see #4705). The correct thing to do here is to map the
ImageRequest.Size directly onto ImageOptions.Size, without taking into
account ImageType or the Blueprint Customizations. The rest are
considered when generating the manifest in images, either when preparing
the Manifest() call or when generating the partition table. This makes
it easier to trace and reason about the effect of each option. This
kind of decision making in the API layer makes it difficult to maintain
the logic, since it requires duplicating the decision making or, as we
had now, making certain specific combinations impossible.
The type of the minsize parameter in the new disk customization was
meant to support both integers (size in bytes) and strings (size with
unit). However, the schema wasn't done properly, which made any input
result in an error:
GenericError: Failed to create the compose request:
{"code":"IMAGE-BUILDER-COMPOSER-30","details":"request body has an
error: doesn't match schema #/components/schemas/ComposeRequest:
Error at \"/customizations/disk/partitions/0\": doesn't match schema
due to: Error at \"/minsize\": input matches more than one oneOf
schemas
Reducing it to just support strings simplifies the schema. It's also
not an important feature reduction since sizes as integers (for
filesystems that are typically in GiB) aren't very convenient.
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>
The image type names for Fedora were changed in images 0.138.0, aliases
were left behind so the old names still exist.
Split out the testcases between rhel and fedora so we test for the new
names being returned.
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Define a reusable minsize property in the cloud API schema.
The minsize type is either a uint64 or a string with data units.
Internally, this creates a union (json.RawMessage) type called Minsize
and optional uses of the property are of type *Minsize. We define an
internal decodeMinsize() function to convert *Minsize to uint64. This
is similar to the decodeSize() function in the blueprint, but made
specifically to handle *Minsize.
Fixed distribution list type, function signatures (later versions parse
uuids in the generated code), defaults actually being set and added
x-go-type where needed.
This commit discards the logrus output when the tests are run. That
might be a controversial change but the amount of redundant output
that drowns the actual failures makes it very hard to work with
these tests.
The original compose request contains useful details that are not
preserved when it is converted to a manifest. Things like the
distribution, arch, image type, blueprint or customizations are useful
when examining builds later.
This saves the original request json using the job id and a new
directory (ComposeRequest) under the artifacts directory. The original
request, if present, is then added to the compose/<id>/metadata response
alongside the package list.
Related: RHEL-60120
This will allow clients to display more information about a compose,
including the image type created, arch and distro, and blueprint to
customizations used to create it.
Related: RHEL-60120
This cleans up the linting results by adding checks for
integer underflow/overflow in several places, suppressing the error in
places where it has been checked, or fixing the types when possible.
This commit fixes the failing TestGetImageRequests_BlueprintDistro
test. It fails because fedora-39 is no longer part of the supported
distros and can no longer be build. Move to fedora-42 so that we
have a bit time before we need to update it again.
It also updates TestGetImageRequests_NoRepositories to point to
fedora-42.
This commit updates osbuild-composer for the new API in images
for the `reporegistry.New()`. The main incompatible change is
that the `/repositories` part is not longer automatically added
inside the library so we need to add it on the call-site.
This needs https://github.com/osbuild/images/pull/1179
This commit updates the cloudapi test that uses the real repositories
to use the version of those from the "images" library. Composer
no longer carries the default repos.
Note that this can most likely be simplified once
https://github.com/osbuild/images/pull/1179
is merged.