Backend: Job succeeds despite the fact that artifact was not found
Summary
When running a ci job with declared artifacts, if the job can not build the artifact, then the artifact is not found at upload time. In that case, I believe job should be marked as failed but it is considered successful.
As a result, one can introduce a regression in its build process without discovering it before days or client reporting incapacity to download artifact.
There's a similar issue open in the runner project that may resolve this issue.
Steps to reproduce
Define a job in .gitlab-ci.yml
which is supposed to build an artifact but does not. Wait for the CI to run and observe that the job has succeeded eventhough no artifact has been published.
I built a sample job that should have failed but succeeded.
Here is a .gitlab-ci.yml to reproduce:
build:
script:
- echo do not build artifact
artifacts:
paths:
- /tmp/unexisting_artifact.zip
The script itself won't fail but the build should since the declared artifact can not be found.
Example Project
https://gitlab.com/pascal_legolas/job_should_fail
Proposal
Implement the following
artifact:
paths:
- simple-path-string.txt
- pattern: "**/**.md"
match: any # all, partial
-
require: any
(default): no matches, all matches, partial matches -
require: all
: all patterns provided must return a match -
require: partial
: at least one pattern must match
Relevant logs and/or screenshots
See sample job.
Output of checks
This bug happens on GitLab.com