Worker/koji-finalize: import osbuild manifest and log to Koji build
Import osbuild manifest and build log to the Koji build as outputs. Also note the respective filenames in the image output extra metadata. Note that the osbuild manifest is imported as a log file for now. Koji has very limited set of output types defined and I still need to determine the best way to use a custom output type in Koji instances (as other content generators do). Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
70e125bd5e
commit
e0ec3a2a1c
6 changed files with 92 additions and 12 deletions
|
|
@ -179,8 +179,8 @@ func TestKojiImport(t *testing.T) {
|
|||
Checksum: hash,
|
||||
Type: koji.BuildOutputTypeImage,
|
||||
RPMs: []rpmmd.RPM{},
|
||||
Extra: koji.BuildOutputExtra{
|
||||
Image: koji.ImageExtraInfo{
|
||||
Extra: &koji.BuildOutputExtra{
|
||||
ImageOutput: koji.ImageExtraInfo{
|
||||
Arch: "noarch",
|
||||
BootMode: distro.BOOT_LEGACY.String(),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ func main() {
|
|||
Type: koji.BuildOutputTypeImage,
|
||||
RPMs: []rpmmd.RPM{},
|
||||
Extra: &koji.BuildOutputExtra{
|
||||
Image: koji.ImageExtraInfo{
|
||||
ImageOutput: koji.ImageExtraInfo{
|
||||
Arch: arch,
|
||||
BootMode: distro.BOOT_NONE.String(), // TODO: put the correct boot mode here
|
||||
},
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
|
|||
|
||||
imgOutputsExtraInfo[imageFilename] = imgOutputExtraInfo
|
||||
|
||||
// Image output
|
||||
outputs = append(outputs, koji.BuildOutput{
|
||||
BuildRootID: uint64(i),
|
||||
Filename: imageFilename,
|
||||
|
|
@ -208,9 +209,44 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
|
|||
Type: koji.BuildOutputTypeImage,
|
||||
RPMs: imageRPMs,
|
||||
Extra: &koji.BuildOutputExtra{
|
||||
Image: imgOutputExtraInfo,
|
||||
ImageOutput: imgOutputExtraInfo,
|
||||
},
|
||||
})
|
||||
|
||||
// OSBuild manifest output
|
||||
// TODO: Condition below is present for backward compatibility with old workers which don't upload the manifest.
|
||||
// TODO: Remove the condition it in the future.
|
||||
if kojiTargetOptions.OSBuildManifest != nil {
|
||||
outputs = append(outputs, koji.BuildOutput{
|
||||
BuildRootID: uint64(i),
|
||||
Filename: kojiTargetOptions.OSBuildManifest.Filename,
|
||||
FileSize: kojiTargetOptions.OSBuildManifest.Size,
|
||||
Arch: buildResult.Arch,
|
||||
ChecksumType: koji.ChecksumType(kojiTargetOptions.OSBuildManifest.ChecksumType),
|
||||
Checksum: kojiTargetOptions.OSBuildManifest.Checksum,
|
||||
Type: koji.BuildOutputTypeManifest,
|
||||
Extra: &koji.BuildOutputExtra{
|
||||
ImageOutput: koji.ManifestExtraInfo{
|
||||
Arch: buildResult.Arch,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// Build log output
|
||||
// TODO: Condition below is present for backward compatibility with old workers which don't upload the log.
|
||||
// TODO: Remove the condition it in the future.
|
||||
if kojiTargetOptions.Log != nil {
|
||||
outputs = append(outputs, koji.BuildOutput{
|
||||
BuildRootID: uint64(i),
|
||||
Filename: kojiTargetOptions.Log.Filename,
|
||||
FileSize: kojiTargetOptions.Log.Size,
|
||||
Arch: "noarch", // log file is not architecture dependent
|
||||
ChecksumType: koji.ChecksumType(kojiTargetOptions.Log.ChecksumType),
|
||||
Checksum: kojiTargetOptions.Log.Checksum,
|
||||
Type: koji.BuildOutputTypeLog,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
build := koji.Build{
|
||||
|
|
@ -222,7 +258,7 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
|
|||
StartTime: int64(args.StartTime),
|
||||
EndTime: time.Now().Unix(),
|
||||
Extra: koji.BuildExtra{
|
||||
TypeInfo: koji.TypeInfo{
|
||||
TypeInfo: koji.TypeInfoBuild{
|
||||
Image: imgOutputsExtraInfo,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -908,7 +908,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
Checksum: imageHash,
|
||||
Size: imageSize,
|
||||
},
|
||||
OsbuildManifest: &target.KojiOutputInfo{
|
||||
OSBuildManifest: &target.KojiOutputInfo{
|
||||
Filename: manifestFilename,
|
||||
ChecksumType: target.ChecksumTypeMD5,
|
||||
Checksum: manifestHash,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue