Cross project artifact downloads with needs only work with full project path
Summary
In regards to Cross project artifact downloads with needs
, our documentation states that if the projects reside within the same group/namespace, then it is not necessary to define the full path.
If the project is in the same group or namespace, you can omit them from the
project: keyword
. For example,project: group/project-name
orproject: project-name
.
However if you don't define the full path of the upstream project, it will fail with the following error:
This job depends on other jobs with expired/erased artifacts: Please refer to https://docs.gitlab.com/ee/ci/yaml/README.html#dependencies
Steps to reproduce
In this example, we will be attempting to pass an artifact from the upstream2
project to the downstream2
project. Both projects reside in the same group called Test-cross-project-artifact-2
upstream2
project as follows:
Create a .gitlab-ci.yml file in the create_artifact:
stage: build
script:
- echo "test" > test.txt
artifacts:
paths:
- test.txt
child:
stage: test
trigger: test-cross-project-artifact-2/downstream2
downstream2
project as follows:
Create a .gitlab-ci.yml file in the use-artifact:
stage: test
script: cat test.txt
needs:
- project: upstream2
job: create_artifact
ref: main
artifacts: true
Per our documentation, the use-artifact
job in the downstream2
project should be able to download/use the artifact created in the create_artifact
job of the upstream2
project. However this only works if you define the full project path in the downstream2
project as follows:
needs:
- project: test-cross-project-artifact-2/upstream2
job: create_artifact
ref: main
artifacts: true
Example Project
https://gitlab.com/test-cross-project-artifact-2
What is the current bug behavior?
According to our documentation, if the projects reside within the same group/namespace, then it is not necessary to define the full path to use an artifact from another project. However if you don't define the full path, you get the following error:
This job depends on other jobs with expired/erased artifacts: Please refer to https://docs.gitlab.com/ee/ci/yaml/README.html#dependencies
What is the expected correct behavior?
If the projects reside within the same group/namespace, then you should just be able to define the project name when using Cross project artifact downloads with needs.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com