Commit dbd9edf7 authored by Fabio Pitino's avatar Fabio Pitino Committed by Bob Van Landuyt

Enable feature flag ci_cross_pipeline_artifacts_download

Set feature flag to be enabled by default and add documentation.
parent a30bdc7f
......@@ -143,7 +143,7 @@ module Ci
def specified_cross_pipeline_dependencies
strong_memoize(:specified_cross_pipeline_dependencies) do
next [] unless Feature.enabled?(:ci_cross_pipeline_artifacts_download, processable.project, default_enabled: false)
next [] unless Feature.enabled?(:ci_cross_pipeline_artifacts_download, processable.project, default_enabled: true)
specified_cross_dependencies.select { |dep| dep[:pipeline] && dep[:artifacts] }
end
......
---
title: Allow job to download artifacts in parent-child pipeline hierarchy
merge_request: 49837
author:
type: added
......@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/287622
milestone: '13.7'
type: development
group: group::continuous integration
default_enabled: false
default_enabled: true
......@@ -2088,12 +2088,59 @@ build_job:
needs:
- project: $CI_PROJECT_PATH
job: $DEPENDENCY_JOB_NAME
ref: $CI_COMMIT_BRANCH
ref: $ARTIFACTS_DOWNLOAD_REF
artifacts: true
```
Downloading artifacts from jobs that are run in [`parallel:`](#parallel) is not supported.
To download artifacts between [parent-child pipelines](../parent_child_pipelines.md) use [`needs:pipeline`](#artifact-downloads-to-child-pipelines).
Downloading artifacts from the same ref as the currently running pipeline is not
recommended because artifacts could be overridden by concurrent pipelines running
on the same ref.
##### Artifact downloads to child pipelines
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/255983) in GitLab v13.7.
A [child pipeline](../parent_child_pipelines.md) can download artifacts from a job in
its parent pipeline or another child pipeline in the same parent-child pipeline hierarchy.
For example, with the following parent pipeline that has a job that creates some artifacts:
```yaml
create-artifact:
stage: build
script: echo 'sample artifact' > artifact.txt
artifacts:
paths: [artifact.txt]
child-pipeline:
stage: test
trigger:
include: child.yml
strategy: depend
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
```
A job in the child pipeline can download artifacts from the `create-artifact` job in
the parent pipeline:
```yaml
use-artifact:
script: cat artifact.txt
needs:
- pipeline: $PARENT_PIPELINE_ID
job: create-artifact
```
The `pipeline` attribute accepts a pipeline ID and it must be a pipeline present
in the same parent-child pipeline hierarchy of the given pipeline.
The `pipeline` attribute does not accept the current pipeline ID (`$CI_PIPELINE_ID`).
To download artifacts from a job in the current pipeline, use the basic form of [`needs`](#artifact-downloads-with-needs).
### `tags`
Use `tags` to select a specific runner from the list of all runners that are
......
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