From 124919bfc61020c89567fde53ff322c0dcc43e67 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 1 Nov 2018 10:41:45 +0800 Subject: [PATCH 1/2] ci: Count build_example jobs in decimal instead of octal --- tools/ci/build_examples.sh | 3 ++- tools/ci/build_examples_cmake.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index 81576bf55..530d6ab2e 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -75,7 +75,8 @@ else [ -z ${JOB_PATTERN} ] && die "JOB_PATTERN is bad" # parse number 'NUM' at the end of string 'some_your_text_NUM' - JOB_NUM=$( echo ${JOB_NAME} | sed -n -r 's/^.*_([0-9]+)$/\1/p' ) + # NOTE: Getting rid of the leading zero to get the decimal + JOB_NUM=$( echo ${JOB_NAME} | sed -n -r 's/^.*_0*([0-9]+)$/\1/p' ) [ -z ${JOB_NUM} ] && die "JOB_NUM is bad" # count number of the jobs diff --git a/tools/ci/build_examples_cmake.sh b/tools/ci/build_examples_cmake.sh index 849943b93..50ce7f1e6 100755 --- a/tools/ci/build_examples_cmake.sh +++ b/tools/ci/build_examples_cmake.sh @@ -80,7 +80,8 @@ else [ -z ${JOB_PATTERN} ] && die "JOB_PATTERN is bad" # parse number 'NUM' at the end of string 'some_your_text_NUM' - JOB_NUM=$( echo ${JOB_NAME} | sed -n -r 's/^.*_([0-9]+)$/\1/p' ) + # NOTE: Getting rid of the leading zero to get the decimal + JOB_NUM=$( echo ${JOB_NAME} | sed -n -r 's/^.*_0*([0-9]+)$/\1/p' ) [ -z ${JOB_NUM} ] && die "JOB_NUM is bad" # count number of the jobs From 0fb6f619c5d5c6a4a74fbc08897cba6904c3a133 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Wed, 31 Oct 2018 18:33:51 +0800 Subject: [PATCH 2/2] ci: Detect undetectable failures in build_examples --- .gitlab-ci.yml | 3 ++- tools/ci/build_examples.sh | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 897e61217..435b11208 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -218,6 +218,8 @@ build_esp_idf_tests: .build_examples_make_template: &build_examples_make_template <<: *build_template + # This is a workaround for a rarely encountered issue with building examples in CI. + # Probably related to building of Kconfig in 'make clean' stage retry: 1 artifacts: when: always @@ -251,7 +253,6 @@ build_esp_idf_tests: # same as above, but for CMake .build_examples_cmake_template: &build_examples_cmake_template <<: *build_template - retry: 1 artifacts: when: always paths: diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index 530d6ab2e..2210a4b45 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -121,14 +121,19 @@ build_example () { local BUILDLOG=${LOG_PATH}/ex_${ID}_log.txt touch ${BUILDLOG} + local FLASH_ARGS=build/download.config + make clean >>${BUILDLOG} 2>&1 && make defconfig >>${BUILDLOG} 2>&1 && make all >>${BUILDLOG} 2>&1 && - ( make print_flash_cmd | tail -n 1 >build/download.config ) >>${BUILDLOG} 2>&1 || + make print_flash_cmd >${FLASH_ARGS}.full 2>>${BUILDLOG} || { RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}" ; } + tail -n 1 ${FLASH_ARGS}.full > ${FLASH_ARGS} || : + test -s ${FLASH_ARGS} || die "Error: ${FLASH_ARGS} file is empty" + cat ${BUILDLOG} popd