Skip to content

Commit

Permalink
bib: add vhd to supported image types
Browse files Browse the repository at this point in the history
This is the coresponding change to the images PR [0] that adds
support to build `vhd` type images directly via bib.

[0] osbuild/images#909
  • Loading branch information
mvo5 authored and achilleas-k committed Sep 10, 2024
1 parent 06ed60b commit 405808f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ The following image types are currently available via the `--type` argument:
| `vmdk` | [VMDK](https://en.wikipedia.org/wiki/VMDK) usable in vSphere, among others |
| `anaconda-iso` | An unattended Anaconda installer that installs to the first disk found. |
| `raw` | Unformatted [raw disk](https://en.wikipedia.org/wiki/Rawdisk). |
| `vhd` | [vhd](https://en.wikipedia.org/wiki/VHD_(file_format)) usable in Virtual PC, among others |

## 💾 Target architecture

Expand Down
1 change: 1 addition & 0 deletions bib/cmd/bootc-image-builder/build_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var supportedImageTypes = map[string]BuildType{
"qcow2": BuildTypeDisk,
"raw": BuildTypeDisk,
"vmdk": BuildTypeDisk,
"vhd": BuildTypeDisk,
"anaconda-iso": BuildTypeISO,
"iso": BuildTypeISO,
}
Expand Down
4 changes: 3 additions & 1 deletion bib/cmd/bootc-image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ func cmdBuild(cmd *cobra.Command, args []string) error {
exports = append(exports, "image")
case "vmdk":
exports = append(exports, "vmdk")

case "vhd":
// should we make "vhd" just an alias for "vpc" everywhere?
exports = append(exports, "vpc")
case "anaconda-iso", "iso":
exports = append(exports, "bootiso")
default:
Expand Down
3 changes: 2 additions & 1 deletion test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload):
"ami": pathlib.Path(output_path) / "image/disk.raw",
"raw": pathlib.Path(output_path) / "image/disk.raw",
"vmdk": pathlib.Path(output_path) / "vmdk/disk.vmdk",
"vhd": pathlib.Path(output_path) / "vpc/disk.vhd",
"anaconda-iso": pathlib.Path(output_path) / "bootiso/install.iso",
}
assert len(artifact) == len(set(tc.image for tc in gen_testcases("all"))), \
Expand Down Expand Up @@ -453,7 +454,7 @@ def test_iso_installs(image_type):
@pytest.mark.parametrize("images", gen_testcases("multidisk"), indirect=["images"])
def test_multi_build_request(images):
artifacts = set()
expected = {"disk.qcow2", "disk.raw", "disk.vmdk"}
expected = {"disk.qcow2", "disk.raw", "disk.vhd", "disk.vmdk"}
for result in images:
filename = os.path.basename(result.img_path)
assert result.img_path.exists()
Expand Down
6 changes: 3 additions & 3 deletions test/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import platform

# disk image types can be build from a single manifest
DISK_IMAGE_TYPES = ("qcow2", "raw", "vmdk")
DISK_IMAGE_TYPES = ["qcow2", "raw", "vmdk", "vhd"]

# supported images that can be booted in a cloud
CLOUD_BOOT_IMAGE_TYPES = ("ami",)
CLOUD_BOOT_IMAGE_TYPES = ["ami"]


@dataclasses.dataclass
Expand Down Expand Up @@ -88,7 +88,7 @@ def gen_testcases(what): # pylint: disable=too-many-return-statements
return [
klass(image=img)
for klass in (TestCaseCentos, TestCaseFedora)
for img in ("ami", "anaconda-iso", "qcow2", "raw", "vmdk")
for img in CLOUD_BOOT_IMAGE_TYPES + DISK_IMAGE_TYPES + ["anaconda-iso"]
]
if what == "multidisk":
# single test that specifies all image types
Expand Down

0 comments on commit 405808f

Please sign in to comment.