Commit 4c3a2f43 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Copy-edit docs for cross-project pipelines

parent b12ce63f
...@@ -32,9 +32,7 @@ Let's assume you deploy your web app from different projects in GitLab: ...@@ -32,9 +32,7 @@ Let's assume you deploy your web app from different projects in GitLab:
With Multi-Project Pipelines, you can visualize the entire pipeline, including all stages of builds and tests for the three projects. With Multi-Project Pipelines, you can visualize the entire pipeline, including all stages of builds and tests for the three projects.
## How it works ## Triggering cross-project pipeline through API
### Creating cross-project pipeline through API
When you use the [`CI_JOB_TOKEN` to trigger pipelines](triggers/README.md#ci-job-token), GitLab When you use the [`CI_JOB_TOKEN` to trigger pipelines](triggers/README.md#ci-job-token), GitLab
recognizes the source of the job token, and thus internally ties these pipelines recognizes the source of the job token, and thus internally ties these pipelines
...@@ -43,19 +41,19 @@ together, allowing you to visualize their relationships on pipeline graphs. ...@@ -43,19 +41,19 @@ together, allowing you to visualize their relationships on pipeline graphs.
These relationships are displayed in the pipeline graph by showing inbound and These relationships are displayed in the pipeline graph by showing inbound and
outbound connections for upstream and downstream pipeline dependencies. outbound connections for upstream and downstream pipeline dependencies.
### Creating cross-project pipeline in .gitlab-ci.yml ## Creating cross-project pipeline in .gitlab-ci.yml
> Introduced in GitLab 11.8 > Introduced in GitLab 11.8
#### Triggering a downstream pipeline using a bridge job ### Triggering a downstream pipeline using a bridge job
Before GitLab 11.8 it was necessary to implement a pipeline job that was Before GitLab 11.8 it was necessary to implement a pipeline job that was
responsible for making the API request [to trigger a pipeline](triggers/README.md#ci-job-token) responsible for making the API request [to trigger a pipeline](triggers/README.md#creating-cross-project-pipeline-through-API)
in a different project. in a different project.
In GitLab 11.8 we introduced a new CI/CD configuration syntax to make this task In GitLab 11.8, GitLab provides a new CI/CD configuration syntax to make this
easier, and avoid the need of involving GitLab Runner in triggering a task easier, and avoid needing GitLab Runner for triggering a cross-project
cross-project pipeline. pipelines.
```yaml ```yaml
rspec: rspec:
...@@ -69,32 +67,33 @@ staging: ...@@ -69,32 +67,33 @@ staging:
trigger: my/deployment trigger: my/deployment
``` ```
The example above, as soon as `rspec` job succeeds in stage `test`, `staging` In the example above, as soon as `rspec` job succeeds in stage `test`,
_bridge_ job is going to be started. Initial status of this job is going to be `staging` "bridge" job is going to be started. Initial status of this job is
`pending`. GitLab will create a downstream pipeline in the `my/deployment` going to be `pending`. GitLab will create a downstream pipeline in the
project, and as soon as the pipeline gets created, `staging` job is going to `my/deployment` project and as soon as the pipeline gets created, the `staging`
succeed. `my/deployment` is a full path to that project. job will succeed. `my/deployment` is a full path to that project.
User that created the upstream pipeline needs to have access rights to the The user that created the upstream pipeline needs to have access rights to the
downstream project (`my/deployment` in this case). If a downstream project can downstream project (`my/deployment` in this case). If a downstream project can
not be found, or a user does not have access rights to create pipeline there, not be found, or a user does not have access rights to create pipeline there,
`staging` job is going to be marked as _failed_. the `staging` job is going to be marked as _failed_.
Note: `staging` job is going to succeed as soon as a downstream pipeline gets NOTE: **Note:**
created. GitLab does not support status attribution yet, however adding `staging` will succeed as soon as a downstream pipeline gets created.
first-class `trigger` configuration syntax is a ground work for implementing GitLab does not support status attribution yet, however adding first-class
`trigger` configuration syntax is a ground work for implementing
[status attribution](https://gitlab.com/gitlab-org/gitlab-ce/issues/39640). [status attribution](https://gitlab.com/gitlab-org/gitlab-ce/issues/39640).
Note: Bridge jobs do not support every configuration entry that a user can use NOTE: **Note:**
in case of regular jobs. Bridge jobs are not going to be picked by a runner, "Bridge" jobs do not support every configuration entry that a user can use
in the case of regular jobs. "Bridge" jobs will not to be picked by a runner,
thus there is no point in adding support for `script`, for example. If a user thus there is no point in adding support for `script`, for example. If a user
tries to used unsupported configuration syntax, YAML validation is going to tries to used unsupported configuration syntax, YAML validation will fail upon
fail upon pipeline creation. pipeline creation.
#### Specifying a downstream pipeline branch ### Specifying a downstream pipeline branch
It is possible to specify a branch name that a downstream pipeline is going to It is possible to specify a branch name that a downstream pipeline will use.
use.
```yaml ```yaml
rspec: rspec:
...@@ -111,14 +110,14 @@ staging: ...@@ -111,14 +110,14 @@ staging:
Use a `project` keyword to specify full path to a downstream project. Use Use a `project` keyword to specify full path to a downstream project. Use
`branch` keyword to specify a branch name. `branch` keyword to specify a branch name.
GitLab is going to use a commit that is currently on the HEAD of the branch GitLab will use a commit that is currently on the HEAD of the branch when
when creating a downstream pipeline. creating a downstream pipeline.
#### Passing variables to a downstream pipeline ### Passing variables to a downstream pipeline
Sometimes you might want to pass variables to a downstream pipeline. Sometimes you might want to pass variables to a downstream pipeline.
You can do that using `variables` keyword, just like you would do in case You can do that using the `variables` keyword, just like you would when
of defining a regular job. defining a regular job.
```yaml ```yaml
rspec: rspec:
...@@ -132,19 +131,18 @@ staging: ...@@ -132,19 +131,18 @@ staging:
trigger: my/deployment trigger: my/deployment
``` ```
`ENVIRONMENT` variable is going to be passed to every job defined in a The `ENVIRONMENT` variable will be passed to every job defined in a downstream
downstream pipeline. It is going to be available as an environment variable pipeline. It will be available as an environment variable when GitLab Runner picks a job.
when GitLab Runner picks a job.
#### Limitations ### Limitations
Because bridge jobs are a little different than regular jobs, it is not Because "bridge" jobs are a little different to regular jobs, it is not
possible to use exactly the same configuration syntax here, as one would possible to use exactly the same configuration syntax here, as one would
normally do when defining a regular job that is going to be picked by a runner. normally do when defining a regular job that will be picked by a runner.
Some features, are not implemented yet, like support for environments. Some features are not implemented yet. For example, support for environments.
Available configuration keywords are: [Configuration keywords](yaml/README.md) available for "bridge" jobs are:
- `trigger` (to define a downstream pipeline trigger) - `trigger` (to define a downstream pipeline trigger)
- `stage` - `stage`
......
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