Target/Koji: rework result options to contain more than just image info
The `KojiTargetResultOptions` previously contained information only about the uploaded image file. And even then, some information, such as the filename, were scattered in other structures such as `KojiFinalizeJob` struct. Since the plan is to start uploading also osbuild manifest and osbuild build log to Koji, we need to extend the result options structure to hold more information and also make it specific to which file is the information related. Rework the `KojiTargetResultOptions` to contain information about: - the built image - build log - osbuild manifest Information about each file contains: - filename - checksum type - file checksum - file size For now, only the built image information is set and consumed by the worker. Add custom JSON (un)marshaler for `KojiTargetResultOptions` to handle backward compatibility when old version of worker or composer server interact with each other. Cover them with unit tests. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
27f98ec313
commit
efbaa93eef
7 changed files with 336 additions and 30 deletions
|
|
@ -50,8 +50,12 @@ func TestKojiCompose(t *testing.T) {
|
|||
Arch: test_distro.TestArchName,
|
||||
HostOS: test_distro.TestDistroName,
|
||||
TargetResults: []*target.TargetResult{target.NewKojiTargetResult(&target.KojiTargetResultOptions{
|
||||
ImageMD5: "browns",
|
||||
ImageSize: 42,
|
||||
Image: &target.KojiOutputInfo{
|
||||
Filename: "test.img",
|
||||
ChecksumType: target.ChecksumTypeMD5,
|
||||
Checksum: "browns",
|
||||
Size: 42,
|
||||
},
|
||||
})},
|
||||
OSBuildOutput: &osbuild.Result{
|
||||
Success: true,
|
||||
|
|
@ -87,8 +91,12 @@ func TestKojiCompose(t *testing.T) {
|
|||
Arch: test_distro.TestArchName,
|
||||
HostOS: test_distro.TestDistroName,
|
||||
TargetResults: []*target.TargetResult{target.NewKojiTargetResult(&target.KojiTargetResultOptions{
|
||||
ImageMD5: "browns",
|
||||
ImageSize: 42,
|
||||
Image: &target.KojiOutputInfo{
|
||||
Filename: "test.img",
|
||||
ChecksumType: target.ChecksumTypeMD5,
|
||||
Checksum: "browns",
|
||||
Size: 42,
|
||||
},
|
||||
})},
|
||||
OSBuildOutput: &osbuild.Result{
|
||||
Success: true,
|
||||
|
|
@ -124,8 +132,12 @@ func TestKojiCompose(t *testing.T) {
|
|||
Arch: test_distro.TestArchName,
|
||||
HostOS: test_distro.TestDistroName,
|
||||
TargetResults: []*target.TargetResult{target.NewKojiTargetResult(&target.KojiTargetResultOptions{
|
||||
ImageMD5: "browns",
|
||||
ImageSize: 42,
|
||||
Image: &target.KojiOutputInfo{
|
||||
Filename: "test.img",
|
||||
ChecksumType: target.ChecksumTypeMD5,
|
||||
Checksum: "browns",
|
||||
Size: 42,
|
||||
},
|
||||
})},
|
||||
OSBuildOutput: &osbuild.Result{
|
||||
Success: true,
|
||||
|
|
@ -160,8 +172,12 @@ func TestKojiCompose(t *testing.T) {
|
|||
Arch: test_distro.TestArchName,
|
||||
HostOS: test_distro.TestDistroName,
|
||||
TargetResults: []*target.TargetResult{target.NewKojiTargetResult(&target.KojiTargetResultOptions{
|
||||
ImageMD5: "browns",
|
||||
ImageSize: 42,
|
||||
Image: &target.KojiOutputInfo{
|
||||
Filename: "test.img",
|
||||
ChecksumType: target.ChecksumTypeMD5,
|
||||
Checksum: "browns",
|
||||
Size: 42,
|
||||
},
|
||||
})},
|
||||
OSBuildOutput: &osbuild.Result{
|
||||
Success: false,
|
||||
|
|
@ -198,8 +214,12 @@ func TestKojiCompose(t *testing.T) {
|
|||
Arch: test_distro.TestArchName,
|
||||
HostOS: test_distro.TestDistroName,
|
||||
TargetResults: []*target.TargetResult{target.NewKojiTargetResult(&target.KojiTargetResultOptions{
|
||||
ImageMD5: "browns",
|
||||
ImageSize: 42,
|
||||
Image: &target.KojiOutputInfo{
|
||||
Filename: "test.img",
|
||||
ChecksumType: target.ChecksumTypeMD5,
|
||||
Checksum: "browns",
|
||||
Size: 42,
|
||||
},
|
||||
})},
|
||||
OSBuildOutput: &osbuild.Result{
|
||||
Success: true,
|
||||
|
|
@ -247,8 +267,12 @@ func TestKojiCompose(t *testing.T) {
|
|||
Arch: test_distro.TestArchName,
|
||||
HostOS: test_distro.TestDistroName,
|
||||
TargetResults: []*target.TargetResult{target.NewKojiTargetResult(&target.KojiTargetResultOptions{
|
||||
ImageMD5: "browns",
|
||||
ImageSize: 42,
|
||||
Image: &target.KojiOutputInfo{
|
||||
Filename: "test.img",
|
||||
ChecksumType: target.ChecksumTypeMD5,
|
||||
Checksum: "browns",
|
||||
Size: 42,
|
||||
},
|
||||
})},
|
||||
OSBuildOutput: &osbuild.Result{
|
||||
Success: true,
|
||||
|
|
@ -288,8 +312,12 @@ func TestKojiCompose(t *testing.T) {
|
|||
Arch: test_distro.TestArchName,
|
||||
HostOS: test_distro.TestDistroName,
|
||||
TargetResults: []*target.TargetResult{target.NewKojiTargetResult(&target.KojiTargetResultOptions{
|
||||
ImageMD5: "browns",
|
||||
ImageSize: 42,
|
||||
Image: &target.KojiOutputInfo{
|
||||
Filename: "test.img",
|
||||
ChecksumType: target.ChecksumTypeMD5,
|
||||
Checksum: "browns",
|
||||
Size: 42,
|
||||
},
|
||||
})},
|
||||
OSBuildOutput: &osbuild.Result{
|
||||
Success: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue