git: 7494fb6b7d80 - main - EC2: Flavour existing AMIs as "base"

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Thu, 28 Sep 2023 22:18:52 UTC
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=7494fb6b7d809257d4eb9eff06ce226143f27add

commit 7494fb6b7d809257d4eb9eff06ce226143f27add
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2023-09-09 00:51:57 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2023-09-28 22:18:46 +0000

    EC2: Flavour existing AMIs as "base"
    
    Using the recently-added "cloudware flavours" mechanism, turn the
    existing EC2 AMIs into a new "base" flavour.  The only user-visible
    change is that AMI names now include the word "base".
    
    releng/14.0 candidate.
    
    Discussed with: gjb
    Reviewed by:    imp
    MFC after:      5 days
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D41791
---
 release/Makefile.ec2                      | 16 +++++++++-------
 release/Makefile.vm                       |  1 +
 release/tools/{ec2.conf => ec2-base.conf} |  0
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/release/Makefile.ec2 b/release/Makefile.ec2
index b3f32d0e3efb..c674c967ff57 100644
--- a/release/Makefile.ec2
+++ b/release/Makefile.ec2
@@ -51,11 +51,12 @@ cw-ec2-portinstall:
 	@touch ${.TARGET}
 
 .for _FS in ${EC2_FSLIST}
+.for _FL in ${EC2_FLAVOURS:tl}
 .if defined(SSMPREFIX) && !empty(SSMPREFIX)
-SSMOPTS_${_FS}=	--ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/${_FS}/${REVISION}/${BRANCH}
+SSMOPTS_${_FL}_${_FS}=	--ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/${_FL}/${_FS}/${REVISION}/${BRANCH}
 .endif
-EC2AMILIST+=	ec2ami-${_FS}
-ec2ami-${_FS}: cw-ec2-${_FS} ${CW_EC2_PORTINSTALL}
+EC2AMILIST+=	ec2ami-${_FL}-${_FS}
+ec2ami-${_FL}-${_FS}: cw-ec2-${_FL}-${_FS} ${CW_EC2_PORTINSTALL}
 .if !defined(AWSKEYFILE) || !exists(${AWSKEYFILE})
 	@echo "--------------------------------------------------------------"
 	@echo ">>> AWSKEYFILE must point at AWS keys for EC2 AMI creation"
@@ -75,14 +76,15 @@ ec2ami-${_FS}: cw-ec2-${_FS} ${CW_EC2_PORTINSTALL}
 	@false
 .endif
 	/usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \
-	    ${EC2ARCH} ${SSMOPTS_${_FS}} ${BOOTMODEOPT} --sriov --ena \
-	    ${.OBJDIR}/${EC2${_FS:tu}IMAGE} \
-	    "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD} ${_FS:tu}" \
+	    ${EC2ARCH} ${SSMOPTS_${_FL}_${_FS}} ${BOOTMODEOPT} --sriov --ena \
+	    ${.OBJDIR}/${EC2-${_FL:tu}${_FS:tu}IMAGE} \
+	    "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD} ${_FL} ${_FS:tu}" \
 	    "${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \
 	    ${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE} \
 	    ${EC2SNSTOPIC} ${EC2SNSREL} ${EC2SNSVERS}
 	@touch ${.TARGET}
 .endfor
+.endfor
 
-ec2ami: ec2ami-${VMFS}
+ec2ami: ec2ami-base-${VMFS}
 ec2amis: ${EC2AMILIST}
diff --git a/release/Makefile.vm b/release/Makefile.vm
index bb719da68ead..679ac74f438c 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -31,6 +31,7 @@ BASIC-CI_DESC=		Image for CI
 EC2_FORMAT=	raw
 EC2_FSLIST=	ufs zfs
 EC2_DESC=	Amazon EC2 image
+EC2_FLAVOURS=	BASE
 GCE_FORMAT=	raw
 GCE_FSLIST=	ufs zfs
 GCE_DESC=	Google Compute Engine image
diff --git a/release/tools/ec2.conf b/release/tools/ec2-base.conf
similarity index 100%
rename from release/tools/ec2.conf
rename to release/tools/ec2-base.conf