From e63472ef4426ea04ab2a1ec9441238e6bb8fb6f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Thu, 21 Sep 2023 09:52:26 +0200 Subject: [PATCH] Koji: expose osbuild artifact information in image metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expose the osbuild information used to produce the image, in the image extra metadata under the `osbuild_artifact` property. This information will get included in the image / build extra metadata and make it explicit how to reproduce the image build using osbuild and the attached manifest. Signed-off-by: Tomáš Hozza --- cmd/osbuild-worker/jobimpl-koji-finalize.go | 5 +++-- internal/upload/koji/koji.go | 2 ++ test/cases/koji.sh | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/osbuild-worker/jobimpl-koji-finalize.go b/cmd/osbuild-worker/jobimpl-koji-finalize.go index 5c3b4aac6..f39973d01 100644 --- a/cmd/osbuild-worker/jobimpl-koji-finalize.go +++ b/cmd/osbuild-worker/jobimpl-koji-finalize.go @@ -184,8 +184,9 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error { imageRPMs = rpmmd.DeduplicateRPMs(imageRPMs) imgOutputExtraInfo := koji.ImageExtraInfo{ - Arch: buildResult.Arch, - BootMode: buildResult.ImageBootMode, + Arch: buildResult.Arch, + BootMode: buildResult.ImageBootMode, + OSBuildArtifact: kojiTargetResult.OsbuildArtifact, } // The image filename is now set in the KojiTargetResultOptions. diff --git a/internal/upload/koji/koji.go b/internal/upload/koji/koji.go index eb1186e6c..8f72dce41 100644 --- a/internal/upload/koji/koji.go +++ b/internal/upload/koji/koji.go @@ -121,6 +121,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"` // Results from any upload targets associated with the image // except for the Koji target. UploadTargetResults []*target.TargetResult `json:"upload_target_results,omitempty"` diff --git a/test/cases/koji.sh b/test/cases/koji.sh index 3de331488..bee7e97ec 100755 --- a/test/cases/koji.sh +++ b/test/cases/koji.sh @@ -236,6 +236,13 @@ function verify_buildinfo() { ;; esac + local image_osbuild_artifact + image_osbuild_artifact="$(echo "${image_metadata_build}" | jq -r '.osbuild_artifact')" + if [ "${image_osbuild_artifact}" == "null" ]; then + echo "Image osbuild artifact information for '${image_filename}' is missing" + exit 1 + fi + local image_metadata_archive image_metadata_archive="$(echo "${image}" | jq -r '.extra.image')" if [ "${image_metadata_build}" != "${image_metadata_archive}" ]; then