Target: expose osbuild artifact information in target result

Add the information about osbuid artifact to the target result.
Specifically the name of the osbuild pipeline which was exported for the
specific target, and the filename of the exported file.

This will later enable embedding this information in Koji build metadata
to make it easy to reproduce the image build using the attached
manifest.
This commit is contained in:
Tomáš Hozza 2023-09-21 09:36:16 +02:00 committed by Tomáš Hozza
parent 4f51d44762
commit 5b414a4516
13 changed files with 71 additions and 42 deletions

View file

@ -8,15 +8,18 @@ import (
)
type TargetResult struct {
Name TargetName `json:"name"`
Options TargetResultOptions `json:"options,omitempty"`
TargetError *clienterrors.Error `json:"target_error,omitempty"`
Name TargetName `json:"name"`
Options TargetResultOptions `json:"options,omitempty"`
// Configuration used to produce osbuild artifact specific to this target
OsbuildArtifact *OsbuildArtifact `json:"osbuild_artifact,omitempty"`
TargetError *clienterrors.Error `json:"target_error,omitempty"`
}
func newTargetResult(name TargetName, options TargetResultOptions) *TargetResult {
func newTargetResult(name TargetName, options TargetResultOptions, artifact *OsbuildArtifact) *TargetResult {
return &TargetResult{
Name: name,
Options: options,
Name: name,
Options: options,
OsbuildArtifact: artifact,
}
}
@ -25,9 +28,10 @@ type TargetResultOptions interface {
}
type rawTargetResult struct {
Name TargetName `json:"name"`
Options json.RawMessage `json:"options,omitempty"`
TargetError *clienterrors.Error `json:"target_error,omitempty"`
Name TargetName `json:"name"`
Options json.RawMessage `json:"options,omitempty"`
OsbuildArtifact *OsbuildArtifact `json:"osbuild_artifact,omitempty"`
TargetError *clienterrors.Error `json:"target_error,omitempty"`
}
func (targetResult *TargetResult) UnmarshalJSON(data []byte) error {
@ -48,6 +52,7 @@ func (targetResult *TargetResult) UnmarshalJSON(data []byte) error {
targetResult.Name = rawTR.Name
targetResult.Options = options
targetResult.OsbuildArtifact = rawTR.OsbuildArtifact
targetResult.TargetError = rawTR.TargetError
return nil
}