upload/koji: don't depend on upload target osbuild artifact structure

Modify the Koji image extra metadata to not depend on the upload target
data structure for the OSBuild Artifact. This is the last dependency on
the internal osbuild-composer package, allowing the move of the Koji
upload code to the osbuild/images repository.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2025-07-07 16:15:15 +02:00 committed by Tomáš Hozza
parent 2ceffb3796
commit 651946ae54
2 changed files with 19 additions and 7 deletions

View file

@ -160,6 +160,14 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
}
kojiTargetResult := kojiTargetResults[0]
var kojiTargetOSBuildArtifact *koji.OsbuildArtifact
if kojiTargetResult.OsbuildArtifact != nil {
kojiTargetOSBuildArtifact = &koji.OsbuildArtifact{
ExportFilename: kojiTargetResult.OsbuildArtifact.ExportFilename,
ExportName: kojiTargetResult.OsbuildArtifact.ExportName,
}
}
kojiTargetOptions := kojiTargetResult.Options.(*target.KojiTargetResultOptions)
buildRoots = append(buildRoots, koji.BuildRoot{
@ -193,7 +201,7 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
imgOutputExtraInfo := koji.ImageExtraInfo{
Arch: buildResult.Arch,
BootMode: buildResult.ImageBootMode,
OSBuildArtifact: kojiTargetResult.OsbuildArtifact,
OSBuildArtifact: kojiTargetOSBuildArtifact,
OSBuildVersion: buildResult.OSBuildVersion,
}

View file

@ -1,9 +1,5 @@
package koji
import (
"github.com/osbuild/osbuild-composer/internal/target"
)
// BUILD METADATA
// TypeInfoBuild is a map whose entries are the names of the build types
@ -84,6 +80,14 @@ type ImageOutputTypeExtraInfo interface {
isImageOutputTypeMD()
}
// OsbuildArtifact represents a configuration to produce the image using osbuild.
type OsbuildArtifact struct {
// Filename of the image as produced by osbuild
ExportFilename string `json:"export_filename"`
// Name of the osbuild pipeline, which was exported to produce this image
ExportName string `json:"export_name"`
}
// ImageExtraInfo holds extra metadata about the image.
// This structure is shared for the Extra metadata of the output and the build.
type ImageExtraInfo struct {
@ -93,8 +97,8 @@ type ImageExtraInfo struct {
Arch string `json:"arch"`
// Boot mode of the image
BootMode string `json:"boot_mode,omitempty"`
// Configuration used to prouce this image using osbuild
OSBuildArtifact *target.OsbuildArtifact `json:"osbuild_artifact,omitempty"`
// Configuration used to produce this image using osbuild
OSBuildArtifact *OsbuildArtifact `json:"osbuild_artifact,omitempty"`
// Version of the osbuild binary used by the worker to build the image
OSBuildVersion string `json:"osbuild_version,omitempty"`
// Results from any upload targets associated with the image