weldr: allow to send warnings on ComposeReply

This adds a new field `Warnings` to the `ComposeReply`
struct, allowing to send back any warnings (e.g. deprecation
notices) generated during the `checkOptions` step of the
manifest initialization.

See also https://github.com/osbuild/weldr-client/pull/99 which
handles the weldr-client side of things.

Signed-off-by: Irene Diez <idiez@redhat.com>
This commit is contained in:
Irene Diez 2023-03-08 13:12:54 +01:00 committed by Tomáš Hozza
parent 8022c227ba
commit 5fb989110a
3 changed files with 37 additions and 35 deletions

View file

@ -2328,8 +2328,9 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
Upload *uploadRequest `json:"upload"`
}
type ComposeReply struct {
BuildID uuid.UUID `json:"build_id"`
Status bool `json:"status"`
BuildID uuid.UUID `json:"build_id"`
Status bool `json:"status"`
Warnings []string `json:"warnings"`
}
contentType := request.Header["Content-Type"]
@ -2499,7 +2500,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
return
}
manifest, err := imageType.Manifest(bp.Customizations,
manifest, warnings, err := imageType.Manifest(bp.Customizations,
options,
imageRepos,
packageSets,
@ -2558,8 +2559,9 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
}
err = json.NewEncoder(writer).Encode(ComposeReply{
BuildID: composeID,
Status: true,
BuildID: composeID,
Status: true,
Warnings: warnings,
})
common.PanicOnError(err)
}