From e6a4ad3d556c771c2df70d370ccd24f721ca9cdb Mon Sep 17 00:00:00 2001 From: Aleksei Apaseev Date: Fri, 3 Nov 2023 18:09:34 +0800 Subject: [PATCH] ci: Move upload artifacts execution of build and target_test stages to the after script section --- .gitlab/ci/common.yml | 7 +++++++ .gitlab/ci/target-test.yml | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitlab/ci/common.yml b/.gitlab/ci/common.yml index 18f78b1e05..c804b66611 100644 --- a/.gitlab/ci/common.yml +++ b/.gitlab/ci/common.yml @@ -172,6 +172,12 @@ variables: # Show ccache statistics if enabled globally test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats || true +.upload_failed_job_log_artifacts: &upload_failed_job_log_artifacts | + - | + if [ $CI_JOB_STATUS = "failed" ]; then + python tools/ci/artifacts_handler.py upload --type logs + fi + .before_script:minimal: before_script: - *common-before_scripts @@ -198,6 +204,7 @@ variables: .after_script:build:ccache: after_script: - *show_ccache_statistics + - *upload_failed_job_log_artifacts ############################## # Git Strategy Job Templates # diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index ab5b531afc..cc8a237bee 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -11,6 +11,8 @@ paths: - .cache/pip policy: pull + after_script: + - python tools/ci/artifacts_handler.py upload --type logs junit_reports .pytest_template: extends: @@ -49,7 +51,6 @@ --parallel-index ${CI_NODE_INDEX:-1} ${PYTEST_EXTRA_FLAGS} --app-info-filepattern \"list_job_*.txt\" - - python tools/ci/artifacts_handler.py upload --type logs junit_reports .pytest_examples_dir_template: extends: .pytest_template @@ -1298,7 +1299,6 @@ pytest_examples_openthread_br: --parallel-index ${CI_NODE_INDEX:-1} ${PYTEST_EXTRA_FLAGS} --app-info-filepattern \"list_job_*.txt\" - - python tools/ci/artifacts_handler.py upload --type logs junit_reports pytest_examples_openthread_bbr: extends: @@ -1333,7 +1333,6 @@ pytest_examples_openthread_bbr: --parallel-index ${CI_NODE_INDEX:-1} ${PYTEST_EXTRA_FLAGS} --app-info-filepattern \"list_job_*.txt\" - - python tools/ci/artifacts_handler.py upload --type logs junit_reports pytest_examples_openthread_sleep: extends: @@ -1365,7 +1364,6 @@ pytest_examples_openthread_sleep: --parallel-index ${CI_NODE_INDEX:-1} ${PYTEST_EXTRA_FLAGS} --app-info-filepattern \"list_job_*.txt\" - - python tools/ci/artifacts_handler.py upload --type logs junit_reports pytest_examples_esp32h2_zigbee: extends: