List of all the built-in variables available in GitLab CI/CD:

  1. Pipeline Variables:
  • CI_PIPELINE_ID: The ID of the pipeline.
  • CI_PIPELINE_IID: The internal ID of the pipeline.
  • CI_PIPELINE_SOURCE: The source of the pipeline trigger (e.g., “push”, “schedule”, “web”).
  • CI_PIPELINE_CREATED_AT: The creation timestamp of the pipeline.
  1. Job Variables:
  • CI_JOB_NAME: The name of the job.
  • CI_JOB_STAGE: The stage in which the job is running (e.g., “test”, “deploy”).
  • CI_JOB_MANUAL: Indicates whether the job is a manual action (true/false).
  • CI_JOB_ID: The unique ID of the job.
  • CI_JOB_TOKEN: The token used for authenticating with the GitLab API during job execution.
  • CI_JOB_URL: The URL of the job in the GitLab UI.
  1. Commit Variables:
  • CI_COMMIT_REF_NAME: The name of the branch or tag being built.
  • CI_COMMIT_SHA: The commit hash of the current commit being built.
  • CI_COMMIT_BEFORE_SHA: The commit hash before the current commit.
  • CI_COMMIT_AFTER_SHA: The commit hash after the current commit.
  • CI_COMMIT_MESSAGE: The commit message of the current commit.
  • CI_COMMIT_TITLE: The title of the commit.
  • CI_COMMIT_DESCRIPTION: The description of the commit.
  • CI_COMMIT_TIMESTAMP: The timestamp of the commit.
  • CI_COMMIT_REF_SLUG: The branch or tag name in a URL-friendly format.
  1. Project Variables:
  • CI_PROJECT_ID: The ID of the GitLab project.
  • CI_PROJECT_NAME: The name of the project.
  • CI_PROJECT_PATH: The path of the project (e.g., “group/project”).
  • CI_PROJECT_PATH_SLUG: The project path in a URL-friendly format.
  • CI_PROJECT_NAMESPACE: The namespace of the project (e.g., group or user name).
  • CI_PROJECT_URL: The URL of the GitLab project.
  1. Runner Variables:
  • CI_RUNNER_ID: The ID of the GitLab Runner executing the job.
  • CI_RUNNER_DESCRIPTION: The description of the GitLab Runner executing the job.
  1. Merge Request Variables:
  • CI_MERGE_REQUEST_ID: The ID of the merge request associated with the pipeline.
  • CI_MERGE_REQUEST_IID: The internal ID of the merge request.
  • CI_MERGE_REQUEST_SOURCE_BRANCH_NAME: The source branch of the merge request.
  • CI_MERGE_REQUEST_TARGET_BRANCH_NAME: The target branch of the merge request.
  1. Container Registry Variables:
  • CI_REGISTRY: The URL of the GitLab Container Registry.
  • CI_REGISTRY_IMAGE: The name of the Docker image.
  • CI_REGISTRY_USER: The username for accessing the GitLab Container Registry.
  • CI_REGISTRY_PASSWORD: The password for accessing the GitLab Container Registry.

These built-in variables provide valuable information and configuration options during pipeline execution, enabling developers to customize and optimize their CI/CD workflows effectively.

References: