Skip to content

Commit 932cf5f

Browse files
committed
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
1 parent 77bf447 commit 932cf5f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/ci/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ TARGET_ARCH= ${TARGET}
4141
.endif
4242
IMAKE= ${MAKE} TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}
4343

44+
.if !defined(CIENV) || empty(CIENV)
45+
CIENV= local
46+
LOG_TARGET= > ${.CURDIR}/_.${TARGET_ARCH}.${.TARGET} 2>&1 || (echo "${.TARGET} failed, check _.${TARGET_ARCH}.${.TARGET} for details" ; false)
47+
.endif
48+
4449
.if defined(CROSS_TOOLCHAIN) || !empty(CROSS_TOOLCHAIN)
4550
CROSS_TOOLCHAIN_PARAM= "CROSS_TOOLCHAIN=${CROSS_TOOLCHAIN}"
4651
.endif
@@ -170,17 +175,14 @@ ci-buildworld: .PHONY
170175
@echo "Building world for ${TARGET_ARCH}"
171176
${IMAKE} -j${PARALLEL_JOBS} -C ${WORLDDIR} ${METAMODE} \
172177
${CROSS_TOOLCHAIN_PARAM} __MAKE_CONF=${MAKECONF} SRCCONF=${SRCCONF} \
173-
${EXTRA_MAKE_FLAGS} buildworld > ${.CURDIR}/_.${TARGET_ARCH}.${.TARGET} 2>&1 || \
174-
(echo "${.TARGET} failed, check _.${TARGET_ARCH}.${.TARGET} for details" ; false)
175-
178+
${EXTRA_MAKE_FLAGS} buildworld ${LOG_TARGET}
176179

177180
ci-buildkernel: ci-buildworld-${TARGET_ARCH:tl} .PHONY
178181
@echo "Building kernel for ${TARGET_ARCH}"
179182
${IMAKE} -j${PARALLEL_JOBS} -C ${WORLDDIR} ${METAMODE} \
180183
${CROSS_TOOLCHAIN_PARAM} __MAKE_CONF=${MAKECONF} SRCCONF=${SRCCONF} \
181184
${EXTRA_MAKE_FLAGS} KERNCONF=${KERNCONF} \
182-
buildkernel > ${.CURDIR}/_.${TARGET_ARCH}.${.TARGET} 2>&1 || \
183-
(echo "${.TARGET} failed, check _.${TARGET_ARCH}.${.TARGET} for details" ; false)
185+
buildkernel ${LOG_TARGET}
184186

185187
ci-buildimage: ${QEMUTGT} ci-buildkernel-${TARGET_ARCH:tl} .PHONY
186188
@echo "Building ci image for ${TARGET_ARCH}"
@@ -190,9 +192,7 @@ ci-buildimage: ${QEMUTGT} ci-buildkernel-${TARGET_ARCH:tl} .PHONY
190192
${RELEASEDIR}/scripts/mk-vmimage.sh \
191193
-C ${RELEASEDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F ${VMFS} \
192194
-i ${.OBJDIR}/ci.img -s ${VMSIZE} -f ${FORMAT} \
193-
-S ${WORLDDIR} -o ${.OBJDIR}/${CIIMAGE} -c ${CICONF} \
194-
> ${.CURDIR}/_.${TARGET_ARCH}.${.TARGET} 2>&1 || \
195-
(echo "${.TARGET} failed, check _.${TARGET_ARCH}.${.TARGET} for details" ; false)
195+
-S ${WORLDDIR} -o ${.OBJDIR}/${CIIMAGE} -c ${CICONF} ${LOG_TARGET}
196196
touch ${.TARGET}
197197

198198
ci-set-smoke-var: .PHONY

0 commit comments

Comments
 (0)