Worker/osbuild: depend on depsolve job for Koji composes

For Koji composes, all files are uploaded to Koji as part of the osbuild
job (specifically as part of handling the Koji target). So in order to
be able to upload SBOM documents to Koji as part of Koji compose, the
osbuild job needs to to be able to access the depsolve job result, which
contains the SBOM documents. For this, the osbuild job must depend on
the depsolve job.

For Koji composes, make sure that osbuild job depends on the depsolve
job and set the DepsolveDynArgsIdx.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-09-10 16:32:05 +02:00 committed by Tomáš Hozza
parent f8d231d024
commit 4ae35a0ed9
2 changed files with 13 additions and 4 deletions

View file

@ -402,8 +402,9 @@ func (s *Server) enqueueKojiCompose(taskID uint64, server, name, version, releas
},
Targets: targets,
ManifestDynArgsIdx: common.ToPtr(1),
DepsolveDynArgsIdx: common.ToPtr(2),
ImageBootMode: ir.imageType.BootMode().String(),
}, []uuid.UUID{initID, manifestJobID}, channel)
}, []uuid.UUID{initID, manifestJobID, depsolveJobID}, channel)
if err != nil {
return id, HTTPErrorWithInternal(ErrorEnqueueingJob, err)
}

View file

@ -21,10 +21,18 @@ import (
type OSBuildJob struct {
Manifest manifest.OSBuildManifest `json:"manifest,omitempty"`
// Index of the ManifestJobByIDResult instance in the job's dynamic arguments slice
ManifestDynArgsIdx *int `json:"manifest_dyn_args_idx,omitempty"`
Targets []*target.Target `json:"targets,omitempty"`
PipelineNames *PipelineNames `json:"pipeline_names,omitempty"`
ManifestDynArgsIdx *int `json:"manifest_dyn_args_idx,omitempty"`
// Index of the DepsolveJobResult instance in the job's dynamic arguments slice
// This is used only for Koji composes, which need to have access to SBOMs produced
// as part of the depsolve job, so that they can be uploaded to Koji.
DepsolveDynArgsIdx *int `json:"depsolve_dyn_args_idx,omitempty"`
Targets []*target.Target `json:"targets,omitempty"`
PipelineNames *PipelineNames `json:"pipeline_names,omitempty"`
// The ImageBootMode is just copied to the result by the worker, so that
// the value can be accessed job which depend on it.
// (string representation of distro.BootMode values)