Skip to content

Commit

Permalink
bib: add "raw" iamge format
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 authored and achilleas-k committed Jan 15, 2024
1 parent 7b37cde commit 220a974
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 2 additions & 4 deletions bib/cmd/bootc-image-builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ func Manifest(c *ManifestConfig) (*manifest.Manifest, error) {
var err error

switch c.ImgType {
case "qcow2":
fallthrough
case "ami":
case "ami", "qcow2", "raw":
img, err = pipelinesForDiskImage(c, rng)
case "iso":
img, err = pipelinesForISO(c, rng)
Expand Down Expand Up @@ -111,7 +109,7 @@ func pipelinesForDiskImage(c *ManifestConfig, rng *rand.Rand) (image.ImageKind,
case "qcow2":
imageFormat = platform.FORMAT_QCOW2
filename = "disk.qcow2"
case "ami":
case "ami", "raw":
imageFormat = platform.FORMAT_RAW
filename = "disk.raw"
}
Expand Down
4 changes: 2 additions & 2 deletions bib/cmd/bootc-image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ func build(cmd *cobra.Command, args []string) {
switch imgType {
case "qcow2":
exports = []string{"qcow2"}
case "ami":
case "ami", "raw":
exports = []string{"image"}
case "iso":
exports = []string{"bootiso"}
default:
fail(fmt.Sprintf("valid types are 'qcow2', 'ami', 'iso', not: '%s'", imgType))
fail(fmt.Sprintf("valid types are 'qcow2', 'ami', 'raw', 'iso', not: '%s'", imgType))
}

manifest_fname := fmt.Sprintf("manifest-%s.json", imgType)
Expand Down
3 changes: 2 additions & 1 deletion test/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def build_container_fixture():


# image types to test
SUPPORTED_IMAGE_TYPES = ["qcow2", "ami"]
SUPPORTED_IMAGE_TYPES = ["qcow2", "ami", "raw"]


class ImageBuildResult(NamedTuple):
Expand Down Expand Up @@ -80,6 +80,7 @@ def image_type_fixture(tmpdir_factory, build_container, request, force_aws_uploa
artifact = {
"qcow2": pathlib.Path(output_path) / "qcow2/disk.qcow2",
"ami": pathlib.Path(output_path) / "image/disk.raw",
"raw": pathlib.Path(output_path) / "image/disk.raw",
}
assert len(artifact) == len(SUPPORTED_IMAGE_TYPES), \
"please keep artifact mapping and supported images in sync"
Expand Down

0 comments on commit 220a974

Please sign in to comment.