git: 9103c2f0ce27 - releng/14.0 - releng-gce: Add ZFS support to GCE image buliding and uploading

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Wed, 18 Oct 2023 19:17:55 UTC
The branch releng/14.0 has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/src/commit/?id=9103c2f0ce273343391a1fdf53cdee92147d2e73

commit 9103c2f0ce273343391a1fdf53cdee92147d2e73
Author:     Li-Wen Hsu <lwhsu@FreeBSD.org>
AuthorDate: 2023-08-29 17:41:43 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2023-10-18 19:17:26 +0000

    releng-gce: Add ZFS support to GCE image buliding and uploading
    
    Approved by:    delphij (re), gjb (re)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D41527
    
    (cherry picked from commit 1b10bdf0e2fa80a485980b783469687623d3f1c3)
    (cherry picked from commit c892a9af7187e94f8dd6f720609e84d79c9e7d1f)
---
 release/Makefile.gce | 38 +++++++++++++++++++++-----------------
 release/Makefile.vm  |  2 +-
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/release/Makefile.gce b/release/Makefile.gce
index bdf7b31ba302..f7fb0d8dc419 100644
--- a/release/Makefile.gce
+++ b/release/Makefile.gce
@@ -4,7 +4,6 @@
 # Makefile for uploading Google Compute Engine disk images.
 #
 
-GCE_IMG?=		${.OBJDIR}/gce.raw
 GCE_UPLOAD_TGTS=	gce-check-depends \
 			gce-do-package \
 			gce-do-upload
@@ -27,10 +26,6 @@ SNAPSHOT_DATE=		-v${BUILDDATE}
 GCE_FAMILY_SUFX=	-snap
 .endif
 
-# Really?  Uppercase characters are not allowed?  Sigh...
-# And don't even get me started on the '.'.
-GCE_TARGET:=		${OSRELEASE:S,.raw,,:tl:S,.,-,g}${SNAPSHOT_DATE}
-
 gce-upload:		${GCE_UPLOAD_TGTS}
 
 gce-check-depends:
@@ -53,25 +48,34 @@ gce-check-depends:
 . endif
 .endif
 
-gce-do-package:
-	@# Yes, really...  Sigh.
-	cd ${.OBJDIR} && mv gce.raw disk.raw
-	cd ${.OBJDIR} && tar --format=gnutar -zcf \
-		${GCE_TARGET:S,${.OBJDIR}/,,}.tar.gz disk.raw
-	cd ${.OBJDIR} && mv disk.raw gce.raw
-	touch ${.OBJDIR}/${.TARGET}
-
 gce-do-login:
 	@echo "This requires human interaction, which is not yet supported."
 	@true
 
-gce-do-upload:
+.for _FS in ${GCE_FSLIST}
+GCE_IMG_${FS}=		${.OBJDIR}/gce.${_FS}.raw
+# Really?  Uppercase characters are not allowed?  Sigh...
+# And don't even get me started on the '.'.
+GCE_TARGET_${_FS}=	${OSRELEASE:S,.raw,,:tl:S,.,-,g}-${_FS}${SNAPSHOT_DATE}
+
+gce-do-package-${_FS}:
+	@# Yes, really...  Sigh.
+	cd ${.OBJDIR} && mv ${GCE_IMG_${_FS}} disk.raw
+	cd ${.OBJDIR} && tar --format=gnutar -zcf \
+		${GCE_TARGET_${_FS}:S,${.OBJDIR}/,,}.tar.gz disk.raw
+	cd ${.OBJDIR} && mv disk.raw ${GCE_IMG_${_FS}}
+	touch ${.OBJDIR}/${.TARGET}
+
+gce-do-upload-${_FS}:
 	@# Fallthrough in case the bucket already exists.
 	/usr/local/bin/gsutil mb gs://${GCE_BUCKET} || true
-	/usr/local/bin/gsutil cp ${.OBJDIR}/${GCE_TARGET}.tar.gz \
+	/usr/local/bin/gsutil cp ${.OBJDIR}/${GCE_TARGET_${_FS}}.tar.gz \
 		gs://${GCE_BUCKET}/
-	/usr/local/bin/gcloud compute images create ${GCE_TARGET} \
+	/usr/local/bin/gcloud compute images create ${GCE_TARGET_${_FS}} \
 		--family=${GCE_FAMILY}${GCE_FAMILY_SUFX} ${GCE_LICENSE} \
-		--source-uri gs://${GCE_BUCKET}/${GCE_TARGET}.tar.gz
+		--source-uri gs://${GCE_BUCKET}/${GCE_TARGET_${_FS}}.tar.gz
 	touch ${.OBJDIR}/${.TARGET}
+.endfor
 
+gce-do-package: gce-do-package-${VMFS}
+gce-do-upload: gce-do-upload-${VMFS}
diff --git a/release/Makefile.vm b/release/Makefile.vm
index e1bba5271a4c..1a58a548b9f4 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -34,7 +34,7 @@ EC2_FLAVOURS=	BASE CLOUD-INIT
 EC2-BASE_DESC=	Amazon EC2 image
 EC2-CLOUD-INIT_DESC=	Amazon EC2 Cloud-Init image
 GCE_FORMAT=	raw
-GCE_FSLIST=	ufs
+GCE_FSLIST=	ufs zfs
 GCE_DESC=	Google Compute Engine image
 OCI_FORMAT=	qcow2
 OCI_FSLIST=	ufs