Artifacts with the same name from different jobs overwrite each other

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Artifacts with the same name from different jobs overwrite each other

Steps to reproduce

  1. Create two jobs that produce an artifact with the same name.
  2. Create another job at a later stage and observe that only the later job's artifact exists.

Example Project

See: https://gitlab.com/nwcs/artifacts_test

Here is an example .gitlab-ci.yml file:

image: busybox:latest

test1:
  stage: test
  script:
    - echo "Job test1" > artifact.txt
  artifacts:
    paths:
    - artifact.txt

test2:
  stage: test
  script:
    - echo "Job test2" > artifact.txt
  artifacts:
    paths:
    - artifact.txt

deploy1:
  stage: deploy
  script:
    - ls
    - cat artifact.txt

What is the current bug behavior?

The most recent job that produces an artifact with the same name overwrites any prior files

What is the expected correct behavior?

Either a warning should be produced, or the artifacts should be preserved separately - perhaps under a job name.

Relevant logs and/or screenshots

See here for the artifact produces jobs: https://gitlab.com/nwcs/artifacts_test/-/jobs/717047106 https://gitlab.com/nwcs/artifacts_test/-/jobs/717047107

See here for the final job: https://gitlab.com/nwcs/artifacts_test/-/jobs/717047108

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Results of GitLab application Check

Possible fixes

Either a warning should be produced, or the artifacts should be preserved separately - perhaps under a job name.

Edited by 🤖 GitLab Bot 🤖