git: d6fecbebfcea - stable/13 - release: Publish non-uploaded cloudware bits

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

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

commit d6fecbebfcea804cc00ead9e93b16ce72b4a7f3d
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:52:55 +0000

    release: Publish non-uploaded cloudware bits
    
    [MFC note: We don't have BASIC-CLOUDINIT or support for multiple disk
    formats or filesystems in VMs on 13.x so this MFC only does BASIC-CI
    and only for UFS on RAW.]
    
    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 | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
 release/Makefile.vm      | 20 +++++++++++++++++++
 3 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/release/Makefile b/release/Makefile
index 7e6bc566961c..55d82a0d0f5e 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
@@ -267,7 +268,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 cbc5cd768e28..904040eb11ba 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 ' '
@@ -219,5 +224,52 @@ vm-images-stage:
 . 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
+	cd ${RELEASEDIR}/ciimages && \
+		mv ${OSRELEASE}-${CW}.raw.xz \
+		${OSRELEASE}-${CW}-${SNAP_SUFFIX}.raw.xz
+	cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.raw.xz \
+		${CI_DIR}/${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.raw.xz
+	cd ${CI_DIR}/Latest && \
+		ln -s ../${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.raw.xz \
+		${OSRELEASE}-${CW}.raw.xz
+.  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
+	cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}.raw.xz \
+		${CI_DIR}/Latest/${OSRELEASE}-${CW}.raw.xz
+.  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 2e5bdb9a7004..520f47ab3ca6 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -174,6 +174,26 @@ vm-install:
 		${DESTDIR}/vmimages/CHECKSUM.SHA256
 .endif
 
+cloud-install-BASIC-CI:
+	mkdir -p ${DESTDIR}/ciimages
+	cp -p ${.OBJDIR}/${BASIC-CIIMAGE} \
+		${DESTDIR}/ciimages/${OSRELEASE}-BASIC-CI.raw
+	${XZ_CMD} ${DESTDIR}/ciimages/${OSRELEASE}-BASIC-CI.raw
+	cd ${DESTDIR}/ciimages && sha512 ${OSRELEASE}* > \
+		${DESTDIR}/ciimages/CHECKSUM.SHA512
+	cd ${DESTDIR}/ciimages && sha256 ${OSRELEASE}* > \
+		${DESTDIR}/ciimages/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}
+
 vm-release:
 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
 	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${VMTARGETS}