The branch main has been updated by bofh:

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

commit 932cf5fa44b7ff3b7ea21ccb32bbbefff11c160c
Author:     Muhammad Moinur Rahman <b...@freebsd.org>
AuthorDate: 2025-08-27 10:46:59 +0000
Commit:     Muhammad Moinur Rahman <b...@freebsd.org>
CommitDate: 2025-08-27 10:46:59 +0000

    tests/ci: Add CIENV variable
    
    The default behavior of of pre-commit script is to suppress all the logs
    as it is assumed that developers will run this on their terminal for the
    tests. But there are also other use cases like running these in
    different CI tools like Cirrus, GH Actions etc where these build logs
    are important in the web interface itself.
    
    To fix this issue introduce a new variable named CIENV which defaults to
    local if empty or undefined. If the CIENV is local in those cases the
    logs are suppressed while for anything else it is not. This variable is
    also important for some other WIP projects of CI I am working on like
    running the CI tests on remote cloud AWS, Azure, GCP etc.
    
    Approved by:    lwhsu
    Differential Revision:  https://reviews.freebsd.org/D51178
    Event: Oslo hackathon 202508
---
 tests/ci/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/ci/Makefile b/tests/ci/Makefile
index bc45c6acdfb4..30ca34a810be 100644
--- a/tests/ci/Makefile
+++ b/tests/ci/Makefile
@@ -41,6 +41,11 @@ TARGET_ARCH= ${TARGET}
 .endif
 IMAKE=         ${MAKE} TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}
 
+.if !defined(CIENV) || empty(CIENV)
+CIENV=         local
+LOG_TARGET=    > ${.CURDIR}/_.${TARGET_ARCH}.${.TARGET} 2>&1 || (echo 
"${.TARGET} failed, check _.${TARGET_ARCH}.${.TARGET} for details" ; false)
+.endif
+
 .if defined(CROSS_TOOLCHAIN) || !empty(CROSS_TOOLCHAIN)
 CROSS_TOOLCHAIN_PARAM= "CROSS_TOOLCHAIN=${CROSS_TOOLCHAIN}"
 .endif
@@ -170,17 +175,14 @@ ci-buildworld: .PHONY
        @echo "Building world for ${TARGET_ARCH}"
        ${IMAKE} -j${PARALLEL_JOBS} -C ${WORLDDIR} ${METAMODE} \
                ${CROSS_TOOLCHAIN_PARAM} __MAKE_CONF=${MAKECONF} 
SRCCONF=${SRCCONF} \
-               ${EXTRA_MAKE_FLAGS} buildworld > 
${.CURDIR}/_.${TARGET_ARCH}.${.TARGET} 2>&1 || \
-               (echo "${.TARGET} failed, check _.${TARGET_ARCH}.${.TARGET} for 
details" ; false)
-
+               ${EXTRA_MAKE_FLAGS} buildworld ${LOG_TARGET}
 
 ci-buildkernel: ci-buildworld-${TARGET_ARCH:tl} .PHONY
        @echo "Building kernel for ${TARGET_ARCH}"
        ${IMAKE} -j${PARALLEL_JOBS} -C ${WORLDDIR} ${METAMODE} \
                ${CROSS_TOOLCHAIN_PARAM} __MAKE_CONF=${MAKECONF} 
SRCCONF=${SRCCONF} \
                ${EXTRA_MAKE_FLAGS} KERNCONF=${KERNCONF} \
-               buildkernel > ${.CURDIR}/_.${TARGET_ARCH}.${.TARGET} 2>&1 || \
-               (echo "${.TARGET} failed, check _.${TARGET_ARCH}.${.TARGET} for 
details" ; false)
+               buildkernel ${LOG_TARGET}
 
 ci-buildimage: ${QEMUTGT} ci-buildkernel-${TARGET_ARCH:tl} .PHONY
        @echo "Building ci image for ${TARGET_ARCH}"
@@ -190,9 +192,7 @@ ci-buildimage: ${QEMUTGT} ci-buildkernel-${TARGET_ARCH:tl} 
.PHONY
                ${RELEASEDIR}/scripts/mk-vmimage.sh \
                -C ${RELEASEDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F 
${VMFS} \
                -i ${.OBJDIR}/ci.img -s ${VMSIZE} -f ${FORMAT} \
-               -S ${WORLDDIR} -o ${.OBJDIR}/${CIIMAGE} -c ${CICONF} \
-               > ${.CURDIR}/_.${TARGET_ARCH}.${.TARGET} 2>&1 || \
-               (echo "${.TARGET} failed, check _.${TARGET_ARCH}.${.TARGET} for 
details" ; false)
+               -S ${WORLDDIR} -o ${.OBJDIR}/${CIIMAGE} -c ${CICONF} 
${LOG_TARGET}
        touch ${.TARGET}
 
 ci-set-smoke-var: .PHONY

Reply via email to