According to the description of ci-env command, 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
is derived from the CI_REGISTRY_IMAGE
gitlab environment variable.
WERF_TAG_BY_STAGES_SIGNATURE
The value of WERF_TAG_BY_STAGES_SIGNATURE
is set to true
when using stages-signature
tagging strategy (which is default).
WERF_TAG_GIT_TAG
The value of WERF_TAG_GIT_TAG
is taken from the CI_COMMIT_TAG
gitlab environment variable.
WERF_TAG_GIT_BRANCH
The value of WERF_TAG_GIT_BRANCH
is taken from the CI_COMMIT_REF_NAME
gitlab environment variable.
WERF_ADD_ANNOTATION_PROJECT_GIT
The value of WERF_ADD_ANNOTATION_PROJECT_GIT
is based on the CI_PROJECT_URL
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
is extracted from the CI_COMMIT_SHA
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
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
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. werf will detect the current environment for the GitLab pipeline and use it as an environment parameter.
The value of WERF_ENV
is extracted from the CI_ENVIRONMENT_SLUG
gitlab environment variable.
Other variables
Other variables are configured in the regular way described in the overview article:
DOCKER_CONFIG
;WERF_GIT_TAG_STRATEGY_LIMIT
;WERF_GIT_TAG_STRATEGY_EXPIRY_DAYS
;WERF_LOG_COLOR_MODE
;WERF_LOG_PROJECT_DIR
;WERF_ENABLE_PROCESS_EXTERMINATOR
;WERF_LOG_TERMINAL_WIDTH
.
How to use
You can turn on the integration with GitLab CI by invoking the werf ci-env
command with the required positional argument:
werf ci-env gitlab