From cca362678b6051c36683c95b2e1d75580ce281c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Fri, 22 Sep 2023 17:12:53 +0200 Subject: [PATCH] Worker/osbuild: include osbuild version in OSBuildJobResult MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will make it easier to reproduce image builds using the same tooling which was used by the worker. This change will enable to include the osbuild version in Koji build metadata. Signed-off-by: Tomáš Hozza --- cmd/osbuild-worker/jobimpl-osbuild.go | 7 +++++++ internal/worker/json.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/cmd/osbuild-worker/jobimpl-osbuild.go b/cmd/osbuild-worker/jobimpl-osbuild.go index 2e5d34d2c..13e669af5 100644 --- a/cmd/osbuild-worker/jobimpl-osbuild.go +++ b/cmd/osbuild-worker/jobimpl-osbuild.go @@ -341,6 +341,13 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error { } }() + osbuildVersion, err := osbuild.OSBuildVersion() + if err != nil { + osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, "Error getting osbuild binary version", err) + return err + } + osbuildJobResult.OSBuildVersion = osbuildVersion + // Read the job specification var jobArgs worker.OSBuildJob err = job.Args(&jobArgs) diff --git a/internal/worker/json.go b/internal/worker/json.go index 32938c240..67642fa70 100644 --- a/internal/worker/json.go +++ b/internal/worker/json.go @@ -63,6 +63,8 @@ type OSBuildJobResult struct { // Boot mode supported by the image // (string representation of distro.BootMode values) ImageBootMode string `json:"image_boot_mode,omitempty"` + // Version of the osbuild binary used by the worker to build the image + OSBuildVersion string `json:"osbuild_version,omitempty"` JobResult }