From 8c361e510dc88c2b8568ea3fbce8dfbffcfd4f09 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 7 Nov 2022 17:52:04 +0100 Subject: [PATCH] platform: add special GCE platform format GCE requires an archive with specific (tar) options, so we should have a platform format defined separately for it. Add the GCE image types to the x86_64 arch using the new platform format. --- internal/distro/rhel9/distro.go | 13 ++++++++++++- internal/platform/platform.go | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/distro/rhel9/distro.go b/internal/distro/rhel9/distro.go index 15b12252a..d0d601fb4 100644 --- a/internal/distro/rhel9/distro.go +++ b/internal/distro/rhel9/distro.go @@ -293,6 +293,17 @@ func newDistro(name string, major, minor int) distro.Distro { x86_64.addImageTypes( rawX86Platform, mkAMIImgTypeX86_64(rd.osVersion, rd.isRHEL()), + ) + + gceX86Platform := &platform.X86{ + BIOS: true, + UEFIVendor: rd.vendor, + BasePlatform: platform.BasePlatform{ + ImageFormat: platform.FORMAT_GCE, + }, + } + x86_64.addImageTypes( + gceX86Platform, gceImgType, ) @@ -443,7 +454,7 @@ func newDistro(name string, major, minor int) distro.Distro { ) // add GCE RHUI image to RHEL only - x86_64.addImageTypes(rawX86Platform, gceRhuiImgType) + x86_64.addImageTypes(gceX86Platform, gceRhuiImgType) } else { x86_64.addImageTypes(azureX64Platform, azureImgType) } diff --git a/internal/platform/platform.go b/internal/platform/platform.go index 62dbf0f6b..faa2e7eb7 100644 --- a/internal/platform/platform.go +++ b/internal/platform/platform.go @@ -17,6 +17,7 @@ const ( FORMAT_QCOW2 FORMAT_VMDK FORMAT_VHD + FORMAT_GCE ) func (a Arch) String() string { @@ -46,6 +47,8 @@ func (f ImageFormat) String() string { return "vmdk" case FORMAT_VHD: return "vhd" + case FORMAT_GCE: + return "gce" default: panic("invalid image format") }