Commit cc087b3f authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'enable-cross-project-artifacts' into 'master'

Enable cross project artifacts in needs

Closes #118805

See merge request gitlab-org/gitlab!22161
parents 00c63483 9878f217
---
title: Download cross-project artifacts by using needs keyword in the CI file
merge_request: 22161
author:
type: added
......@@ -2385,6 +2385,51 @@ rspec:
- build_job_3
```
#### Cross project artifact downloads with `needs` **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/14311) in GitLab v12.7.
`needs` can be used to download artifacts from up to five jobs in pipelines on
[other refs in the same project](#artifact-downloads-between-pipelines-in-the-same-project),
or pipelines in different projects:
```yaml
build_job:
stage: build
script:
- ls -lhR
needs:
- project: group/project-name
job: build-1
ref: master
artifacts: true
```
`build_job` will download the artifacts from the latest successful `build-1` job
on the `master` branch in the `group/project-name` project.
##### Artifact downloads between pipelines in the same project
`needs` can be used to download artifacts from different pipelines in the current project
by setting the `project` keyword as the current project's name, and specifying a ref.
In the example below, `build_job` will download the artifacts for the latest successful
`build-1` job with the `other-ref` ref:
```yaml
build_job:
stage: build
script:
- ls -lhR
needs:
- project: group/same-project-name
job: build-1
ref: other-ref
artifacts: true
```
NOTE: **Note:**
Downloading artifacts from jobs that are run in [`parallel:`](#parallel) is not supported.
### `coverage`
> [Introduced][ce-7447] in GitLab 8.17.
......
......@@ -120,7 +120,7 @@ module EE
override :cross_dependencies
def cross_dependencies
return [] unless user_id
return [] unless ::Feature.enabled?(:cross_project_need_artifacts, project, default_enabled: false)
return [] unless ::Feature.enabled?(:cross_project_need_artifacts, project, default_enabled: true)
return [] unless project.feature_available?(:cross_project_pipelines)
cross_dependencies_relationship
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment