Source code for gcip2.pipeline_vars

  1import enum
  2import os
  3import typing
  4
  5T = typing.TypeVar("T")
  6
  7
[docs] 8class VarEnum(str, enum.Enum): 9 @typing.override 10 def __repr__(self) -> str: 11 return self.name 12 13 @typing.override 14 def __str__(self) -> str: 15 return self.__repr__() 16 17 def __call__(self) -> typing.Optional[str]: 18 return self.getenv() 19
[docs] 20 def getenv(self, default: typing.Optional[T] = None) -> typing.Optional[T | str]: 21 return os.getenv(key=self.name, default=default)
22
[docs] 23 def must(self) -> str: 24 value = self.getenv() 25 if not value: 26 raise ValueError(f"could not get variable from env: {self.name}") 27 return value
28 29
[docs] 30class Predefined(VarEnum, enum.Enum): 31 CHAT_CHANNEL = enum.auto() 32 "The Source chat channel that triggered the ChatOps command." 33 "Availability: Pipeline" 34 35 CHAT_INPUT = enum.auto() 36 "The additional arguments passed with the ChatOps command." 37 "Availability: Pipeline" 38 39 CHAT_USER_ID = enum.auto() 40 "The chat service’s user ID of the user who triggered the ChatOps command." 41 "Availability: Pipeline" 42 43 CI = enum.auto() 44 "Available for all jobs executed in CI/CD. true when available." 45 "Availability: Pre-pipeline" 46 47 CI_API_V4_URL = enum.auto() 48 "The GitLab API v4 root URL." 49 "Availability: Pre-pipeline" 50 51 CI_API_GRAPHQL_URL = enum.auto() 52 "The GitLab API GraphQL root URL." 53 "Availability: Pre-pipeline" 54 55 CI_BUILD_NETWORK_NAME = enum.auto() 56 "The name of the network that the job created. Available only with the Docker executor when FF_NETWORK_PER_BUILD " 57 "is enabled." 58 "Availability: Job-only" 59 60 CI_BUILDS_DIR = enum.auto() 61 "The top-level directory where builds are executed." 62 "Availability: Job-only" 63 64 CI_COMMIT_AUTHOR = enum.auto() 65 "The author of the commit in Name <email> format." 66 "Availability: Pre-pipeline" 67 68 CI_COMMIT_BEFORE_SHA = enum.auto() 69 "The previous latest commit present on a branch or tag. It is always 0000000000000000000000000000000000000000 for " 70 "merge request pipelines, scheduled pipelines, the first commit in pipelines for branches or tags, " 71 "or when manually running a pipeline." 72 "Availability: Pre-pipeline" 73 74 CI_COMMIT_BRANCH = enum.auto() 75 "The commit branch name. Available in branch pipelines, including pipelines for the default branch. " 76 "Not available in merge request pipelines or tag pipelines." 77 "Availability: Pre-pipeline" 78 79 CI_COMMIT_DEFAULT_BRANCH_BASE_SHA = enum.auto() 80 "The merge base between CI_COMMIT_SHA and the default branch. Available only in non-default branch pipelines. " 81 "Introduced in GitLab 19.1." 82 "Availability: Pre-pipeline" 83 84 CI_COMMIT_DESCRIPTION = enum.auto() 85 "The description of the commit. If the title is shorter than 100 characters, the description is the " 86 "message without the first line." 87 "Availability: Pre-pipeline" 88 89 CI_COMMIT_MESSAGE = enum.auto() 90 "The full commit message." 91 "Availability: Pre-pipeline" 92 93 CI_COMMIT_MESSAGE_IS_TRUNCATED = enum.auto() 94 "true if CI_COMMIT_MESSAGE is truncated to the size specified in the GITLAB_CI_MAX_COMMIT_MESSAGE_SIZE_IN_BYTES " 95 "system environment variable (default 100 KB) because the commit message is too long. Otherwise false. " 96 "Introduced in GitLab 18.6." 97 "Availability: Pre-pipeline" 98 99 CI_COMMIT_REF_NAME = enum.auto() 100 "The branch or tag name for which project is built." 101 "Availability: Pre-pipeline" 102 103 CI_COMMIT_REF_PROTECTED = enum.auto() 104 "true if the job is running for a protected reference, false otherwise." 105 "Availability: Pre-pipeline" 106 107 CI_COMMIT_REF_SLUG = enum.auto() 108 "CI_COMMIT_REF_NAME in lowercase, shortened to 63 bytes, and with everything except 0-9 and a-z replaced " 109 "with -. No leading / trailing -. Use in URLs, host names and domain names." 110 "Availability: Pre-pipeline" 111 112 CI_COMMIT_SHA = enum.auto() 113 "The commit revision the project is built for." 114 "Availability: Pre-pipeline" 115 116 CI_COMMIT_SHORT_SHA = enum.auto() 117 "The first eight characters of CI_COMMIT_SHA." 118 "Availability: Pre-pipeline" 119 120 CI_COMMIT_TAG = enum.auto() 121 "The commit tag name. Available only in pipelines for tags." 122 "Availability: Pre-pipeline" 123 124 CI_COMMIT_TAG_MESSAGE = enum.auto() 125 "The commit tag message. Available only in pipelines for tags." 126 "Availability: Pre-pipeline" 127 128 CI_COMMIT_TIMESTAMP = enum.auto() 129 "The timestamp of the commit in the ISO 8601 format. For example, 2022-01-31T16:47:55Z. UTC by default." 130 "Availability: Pre-pipeline" 131 132 CI_COMMIT_TITLE = enum.auto() 133 "The title of the commit. The full first line of the message." 134 "Availability: Pre-pipeline" 135 136 CI_COMMIT_USER_LOGIN = enum.auto() 137 "The GitLab username of the commit author if the author’s profile and email are public and match the commit email, " 138 "otherwise an empty string. Introduced in GitLab 18.10." 139 "Availability: Pre-pipeline" 140 141 CI_CONCURRENT_ID = enum.auto() 142 "The unique ID of build execution in a single executor." 143 "Availability: Job-only" 144 145 CI_CONCURRENT_PROJECT_ID = enum.auto() 146 "The unique ID of build execution in a single executor and project." 147 "Availability: Job-only" 148 149 CI_CONFIG_PATH = enum.auto() 150 "The path to the CI/CD configuration file. Defaults to .gitlab-ci.yml." 151 "Availability: Pre-pipeline" 152 153 CI_CONFIG_REF_URI = enum.auto() 154 "The fully qualified ref path to the top-level pipeline definition, for example " 155 "gitlab.example.com/my-group/my-project//.gitlab-ci.yml@refs/heads/main. " 156 "Not available when the pipeline source ref cannot be determined. Introduced in GitLab 19.0." 157 "Availability: Pipeline" 158 159 CI_DEBUG_TRACE = enum.auto() 160 "true if debug logging (tracing) is enabled." 161 "Availability: Pipeline" 162 163 CI_DEBUG_SERVICES = enum.auto() 164 "true if service container logging is enabled." 165 "Availability: Pipeline" 166 167 CI_DEFAULT_BRANCH = enum.auto() 168 "The name of the project’s default branch." 169 "Availability: Pre-pipeline" 170 171 CI_DEFAULT_BRANCH_SLUG = enum.auto() 172 "CI_DEFAULT_BRANCH in lowercase, shortened to 63 bytes, and with everything except 0-9 and a-z replaced " 173 "with -. No leading / trailing -." 174 "Availability: Pre-pipeline" 175 176 CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX = enum.auto() 177 "The direct group image prefix for pulling images through the Dependency Proxy." 178 "Availability: Pre-pipeline" 179 180 CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX = enum.auto() 181 "The top-level group image prefix for pulling images through the Dependency Proxy." 182 "Availability: Pre-pipeline" 183 184 CI_DEPENDENCY_PROXY_PASSWORD = enum.auto() 185 "The password to pull images through the Dependency Proxy." 186 "Availability: Pipeline" 187 188 CI_DEPENDENCY_PROXY_SERVER = enum.auto() 189 "The server for logging in to the Dependency Proxy. This variable is equivalent to $CI_SERVER_HOST:$CI_SERVER_PORT." 190 "Availability: Pre-pipeline" 191 192 CI_DEPENDENCY_PROXY_USER = enum.auto() 193 "The username to pull images through the Dependency Proxy." 194 "Availability: Pipeline" 195 196 CI_DEPLOY_FREEZE = enum.auto() 197 "Only available if the pipeline runs during a deploy freeze window. true when available." 198 "Availability: Pre-pipeline" 199 200 CI_DEPLOY_PASSWORD = enum.auto() 201 "The authentication password of the GitLab Deploy Token, if the project has one." 202 "Availability: Job-only" 203 204 CI_DEPLOY_USER = enum.auto() 205 "The authentication username of the GitLab Deploy Token, if the project has one." 206 "Availability: Job-only" 207 208 CI_DISPOSABLE_ENVIRONMENT = enum.auto() 209 "Only available if the job is executed in a disposable environment (something that is created only for this " 210 "job and disposed of/destroyed after the execution - all executors except shell and ssh). true when available." 211 "Availability: Pipeline" 212 213 CI_ENVIRONMENT_ID = enum.auto() 214 "The ID of the environment for this job. Available if environment:name is set." 215 "Availability: Pipeline" 216 217 CI_ENVIRONMENT_NAME = enum.auto() 218 "The name of the environment for this job. Available if environment:name is set." 219 "Availability: Pipeline" 220 221 CI_ENVIRONMENT_SLUG = enum.auto() 222 "The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, " 223 "and so on. Available if environment:name is set. The slug is truncated to 24 characters. " 224 "A random suffix is automatically added to uppercase environment names." 225 "Availability: Pipeline" 226 227 CI_ENVIRONMENT_URL = enum.auto() 228 "The URL of the environment for this job. Available if environment:url is set." 229 "Availability: Pipeline" 230 231 CI_ENVIRONMENT_ACTION = enum.auto() 232 "The action annotation specified for this job’s environment. Available if environment:action is set. Can be start, " 233 "prepare, or stop." 234 "Availability: Pipeline" 235 236 CI_ENVIRONMENT_TIER = enum.auto() 237 "The deployment tier of the environment for this job." 238 "Availability: Pipeline" 239 240 CI_GITLAB_FIPS_MODE = enum.auto() 241 "Only available if FIPS mode is enabled in the GitLab instance. true when available." 242 "Availability: Pre-pipeline" 243 244 CI_HAS_OPEN_REQUIREMENTS = enum.auto() 245 "Only available if the pipeline’s project has an open requirement. true when available." 246 "Availability: Pipeline" 247 248 CI_JOB_GROUP_NAME = enum.auto() 249 "The shared name of a group of jobs, when using either parallel or manually grouped jobs. For example, if the job " 250 "name is rspec:test: [ruby, ubuntu], the CI_JOB_GROUP_NAME is rspec:test. It is the same as CI_JOB_NAME otherwise. " 251 "Introduced in GitLab 17.10." 252 "Availability: Pipeline" 253 254 CI_JOB_ID = enum.auto() 255 "The internal ID of the job, unique across all jobs in the GitLab instance." 256 "Availability: Job-only" 257 258 CI_JOB_IMAGE = enum.auto() 259 "The name of the Docker image running the job. Only available when the job explicitly specifies a Docker image." 260 "Availability: Job-only" 261 262 CI_JOB_MANUAL = enum.auto() 263 "Only available if the job was started manually. true when available." 264 "Availability: Pipeline" 265 266 CI_JOB_NAME = enum.auto() 267 "The name of the job." 268 "Availability: Pipeline" 269 270 CI_JOB_NAME_SLUG = enum.auto() 271 "CI_JOB_NAME in lowercase, shortened to 63 bytes, and with everything except 0-9 and a-z replaced " 272 "with -. No leading / trailing -. Use in paths." 273 "Availability: Pipeline" 274 275 CI_JOB_STAGE = enum.auto() 276 "The name of the job’s stage." 277 "Availability: Pipeline" 278 279 CI_JOB_STATUS = enum.auto() 280 "The status of the job as each runner stage is executed. Use with after_script. " 281 "Can be success, failed, or canceled." 282 "Availability: Job-only" 283 284 CI_JOB_TAGS = enum.auto() 285 'A JSON array of the job’s runner tags. For example ["tag_1", "tag_2"]. Introduced in GitLab 19.3.' 286 "Availability: Job-only" 287 288 CI_JOB_TIMEOUT = enum.auto() 289 "The job timeout, in seconds." 290 "Availability: Job-only" 291 292 CI_JOB_TOKEN = enum.auto() 293 "A token to authenticate with certain API endpoints. The token is valid as long as the job is running." 294 "Availability: Job-only" 295 296 CI_JOB_URL = enum.auto() 297 "The job details URL." 298 "Availability: Job-only" 299 300 CI_JOB_STARTED_AT = enum.auto() 301 "The date and time when a job started, in ISO 8601 format. For example, 2022-01-31T16:47:55Z. UTC by default." 302 "Availability: Job-only" 303 304 CI_JOB_STARTED_AT_SLUG = enum.auto() 305 "CI_JOB_STARTED_AT in lowercase, shortened to 63 characters, and with everything except 0-9 and a-z replaced " 306 "with -. No leading / trailing -. Suitable for use in Docker image tags and other identifiers." 307 "Availability: Job-only" 308 309 CI_KUBERNETES_ACTIVE = enum.auto() 310 "Only available if the pipeline has a Kubernetes cluster available for deployments. true when available." 311 "Availability: Pre-pipeline" 312 313 CI_NODE_INDEX = enum.auto() 314 "The index of the job in the job set. Only available if the job uses parallel." 315 "Availability: Pipeline" 316 317 CI_NODE_TOTAL = enum.auto() 318 "The total number of instances of this job running in parallel. Set to 1 if the job does not use parallel." 319 "Availability: Pipeline" 320 321 CI_OPEN_MERGE_REQUESTS = enum.auto() 322 "A comma-separated list of up to four merge requests that use the current branch and project as the merge request " 323 "source. Only available in branch and merge request pipelines if the branch has an associated merge request. " 324 "For example, gitlab-org/gitlab!333,gitlab-org/gitlab-foss!11." 325 "Availability: Pre-pipeline" 326 327 CI_PAGES_DOMAIN = enum.auto() 328 "The instance’s domain that hosts GitLab Pages, not including the namespace subdomain. To use the full hostname, " 329 "use CI_PAGES_HOSTNAME instead." 330 "Availability: Pre-pipeline" 331 332 CI_PAGES_HOSTNAME = enum.auto() 333 "The full hostname of the Pages deployment." 334 "Availability: Job-only" 335 336 CI_PAGES_URL = enum.auto() 337 "The URL for a GitLab Pages site. Always a subdomain of CI_PAGES_DOMAIN. In GitLab 17.9 and later, the value " 338 "includes the path_prefix when one is specified." 339 "Availability: Job-only" 340 341 CI_PIPELINE_ID = enum.auto() 342 "The instance-level ID of the current pipeline. This ID is unique across all projects on the GitLab instance." 343 "Availability: Job-only" 344 345 CI_PIPELINE_IID = enum.auto() 346 "The project-level IID (internal ID) of the current pipeline. This ID is unique only in the current project." 347 "Availability: Pipeline" 348 349 CI_PIPELINE_SOURCE = enum.auto() 350 "How the pipeline was triggered. The value can be one of the pipeline sources." 351 "Availability: Pre-pipeline" 352 353 CI_PIPELINE_TRIGGERED = enum.auto() 354 "true for pipelines triggered with a trigger token. For pipelines triggered with the trigger keyword, " 355 "use CI_PIPELINE_SOURCE instead." 356 "Availability: Pipeline" 357 358 CI_PIPELINE_URL = enum.auto() 359 "The URL for the pipeline details." 360 "Availability: Job-only" 361 362 CI_PIPELINE_CREATED_AT = enum.auto() 363 "The date and time when the pipeline was created, in ISO 8601 format. For example, 2022-01-31T16:47:55Z. " 364 "UTC by default." 365 "Availability: Job-only" 366 367 CI_PIPELINE_NAME = enum.auto() 368 "The pipeline name defined in workflow:name." 369 "Availability: Pre-pipeline" 370 371 CI_PIPELINE_SCHEDULE_DESCRIPTION = enum.auto() 372 "The description of the pipeline schedule. Only available in scheduled pipelines. Introduced in GitLab 17.8." 373 "Availability: Pre-pipeline" 374 375 CI_PROJECT_DIR = enum.auto() 376 "The full path the repository is cloned to, and where the job runs from. If the GitLab Runner builds_dir parameter " 377 "is set, this variable is set relative to the value of builds_dir. " 378 "For more information, see the Advanced GitLab Runner configuration." 379 "Availability: Job-only" 380 381 CI_PROJECT_ID = enum.auto() 382 "The ID of the current project. This ID is unique across all projects on the GitLab instance." 383 "Availability: Pre-pipeline" 384 385 CI_PROJECT_NAME = enum.auto() 386 "The name of the directory for the project. For example if the project URL is " 387 "gitlab.example.com/group-name/project-1, CI_PROJECT_NAME is project-1." 388 "Availability: Pre-pipeline" 389 390 CI_PROJECT_NAMESPACE = enum.auto() 391 "The project namespace (username or group name) of the job." 392 "Availability: Pre-pipeline" 393 394 CI_PROJECT_NAMESPACE_ID = enum.auto() 395 "The project namespace ID of the job." 396 "Availability: Pre-pipeline" 397 398 CI_PROJECT_NAMESPACE_SLUG = enum.auto() 399 "$CI_PROJECT_NAMESPACE in lowercase, shortened to 63 characters, and with everything except 0-9 and a-z replaced " 400 " with -. No leading / trailing -." 401 "Availability: Pre-pipeline" 402 403 CI_PROJECT_PATH_SLUG = enum.auto() 404 "$CI_PROJECT_PATH in lowercase, shortened to 63 characters, and with everything except 0-9 and a-z replaced with -." 405 " No leading / trailing -. Use in URLs and domain names." 406 "Availability: Pre-pipeline" 407 408 CI_PROJECT_PATH = enum.auto() 409 "The project namespace with the project name included." 410 "Availability: Pre-pipeline" 411 412 CI_PROJECT_REPOSITORY_LANGUAGES = enum.auto() 413 "A comma-separated, lowercase list of the languages used in the repository. For example ruby,javascript,html,css. " 414 "The maximum number of languages is limited to 5. An issue proposes to increase the limit." 415 "Availability: Pre-pipeline" 416 417 CI_PROJECT_ROOT_NAMESPACE = enum.auto() 418 "The root project namespace (username or group name) of the job. For example, if CI_PROJECT_NAMESPACE is " 419 "root-group/child-group/grandchild-group, CI_PROJECT_ROOT_NAMESPACE is root-group." 420 "Availability: Pre-pipeline" 421 422 CI_PROJECT_ROOT_NAMESPACE_SLUG = enum.auto() 423 "$CI_PROJECT_ROOT_NAMESPACE in lowercase, shortened to 63 characters, and with everything except 0-9 and a-z " 424 "replaced with -. No leading / trailing -. Introduced in GitLab 19.0." 425 "Availability: Pre-pipeline" 426 427 CI_PROJECT_TITLE = enum.auto() 428 "The human-readable project name as displayed in the GitLab web interface." 429 "Availability: Pre-pipeline" 430 431 CI_PROJECT_DESCRIPTION = enum.auto() 432 "The project description as displayed in the GitLab web interface." 433 "Availability: Pre-pipeline" 434 435 CI_PROJECT_TOPICS = enum.auto() 436 "A comma-separated, lowercase list of topics (limited to the first 20) assigned to the project. " 437 "Introduced in GitLab 18.3" 438 "Availability: Pre-pipeline" 439 440 CI_PROJECT_URL = enum.auto() 441 "The HTTP(S) address of the project." 442 "Availability: Pre-pipeline" 443 444 CI_PROJECT_VISIBILITY = enum.auto() 445 "The project visibility. Can be internal, private, or public." 446 "Availability: Pre-pipeline" 447 448 CI_PROJECT_CLASSIFICATION_LABEL = enum.auto() 449 "The project external authorization classification label." 450 "Availability: Pre-pipeline" 451 452 CI_REGISTRY = enum.auto() 453 "Address of the container registry server, formatted as <host>[:<port>]. For example: registry.gitlab.example.com. " 454 "Only available if the container registry is enabled for the GitLab instance." 455 "Availability: Pre-pipeline" 456 457 CI_REGISTRY_IMAGE = enum.auto() 458 "Base address for the container registry to push, pull, or tag project’s images, formatted as " 459 "<host>[:<port>]/<project_full_path>. For example: registry.gitlab.example.com/my_group/my_project. " 460 "Image names must follow the container registry naming convention. Only available if the container " 461 "registry is enabled for the project." 462 "Availability: Pre-pipeline" 463 464 CI_REGISTRY_PASSWORD = enum.auto() 465 "The password to push containers to the GitLab project’s container registry. Only available if the container " 466 "registry is enabled for the project. This password value is the same as the CI_JOB_TOKEN and is valid only as " 467 "long as the job is running. Use the CI_DEPLOY_PASSWORD for long-lived access to the registry" 468 "Availability: Job-only" 469 470 CI_REGISTRY_USER = enum.auto() 471 "The username to push containers to the GitLab project’s container registry. Only available if the container " 472 "registry is enabled for the project." 473 "Availability: Job-only" 474 475 CI_RELEASE_DESCRIPTION = enum.auto() 476 "The description of the release. Available only on pipelines for tags. Description length is limited to first 1024 " 477 "characters." 478 "Availability: Pipeline" 479 480 CI_REPOSITORY_URL = enum.auto() 481 "The full path to Git clone (HTTP) the repository with a CI/CD job token, in the format https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.example.com/my-group/my-project.git." 482 "Availability: Job-only" 483 484 CI_RUNNER_DESCRIPTION = enum.auto() 485 "The description of the runner." 486 "Availability: Job-only" 487 488 CI_RUNNER_EXECUTABLE_ARCH = enum.auto() 489 "The OS/architecture of the GitLab Runner executable. Might not be the same as the environment of the executor." 490 "Availability: Job-only" 491 492 CI_RUNNER_ID = enum.auto() 493 "The unique ID of the runner being used." 494 "Availability: Job-only" 495 496 CI_RUNNER_REVISION = enum.auto() 497 "The revision of the runner running the job." 498 "Availability: Job-only" 499 500 CI_RUNNER_SHORT_TOKEN = enum.auto() 501 "The runner’s unique ID, used to authenticate new job requests. The token contains a prefix, and the first 17 " 502 "characters are used." 503 "Availability: Job-only" 504 505 CI_RUNNER_TAGS = enum.auto() 506 'A JSON array of the runner tags configured on the runner that picked up the job. For example ["tag_1", "tag_2"].' 507 "Availability: Job-only" 508 509 CI_RUNNER_VERSION = enum.auto() 510 "The version of the GitLab Runner running the job." 511 "Availability: Job-only" 512 513 CI_SERVER_FQDN = enum.auto() 514 "The fully qualified domain name (FQDN) of the instance. For example gitlab.example.com:8080." 515 "Availability: Pre-pipeline" 516 517 CI_SERVER_HOST = enum.auto() 518 "The host of the GitLab instance URL, without protocol or port. For example gitlab.example.com." 519 "Availability: Pre-pipeline" 520 521 CI_SERVER_NAME = enum.auto() 522 "The name of CI/CD server that coordinates jobs." 523 "Availability: Pre-pipeline" 524 525 CI_SERVER_PORT = enum.auto() 526 "The port of the GitLab instance URL, without host or protocol. For example 8080." 527 "Availability: Pre-pipeline" 528 529 CI_SERVER_PROTOCOL = enum.auto() 530 "The protocol of the GitLab instance URL, without host or port. For example https." 531 "Availability: Pre-pipeline" 532 533 CI_SERVER_SHELL_SSH_HOST = enum.auto() 534 "The SSH host of the GitLab instance, used for access to Git repositories through SSH. For example gitlab.com." 535 "Availability: Pre-pipeline" 536 537 CI_SERVER_SHELL_SSH_PORT = enum.auto() 538 "The SSH port of the GitLab instance. For example 22." 539 "Availability: Pre-pipeline" 540 541 CI_SERVER_REVISION = enum.auto() 542 "GitLab revision that schedules jobs." 543 "Availability: Pre-pipeline" 544 545 CI_SERVER_TLS_CA_FILE = enum.auto() 546 "File containing the TLS CA certificate to verify the GitLab server when tls-ca-file set in runner settings." 547 "Availability: Pipeline" 548 549 CI_SERVER_TLS_CERT_FILE = enum.auto() 550 "File containing the TLS certificate to verify the GitLab server when tls-cert-file set in runner settings." 551 "Availability: Pipeline" 552 553 CI_SERVER_TLS_KEY_FILE = enum.auto() 554 "File containing the TLS key to verify the GitLab server when tls-key-file set in runner settings." 555 "Availability: Pipeline" 556 557 CI_SERVER_URL = enum.auto() 558 "The base URL of the GitLab instance, including protocol and port. For example https://gitlab.example.com:8080." 559 "Availability: Pre-pipeline" 560 561 CI_SERVER_VERSION_MAJOR = enum.auto() 562 "The major version of the GitLab instance. For example, if the GitLab version is 17.2.1, " 563 "the CI_SERVER_VERSION_MAJOR is 17." 564 "Availability: Pre-pipeline" 565 566 CI_SERVER_VERSION_MINOR = enum.auto() 567 "The minor version of the GitLab instance. For example, if the GitLab version is 17.2.1, " 568 "the CI_SERVER_VERSION_MINOR is 2." 569 "Availability: Pre-pipeline" 570 571 CI_SERVER_VERSION_PATCH = enum.auto() 572 "The patch version of the GitLab instance. For example, if the GitLab version is 17.2.1, " 573 "the CI_SERVER_VERSION_PATCH is 1." 574 "Availability: Pre-pipeline" 575 576 CI_SERVER_VERSION = enum.auto() 577 "The full version of the GitLab instance." 578 "Availability: Pre-pipeline" 579 580 CI_SERVER = enum.auto() 581 "Available for all jobs executed in CI/CD. yes when available." 582 "Availability: Job-only" 583 584 CI_SHARED_ENVIRONMENT = enum.auto() 585 "Only available if the job is executed in a shared environment (something that is persisted across CI/CD " 586 "invocations, like the shell or ssh executor). true when available." 587 "Availability: Pipeline" 588 589 CI_TEMPLATE_REGISTRY_HOST = enum.auto() 590 "The host of the registry used by CI/CD templates. Defaults to registry.gitlab.com." 591 "Availability: Pre-pipeline" 592 593 CI_TRIGGER_SHORT_TOKEN = enum.auto() 594 "First 4 characters of the trigger token of the current job. Only available if the pipeline was triggered with a " 595 "trigger token. For example, for a trigger token of glptt-1234567890abcdefghij, " 596 "CI_TRIGGER_SHORT_TOKEN would be 1234. Introduced in GitLab 17.0." 597 "Availability: Job-only" 598 599 CI_UPSTREAM_JOB_ID = enum.auto() 600 "ID of the upstream trigger job that triggered the current pipeline in a multi-project or parent-child pipeline. " 601 "Introduced in GitLab 18.9." 602 "Availability: Pre-pipeline" 603 604 CI_UPSTREAM_PIPELINE_ID = enum.auto() 605 "ID of the upstream pipeline that triggered the current pipeline in a multi-project or parent-child pipeline. " 606 "Introduced in GitLab 18.9." 607 "Availability: Pre-pipeline" 608 609 CI_UPSTREAM_PROJECT_ID = enum.auto() 610 "ID of the upstream project that triggered the current pipeline in a multi-project or parent-child pipeline. " 611 "Introduced in GitLab 18.9." 612 "Availability: Pre-pipeline" 613 614 CI_TRACEPARENT = enum.auto() 615 "A W3C Trace Context traceparent header value for the job, in the format 00-<trace_id>-<span_id>-01. The trace_id " 616 "is the root pipeline ID as a zero-padded 32-character hex string, shared by all jobs in the same pipeline " 617 "hierarchy, including parent and child pipelines. The span_id is a deterministic hash derived from the root " 618 "pipeline ID and job ID, unique per job. You can use this variable to correlate CI/CD jobs with external " 619 "distributed tracing systems." 620 "Availability: Job-only" 621 622 CI_TRACESTATE = enum.auto() 623 "A W3C Trace Context tracestate header value containing GitLab-specific trace metadata. " 624 "Format: gitlab=pipeline:<pipeline_id>;job:<job_id>." 625 "Availability: Job-only" 626 627 GITLAB_CI = enum.auto() 628 "Available for all jobs executed in CI/CD. true when available." 629 "Availability: Pre-pipeline" 630 631 GITLAB_FEATURES = enum.auto() 632 "The comma-separated list of licensed features available for the GitLab instance and license." 633 "Availability: Pre-pipeline" 634 635 GITLAB_USER_EMAIL = enum.auto() 636 "The email of the user who started the pipeline, unless the job is a manual job. In manual jobs, " 637 "the value is the email of the user who started the job." 638 "Availability: Pipeline" 639 640 GITLAB_USER_ID = enum.auto() 641 "The numeric ID of the user who started the pipeline, unless the job is a manual job. In manual jobs, " 642 "the value is the ID of the user who started the job." 643 "Availability: Pipeline" 644 645 GITLAB_USER_LOGIN = enum.auto() 646 "The unique username of the user who started the pipeline, unless the job is a manual job. In manual jobs, " 647 "the value is the username of the user who started the job." 648 "Availability: Pipeline" 649 650 GITLAB_USER_NAME = enum.auto() 651 "The display name (user-defined Full name in the profile settings) of the user who started the pipeline, " 652 "unless the job is a manual job. In manual jobs, the value is the name of the user who started the job." 653 "Availability: Pipeline" 654 655 KUBECONFIG = enum.auto() 656 "The path to the kubeconfig file with contexts for every shared agent connection. " 657 "Only available when a GitLab agent for Kubernetes is authorized to access the project." 658 "Availability: Pipeline" 659 660 TRIGGER_PAYLOAD = enum.auto() 661 "The webhook payload. Only available when a pipeline is triggered with a webhook." 662 "Availability: Pipeline" 663 664 CI_JOB_JWT = enum.auto()
665 666
[docs] 667class PredefinedMergeRequest(VarEnum, enum.Enum): 668 CI_MERGE_REQUEST_APPROVED = enum.auto() 669 "Approval status of the merge request. true when merge request approvals is available and " 670 "the merge request has been approved." 671 "Availability: Pre-pipeline" 672 673 CI_MERGE_REQUEST_ASSIGNEES = enum.auto() 674 "Comma-separated list of usernames of assignees for the merge request. " 675 "Only available if the merge request has at least one assignee." 676 "Availability: Pre-pipeline" 677 678 CI_MERGE_REQUEST_DIFF_BASE_SHA = enum.auto() 679 "The base SHA of the merge request diff." 680 "Availability: Pre-pipeline" 681 682 CI_MERGE_REQUEST_DIFF_ID = enum.auto() 683 "The version of the merge request diff." 684 "Availability: Pre-pipeline" 685 686 CI_MERGE_REQUEST_EVENT_TYPE = enum.auto() 687 "The event type of the merge request. Can be detached, merged_result or merge_train." 688 "Availability: Pre-pipeline" 689 690 CI_MERGE_REQUEST_DESCRIPTION = enum.auto() 691 "The description of the merge request. If the description is more than 2700 characters long, " 692 "only the first 2700 characters are stored in the variable." 693 "Availability: Pre-pipeline" 694 695 CI_MERGE_REQUEST_DESCRIPTION_IS_TRUNCATED = enum.auto() 696 "true if CI_MERGE_REQUEST_DESCRIPTION is truncated down to 2700 characters " 697 "because the description of the merge request is too long, otherwise false." 698 "Availability: Pre-pipeline" 699 700 CI_MERGE_REQUEST_ID = enum.auto() 701 "The instance-level ID of the merge request. The ID is unique across all projects on the GitLab instance." 702 "Availability: Pre-pipeline" 703 704 CI_MERGE_REQUEST_IID = enum.auto() 705 "The project-level IID (internal ID) of the merge request. This ID is unique for the current project, " 706 "and is the number used in the merge request URL, page title, and other visible locations." 707 "Availability: Pre-pipeline" 708 709 CI_MERGE_REQUEST_LABELS = enum.auto() 710 "Comma-separated label names of the merge request. Only available if the merge request has at least one label." 711 "Availability: Pre-pipeline" 712 713 CI_MERGE_REQUEST_MILESTONE = enum.auto() 714 "The milestone title of the merge request. Only available if the merge request has a milestone set." 715 "Availability: Pre-pipeline" 716 717 CI_MERGE_REQUEST_PROJECT_ID = enum.auto() 718 "The ID of the project of the merge request." 719 "Availability: Pre-pipeline" 720 721 CI_MERGE_REQUEST_PROJECT_PATH = enum.auto() 722 "The path of the project of the merge request. For example namespace/awesome-project." 723 "Availability: Pre-pipeline" 724 725 CI_MERGE_REQUEST_PROJECT_URL = enum.auto() 726 "The URL of the project of the merge request. For example, http://192.168.10.15:3000/namespace/awesome-project." 727 "Availability: Pre-pipeline" 728 729 CI_MERGE_REQUEST_REF_PATH = enum.auto() 730 "The ref path of the merge request. For example, refs/merge-requests/1/head." 731 "Availability: Pre-pipeline" 732 733 CI_MERGE_REQUEST_SOURCE_BRANCH_NAME = enum.auto() 734 "The source branch name of the merge request." 735 "Availability: Pre-pipeline" 736 737 CI_MERGE_REQUEST_SOURCE_BRANCH_PROTECTED = enum.auto() 738 "true when the source branch of the merge request is protected." 739 "Availability: Pre-pipeline" 740 741 CI_MERGE_REQUEST_SOURCE_BRANCH_SHA = enum.auto() 742 "The HEAD SHA of the source branch of the merge request. The variable is empty in merge request pipelines. " 743 "The SHA is present only in merged results pipelines." 744 "Availability: Pre-pipeline" 745 746 CI_MERGE_REQUEST_SOURCE_PROJECT_ID = enum.auto() 747 "The ID of the source project of the merge request." 748 "Availability: Pre-pipeline" 749 750 CI_MERGE_REQUEST_SOURCE_PROJECT_PATH = enum.auto() 751 "The path of the source project of the merge request." 752 "Availability: Pre-pipeline" 753 754 CI_MERGE_REQUEST_SOURCE_PROJECT_URL = enum.auto() 755 "The URL of the source project of the merge request." 756 "Availability: Pre-pipeline" 757 758 CI_MERGE_REQUEST_SQUASH_ON_MERGE = enum.auto() 759 "true when the squash on merge option is set." 760 "Availability: Pre-pipeline" 761 762 CI_MERGE_REQUEST_TARGET_BRANCH_NAME = enum.auto() 763 "The target branch name of the merge request." 764 "Availability: Pre-pipeline" 765 766 CI_MERGE_REQUEST_TARGET_BRANCH_PROTECTED = enum.auto() 767 "true when the target branch of the merge request is protected." 768 "Availability: Pre-pipeline" 769 770 CI_MERGE_REQUEST_TARGET_BRANCH_SHA = enum.auto() 771 "The HEAD SHA of the target branch of the merge request. The variable is empty in merge request pipelines. " 772 "The SHA is present only in merged results pipelines." 773 "Availability: Pre-pipeline" 774 775 CI_MERGE_REQUEST_TITLE = enum.auto() 776 "The title of the merge request." 777 "Availability: Pre-pipeline" 778 779 CI_MERGE_REQUEST_DRAFT = enum.auto() 780 "true if the merge request is a draft. Introduced in GitLab 17.10." 781 "Availability: Pre-pipeline"
782 783
[docs] 784class PredefinedExternalPullRequest(VarEnum, enum.Enum): 785 CI_EXTERNAL_PULL_REQUEST_IID = enum.auto() 786 "Pull request ID from GitHub." 787 "Availability: Pipeline" 788 789 CI_EXTERNAL_PULL_REQUEST_SOURCE_REPOSITORY = enum.auto() 790 "The source repository name of the pull request." 791 "Availability: Pipeline" 792 793 CI_EXTERNAL_PULL_REQUEST_TARGET_REPOSITORY = enum.auto() 794 "The target repository name of the pull request." 795 "Availability: Pipeline" 796 797 CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME = enum.auto() 798 "The source branch name of the pull request." 799 "Availability: Pipeline" 800 801 CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_SHA = enum.auto() 802 "The HEAD SHA of the source branch of the pull request." 803 "Availability: Pipeline" 804 805 CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME = enum.auto() 806 "The target branch name of the pull request." 807 "Availability: Pipeline" 808 809 CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_SHA = enum.auto() 810 "The HEAD SHA of the target branch of the pull request." 811 "Availability: Pipeline"