mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ci: Include context from failed build logs in the CI job log
This is faster to look up than browsing or downloading artifacts, and will often contain the root cause. Context includes the last 25 lines of the log, and any lines contaiing 'error:' or 'warning:'
This commit is contained in:
parent
936523b904
commit
2a33dbb5a7
@ -7,11 +7,19 @@
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
|
||||
from find_build_apps import BUILD_SYSTEMS, BuildError, BuildItem, setup_logging
|
||||
from find_build_apps.common import SIZE_JSON_FN, rmdir
|
||||
|
||||
# This RE will match GCC errors and many other fatal build errors and warnings as well
|
||||
LOG_ERROR_WARNING = re.compile(r'(error|warning):', re.IGNORECASE)
|
||||
|
||||
# Log this many trailing lines from a failed build log, also
|
||||
LOG_DEBUG_LINES = 25
|
||||
|
||||
|
||||
def main(): # type: () -> None
|
||||
parser = argparse.ArgumentParser(description='ESP-IDF app builder')
|
||||
@ -120,6 +128,17 @@ def main(): # type: () -> None
|
||||
build_system_class.build(build_info)
|
||||
except BuildError as e:
|
||||
logging.error(str(e))
|
||||
if build_info.build_log_path:
|
||||
log_filename = os.path.basename(build_info.build_log_path)
|
||||
with open(build_info.build_log_path, 'r') as f:
|
||||
lines = [line.rstrip() for line in f.readlines() if line.rstrip()] # non-empty lines
|
||||
logging.debug('Error and warning lines from {}:'.format(log_filename))
|
||||
for line in lines:
|
||||
if LOG_ERROR_WARNING.search(line):
|
||||
logging.warning('>>> {}'.format(line))
|
||||
logging.debug('Last {} lines of {}:'.format(LOG_DEBUG_LINES, log_filename))
|
||||
for line in lines[-LOG_DEBUG_LINES:]:
|
||||
logging.debug('>>> {}'.format(line))
|
||||
if args.keep_going:
|
||||
failed_builds.append(build_info)
|
||||
else:
|
||||
|
@ -153,7 +153,6 @@ examples/wifi/iperf/iperf_test.py
|
||||
tools/ble/lib_ble_client.py
|
||||
tools/ble/lib_gap.py
|
||||
tools/ble/lib_gatt.py
|
||||
tools/build_apps.py
|
||||
tools/check_python_dependencies.py
|
||||
tools/check_term.py
|
||||
tools/ci/check_artifacts_expire_time.py
|
||||
|
Loading…
x
Reference in New Issue
Block a user