git: 1b10bdf0e2fa - main - releng-gce: Add ZFS support to GCE image buliding and uploading

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Tue, 29 Aug 2023 17:43:14 UTC
The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/src/commit/?id=1b10bdf0e2fa80a485980b783469687623d3f1c3

commit 1b10bdf0e2fa80a485980b783469687623d3f1c3
Author:     Li-Wen Hsu <lwhsu@FreeBSD.org>
AuthorDate: 2023-08-29 17:41:43 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2023-08-29 17:41:43 +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
---
 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 a5d194cc2678..ad09f3ff6602 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -36,7 +36,7 @@ EC2_FSLIST=	ufs zfs
 EC2_DESC=	Amazon EC2 image
 EC2_DISK=	${OSRELEASE}.${EC2_FORMAT}
 GCE_FORMAT=	raw
-GCE_FSLIST=	ufs
+GCE_FSLIST=	ufs zfs
 GCE_DESC=	Google Compute Engine image
 GCE_DISK=	disk.${GCE_FORMAT}
 OCI_FORMAT=	qcow2