Worker/koji-finalize: include manifest metadata in the build metadata

Expose the extra metadata attached to each manifest output, also to the
build extra metadata under `osbuild_manifest` property. The value is a
map of all manifest metadata with keys being the filename of each
manifest.

This will expose the information about osbuild-composer and
osbuild/images versions used to produce the manifest in the Koji
buildinfo, including the Web UI.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-09-22 16:30:42 +02:00 committed by Tomáš Hozza
parent c27cf0253d
commit 95169111de
2 changed files with 8 additions and 0 deletions

View file

@ -119,6 +119,7 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
var outputs []koji.BuildOutput
// Extra info for each image output is stored using the image filename as the key
imgOutputsExtraInfo := map[string]koji.ImageExtraInfo{}
manifestOutputsExtraInfo := map[string]*koji.ManifestExtraInfo{}
var osbuildResults []worker.OSBuildJobResult
initArgs, osbuildResults, err = extractDynamicArgs(job)
@ -249,6 +250,8 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
manifestExtraInfo.Info = manifestInfo
}
manifestOutputsExtraInfo[kojiTargetOptions.OSBuildManifest.Filename] = &manifestExtraInfo
outputs = append(outputs, koji.BuildOutput{
BuildRootID: uint64(i),
Filename: kojiTargetOptions.OSBuildManifest.Filename,
@ -291,6 +294,7 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
TypeInfo: koji.TypeInfoBuild{
Image: imgOutputsExtraInfo,
},
Manifest: manifestOutputsExtraInfo,
},
}

View file

@ -53,6 +53,10 @@ type TypeInfoBuild struct {
// It is a free-form map, but must contain at least the 'typeinfo' key.
type BuildExtra struct {
TypeInfo TypeInfoBuild `json:"typeinfo"`
// Manifest holds extra metadata about osbuild manifests attached to the build.
// It is a map whose keys are the filenames of the manifests, and
// the values are the extra metadata for the manifest.
Manifest map[string]*ManifestExtraInfo `json:"osbuild_manifest,omitempty"`
}
// Build represents a Koji build and holds metadata about it.