Skip to content

Commit

Permalink
bib: add a new gce image type
Browse files Browse the repository at this point in the history
This commit adds a new image type `gce` that contains a tar
file with the raw image inside. This can then be imported
into GCE.
  • Loading branch information
mvo5 committed Sep 17, 2024
1 parent 8bf1433 commit 9d06575
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ The following image types are currently available via the `--type` argument:
| `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 |
| `gce` | GCE input (unformatted raw disk inside a tar.gz file) |

## 💾 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 @@ -19,6 +19,7 @@ var supportedImageTypes = map[string]BuildType{
"raw": BuildTypeDisk,
"vmdk": BuildTypeDisk,
"vhd": BuildTypeDisk,
"gce": BuildTypeDisk,
"anaconda-iso": BuildTypeISO,
"iso": BuildTypeISO,
}
Expand Down
2 changes: 2 additions & 0 deletions bib/cmd/bootc-image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ func cmdBuild(cmd *cobra.Command, args []string) error {
case "vhd":
// should we make "vhd" just an alias for "vpc" everywhere?
exports = append(exports, "vpc")
case "gce":
exports = append(exports, "gce")
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 @@ -135,6 +135,7 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload):
"raw": pathlib.Path(output_path) / "image/disk.raw",
"vmdk": pathlib.Path(output_path) / "vmdk/disk.vmdk",
"vhd": pathlib.Path(output_path) / "vpc/disk.vhd",
"gce": pathlib.Path(output_path) / "gce/image.tgz",
"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 @@ -454,7 +455,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.vhd", "disk.vmdk"}
expected = {"disk.qcow2", "disk.raw", "disk.vhd", "disk.vmdk", "image.tgz"}
for result in images:
filename = os.path.basename(result.img_path)
assert result.img_path.exists()
Expand Down
2 changes: 1 addition & 1 deletion test/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import platform

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

# supported images that can be booted in a cloud
CLOUD_BOOT_IMAGE_TYPES = ["ami"]
Expand Down

0 comments on commit 9d06575

Please sign in to comment.