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
This commit is contained in:
Thomas Haller 2022-03-30 11:02:56 +02:00
parent 318776c56d
commit 11e8b3375f
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 11 additions and 9 deletions

View file

@ -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: []

View file

@ -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: []