Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ci/pipelines')
-rw-r--r--doc/ci/pipelines/cicd_minutes.md26
-rw-r--r--doc/ci/pipelines/img/pipeline_mini_graph_v15_0.pngbin0 -> 6061 bytes
-rw-r--r--doc/ci/pipelines/merge_request_pipelines.md9
-rw-r--r--doc/ci/pipelines/merge_trains.md5
-rw-r--r--doc/ci/pipelines/multi_project_pipelines.md122
-rw-r--r--doc/ci/pipelines/settings.md36
6 files changed, 165 insertions, 33 deletions
diff --git a/doc/ci/pipelines/cicd_minutes.md b/doc/ci/pipelines/cicd_minutes.md
index 1e862c87035..4b7d3845361 100644
--- a/doc/ci/pipelines/cicd_minutes.md
+++ b/doc/ci/pipelines/cicd_minutes.md
@@ -21,7 +21,7 @@ On GitLab.com:
- CI/CD minutes quotas are enabled for both public and private projects, but public
projects [consume CI/CD minutes at a slower rate](#cost-factor).
-- The base monthly CI/CD minutes quota for a GitLab.com [namespace](../../user/group/index.md#namespaces)
+- The base monthly CI/CD minutes quota for a GitLab.com [namespace](../../user/namespace/index.md)
is determined by its [license tier](https://about.gitlab.com/pricing/).
- You can [purchase additional CI/CD minutes](#purchase-additional-cicd-minutes)
if you need more than the number of CI/CD minutes in your monthly quota.
@@ -204,12 +204,36 @@ The cost factors for jobs running on shared runners on GitLab.com are:
- `0.008` for public projects, and projects in the [GitLab for Open Source program](../../subscriptions/index.md#gitlab-for-open-source).
For every 125 minutes of job execution time, you use 1 CI/CD minute.
- `1` for internal and private projects.
+- Calculated differently for [community contributions to GitLab projects](#cost-factor-for-community-contributions-to-gitlab-projects).
The cost factors on self-managed instances are:
- `0` for public projects, so they do not consume CI/CD minutes.
- `1` for internal and private projects.
+#### Cost factor for community contributions to GitLab projects
+
+Community contributors can use up to 300,000 minutes on shared runners when
+contributing to open source projects maintained by GitLab. The 300,000
+minutes applies to all SaaS tiers, and the cost factor calculation is:
+
+- `Monthly minute quota / 300,000 job duration minutes = Cost factor`
+
+For example, with the 10,000 CI/CD minutes per month in the Premium tier:
+
+- 10,000 / 300,000 = 0.03333333333 cost factor.
+
+For this reduced cost factor:
+
+- The merge request source project must be a fork of a GitLab-maintained project,
+ such as [`gitlab-com/www-gitlab-com`](https://gitlab.com/gitlab-com/www-gitlab-com),
+ [`gitlab-org/gitlab`](https://gitlab.com/gitlab-org/gitlab), and so on.
+- The merge request target project must be the fork's parent project.
+- The pipeline must be a merge request, merged results, or merge train pipeline.
+
+GitLab administrators can add a namespace to the reduced cost factor
+[with a flag](../../administration/feature_flags.md) named `ci_minimal_cost_factor_for_gitlab_namespaces`.
+
### Additional costs on GitLab SaaS
GitLab SaaS shared runners have different cost factors, depending on the runner type (Linux, Windows, macOS) and the virtual machine configuration.
diff --git a/doc/ci/pipelines/img/pipeline_mini_graph_v15_0.png b/doc/ci/pipelines/img/pipeline_mini_graph_v15_0.png
new file mode 100644
index 00000000000..48a0ca9d84f
--- /dev/null
+++ b/doc/ci/pipelines/img/pipeline_mini_graph_v15_0.png
Binary files differ
diff --git a/doc/ci/pipelines/merge_request_pipelines.md b/doc/ci/pipelines/merge_request_pipelines.md
index 89839de718b..5ba489c9830 100644
--- a/doc/ci/pipelines/merge_request_pipelines.md
+++ b/doc/ci/pipelines/merge_request_pipelines.md
@@ -151,7 +151,10 @@ or [**Rebase** option](../../user/project/merge_requests/methods/index.md#rebasi
Prerequisites:
-- You must be a member of the parent project and have at least the [Developer role](../../user/permissions.md).
+- The parent project's [CI/CD configuration file](../yaml/index.md) must be configured to
+ [run jobs in merge request pipelines](#prerequisites).
+- You must be a member of the parent project with [permissions to run CI/CD pipelines](../../user/permissions.md#gitlab-cicd-permissions).
+ You might need additional permissions if the branch is protected.
- The fork project must be [visible](../../user/public_access.md) to the
user running the pipeline. Otherwise, the **Pipelines** tab does not display
in the merge request.
@@ -161,6 +164,10 @@ To use the UI to run a pipeline in the parent project for a merge request from a
1. In the merge request, go to the **Pipelines** tab.
1. Select **Run pipeline**. You must read and accept the warning, or the pipeline does not run.
+You can disable this feature by using [the projects API](../../api/projects.md#edit-project)
+to disable the `ci_allow_fork_pipelines_to_run_in_parent_project` setting.
+The setting is `enabled` by default.
+
## Available predefined variables
When you use merge request pipelines, you can use:
diff --git a/doc/ci/pipelines/merge_trains.md b/doc/ci/pipelines/merge_trains.md
index ac644628f3a..2882cd378aa 100644
--- a/doc/ci/pipelines/merge_trains.md
+++ b/doc/ci/pipelines/merge_trains.md
@@ -59,9 +59,8 @@ changes that are included in the target branch, and the `C` changes that are fro
the merge request already in the train.
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
-Watch this video for a demonstration on [how parallel execution
-of merge trains can prevent commits from breaking the default
-branch](https://www.youtube.com/watch?v=D4qCqXgZkHQ).
+Watch this video for a demonstration on
+[how parallel execution of merge trains can prevent commits from breaking the default branch](https://www.youtube.com/watch?v=D4qCqXgZkHQ).
## Prerequisites
diff --git a/doc/ci/pipelines/multi_project_pipelines.md b/doc/ci/pipelines/multi_project_pipelines.md
index dfbd2708d8d..a71af78f410 100644
--- a/doc/ci/pipelines/multi_project_pipelines.md
+++ b/doc/ci/pipelines/multi_project_pipelines.md
@@ -45,8 +45,8 @@ To create multi-project pipelines, you can:
> [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/199224) to GitLab Free in 12.8.
-When you create a multi-project pipeline in your `.gitlab-ci.yml` file,
-you create what is called a *trigger job*. For example:
+When you use the [`trigger`](../yaml/index.md#trigger) keyword to create a multi-project
+pipeline in your `.gitlab-ci.yml` file, you create what is called a *trigger job*. For example:
```yaml
rspec:
@@ -76,7 +76,7 @@ downstream project (`my/deployment`) too. If the downstream project is not found
or the user does not have [permission](../../user/permissions.md) to create a pipeline there,
the `staging` job is marked as _failed_.
-#### Trigger job configuration keywords
+#### Trigger job configuration limitations
Trigger jobs can use only a limited set of the GitLab CI/CD [configuration keywords](../yaml/index.md).
The keywords available for use in trigger jobs are:
@@ -90,6 +90,8 @@ The keywords available for use in trigger jobs are:
- [`extends`](../yaml/index.md#extends)
- [`needs`](../yaml/index.md#needs), but not [`needs:project`](../yaml/index.md#needsproject)
+Trigger jobs cannot use [job-level persisted variables](../variables/where_variables_can_be_used.md#persisted-variables).
+
#### Specify a downstream pipeline branch
You can specify a branch name for the downstream pipeline to use.
@@ -111,6 +113,8 @@ staging:
Use:
- The `project` keyword to specify the full path to a downstream project.
+ In [GitLab 15.3 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/367660), variable expansion is
+ supported.
- The `branch` keyword to specify the name of a branch in the project specified by `project`.
In [GitLab 12.4 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/10126), variable expansion is
supported.
@@ -180,9 +184,12 @@ downstream-job:
trigger: my/project
```
-In this scenario, the `UPSTREAM_BRANCH` variable with a value related to the
-upstream pipeline is passed to the `downstream-job` job. It is available
-in the context of all downstream builds.
+In this scenario, the `UPSTREAM_BRANCH` variable with the value of the upstream pipeline's
+`$CI_COMMIT_REF_NAME` is passed to `downstream-job`. It is available in the
+context of all downstream builds.
+
+You cannot use this method to forward [job-level persisted variables](../variables/where_variables_can_be_used.md#persisted-variables)
+to a downstream pipeline, as they are not available in trigger jobs.
Upstream pipelines take precedence over downstream ones. If there are two
variables with the same name defined in both upstream and downstream projects,
@@ -228,6 +235,96 @@ In the upstream pipeline:
artifacts: true
```
+#### Pass artifacts to a downstream pipeline
+
+You can pass artifacts to a downstream pipeline by using [`needs:project`](../yaml/index.md#needsproject).
+
+1. In a job in the upstream pipeline, save the artifacts using the [`artifacts`](../yaml/index.md#artifacts) keyword.
+1. Trigger the downstream pipeline with a trigger job:
+
+ ```yaml
+ build_artifacts:
+ stage: build
+ script:
+ - echo "This is a test artifact!" >> artifact.txt
+ artifacts:
+ paths:
+ - artifact.txt
+
+ deploy:
+ stage: deploy
+ trigger: my/downstream_project
+ ```
+
+1. In a job in the downstream pipeline, fetch the artifacts from the upstream pipeline
+ by using `needs:project`. Set `job` to the job in the upstream pipeline to fetch artifacts from,
+ `ref` to the branch, and `artifacts: true`.
+
+ ```yaml
+ test:
+ stage: test
+ script:
+ - cat artifact.txt
+ needs:
+ - project: my/upstream_project
+ job: build_artifacts
+ ref: main
+ artifacts: true
+ ```
+
+#### Pass artifacts to a downstream pipeline from a Merge Request pipeline
+
+When you use `needs:project` to [pass artifacts to a downstream pipeline](#pass-artifacts-to-a-downstream-pipeline),
+the `ref` value is usually a branch name, like `main` or `development`.
+
+For merge request pipelines, the `ref` value is in the form of `refs/merge-requests/<id>/head`,
+where `id` is the merge request ID. You can retrieve this ref with the [`CI_MERGE_REQUEST_REF_PATH`](../variables/predefined_variables.md#predefined-variables-for-merge-request-pipelines)
+CI/CD variable. Do not use a branch name as the `ref` with merge request pipelines,
+because the downstream pipeline attempts to fetch artifacts from the latest branch pipeline.
+
+To fetch the artifacts from the upstream `merge request` pipeline instead of the `branch` pipeline,
+pass this variable to the downstream pipeline using variable inheritance:
+
+1. In a job in the upstream pipeline, save the artifacts using the [`artifacts`](../yaml/index.md#artifacts) keyword.
+1. In the job that triggers the downstream pipeline, pass the `$CI_MERGE_REQUEST_REF_PATH` variable by using
+ [variable inheritance](#pass-cicd-variables-to-a-downstream-pipeline-by-using-the-variables-keyword):
+
+ ```yaml
+ build_artifacts:
+ stage: build
+ script:
+ - echo "This is a test artifact!" >> artifact.txt
+ artifacts:
+ paths:
+ - artifact.txt
+
+ upstream_job:
+ variables:
+ UPSTREAM_REF: $CI_MERGE_REQUEST_REF_PATH
+ trigger:
+ project: my/downstream_project
+ branch: my-branch
+ ```
+
+1. In a job in the downstream pipeline, fetch the artifacts from the upstream pipeline
+ by using `needs:project`. Set the `ref` to the `UPSTREAM_REF` variable, and `job`
+ to the job in the upstream pipeline to fetch artifacts from:
+
+ ```yaml
+ test:
+ stage: test
+ script:
+ - cat artifact.txt
+ needs:
+ - project: my/upstream_project
+ job: build_artifacts
+ ref: UPSTREAM_REF
+ artifacts: true
+ ```
+
+This method works for fetching artifacts from a regular merge request parent pipeline,
+but fetching artifacts from [merge results](merged_results_pipelines.md) pipelines is not supported.
+
#### Use `rules` or `only`/`except` with multi-project pipelines
You can use CI/CD variables or the [`rules`](../yaml/index.md#rulesif) keyword to
@@ -244,8 +341,8 @@ If you use [`only/except`](../yaml/index.md#only--except) to control job behavio
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/11238) in GitLab Premium 12.3.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/199224) to GitLab Free in 12.8.
-You can mirror the pipeline status from the triggered pipeline to the source
-trigger job by using `strategy: depend`. For example:
+You can mirror the pipeline status from the triggered pipeline to the source trigger job
+by using [`strategy: depend`](../yaml/index.md#triggerstrategy). For example:
```yaml
trigger_job:
@@ -303,11 +400,16 @@ downstream projects. On self-managed instances, an administrator can change this
## Multi-project pipeline visualization **(PREMIUM)**
-When you configure GitLab CI/CD for your project, you can visualize the stages of your
-[jobs](index.md#configure-a-pipeline) on a [pipeline graph](index.md#visualize-pipelines).
+When your pipeline triggers a downstream pipeline, the downstream pipeline displays
+to the right of the [pipeline graph](index.md#visualize-pipelines).
![Multi-project pipeline graph](img/multi_project_pipeline_graph_v14_3.png)
+In [pipeline mini graphs](index.md#pipeline-mini-graphs), the downstream pipeline
+displays to the right of the mini graph.
+
+![Multi-project pipeline mini graph](img/pipeline_mini_graph_v15_0.png)
+
## Retry or cancel multi-project pipelines
If you have permission to trigger pipelines in the downstream project, you can
diff --git a/doc/ci/pipelines/settings.md b/doc/ci/pipelines/settings.md
index 43f20bfa9ea..34eae9828dd 100644
--- a/doc/ci/pipelines/settings.md
+++ b/doc/ci/pipelines/settings.md
@@ -250,8 +250,8 @@ using the [`coverage`](../yaml/index.md#coverage) keyword.
### Add test coverage results using project settings (removed)
-> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 14.8. Replaced by [`coverage` keyword](../yaml/index.md#coverage).
-> [Removed](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 15.0.
+> - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 14.8. Replaced by [`coverage` keyword](../yaml/index.md#coverage).
+> - [Removed](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 15.0.
This feature is in its end-of-life process. It was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/17633)
in GitLab 14.8. The feature is [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 15.0.
@@ -299,22 +299,22 @@ Use this regex for commonly used test tools.
<!-- vale gitlab.Spelling = NO -->
-- Simplecov (Ruby). Example: `\(\d+.\d+\%\) covered`.
-- pytest-cov (Python). Example: `(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$`.
-- Scoverage (Scala). Example: `Statement coverage[A-Za-z\.*]\s*:\s*([^%]+)`.
-- `phpunit --coverage-text --colors=never` (PHP). Example: `^\s*Lines:\s*\d+.\d+\%`.
-- gcovr (C/C++). Example: `^TOTAL.*\s+(\d+\%)$`.
-- `tap --coverage-report=text-summary` (NodeJS). Example: `^Statements\s*:\s*([^%]+)`.
-- `nyc npm test` (NodeJS). Example: `All files[^|]*\|[^|]*\s+([\d\.]+)`.
-- `jest --ci --coverage` (NodeJS). Example: `All files[^|]*\|[^|]*\s+([\d\.]+)`.
-- excoveralls (Elixir). Example: `\[TOTAL\]\s+(\d+\.\d+)%`.
-- `mix test --cover` (Elixir). Example: `\d+.\d+\%\s+\|\s+Total`.
-- JaCoCo (Java/Kotlin). Example: `Total.*?([0-9]{1,3})%`.
-- `go test -cover` (Go). Example: `coverage: \d+.\d+% of statements`.
-- .NET (OpenCover). Example: `(Visited Points).*\((.*)\)`.
-- .NET (`dotnet test` line coverage). Example: `Total\s*\|\s*(\d+(?:\.\d+)?)`.
-- tarpaulin (Rust). Example: `^\d+.\d+% coverage`.
-- Pester (PowerShell). Example: `Covered (\d+\.\d+%)`.
+- Simplecov (Ruby). Example: `/\(\d+.\d+\%\) covered/`.
+- pytest-cov (Python). Example: `/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/`.
+- Scoverage (Scala). Example: `/Statement coverage[A-Za-z\.*]\s*:\s*([^%]+)/`.
+- `phpunit --coverage-text --colors=never` (PHP). Example: `/^\s*Lines:\s*\d+.\d+\%/`.
+- gcovr (C/C++). Example: `/^TOTAL.*\s+(\d+\%)$/`.
+- `tap --coverage-report=text-summary` (NodeJS). Example: `/^Statements\s*:\s*([^%]+)/`.
+- `nyc npm test` (NodeJS). Example: `/All files[^|]*\|[^|]*\s+([\d\.]+)/`.
+- `jest --ci --coverage` (NodeJS). Example: `/All files[^|]*\|[^|]*\s+([\d\.]+)/`.
+- excoveralls (Elixir). Example: `/\[TOTAL\]\s+(\d+\.\d+)%/`.
+- `mix test --cover` (Elixir). Example: `/\d+.\d+\%\s+\|\s+Total/`.
+- JaCoCo (Java/Kotlin). Example: `/Total.*?([0-9]{1,3})%/`.
+- `go test -cover` (Go). Example: `/coverage: \d+.\d+% of statements/`.
+- .NET (OpenCover). Example: `/(Visited Points).*\((.*)\)/`.
+- .NET (`dotnet test` line coverage). Example: `/Total\s*\|\s*(\d+(?:\.\d+)?)/`.
+- tarpaulin (Rust). Example: `/^\d+.\d+% coverage/`.
+- Pester (PowerShell). Example: `/Covered (\d+\.\d+%)/`.
<!-- vale gitlab.Spelling = YES -->