Commit 37e7083d authored by Fabio Pitino's avatar Fabio Pitino Committed by Sean McGivern

Document Dynamic child pipelines

- Add docs to parent/child pipelines
- Add docs to yaml reference
parent 92fbe822
---
title: Enable feature Dynamic Child Pipeline creation via artifact
merge_request: 26648
author:
type: added
...@@ -126,7 +126,22 @@ microservice_a: ...@@ -126,7 +126,22 @@ microservice_a:
script: ... script: ...
``` ```
## Dynamic child pipelines
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/35632) in GitLab 12.9.
Instead of running a child pipeline from a static YAML file, you can define a job that runs
your own script to generate a YAML file, which is then [used to trigger a child pipeline](yaml/README.md#trigger-child-pipeline-with-generated-configuration-file).
This technique can be very powerful in generating pipelines targeting content that changed or to
build a matrix of targets and architectures.
## Limitations ## Limitations
A parent pipeline can trigger many child pipelines, but a child pipeline cannot trigger A parent pipeline can trigger many child pipelines, but a child pipeline cannot trigger
further child pipelines. See the [related issue](https://gitlab.com/gitlab-org/gitlab/issues/29651) for discussion on possible future improvements. further child pipelines. See the [related issue](https://gitlab.com/gitlab-org/gitlab/issues/29651)
for discussion on possible future improvements.
When triggering dynamic child pipelines, if the job containing the CI config artifact is not a predecessor of the
trigger job, the child pipeline will fail to be created, causing also the parent pipeline to fail.
In the future we want to validate the trigger job's dependencies [at the time the parent pipeline is created](https://gitlab.com/gitlab-org/gitlab/-/issues/209070) rather than when the child pipeline is created.
...@@ -2880,6 +2880,31 @@ trigger_job: ...@@ -2880,6 +2880,31 @@ trigger_job:
strategy: depend strategy: depend
``` ```
##### Trigger child pipeline with generated configuration file
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/35632) in GitLab 12.9.
You can also trigger a child pipeline from a [dynamically generated configuration file](../parent_child_pipelines.md#dynamic-child-pipelines):
```yaml
generate-config:
stage: build
script: generate-ci-config > generated-config.yml
artifacts:
paths:
- generated-config.yml
child-pipeline:
stage: test
trigger:
include:
- artifact: generated-config.yml
job: generate-config
```
The `generated-config.yml` is extracted from the artifacts and used as the configuration
for triggering the child pipeline.
#### Linking pipelines with `trigger:strategy` #### Linking pipelines with `trigger:strategy`
By default, the `trigger` job completes with the `success` status By default, the `trigger` job completes with the `success` status
......
...@@ -30,7 +30,7 @@ module Gitlab ...@@ -30,7 +30,7 @@ module Gitlab
def matching? def matching?
super && super &&
Feature.enabled?(:ci_dynamic_child_pipeline, project) Feature.enabled?(:ci_dynamic_child_pipeline, project, default_enabled: true)
end end
private private
......
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