Enable multiple artifacts definition with different settings
How does it work now?
Current Gitlab yaml syntax considers that artifacts section - is the record. Which means all these parameters can be set up only once:
- artifacts:paths
- artifacts:exclude
- artifacts:expire_in
- artifacts:expose_as
- artifacts:name
- artifacts:public
- artifacts:access
- artifacts:reports
- artifacts:untracked
- artifacts:when
What is the proposed suggestion?
I propose to introduce multiple artifacts definition that's how artifacts can accept also the array
Example use case
In the build task we compile the project to the dist
folder. Some times build fails and we would like to review logs stored in logs
folder. Not to expose too many logs we would like to expose logs only when pipeline fails. While build should be exposed only on successful pipeline. We want to control expiration date also differently per path. So it would be cool to have something like this
artifacts:
- paths:
- dist
when: on_success
expire_in: 1 year
- paths:
- logs
when: on_failure
expire_in: 1 week
Of course - it is possible somehow to mimic this logic by exposing all paths for all statuses and then just manipulating files and anaysing CI_JOB_STATUS, but my proposal just allows us to do this without any extra actions which is indeed the goal of having CI config.
What do you think of this proposal?
Thanks!
P.S: May be there is already a similar discussion somewhere but I haven't found it yet.