git: 4ef9a9d28afe - stable/14 - release: Publish non-uploaded cloudware bits

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Wed, 26 Jun 2024 00:35:17 UTC
The branch stable/14 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=4ef9a9d28afe86d2d73408d893064a56a8db0c32

commit 4ef9a9d28afe86d2d73408d893064a56a8db0c32
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2024-06-19 19:28:42 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-06-26 00:34:43 +0000

    release: Publish non-uploaded cloudware bits
    
    While most "cloudware" (AWS, Azure, GCP, Vagrant) images get uploaded
    to their respective clouds, we have two images -- BASIC-CI and
    BASIC-CLOUDINIT -- which are published via the FTP mirrors.  We have
    been handling these using a manual and error-prone process of copying
    them from the internal build directories into the FTP staging tree,
    but they should be handled using the "make install ftp-stage"
    mechanism which is used for all the other published images.
    
    This commit 1. Adds a new 'make cloud-install' target which is run as
    part of 'make install' and installs BASIC-CI and BASIC-CLOUDINIT images,
    and 2. Extends 'make ftp-stage' in Makefile.mirrors to copy those bits
    into the FTP staging area.
    
    As a side benefit, this will also make BASIC-CI and BASIC-CLOUDINIT
    images available for arm64; until now they have only been available
    for amd64.
    
    MFC after:      1 week
    
    (cherry picked from commit 4771c2e9d1c7db949a82dfe4f2b9878bb358a50e)
---
 release/Makefile         |  3 +-
 release/Makefile.mirrors | 96 ++++++++++++++++++++++++++++++++++++++++++++++++
 release/Makefile.vm      | 42 +++++++++++++++++++++
 3 files changed, 140 insertions(+), 1 deletion(-)

diff --git a/release/Makefile b/release/Makefile
index ba9499ac5a3f..32e59a1a5c90 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -14,6 +14,7 @@
 #  install: Invokes the release-install and vm-install targets
 #  release-install: Copies all release installation media into ${DESTDIR}
 #  vm-install: Copies all virtual machine images into ${DESTDIR}
+#  cloud-install: Copies non-uploaded cloud images into ${DESTDIR}
 #
 # Variables affecting the build process:
 #  WORLDDIR: location of src tree -- must have built world and default kernel
@@ -329,7 +330,7 @@ real-release:
 	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
 	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
 
-install:	release-install vm-install
+install:	release-install vm-install .WAIT cloud-install
 
 release-install:
 .if defined(DESTDIR) && !empty(DESTDIR)
diff --git a/release/Makefile.mirrors b/release/Makefile.mirrors
index 591fd85b29ea..fd233e7abdb6 100644
--- a/release/Makefile.mirrors
+++ b/release/Makefile.mirrors
@@ -53,6 +53,11 @@ STAGE_TARGETS+=		vm-images-stage
 VM_DIR=			${TLD}/VM-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH}
 .endif
 
+.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE)
+STAGE_TARGETS+=		ci-images-stage
+CI_DIR=			${TLD}/CI-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH}
+.endif
+
 CLEANFILES+=		${STAGE_TARGETS}
 CHECKSUM_FILES?=	SHA512 SHA256
 SNAP_SUFFIX!=		echo ${_SNAP_SUFFIX:S,^-,,1} | tr -d ' '
@@ -203,6 +208,22 @@ vm-images-stage:
 		ln -s ../${BUILDDATE}/${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz \
 		${OSRELEASE}-${FS}.${VMFORMAT}.xz
 .  endfor
+. endfor
+. for CW in ${CLOUDWARE}
+.  if ${CW} == BASIC-CLOUDINIT
+.   for VMFORMAT in ${${CW}_FORMAT}
+.    for FS in ${${CW}_FSLIST}
+	cd ${RELEASEDIR}/vmimages && \
+		mv ${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz \
+		${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz
+	cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz \
+		${VM_DIR}/${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz
+	cd ${VM_DIR}/Latest && \
+		ln -s ../${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz \
+		${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz
+.    endfor
+.   endfor
+.  endif
 . endfor
 	cd ${RELEASEDIR}/vmimages && rm -f CHECKSUM.*
 . for CHECKSUM in ${CHECKSUM_FILES}
@@ -227,11 +248,86 @@ vm-images-stage:
 		${VM_DIR}/Latest/${OSRELEASE}-${FS}.${VMFORMAT}.xz
 .  endfor
 . endfor
+. for CW in ${CLOUDWARE}
+.  if ${CW} == BASIC-CLOUDINIT
+.   for VMFORMAT in ${${CW}_FORMAT}
+.    for FS in ${${CW}_FSLIST}
+	cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz \
+		${VM_DIR}/Latest/${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz
+.    endfor
+.   endfor
+.  endif
+. endfor
 . for CHECKSUM in ${CHECKSUM_FILES}
 	cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM} \
 		${VM_DIR}/Latest/CHECKSUM.${CHECKSUM}
 . endfor
 .endif
 
+ci-images-stage:
+	mkdir -p ${CI_DIR}
+.if defined(SNAPSHOT) && !empty(SNAPSHOT)
+. if exists(${CI_DIR}/Latest)
+	rm -rf ${CI_DIR}/Latest
+. endif
+	mkdir -p ${CI_DIR}/Latest
+	mkdir -p ${CI_DIR}/${BUILDDATE}
+. for CW in ${CLOUDWARE}
+.  if ${CW} == BASIC-CI
+.   for VMFORMAT in ${${CW}_FORMAT}
+.    for FS in ${${CW}_FSLIST}
+	cd ${RELEASEDIR}/ciimages && \
+		mv ${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz \
+		${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz
+	cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz \
+		${CI_DIR}/${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz
+	cd ${CI_DIR}/Latest && \
+		ln -s ../${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz \
+		${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz
+.    endfor
+	cd ${RELEASEDIR}/ciimages && \
+		mv ${OSRELEASE}-${CW}.${VMFORMAT}.xz \
+		${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${VMFORMAT}.xz
+	cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${VMFORMAT}.xz \
+		${CI_DIR}/${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${VMFORMAT}.xz
+	cd ${CI_DIR}/Latest && \
+		ln -s ../${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${VMFORMAT}.xz \
+		${OSRELEASE}-${CW}.${VMFORMAT}.xz
+.   endfor
+.  endif
+. endfor
+	cd ${RELEASEDIR}/ciimages && rm -f CHECKSUM.*
+. for CHECKSUM in ${CHECKSUM_FILES}
+	cd ${RELEASEDIR}/ciimages && \
+		${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
+	cp -p ${RELEASEDIR}/ciimages/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
+		${CI_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
+	cd ${CI_DIR}/Latest && \
+		ln -s ../${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
+		CHECKSUM.${CHECKSUM}
+. endfor
+.else # not snapshot
+. if exists(${CI_DIR}/Latest)
+	rm -rf ${CI_DIR}/Latest
+. endif
+	mkdir -p ${CI_DIR}/Latest
+. for CW in ${CLOUDWARE}
+.  if ${CW} == BASIC-CI
+.   for VMFORMAT in ${${CW}_FORMAT}
+.    for FS in ${${CW}_FSLIST}
+	cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz \
+		${CI_DIR}/Latest/${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz
+.    endfor
+	cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}.${VMFORMAT}.xz \
+		${CI_DIR}/Latest/${OSRELEASE}-${CW}.${VMFORMAT}.xz
+.   endfor
+.  endif
+. endfor
+. for CHECKSUM in ${CHECKSUM_FILES}
+	cp -p ${RELEASEDIR}/ciimages/CHECKSUM.${CHECKSUM} \
+		${CI_DIR}/Latest/CHECKSUM.${CHECKSUM}
+. endfor
+.endif
+
 ftp-stage:	remove-old-bits ${STAGE_TARGETS}
 
diff --git a/release/Makefile.vm b/release/Makefile.vm
index 95d48490c353..71a4392b6b0c 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -223,6 +223,48 @@ vm-install:
 		${DESTDIR}/vmimages/CHECKSUM.SHA256
 .endif
 
+cloud-install-BASIC-CI:
+	mkdir -p ${DESTDIR}/ciimages
+.for _FS in ${BASIC-CI_FSLIST}
+. for _FMT in ${BASIC-CI_FORMAT}
+	cp -p ${.OBJDIR}/${BASIC-CI${_FS:tu}${_FMT:tu}IMAGE} \
+		${DESTDIR}/ciimages/${OSRELEASE}-BASIC-CI-${_FS}.${_FMT}
+	${XZ_CMD} ${DESTDIR}/ciimages/${OSRELEASE}-BASIC-CI-${_FS}.${_FMT}
+. endfor
+.endfor
+.for _FMT in ${BASIC-CI_FORMAT}
+	ln -f ${DESTDIR}/ciimages/${OSRELEASE}-BASIC-CI-${VMFS}.${_FMT}.xz \
+		${DESTDIR}/ciimages/${OSRELEASE}-BASIC-CI.${_FMT}.xz
+.endfor
+	cd ${DESTDIR}/ciimages && sha512 ${OSRELEASE}* > \
+		${DESTDIR}/ciimages/CHECKSUM.SHA512
+	cd ${DESTDIR}/ciimages && sha256 ${OSRELEASE}* > \
+		${DESTDIR}/ciimages/CHECKSUM.SHA256
+
+cloud-install-BASIC-CLOUDINIT:
+	mkdir -p ${DESTDIR}/vmimages
+.for _FS in ${BASIC-CLOUDINIT_FSLIST}
+. for _FMT in ${BASIC-CLOUDINIT_FORMAT}
+	cp -p ${.OBJDIR}/${BASIC-CLOUDINIT${_FS:tu}${_FMT:tu}IMAGE} \
+		${DESTDIR}/vmimages/${OSRELEASE}-BASIC-CLOUDINIT.${_FS}.${_FMT}
+	${XZ_CMD} ${DESTDIR}/vmimages/${OSRELEASE}-BASIC-CLOUDINIT.${_FS}.${_FMT}
+. endfor
+.endfor
+	cd ${DESTDIR}/vmimages && sha512 ${OSRELEASE}* > \
+		${DESTDIR}/vmimages/CHECKSUM.SHA512
+	cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \
+		${DESTDIR}/vmimages/CHECKSUM.SHA256
+
+CLOUD_INSTALL_TGTS=
+.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE)
+. for _CW in ${CLOUDWARE}
+.  if target(cloud-install-${_CW})
+CLOUD_INSTALL_TGTS+=	cloud-install-${_CW}
+.  endif
+. endfor
+.endif
+cloud-install:	${CLOUD_INSTALL_TGTS}
+
 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
 vm-release:	${VMTARGETS}
 .else