From 11e8b3375f1068bc7c9111144d76862d069f592c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 30 Mar 2022 11:02:56 +0200 Subject: [PATCH] gitlab-ci: fix archiving build log During the test, we `tee` the output to a log file in "/tmp". We do that, because the test script cleans the working directory several times, so the file cannot reside there. Afterwards, we need to move the file back into the git-tree, so that gitlab can archive it. Previously that was done by "after_script", but the "after_script" may not see the same "/tmp" as the test run ([1]). This needs to be done as part of the "script" step. [1] https://docs.gitlab.com/ee/ci/yaml/#after_script --- .gitlab-ci.yml | 15 ++++++++------- .gitlab-ci/ci.template | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d6c942f0..f17414149 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,11 +47,11 @@ variables: # # This is done by running `ci-fairy generate-template` and possibly bump # ".default_tag". - FEDORA_TAG: '2022-03-15.0-fe6b35cace78' - UBUNTU_TAG: '2022-03-15.0-ad509d98bfc2' - DEBIAN_TAG: '2022-03-15.0-ad509d98bfc2' - CENTOS_TAG: '2022-03-15.0-fe6b35cace78' - ALPINE_TAG: '2022-03-15.0-913fc0767f1d' + FEDORA_TAG: '2022-03-15.0-a017895d3124' + UBUNTU_TAG: '2022-03-15.0-0d592fa70bc5' + DEBIAN_TAG: '2022-03-15.0-0d592fa70bc5' + CENTOS_TAG: '2022-03-15.0-a017895d3124' + ALPINE_TAG: '2022-03-15.0-65bef47ff3ce' FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh' UBUNTU_EXEC: 'bash .gitlab-ci/debian-install.sh' @@ -626,9 +626,10 @@ alpine:latest@container-clean: stage: test script: - env - - .gitlab-ci/run-test.sh 2>&1 | tee /tmp/nm-test.log - after_script: + - r=0 + - .gitlab-ci/run-test.sh 2>&1 | tee /tmp/nm-test.log || r=$? - mv /tmp/nm-test.log . + - exit $r dependencies: [] diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index 092fffcda..e85752e83 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -148,9 +148,10 @@ variables: stage: test script: - env - - .gitlab-ci/run-test.sh 2>&1 | tee /tmp/nm-test.log - after_script: + - r=0 + - .gitlab-ci/run-test.sh 2>&1 | tee /tmp/nm-test.log || r=$? - mv /tmp/nm-test.log . + - exit $r dependencies: []