Rather than Manifest() returning an osbuild.Manifest object, introduce a new distro.Manifest object which represents it as an opaque, JSON serializable object. This new type has the following properties: 1) its serialization is compatible with the input to osbuild, 2) any valid osbuild input can be deserialized into it, and 3) marshalling and unmarshaling to and from JSON is lossless. This means that even as we change the subset of valid osbulid manifests that we support, we can still load any previous state from disk, and it will continue to work just as before, even though we can no longer deserialize it into our internal notion of osbuild.Manifest. This fixes the underlying problem of which #685 was a symptom. Signed-off-by: Tom Gundersen <teg@jklm.no>
51 lines
1 KiB
Go
51 lines
1 KiB
Go
package worker
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/osbuild/osbuild-composer/internal/common"
|
|
"github.com/osbuild/osbuild-composer/internal/distro"
|
|
"github.com/osbuild/osbuild-composer/internal/target"
|
|
)
|
|
|
|
//
|
|
// JSON-serializable types for the jobqueue
|
|
//
|
|
|
|
type OSBuildJob struct {
|
|
Manifest distro.Manifest `json:"manifest"`
|
|
Targets []*target.Target `json:"targets,omitempty"`
|
|
}
|
|
|
|
type OSBuildJobResult struct {
|
|
OSBuildOutput *common.ComposeResult `json:"osbuild_output,omitempty"`
|
|
}
|
|
|
|
//
|
|
// JSON-serializable types for the HTTP API
|
|
//
|
|
|
|
type statusResponse struct {
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type errorResponse struct {
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
type addJobRequest struct {
|
|
}
|
|
|
|
type addJobResponse struct {
|
|
Id uuid.UUID `json:"id"`
|
|
Manifest distro.Manifest `json:"manifest"`
|
|
Targets []*target.Target `json:"targets,omitempty"`
|
|
}
|
|
|
|
type updateJobRequest struct {
|
|
Status common.ImageBuildState `json:"status"`
|
|
Result *common.ComposeResult `json:"result"`
|
|
}
|
|
|
|
type updateJobResponse struct {
|
|
}
|