Commit graph

3352 commits

Author SHA1 Message Date
Brian C. Lane
78e983b69a cloudapi: Add support for depsolving a blueprint + image type
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
2025-08-06 15:35:38 -07:00
Brian C. Lane
c2f982e6cc cloudapi: Add optional image_type to depsolve yaml
This will be used to select the image type to combine the blueprint with
when depsolving the packages that will be on the final image.
2025-08-06 15:35:38 -07:00
Lukas Zapletal
a58a399008 v2: update errors test for new error type
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.
2025-08-05 18:55:32 +02:00
lzap
e118df5dfd chore: bump Go dependencies 2025-08-05 18:55:32 +02:00
Achilleas Koutsou
b3d1e4cf13 Makefile: bump GOLANGCI_LINT_VERSION to v1.61
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
2025-07-31 12:34:24 +02:00
Sanne Raymaekers
0e2daa201f many: switch to osbuild/images/pkg/upload for azure
This is part of consolidating all the upload code in images.
2025-07-29 13:10:22 +02:00
Lukas Zapletal
26ab15b1c9 worker: silence linter 2025-07-28 20:39:32 +02:00
Lukas Zapletal
b932daaa76 weldr: remove double import 2025-07-28 20:39:32 +02:00
Lukas Zapletal
39a65e3f34 client: improve test temporary dirs 2025-07-28 20:39:32 +02:00
Lukas Zapletal
9db1f304fa auth: refactor errors to have prefix 2025-07-28 20:39:32 +02:00
Achilleas Koutsou
6223c43cd7 cloudapi: new image type: azure-sapapps-rhui
osbuild/images v0.156.0, updated in
3fd7092db5, introduced a new Azure image
type: azure-sapapps-rhui.

Adding it to the cloud API.
2025-07-28 17:30:34 +02:00
Sanne Raymaekers
d7686244cd cmd/osbuild-composer-dbjobqueue-tests: add migration test
Migration 9 alters the result column in the jobs table is relied on for
compose statuses. Because it has to be kept consistent across
migrations, add a test to verify this.

As a side effect, the test itself handles the migration now, so remove
that part from the tests GHA.
2025-07-25 13:10:10 +02:00
Sanne Raymaekers
c4360a67f5 jobqueue: handle escaped null bytes in postgres
Postgres doesn't accept `\u0000` in the jsonb datatype. Switch to the
json datatype which is larger and slower, but accepts escaped null
bytes.

As we don't actually query or index the result jsonb directly, the
impact of this should be minimal.

See: https://www.postgresql.org/docs/current/datatype-json.html
2025-07-25 13:10:10 +02:00
Achilleas Koutsou
ccb8e9ae33 cloudapi: use distrofactory to get rhel-9.3
Same as in 57813199cf.

The test was importing `distro/rhel/rhel9`, which is going away, instead
of using the distrofactory.
2025-07-24 10:37:37 +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
3e3f9a0789 Many: move to koji upload implementation from osbuild/images
Delete the `internal/upload/koji` package and replace it with
`pkg/upload/koji` package provided by `osbuild/images`.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-14 17:20:02 +02:00
Tomáš Hozza
7a580f79ae go.mod: bump osbuild/images to v0.158.0
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>
2025-07-14 17:20:02 +02:00
Brian C. Lane
60c5f10af8 cloudapi: Fix the href of the delete response
Originally it was going to include /delete/ in the path. It was removed
in the openapi yaml but not in the result from deleteComposeImpl.
2025-07-11 00:47:22 +02:00
Brian C. Lane
07d34f339c cloudapi: Use error 400 for cloudapi delete errors
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.
2025-07-11 00:47:22 +02:00
Tomáš Hozza
97c3460a94 cmd: delete osbuild-koji
Delete the osbuild-koji tools, which is not used by any code or test
case. This also allows to delete the koji.NewFromPlain() function. This
is to minimize the set of exported functions by the koji package, before
moving it to osbuild/images repository.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 22:51:53 +02:00
Tomáš Hozza
651946ae54 upload/koji: don't depend on upload target osbuild artifact structure
Modify the Koji image extra metadata to not depend on the upload target
data structure for the OSBuild Artifact. This is the last dependency on
the internal osbuild-composer package, allowing the move of the Koji
upload code to the osbuild/images repository.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 22:51:53 +02:00
Tomáš Hozza
2ceffb3796 upload/koji: don't depend on upload target results data structures
Modify the Koji image extra metadata to not depend on the upload target
data structures for upload results. The target results are supposed to
be specific to the uploader implementation, which will eventually
change. Moreover, the definition is internal to osbuild-composer, so
this would create a problem once the Koji upload implementation is moved
to osbuild/images.

The Koji upload implementation does not really care about the exact
structure of the upload results. It is just a list of JSON objects.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 22:51:53 +02:00
Tomáš Hozza
0bafc0915d upload/koji: don't depend on rpmmd.RPM for build metadata
The use of rpmmd.RPM is exclusive to the Koji upload implementation.
Consolidate the metadata structure for RPMs into the koji package
codebase, together with any required functions for converting osbuild
stage metadata. The respective code in osbuild/images will be eventually
removed.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 22:51:53 +02:00
Tomáš Hozza
0ca81d5af4 upload/koji: move metadata structures to a separate file
Increase readability by logically splitting the build metadata
structures from the actual upload API implementation.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 22:51:53 +02:00
Tomáš Hozza
dc8f8964a4 upload/koji: delete unused GSSAPICredentialsFromEnv()
The function is not being used anywhere, therefore delete it.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 22:51:53 +02:00
Tomáš Hozza
ca1e1dce36 Many: factor out logger implementation from upload/koji
The upload/koji package functions were creating a logger and then were
using it. This is not ideal for a library implementation.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 22:51:53 +02:00
Tomáš Hozza
60014b1218 upload/koji: use passed transport in NewFromPlain()
Don't create a new transport in NewFromPlain() using
CreateRetryableTransport(), because the only place
in which NewFromPlain() is called passes the return value of
CreateRetryableTransport() when calling it.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 22:51:53 +02:00
Lukas Zapletal
1cde7e341b common: fix unclosed logrus logging pipes 2025-07-08 11:38:27 +02:00
rverdile
0c325137cf cloudapi/v2: add patch_url to customizations
Supports registering a template to insights on boot. Patch URL is needed
for RHEL 8 and RHEL 9.5 support.
2025-07-04 08:36:23 +02:00
Achilleas Koutsou
f6c1709d8d cloudapi: add azure-cvm image type
Introduce the azure-cvm (confidential VM) in the cloud API.
2025-06-24 15:38:32 +02:00
Achilleas Koutsou
deccaf9548 go.mod: update osbuild/images to v0.151.0
tag v0.149.0
Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com>

Changes with 0.149.0

----------------
  * Update dependencies 2025-05-25 (osbuild/images#1560)
    * Author: SchutzBot, Reviewers: Simon de Vlieger, Tomáš Hozza
  * Update osbuild dependency commit ID to latest (osbuild/images#1522)
    * Author: SchutzBot, Reviewers: Simon de Vlieger, Tomáš Hozza
  * Update snapshots to 20250515 (osbuild/images#1524)
    * Author: SchutzBot, Reviewers: Simon de Vlieger, Tomáš Hozza
  * `vagrant-libvirt` implementation (HMS-6116) (osbuild/images#1548)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * fedora: tweaks after all imageTypes are YAML (osbuild/images#1518)
    * Author: Michael Vogt, Reviewers: Simon de Vlieger, Tomáš Hozza
  * gha: do not break gobump output (osbuild/images#1561)
    * Author: Lukáš Zapletal, Reviewers: Simon de Vlieger, Tomáš Hozza
  * repositories: AlmaLinux 10 (osbuild/images#1567)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Lukáš Zapletal, Neal Gompa (ニール・ゴンパ)
  * vagrant: image config for default vagrant user (HMS-6116) (osbuild/images#1565)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Michael Vogt

— Somewhere on the Internet, 2025-05-27

---

tag v0.150.0
Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com>

Changes with 0.150.0

----------------
  * Replace hardcoded kickstart %post scripts with new stage options and bootc switch with custom kickstart content (HMS-6051) (osbuild/images#1527)
    * Author: Achilleas Koutsou, Reviewers: Simon de Vlieger, Tomáš Hozza
  * test: install yamllint for tests (osbuild/images#1572)
    * Author: Achilleas Koutsou, Reviewers: Lukáš Zapletal, Simon de Vlieger, Tomáš Hozza

— Somewhere on the Internet, 2025-06-02

---

tag v0.151.0
Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com>

Changes with 0.151.0

----------------
  * Introduce new Azure CVM image type (HMS-5636) (osbuild/images#1318)
    * Author: Achilleas Koutsou, Reviewers: Nobody
  * Many: support using string with unit for byte-sized partitioning fields in YAML distro definitions (osbuild/images#1579)
    * Author: Tomáš Hozza, Reviewers: Achilleas Koutsou, Brian C. Lane
  * Update osbuild dependency commit ID to latest (osbuild/images#1587)
    * Author: SchutzBot, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * Update snapshots to 20250601 (osbuild/images#1573)
    * Author: SchutzBot, Reviewers: Achilleas Koutsou, Lukáš Zapletal
  * bootc: Make installed rootfs configurable (osbuild/images#1555)
    * Author: Mbarak Bujra, Reviewers: Michael Vogt, Tomáš Hozza
  * distro: create new ImageConfig.DNFConfig (osbuild/images#1583)
    * Author: Michael Vogt, Reviewers: Simon de Vlieger, Tomáš Hozza
  * distro: make "fedora" a "generic" distro (osbuild/images#1563)
    * Author: Michael Vogt, Reviewers: Nobody
  * image: If using a separate build container, copy bootc customization to it (osbuild/images#1571)
    * Author: Alexander Larsson, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * manifest/ostree: explicitly include shadow-utils (osbuild/images#1585)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Michael Vogt
  * osbuild/tar: explicit compression (HMS-8573, HMS-6116) (osbuild/images#1581)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * tests: bump fedora versions to 41 (osbuild/images#1438)
    * Author: Lukáš Zapletal, Reviewers: Brian C. Lane, Michael Vogt

— Somewhere on the Internet, 2025-06-09

---
2025-06-23 14:37:30 +01:00
Lukas Zapletal
f2bf47814f deps: upgrade go-systemd from v1 to v22 2025-06-16 17:46:45 +02:00
Achilleas Koutsou
5a5e6d732c clouapi: test Disk customization validation
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.
2025-06-16 13:33:20 +02:00
Achilleas Koutsou
45929efbcf cloudapi: validate Disk customization before returining
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.
2025-06-16 13:33:20 +02:00
Achilleas Koutsou
ea0b5e8661 cloudapi: make fs_type required for filesystems and logical volumes
While technically this is a backwards incompatible API change, the
core blueprint schema didn't allow for empty or undefined fs_type [1,2],
so the general behaviour hasn't changed, we're just catching it early
now.

[1] de18902e3f/pkg/blueprint/disk_customizations.go (L624-L627)
[2] de18902e3f/pkg/blueprint/disk_customizations.go (L677-L680)
2025-06-16 13:33:20 +02:00
Achilleas Koutsou
a03d01c92c cloudapi: make type mandatory for non-plain partitions
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".
2025-06-16 13:33:20 +02:00
Achilleas Koutsou
6cd4bbc6d2 cloudapi: support swap partitions and volume groups
Supporting "swap" as the fs_type requires making the mountpoint an
optional field.  When setting fs_type="swap", the mountpoint must be
empty.
2025-06-16 13:33:20 +02:00
Achilleas Koutsou
edb9b284d5 cloudapi: return http error when failing to convert disk customizations
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.
2025-06-16 13:33:20 +02:00
Brian C. Lane
12dd0b0be4 cloudapi: Fix listing composes with empty result
It was returning a null body instead of an empty list.

Related: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
b33f86783f cloudapi: Add artifact cleanup to delete handler
Related: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
56fc58cca3 cloudapi: Add DeleteCompose to delete a job by UUID
This adds the handler for DELETE /composes/{id} which will delete a job and
all of its dependencies, and any artifacts.

Related: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
a569ac0f7b cloudapi: Add DELETE /composes/{id} route to delete a job
This will be used to delete jobs and their artifacts.

Related: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
f1a2c24563 worker: Add CleanupArtifacts function
This removes all artifact directories, and their contents, if there
isn't an associated Job. This is used to clean up local artifacts after
the compose job has been deleted.

Related: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
c3394ae589 jobqueuetest: Add job delete tests
This adds tests for retrieving all root jobs, and deleting jobs
and unused dependencies. These tests are run against the fsjobqueue for
unit testing, and against dbjobqueue for integration testing.

Resolves: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
5cddc4223d dbjobqueue: Add AllRootJobIDs implementation
Related: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
d8285a0b74 jobqueue: Add DeleteJob function
This allows jobs to be deleted from the database.
Currently only implemented by fsjobqueue. The function for
dbjobqueue currently returns nil.

This will remove all the job files used by the root job UUID as long as
no other job depends on them. ie. It starts at the top, and moves down
the dependency tree until it finds a job that is also used by another
job, removes the job to be deleted from its dependants list, and moves
back up the tree only deleting jobs with empty dependants lists.

Related: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
5961b69caa jsondb: Add Delete function
This allows database entries to be deleted.

Related: RHEL-60120
2025-06-05 10:32:56 +02:00
Brian C. Lane
4cb47a424d cloudapi: Fix missing specs for koji ContainerResolve
It looks like this got lost in a refactor back in commit 6e4efabf24
when it used to populate the Specs list in a loop.
2025-05-13 20:38:38 +02:00
rverdile
1559b4d760 cloudapi/v2: add templates to subscription image options
Adds optional templateName and templateUUID paramaters to image options,
each used if registering a system to a template a boot.
2025-05-12 10:07:19 +02:00
Michael Vogt
1a6c70b649 internal: drop internal/fsnode package
This package has an identical copy in `images` and is also (AFAICT)
unused. Hence this commit removes it.
2025-05-06 10:45:21 +03:00