From 143eb5cb912eb342cddb13d5ba4228c57a5d22d1 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Fri, 10 Sep 2021 15:43:37 +0200 Subject: [PATCH] worker: add PipelineNames to Job descriptions The names of the pipelines that make up a Manifest for a job are attached to the job data that is stored in the queue. The pipelines are separated into Build and Payload. This information is useful for identifying the build pipeline results and metadata and for the order of the pipelines as they appeared in the manifest. --- internal/worker/json.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/worker/json.go b/internal/worker/json.go index 7d62f8921..85d7653ed 100644 --- a/internal/worker/json.go +++ b/internal/worker/json.go @@ -17,6 +17,7 @@ type OSBuildJob struct { ImageName string `json:"image_name,omitempty"` StreamOptimized bool `json:"stream_optimized,omitempty"` Exports []string `json:"export_stages,omitempty"` + PipelineNames *PipelineNames `json:"pipeline_names,omitempty"` } type OSBuildJobResult struct { @@ -25,6 +26,7 @@ type OSBuildJobResult struct { TargetResults []*target.TargetResult `json:"target_results,omitempty"` TargetErrors []string `json:"target_errors,omitempty"` UploadStatus string `json:"upload_status"` + PipelineNames *PipelineNames `json:"pipeline_names,omitempty"` } type KojiInitJob struct { @@ -44,6 +46,7 @@ type OSBuildKojiJob struct { Manifest distro.Manifest `json:"manifest"` ImageName string `json:"image_name"` Exports []string `json:"exports"` + PipelineNames *PipelineNames `json:"pipeline_names,omitempty"` KojiServer string `json:"koji_server"` KojiDirectory string `json:"koji_directory"` KojiFilename string `json:"koji_filename"` @@ -53,6 +56,7 @@ type OSBuildKojiJobResult struct { HostOS string `json:"host_os"` Arch string `json:"arch"` OSBuildOutput *osbuild.Result `json:"osbuild_output"` + PipelineNames *PipelineNames `json:"pipeline_names,omitempty"` ImageHash string `json:"image_hash"` ImageSize uint64 `json:"image_size"` KojiError string `json:"koji_error"` @@ -73,6 +77,20 @@ type KojiFinalizeJobResult struct { KojiError string `json:"koji_error"` } +// PipelineNames is used to provide two pieces of information related to a job: +// 1. A categorization of each pipeline into one of two groups +// // 2. A pipeline ordering when the lists are concatenated: build -> os +// 2. A pipeline ordering when the lists are concatenated: build -> os +type PipelineNames struct { + Build []string `json:"build"` + Payload []string `json:"payload"` +} + +// Returns a concatenated list of the pipeline names +func (pn *PipelineNames) All() []string { + return append(pn.Build, pn.Payload...) +} + type DepsolveJob struct { PackageSets map[string]rpmmd.PackageSet `json:"package_sets"` Repos []rpmmd.RepoConfig `json:"repos"`