gitlab-runner artifacts-uploader does not fail if artifact file to upload does not exist
gitlab-runner artifacts-uploader does not fail if artifact file to upload does not exist.
This leads to pipeline working and lets subsequent pipelines fail or worse lets falsy data get to production.
This relates to gitlab#22711 as well
Steps to reproduce
Version of gitlab-runner: 11.8.0
Issue the following command:
/usr/bin/gitlab-runner artifacts-uploader \ --url <url to gitlab ci> \ --token <access token> \ --id <id> \ --path <path to NON existing file> \ --artifact-format zip \ --artifact-type archive
The return value will be 0
echo $? 0
What is the current bug behavior?
The output of the command is:
Runtime platform arch=amd64 os=linux pid=21534 revision=4745a6f3 version=11.8.0 WARNING: <path to NON existing file>: no matching files ERROR: No files to upload
But the exit code is
What is the expected correct behavior?
The output should remain but the exit code should become
The problem exists in line
should be probably changed to
return errors.New("No files to upload")
createReadStream should return an error.