- Predefined variables for merge request pipelines
- Predefined variables for external pull request pipelines
Predefined variables reference
Predefined CI/CD variables are available in every GitLab CI/CD pipeline.
Some variables are only available with more recent versions of GitLab Runner.
You can output the values of all variables available for a job
with a script
command.
There are also Kubernetes-specific deployment variables (deprecated).
There are also a number of variables you can use to configure runner behavior globally or for individual jobs.
Predefined variables for merge request pipelines
These variables are available when:
- The pipelines are merge request pipelines.
- The merge request is open.
Variable | GitLab | Runner | Description |
---|---|---|---|
CI_MERGE_REQUEST_APPROVED
| 14.1 | all | Approval status of the merge request. true when merge request approvals is available and the merge request has been approved.
|
CI_MERGE_REQUEST_ASSIGNEES
| 11.9 | all | Comma-separated list of usernames of assignees for the merge request. |
CI_MERGE_REQUEST_ID
| 11.6 | all | The instance-level ID of the merge request. This is a unique ID across all projects on GitLab. |
CI_MERGE_REQUEST_IID
| 11.6 | all | The project-level IID (internal ID) of the merge request. This ID is unique for the current project. |
CI_MERGE_REQUEST_LABELS
| 11.9 | all | Comma-separated label names of the merge request. |
CI_MERGE_REQUEST_MILESTONE
| 11.9 | all | The milestone title of the merge request. |
CI_MERGE_REQUEST_PROJECT_ID
| 11.6 | all | The ID of the project of the merge request. |
CI_MERGE_REQUEST_PROJECT_PATH
| 11.6 | all | The path of the project of the merge request. For example namespace/awesome-project .
|
CI_MERGE_REQUEST_PROJECT_URL
| 11.6 | all | The URL of the project of the merge request. For example, http://192.168.10.15:3000/namespace/awesome-project .
|
CI_MERGE_REQUEST_REF_PATH
| 11.6 | all | The ref path of the merge request. For example, refs/merge-requests/1/head .
|
CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
| 11.6 | all | The source branch name of the merge request. |
CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
| 11.9 | all | The HEAD SHA of the source branch of the merge request. The variable is empty in merge request pipelines. The SHA is present only in merged results pipelines. |
CI_MERGE_REQUEST_SOURCE_PROJECT_ID
| 11.6 | all | The ID of the source project of the merge request. |
CI_MERGE_REQUEST_SOURCE_PROJECT_PATH
| 11.6 | all | The path of the source project of the merge request. |
CI_MERGE_REQUEST_SOURCE_PROJECT_URL
| 11.6 | all | The URL of the source project of the merge request. |
CI_MERGE_REQUEST_TARGET_BRANCH_NAME
| 11.6 | all | The target branch name of the merge request. |
CI_MERGE_REQUEST_TARGET_BRANCH_SHA
| 11.9 | all | The HEAD SHA of the target branch of the merge request. The variable is empty in merge request pipelines. The SHA is present only in merged results pipelines. |
CI_MERGE_REQUEST_TITLE
| 11.9 | all | The title of the merge request. |
CI_MERGE_REQUEST_EVENT_TYPE
| 12.3 | all | The event type of the merge request. Can be detached , merged_result or merge_train .
|
CI_MERGE_REQUEST_DIFF_ID
| 13.7 | all | The version of the merge request diff. |
CI_MERGE_REQUEST_DIFF_BASE_SHA
| 13.7 | all | The base SHA of the merge request diff. |
Predefined variables for external pull request pipelines
These variables are only available when:
- The pipelines are external pull requests pipelines
- The pull request is open.
Variable | GitLab | Runner | Description |
---|---|---|---|
CI_EXTERNAL_PULL_REQUEST_IID
| 12.3 | all | Pull request ID from GitHub. |
CI_EXTERNAL_PULL_REQUEST_SOURCE_REPOSITORY
| 13.3 | all | The source repository name of the pull request. |
CI_EXTERNAL_PULL_REQUEST_TARGET_REPOSITORY
| 13.3 | all | The target repository name of the pull request. |
CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME
| 12.3 | all | The source branch name of the pull request. |
CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_SHA
| 12.3 | all | The HEAD SHA of the source branch of the pull request. |
CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME
| 12.3 | all | The target branch name of the pull request. |
CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_SHA
| 12.3 | all | The HEAD SHA of the target branch of the pull request. |