From 2ceffb3796b08a8c41e7a4e2d5cb682d2288933e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Mon, 7 Jul 2025 16:15:15 +0200 Subject: [PATCH] upload/koji: don't depend on upload target results data structures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modify the Koji image extra metadata to not depend on the upload target data structures for upload results. The target results are supposed to be specific to the uploader implementation, which will eventually change. Moreover, the definition is internal to osbuild-composer, so this would create a problem once the Koji upload implementation is moved to osbuild/images. The Koji upload implementation does not really care about the exact structure of the upload results. It is just a list of JSON objects. Signed-off-by: Tomáš Hozza --- cmd/osbuild-worker/jobimpl-koji-finalize.go | 4 ++-- internal/upload/koji/metadata.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/osbuild-worker/jobimpl-koji-finalize.go b/cmd/osbuild-worker/jobimpl-koji-finalize.go index a63edf00f..e75ca712a 100644 --- a/cmd/osbuild-worker/jobimpl-koji-finalize.go +++ b/cmd/osbuild-worker/jobimpl-koji-finalize.go @@ -208,8 +208,8 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error { // If there are any non-Koji target results in the build, // add them to the image output extra metadata. nonKojiTargetResults := buildResult.TargetResultsFilterByName([]target.TargetName{target.TargetNameKoji}) - if len(nonKojiTargetResults) > 0 { - imgOutputExtraInfo.UploadTargetResults = nonKojiTargetResults + for _, result := range nonKojiTargetResults { + imgOutputExtraInfo.UploadTargetResults = append(imgOutputExtraInfo.UploadTargetResults, result) } imgOutputsExtraInfo[imageFilename] = imgOutputExtraInfo diff --git a/internal/upload/koji/metadata.go b/internal/upload/koji/metadata.go index 55b5b973f..8f947fbe5 100644 --- a/internal/upload/koji/metadata.go +++ b/internal/upload/koji/metadata.go @@ -98,8 +98,9 @@ type ImageExtraInfo struct { // 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 - // except for the Koji target. - UploadTargetResults []*target.TargetResult `json:"upload_target_results,omitempty"` + // The structure of the data does not need to be known by the consumer, + // it is just a list of JSON objects. + UploadTargetResults []interface{} `json:"upload_target_results,omitempty"` } func (ImageExtraInfo) isImageOutputTypeMD() {}