git: 219caac69a2a - main - EC2: Build and upload AMIs for both UFS and ZFS

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Wed, 09 Aug 2023 22:45:19 UTC
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=219caac69a2a620086baa13b0663ac1ae2203451

commit 219caac69a2a620086baa13b0663ac1ae2203451
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2023-08-07 01:56:18 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2023-08-09 22:44:54 +0000

    EC2: Build and upload AMIs for both UFS and ZFS
    
    The pre-existing "ec2ami" target builds and uploads a single AMI
    (with filesystem determined by ${VMFS}) as before; a new "ec2amis"
    target does both UFS and ZFS.
    
    Reviewed by:    gjb
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D41343
---
 release/Makefile.ec2 | 18 +++++++++++-------
 release/Makefile.vm  |  2 +-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/release/Makefile.ec2 b/release/Makefile.ec2
index bedc0b6221ad..eeea35eac213 100644
--- a/release/Makefile.ec2
+++ b/release/Makefile.ec2
@@ -18,9 +18,6 @@ PUBLICSNAP=	--publicsnap
 EC2SNSREL=	${REVISION}-${BRANCH}
 EC2SNSVERS=	${GITBRANCH}@${GITREV}
 .endif
-.if defined(SSMPREFIX) && !empty(SSMPREFIX)
-SSMOPTS=	--ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/${VMFS}/${REVISION}/${BRANCH}
-.endif
 .if ${TARGET_ARCH} != "amd64"
 EC2ARCH=	--${TARGET_ARCH:S/aarch64/arm64/}
 .endif
@@ -54,7 +51,12 @@ cw-ec2-portinstall:
 .endif
 	@touch ${.TARGET}
 
-ec2ami-${VMFS}: cw-ec2-${VMFS} ${CW_EC2_PORTINSTALL}
+.for _FS in ${EC2_FSLIST}
+.if defined(SSMPREFIX) && !empty(SSMPREFIX)
+SSMOPTS_${_FS}=	--ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/${_FS}/${REVISION}/${BRANCH}
+.endif
+EC2AMILIST+=	ec2ami-${_FS}
+ec2ami-${_FS}: cw-ec2-${_FS} ${CW_EC2_PORTINSTALL}
 .if !defined(AWSKEYFILE) || !exists(${AWSKEYFILE})
 	@echo "--------------------------------------------------------------"
 	@echo ">>> AWSKEYFILE must point at AWS keys for EC2 AMI creation"
@@ -74,12 +76,14 @@ ec2ami-${VMFS}: cw-ec2-${VMFS} ${CW_EC2_PORTINSTALL}
 	@false
 .endif
 	/usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \
-	    ${EC2ARCH} ${SSMOPTS} ${BOOTMODEOPT} --sriov --ena \
-	    ${.OBJDIR}/ec2.raw \
-	    "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD} ${VMFS:tu}" \
+	    ${EC2ARCH} ${SSMOPTS_${_FS}} ${BOOTMODEOPT} --sriov --ena \
+	    ${.OBJDIR}/${EC2${_FS:tu}IMAGE} \
+	    "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD} ${_FS:tu}" \
 	    "${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \
 	    ${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE} \
 	    ${EC2SNSTOPIC} ${EC2SNSREL} ${EC2SNSVERS}
 	@touch ${.TARGET}
+.endfor
 
 ec2ami: ec2ami-${VMFS}
+ec2amis: ${EC2AMILIST}
diff --git a/release/Makefile.vm b/release/Makefile.vm
index a76e78a20f21..17c79a214af9 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -33,7 +33,7 @@ BASIC-CI_FSLIST=	ufs
 BASIC-CI_DESC=		Image for CI
 BASIC-CI_DISK=	${OSRELEASE}.${BASIC-CI_FORMAT}
 EC2_FORMAT=	raw
-EC2_FSLIST=	ufs
+EC2_FSLIST=	ufs zfs
 EC2_DESC=	Amazon EC2 image
 EC2_DISK=	${OSRELEASE}.${EC2_FORMAT}
 GCE_FORMAT=	raw