cloudapi: move blueprint into an image request

The goal of this commit is primarily to simplify the API of the enqueue
methods. This way, basically everything needed to generate manifests
is in the imageRequest structure, which simplifies the amount of structures
that we need to think about.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2024-02-16 14:15:09 +01:00 committed by Tomáš Hozza
parent ab8c1ae4f7
commit 7385cab165
2 changed files with 10 additions and 7 deletions

View file

@ -5,6 +5,7 @@ import (
"crypto/rand"
"encoding/json"
"fmt"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"math"
"math/big"
"net/http"
@ -139,6 +140,7 @@ type imageRequest struct {
repositories []rpmmd.RepoConfig
imageOptions distro.ImageOptions
targets []*target.Target
blueprint blueprint.Blueprint
}
func (h *apiHandlers) PostCompose(ctx echo.Context) error {
@ -268,17 +270,18 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
repositories: repos,
imageOptions: imageOptions,
targets: irTargets,
blueprint: bp,
})
}
var id uuid.UUID
if request.Koji != nil {
id, err = h.server.enqueueKojiCompose(uint64(request.Koji.TaskId), request.Koji.Server, request.Koji.Name, request.Koji.Version, request.Koji.Release, bp, manifestSeed, irs, channel)
id, err = h.server.enqueueKojiCompose(uint64(request.Koji.TaskId), request.Koji.Server, request.Koji.Name, request.Koji.Version, request.Koji.Release, manifestSeed, irs, channel)
if err != nil {
return err
}
} else {
id, err = h.server.enqueueCompose(bp, manifestSeed, irs, channel)
id, err = h.server.enqueueCompose(manifestSeed, irs, channel)
if err != nil {
return err
}