1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-30 00:21:17 +00:00

ci: fail any build that emits warnings

Using a custom logging.yml we can instruct BitBake's logger to write all
warnings and errors into a separate log file.

Then after the build has finished we can see if the log file is empty and if
not show it and abort the build.

Change-Id: Ida835b5c822941fb513dfb1758b4ec195e0050fc
Signed-off-by: Ross Burton <ross.burton@arm.com>
This commit is contained in:
Ross Burton
2020-12-10 13:09:38 +00:00
parent 68c43a96f8
commit 78131b1bed
4 changed files with 36 additions and 0 deletions
+2
View File
@@ -15,6 +15,7 @@ stages:
KAS_WORK_DIR: $CI_PROJECT_DIR/work
SSTATE_DIR: $CI_BUILDS_DIR/persist/sstate
DL_DIR: $CI_BUILDS_DIR/persist/downloads
BB_LOGCONFIG: $CI_PROJECT_DIR/kas/logging.yml
before_script:
- echo KAS_WORK_DIR = $KAS_WORK_DIR
- echo SSTATE_DIR = $SSTATE_DIR
@@ -28,6 +29,7 @@ stages:
- KASFILES=$(kas/jobs-to-kas $CI_JOB_NAME)
- kas shell --update --force-checkout $KASFILES -c 'cat conf/*.conf'
- kas build $KASFILES
- ./kas/check-warnings $KAS_WORK_DIR/build/warnings.log
#
+3
View File
@@ -25,6 +25,9 @@ repos:
layers:
meta-oe:
env:
BB_LOGCONFIG: ""
local_conf_header:
base: |
CONF_VERSION = "1"
+18
View File
@@ -0,0 +1,18 @@
#! /bin/bash
# Expects the path to a log file as $1, and if this file has any content
# then display the contents and exit with an error code.
set -e -u
LOGFILE=$1
if test -s $LOGFILE; then
echo ==============================
echo The build had warnings/errors:
echo ==============================
cat $LOGFILE
exit 1
fi
exit 0
+13
View File
@@ -0,0 +1,13 @@
# Python logging configuration to write all warnings to a separate file
version: 1
handlers:
warnings:
class: logging.FileHandler
level: WARNING
filename: warnings.log
formatter: BitBake.logfileFormatter
loggers:
BitBake:
handlers: [warnings]