Worker/osbuild: include Manifest info in Koji target result
Copy the Manifest info data from the Manifest job result to the Koji target result, so that this information can be then imported to Koji build metadata by the koji-finalize job. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
3c95ba8476
commit
285cd30af2
2 changed files with 44 additions and 3 deletions
|
|
@ -349,6 +349,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
}
|
||||
|
||||
// In case the manifest is empty, try to get it from dynamic args
|
||||
var manifestInfo *worker.ManifestInfo
|
||||
if len(jobArgs.Manifest) == 0 {
|
||||
if job.NDynamicArgs() > 0 {
|
||||
var manifestJR worker.ManifestJobByIDResult
|
||||
|
|
@ -374,6 +375,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
return nil
|
||||
}
|
||||
jobArgs.Manifest = manifestJR.Manifest
|
||||
manifestInfo = &manifestJR.ManifestInfo
|
||||
}
|
||||
|
||||
if len(jobArgs.Manifest) == 0 {
|
||||
|
|
@ -901,6 +903,28 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
}
|
||||
logWithId.Info("[Koji] 🎉 osbuild output log successfully uploaded")
|
||||
|
||||
// Attach the manifest info to the koji target result, so that it
|
||||
// it can be imported to the Koji build by the koji-finalize job.
|
||||
var kojiManifestInfo *target.ManifestInfo
|
||||
if manifestInfo != nil {
|
||||
kojiManifestInfo = &target.ManifestInfo{
|
||||
OSBuildComposerVersion: manifestInfo.OSBuildComposerVersion,
|
||||
}
|
||||
for _, composerDep := range manifestInfo.OSBuildComposerDeps {
|
||||
dep := &target.OSBuildComposerDepModule{
|
||||
Path: composerDep.Path,
|
||||
Version: composerDep.Version,
|
||||
}
|
||||
if composerDep.Replace != nil {
|
||||
dep.Replace = &target.OSBuildComposerDepModule{
|
||||
Path: composerDep.Replace.Path,
|
||||
Version: composerDep.Replace.Version,
|
||||
}
|
||||
}
|
||||
kojiManifestInfo.OSBuildComposerDeps = append(kojiManifestInfo.OSBuildComposerDeps, dep)
|
||||
}
|
||||
}
|
||||
|
||||
targetResult.Options = &target.KojiTargetResultOptions{
|
||||
Image: &target.KojiOutputInfo{
|
||||
Filename: jobTarget.ImageName,
|
||||
|
|
@ -920,6 +944,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
Checksum: osbuildOutputHash,
|
||||
Size: osbuildOutputSize,
|
||||
},
|
||||
OSBuildManifestInfo: kojiManifestInfo,
|
||||
}
|
||||
|
||||
case *target.OCITargetOptions:
|
||||
|
|
|
|||
|
|
@ -42,10 +42,26 @@ type KojiOutputInfo struct {
|
|||
Size uint64 `json:"size"`
|
||||
}
|
||||
|
||||
type OSBuildComposerDepModule struct {
|
||||
Path string `json:"path"`
|
||||
Version string `json:"version"`
|
||||
Replace *OSBuildComposerDepModule `json:"replace,omitempty"`
|
||||
}
|
||||
|
||||
// ManifestInfo contains information about the environment in which
|
||||
// the manifest was produced and which could affect its content.
|
||||
type ManifestInfo struct {
|
||||
OSBuildComposerVersion string `json:"osbuild_composer_version"`
|
||||
// List of relevant modules used by osbuild-composer which
|
||||
// could affect the manifest content.
|
||||
OSBuildComposerDeps []*OSBuildComposerDepModule `json:"osbuild_composer_deps,omitempty"`
|
||||
}
|
||||
|
||||
type KojiTargetResultOptions struct {
|
||||
Image *KojiOutputInfo `json:"image"`
|
||||
Log *KojiOutputInfo `json:"log,omitempty"`
|
||||
OSBuildManifest *KojiOutputInfo `json:"osbuild_manifest,omitempty"`
|
||||
Image *KojiOutputInfo `json:"image"`
|
||||
Log *KojiOutputInfo `json:"log,omitempty"`
|
||||
OSBuildManifest *KojiOutputInfo `json:"osbuild_manifest,omitempty"`
|
||||
OSBuildManifestInfo *ManifestInfo `json:"osbuild_manifest_info,omitempty"`
|
||||
}
|
||||
|
||||
func (o *KojiTargetResultOptions) UnmarshalJSON(data []byte) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue