Skip to content

Commit b415a4f

Browse files
committed
bib: expose new ova image type in bib
This commit exposes the new `ova` image type and adds a basic smoke test.
1 parent 29eaa41 commit b415a4f

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

bib/internal/imagetypes/imagetypes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var supportedImageTypes = map[string]imageType{
2323
"vmdk": imageType{Export: "vmdk"},
2424
"vhd": imageType{Export: "vpc"},
2525
"gce": imageType{Export: "gce"},
26+
"ova": imageType{Export: "archive"},
2627
// the iso image types are RPM based and legacy/deprecated
2728
"anaconda-iso": imageType{Export: "bootiso", ISO: true, Legacy: true},
2829
"iso": imageType{Export: "bootiso", ISO: true, Legacy: true},

bib/internal/imagetypes/imagetypes_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ func TestImageTypes(t *testing.T) {
6363
},
6464
"bad-image-type": {
6565
imageTypes: []string{"bad"},
66-
expectedErr: errors.New(`unsupported image type "bad", valid types are ami, anaconda-iso, gce, iso, qcow2, raw, vhd, vmdk`),
66+
expectedErr: errors.New(`unsupported image type "bad", valid types are ami, anaconda-iso, gce, iso, ova, qcow2, raw, vhd, vmdk`),
6767
},
6868
"bad-in-good": {
6969
imageTypes: []string{"ami", "raw", "vmdk", "qcow2", "something-else-what-is-this"},
70-
expectedErr: errors.New(`unsupported image type "something-else-what-is-this", valid types are ami, anaconda-iso, gce, iso, qcow2, raw, vhd, vmdk`),
70+
expectedErr: errors.New(`unsupported image type "something-else-what-is-this", valid types are ami, anaconda-iso, gce, iso, ova, qcow2, raw, vhd, vmdk`),
7171
},
7272
"all-bad": {
7373
imageTypes: []string{"bad1", "bad2", "bad3", "bad4", "bad5", "bad42"},
74-
expectedErr: errors.New(`unsupported image type "bad1", valid types are ami, anaconda-iso, gce, iso, qcow2, raw, vhd, vmdk`),
74+
expectedErr: errors.New(`unsupported image type "bad1", valid types are ami, anaconda-iso, gce, iso, ova, qcow2, raw, vhd, vmdk`),
7575
},
7676
}
7777

test/test_manifest.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -858,10 +858,9 @@ def test_manifest_customization_custom_file_smoke(tmp_path, build_container):
858858
def find_stage_options_from(manifest_str, stage_type):
859859
manifest = json.loads(manifest_str)
860860
for pipl in manifest["pipelines"]:
861-
if pipl["name"] == "image":
862-
for st in pipl["stages"]:
863-
if st["type"] == stage_type:
864-
return st["options"]
861+
for st in pipl["stages"]:
862+
if st["type"] == stage_type:
863+
return st["options"]
865864
raise ValueError(f"cannot find {stage_type} stage manifest:\n{manifest_str}")
866865

867866

@@ -1032,3 +1031,27 @@ def test_manifest_image_disk_yaml(tmp_path, build_container):
10321031
], encoding="utf8")
10331032
write_device_options = find_stage_options_from(manifest_str, "org.osbuild.write-device")
10341033
assert write_device_options["from"] == "input://tree/usr/lib/modules/5.0-x86_64/aboot.img"
1034+
1035+
1036+
@pytest.mark.parametrize("tc", gen_testcases("anaconda-iso"))
1037+
def test_ova_manifest_smoke(build_container, tc):
1038+
testutil.pull_container(tc.container_ref, tc.target_arch)
1039+
1040+
output = subprocess.check_output([
1041+
*testutil.podman_run_common,
1042+
build_container,
1043+
"manifest",
1044+
*tc.bib_rootfs_args(),
1045+
"--type=ova",
1046+
f"{tc.container_ref}",
1047+
])
1048+
# just some basic validation that we generate a ova
1049+
assert find_stage_options_from(output, "org.osbuild.tar") == {
1050+
"filename": "image.ova",
1051+
"format": "ustar",
1052+
"paths": [
1053+
"image.ovf",
1054+
"image.mf",
1055+
"image.vmdk"
1056+
]
1057+
}

0 commit comments

Comments
 (0)