<commit_before>---
title: GitLab CI
sidebar: documentation
permalink: documentation/reference/plugging_into_cicd/gitlab_ci.html
author: <NAME> <<EMAIL>>
---

According to the description of [ci-env command]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#what-is-ci-env), werf should define a set of `WERF_*` variables and perform some actions to integrate with the CI/CD system.

werf uses the following values for werf environment variables:

### WERF_IMAGES_REPO

The value of [`WERF_IMAGES_REPO`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_images_repo) is derived from the [`CI_REGISTRY_IMAGE`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable.

### WERF_TAG_GIT_TAG

The value of [`WERF_TAG_GIT_TAG`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_tag_git_tag) is taken from the [`CI_COMMIT_TAG`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable.

### WERF_TAG_GIT_BRANCH

The value of [`WERF_TAG_GIT_BRANCH`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_tag_git_branch) is taken from the [`CI_COMMIT_REF_NAME`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable.

### WERF_ADD_ANNOTATION_PROJECT_GIT

The value of [`WERF_ADD_ANNOTATION_PROJECT_GIT`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_add_annotation_project_git) is based on the [`CI_PROJECT_URL`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable and composed as follows:

```
project.werf.io/git=$CI_PROJECT_URL
```

### WERF_ADD_ANNOTATION_CI_COMMIT

The value of [`WERF_ADD_ANNOTATION_CI_COMMIT`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_add_annotation_ci_commit) is taken from the [`CI_COMMIT_SHA`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable and composed as follows:

```
ci.werf.io/commit=$CI_COMMIT_SHA
```

### WERF_ADD_ANNOTATION_GITLAB_CI_PIPELINE_URL

The value of `WERF_ADD_ANNOTATION_GITLAB_CI_PIPELINE_URL` is taken from the [`CI_PIPELINE_ID`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable and composed in the following way:

```
gitlab.ci.werf.io/pipeline-url=$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID
```

### WERF_ADD_ANNOTATION_GITLAB_CI_JOB_URL

The value of `WERF_ADD_ANNOTATION_GITLAB_CI_JOB_URL` is taken from the [`CI_JOB_ID`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable and composed as follows:

```
gitlab.ci.werf.io/job-url=$CI_PROJECT_URL/-/jobs/$CI_JOB_ID
```

### WERF_ENV

GitLab supports [environments](https://docs.gitlab.com/ce/ci/environments.html). werf will detect the current environment for the GitLab pipeline and use it as an environment parameter.

The value of [`WERF_ENV`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_env) is taken from the [`CI_ENVIRONMENT_SLUG`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable.

### Other variables

Other variables are configured in the common way described in the [overview article]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html):
 * [`DOCKER_CONFIG`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#docker_config);
 * [`WERF_GIT_TAG_STRATEGY_LIMIT`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_git_tag_strategy_limit);
 * [`WERF_GIT_TAG_STRATEGY_EXPIRY_DAYS`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_git_tag_strategy_expiry_days);
 * [`WERF_LOG_COLOR_MODE`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_log_color_mode);
 * [`WERF_LOG_PROJECT_DIR`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_log_project_dir);
 * [`WERF_ENABLE_PROCESS_EXTERMINATOR`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_enable_process_exterminator);
 * [`WERF_LOG_TERMINAL_WIDTH`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_log_terminal_width).

## How to use

The integration with GitLab CI is turned on with the [`werf ci-env` command]({{ site.baseurl }}/documentation/cli/toolbox/ci_env.html) by providing the required positional argument:

```
werf ci-env gitlab --tagging-strategy ...
```<commit_msg>[docs] replaced some words with synonyms<commit_after>---
title: GitLab CI
sidebar: documentation
permalink: documentation/reference/plugging_into_cicd/gitlab_ci.html
author: <NAME> <<EMAIL>>
---

According to the description of [ci-env command]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#what-is-ci-env), werf should define a set of `WERF_*` variables and perform some actions to integrate with the CI/CD system.

werf uses the following values for werf environment variables:

### WERF_IMAGES_REPO

The value of [`WERF_IMAGES_REPO`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_images_repo) is derived from the [`CI_REGISTRY_IMAGE`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable.

### WERF_TAG_GIT_TAG

The value of [`WERF_TAG_GIT_TAG`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_tag_git_tag) is taken from the [`CI_COMMIT_TAG`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable.

### WERF_TAG_GIT_BRANCH

The value of [`WERF_TAG_GIT_BRANCH`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_tag_git_branch) is taken from the [`CI_COMMIT_REF_NAME`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable.

### WERF_ADD_ANNOTATION_PROJECT_GIT

The value of [`WERF_ADD_ANNOTATION_PROJECT_GIT`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_add_annotation_project_git) is based on the [`CI_PROJECT_URL`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable and composed as follows:

```
project.werf.io/git=$CI_PROJECT_URL
```

### WERF_ADD_ANNOTATION_CI_COMMIT

The value of [`WERF_ADD_ANNOTATION_CI_COMMIT`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_add_annotation_ci_commit) is extracted from the [`CI_COMMIT_SHA`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable and composed as follows:

```
ci.werf.io/commit=$CI_COMMIT_SHA
```

### WERF_ADD_ANNOTATION_GITLAB_CI_PIPELINE_URL

The value of `WERF_ADD_ANNOTATION_GITLAB_CI_PIPELINE_URL` is derived from the [`CI_PIPELINE_ID`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable and composed in the following way:

```
gitlab.ci.werf.io/pipeline-url=$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID
```

### WERF_ADD_ANNOTATION_GITLAB_CI_JOB_URL

The value of `WERF_ADD_ANNOTATION_GITLAB_CI_JOB_URL` is taken from the [`CI_JOB_ID`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable and composed as follows:

```
gitlab.ci.werf.io/job-url=$CI_PROJECT_URL/-/jobs/$CI_JOB_ID
```

### WERF_ENV

GitLab supports [environments](https://docs.gitlab.com/ce/ci/environments.html). werf will detect the current environment for the GitLab pipeline and use it as an environment parameter.

The value of [`WERF_ENV`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_env) is extracted from the [`CI_ENVIRONMENT_SLUG`](https://docs.gitlab.com/ee/ci/variables/) gitlab environment variable.

### Other variables

Other variables are configured in the regular way described in the [overview article]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html):
 * [`DOCKER_CONFIG`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#docker_config);
 * [`WERF_GIT_TAG_STRATEGY_LIMIT`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_git_tag_strategy_limit);
 * [`WERF_GIT_TAG_STRATEGY_EXPIRY_DAYS`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_git_tag_strategy_expiry_days);
 * [`WERF_LOG_COLOR_MODE`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_log_color_mode);
 * [`WERF_LOG_PROJECT_DIR`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_log_project_dir);
 * [`WERF_ENABLE_PROCESS_EXTERMINATOR`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_enable_process_exterminator);
 * [`WERF_LOG_TERMINAL_WIDTH`]({{ site.baseurl }}/documentation/reference/plugging_into_cicd/overview.html#werf_log_terminal_width).

## How to use

You can turn on the integration with GitLab CI by invoking the [`werf ci-env` command]({{ site.baseurl }}/documentation/cli/toolbox/ci_env.html) with the required positional argument:

```
werf ci-env gitlab --tagging-strategy ...
```
{'fraction_non_alphanumeric': 0.1262614936084324, 'fraction_numerical': 0.0, 'mean_word_length': 6.984780662488809, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5102414', 'n_tokens_mistral': 3258, 'n_tokens_neox': 3139, 'n_words': 548}