Skip to content

Instantly share code, notes, and snippets.

@damianh
Last active June 27, 2023 17:18
Show Gist options
  • Save damianh/4d699591bb2d87926108b1278a43b64e to your computer and use it in GitHub Desktop.
Save damianh/4d699591bb2d87926108b1278a43b64e to your computer and use it in GitHub Desktop.
GitLab predefined CI/CD variables as a C# DTO
public class GitLabCICDPredefinedVariables
{
    /// <summary>
    /// The Source chat channel that triggered the ChatOps command.
    /// </summary>
    public string? CHAT_CHANNEL { get; set; }

    /// <summary>
    /// The additional arguments passed with the ChatOps command.
    /// </summary>
    public string? CHAT_INPUT { get; set; }

    /// <summary>
    /// The chat service's user ID of the user who triggered the ChatOps command.
    /// </summary>
    public string? CHAT_USER_ID { get; set; }

    /// <summary>
    /// Available for all jobs executed in CI/CD. `true` when available.
    /// </summary>
    public bool? CI { get; set; }

    /// <summary>
    /// The GitLab API v4 root URL.
    /// </summary>
    public string? CI_API_V4_URL { get; set; }

    /// <summary>
    /// The GitLab API GraphQL root URL.
    /// </summary>
    public string? CI_API_GRAPHQL_URL { get; set; }

    /// <summary>
    /// The top-level directory where builds are executed.
    /// </summary>
    public string? CI_BUILDS_DIR { get; set; }

    /// <summary>
    /// The author of the commit in `Name <email>` format.
    /// </summary>
    public string? CI_COMMIT_AUTHOR { get; set; }
    /// <summary>
    /// The description of the commit. If the title is shorter than 100 characters, the message without the first line.
    /// </summary>
    public string? CI_COMMIT_DESCRIPTION { get; set; }

    /// <summary>
    /// The full commit message.
    /// </summary>
    public string? CI_COMMIT_MESSAGE { get; set; }

    /// <summary>
    /// The branch or tag name for which project is built.
    /// </summary>
    public string? CI_COMMIT_REF_NAME { get; set; }

    /// <summary>
    /// `true` if the job is running for a protected reference, `false` otherwise.
    /// </summary>
    public bool? CI_COMMIT_REF_PROTECTED { get; set; }

    /// <summary>
    /// `CI_COMMIT_REF_NAME` in lowercase, shortened to 63 bytes, and with everything except `0-9` and `a-z` replaced with `-`. No leading / trailing `-`. Use in URLs, host names and domain names.
    /// </summary>
    public string? CI_COMMIT_REF_SLUG { get; set; }

    /// <summary>
    /// The commit revision the project is built for.
    /// </summary>
    public string? CI_COMMIT_SHA { get; set; }

    /// <summary>
    /// The first eight characters of `CI_COMMIT_SHA`.
    /// </summary>
    public string? CI_COMMIT_SHORT_SHA { get; set; }

    /// <summary>
    /// The commit tag name. Available only in pipelines for tags.
    /// </summary>
    public string? CI_COMMIT_TAG { get; set; }

    /// <summary>
    /// The commit tag message. Available only in pipelines for tags.
    /// </summary>
    public string? CI_COMMIT_TAG_MESSAGE { get; set; }

    /// <summary>
    /// The timestamp of the commit in the ISO 8601 format.
    /// </summary>
    public string? CI_COMMIT_TIMESTAMP { get; set; }

    /// <summary>
    /// The title of the commit. The full first line of the message.
    /// </summary>
    public string? CI_COMMIT_TITLE { get; set; }
    /// <summary>
    /// The unique ID of build execution in a single executor.
    /// </summary>
    public string? CI_CONCURRENT_ID { get; set; }

    /// <summary>
    /// The unique ID of build execution in a single executor and project.
    /// </summary>
    public string? CI_CONCURRENT_PROJECT_ID { get; set; }

    /// <summary>
    /// The path to the CI/CD configuration file. Defaults to `.gitlab-ci.yml`. Read-only inside a running pipeline.
    /// </summary>
    public string? CI_CONFIG_PATH { get; set; }

    /// <summary>
    /// `true` if debug logging (tracing) is enabled.
    /// </summary>
    public bool? CI_DEBUG_TRACE { get; set; }

    /// <summary>
    /// `true` if service container logging is enabled.
    /// </summary>
    public bool? CI_DEBUG_SERVICES { get; set; }

    /// <summary>
    /// The name of the project's default branch.
    /// </summary>
    public string? CI_DEFAULT_BRANCH { get; set; }

    /// <summary>
    /// The top-level group image prefix for pulling images through the Dependency Proxy.
    /// </summary>
    public string? CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX { get; set; }

    /// <summary>
    /// The direct group image prefix for pulling images through the Dependency Proxy.
    /// </summary>
    public string? CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX { get; set; }

    /// <summary>
    /// The password to pull images through the Dependency Proxy.
    /// </summary>
    public string? CI_DEPENDENCY_PROXY_PASSWORD { get; set; }

    /// <summary>
    /// The server for logging in to the Dependency Proxy. This is equivalent to `$CI_SERVER_HOST:$CI_SERVER_PORT`.
    /// </summary>
    public string? CI_DEPENDENCY_PROXY_SERVER { get; set; }

    /// <summary>
    /// The username to pull images through the Dependency Proxy.
    /// </summary>
    public string? CI_DEPENDENCY_PROXY_USER { get; set; }

    /// <summary>
    /// Only available if the pipeline runs during a deploy freeze window. `true` when available.
    /// </summary>
    public bool? CI_DEPLOY_FREEZE { get; set; }

    /// <summary>
    /// The authentication password of the GitLab Deploy Token, if the project has one.
    /// </summary>
    public string? CI_DEPLOY_PASSWORD { get; set; }

    /// <summary>
    /// The authentication username of the GitLab Deploy Token, if the project has one.
    /// </summary>
    public string? CI_DEPLOY_USER { get; set; }

    /// <summary>
    /// Only available if the job is executed in a disposable environment (something that is created only for this job and disposed of/destroyed after the execution - all executors except `shell` and `ssh`). `true` when available.
    /// </summary>
    public bool? CI_DISPOSABLE_ENVIRONMENT { get; set; }

    /// <summary>
    /// The name of the environment for this job. Available if `environment:name` is set.
    /// </summary>
    public string? CI_ENVIRONMENT_NAME { get; set; }

    /// <summary>
    /// The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on. Available if `environment:name` is set. The slug is truncated to 24 characters.
    /// </summary>
    public string? CI_ENVIRONMENT_SLUG { get; set; }

    /// <summary>
    /// The URL of the environment for this job. Available if `environment:url` is set.
    /// </summary>
    public string? CI_ENVIRONMENT_URL { get; set; }

    /// <summary>
    /// The action annotation specified for this job's environment. Available if `environment:action` is set. Can be `start`, `prepare`, or `stop`.
    /// </summary>
    public string? CI_ENVIRONMENT_ACTION { get; set; }

    /// <summary>
    /// The deployment tier of the environment for this job.
    /// </summary>
    public string? CI_ENVIRONMENT_TIER { get; set; }

    /// <summary>
    /// The description of the release. Available only on pipelines for tags. Description length is limited to first 1024 characters.
    /// </summary>
    public string? CI_RELEASE_DESCRIPTION { get; set; }

    /// <summary>
    /// The configuration setting for whether FIPS mode is enabled in the GitLab instance.
    /// </summary>
    public string? CI_GITLAB_FIPS_MODE { get; set; }

    /// <summary>
    /// Only available if the pipeline's project has an open requirement. `true` when available.
    /// </summary>
    public bool? CI_HAS_OPEN_REQUIREMENTS { get; set; }

    /// <summary>
    /// The internal ID of the job, unique across all jobs in the GitLab instance.
    /// </summary>
    public string? CI_JOB_ID { get; set; }

    /// <summary>
    /// The name of the Docker image running the job.
    /// </summary>
    public string? CI_JOB_IMAGE { get; set; }

    /// <summary>
    /// A RS256 JSON web token to authenticate with third party systems that support JWT authentication, for example HashiCorp's Vault. Deprecated in GitLab 15.9 and scheduled to be removed in GitLab 16.5. Use ID tokens instead.
    /// </summary>
    public string? CI_JOB_JWT { get; set; }

    /// <summary>
    /// The same value as `CI_JOB_JWT`. Deprecated in GitLab 15.9 and scheduled to be removed in GitLab 16.5. Use ID tokens instead.
    /// </summary>
    public string? CI_JOB_JWT_V1 { get; set; }

    /// <summary>
    /// A newly formatted RS256 JSON web token to increase compatibility. Similar to `CI_JOB_JWT`, except the issuer (`iss`) claim is changed from `gitlab.com` to `https://gitlab.com`, `sub` has changed from `job_id` to a string that contains the project path, and an `aud` claim is added. The `aud` field is a constant value. Trusting JWTs in multiple relying parties can lead to one RP sending a JWT to another one and acting maliciously as a job. Deprecated in GitLab 15.9 and scheduled to be removed in GitLab 16.5. Use ID tokens instead.
    /// </summary>
    public string? CI_JOB_JWT_V2 { get; set; }

    /// <summary>
    /// Only available if the job was started manually. `true` when available.
    /// </summary>
    public bool? CI_JOB_MANUAL { get; set; }

    /// <summary>
    /// The name of the job.
    /// </summary>
    public string? CI_JOB_NAME { get; set; }

    /// <summary>
    /// `CI_JOB_NAME_SLUG` in lowercase, shortened to 63 bytes, and with everything except `0-9` and `a-z` replaced with `-`. No leading / trailing `-`. Use in paths.
    /// </summary>
    public string? CI_JOB_NAME_SLUG { get; set; }

    /// <summary>
    /// The name of the job's stage.
    /// </summary>
    public string? CI_JOB_STAGE { get; set; }

    /// <summary>
    /// The status of the job as each runner stage is executed. Use with `after_script`. Can be `success`, `failed`, or `canceled`.
    /// </summary>
    public string? CI_JOB_STATUS { get; set; }

    /// <summary>
    /// The job timeout value.
    /// </summary>
    public string? CI_JOB_TIMEOUT { get; set; }

    /// <summary>
    /// A token to authenticate with certain API endpoints. The token is valid as long as the job is running.
    /// </summary>
    public string? CI_JOB_TOKEN { get; set; }

    /// <summary>
    /// The job details URL.
    /// </summary>
    public string? CI_JOB_URL { get; set; }

    /// <summary>
    /// The UTC datetime when a job started, in ISO 8601 format.
    /// </summary>
    public string? CI_JOB_STARTED_AT { get; set; }

    /// <summary>
    /// Only available if the pipeline has a Kubernetes cluster available for deployments. `true` when available.
    /// </summary>
    public bool? CI_KUBERNETES_ACTIVE { get; set; }

    /// <summary>
    /// The index of the job in the job set. Only available if the job uses `parallel`.
    /// </summary>
    public string? CI_NODE_INDEX { get; set; }

    /// <summary>
    /// The total number of instances of this job running in parallel. Set to `1` if the job does not use `parallel`.
    /// </summary>
    public string? CI_NODE_TOTAL { get; set; }

    /// <summary>
    /// A comma-separated list of up to four merge requests that use the current branch and project as the merge request source. Only available in branch and merge request pipelines if the branch has an associated merge request.
    /// </summary>
    public string? CI_OPEN_MERGE_REQUESTS { get; set; }

    /// <summary>
    /// The configured domain that hosts GitLab Pages.
    /// </summary>
    public string? CI_PAGES_DOMAIN { get; set; }

    /// <summary>
    /// The URL for a GitLab Pages site. Always a subdomain of `CI_PAGES_DOMAIN`.
    /// </summary>
    public string? CI_PAGES_URL { get; set; }

    /// <summary>
    /// The instance-level ID of the current pipeline. This ID is unique across all projects on the GitLab instance.
    /// </summary>
    public string? CI_PIPELINE_ID { get; set; }

    /// <summary>
    /// The project-level IID (internal ID) of the current pipeline. This ID is unique only within the current project.
    /// </summary>
    public string? CI_PIPELINE_IID { get; set; }

    /// <summary>
    /// How the pipeline was triggered. Can be `push`, `web`, `schedule`, `api`, `external`, `chat`, `webide`, `merge_request_event`, `external_pull_request_event`, `parent_pipeline`, `trigger`, or `pipeline`.
    /// </summary>
    public string? CI_PIPELINE_SOURCE { get; set; }

    /// <summary>
    /// `true` if the job was triggered.
    /// </summary>
    public bool? CI_PIPELINE_TRIGGERED { get; set; }

    /// <summary>
    /// The URL for the pipeline details.
    /// </summary>
    public string? CI_PIPELINE_URL { get; set; }

    /// <summary>
    /// The UTC datetime when the pipeline was created, in ISO 8601 format.
    /// </summary>
    public string? CI_PIPELINE_CREATED_AT { get; set; }

    /// <summary>
    /// The full path the repository is cloned to, and where the job runs from. If the GitLab Runner `builds_dir` parameter is set, this variable is set relative to the value of `builds_dir`.
    /// </summary>
    public string? CI_PROJECT_DIR { get; set; }

    /// <summary>
    /// The ID of the current project. This ID is unique across all projects on the GitLab instance.
    /// </summary>
    public string? CI_PROJECT_ID { get; set; }

    /// <summary>
    /// The name of the directory for the project. For example if the project URL is `gitlab.example.com/group-name/project-1`, `CI_PROJECT_NAME` is `project-1`.
    /// </summary>
    public string? CI_PROJECT_NAME { get; set; }

    /// <summary>
    /// The project namespace (username or group name) of the job.
    /// </summary>
    public string? CI_PROJECT_NAMESPACE { get; set; }

    /// <summary>
    /// The project namespace ID of the job.
    /// </summary>
    public string? CI_PROJECT_NAMESPACE_ID { get; set; }

    /// <summary>
    /// `$CI_PROJECT_PATH` in lowercase with characters that are not `a-z` or `0-9` replaced with `-` and shortened to 63 bytes. Use in URLs and domain names.
    /// </summary>
    public string? CI_PROJECT_PATH_SLUG { get; set; }

    /// <summary>
    /// The project namespace with the project name included.
    /// </summary>
    public string? CI_PROJECT_PATH { get; set; }

    /// <summary>
    /// A comma-separated, lowercase list of the languages used in the repository. The maximum number of languages is limited to 5.
    /// </summary>
    public string? CI_PROJECT_REPOSITORY_LANGUAGES { get; set; }

    /// <summary>
    /// The root project namespace (username or group name) of the job. For example, if `CI_PROJECT_NAMESPACE` is `root-group/child-group/grandchild-group`, `CI_PROJECT_ROOT_NAMESPACE` is `root-group`.
    /// </summary>
    public string? CI_PROJECT_ROOT_NAMESPACE { get; set; }

    /// <summary>
    /// The human-readable project name as displayed in the GitLab web interface.
    /// </summary>
    public string? CI_PROJECT_TITLE { get; set; }

    /// <summary>
    /// The project description as displayed in the GitLab web interface.
    /// </summary>
    public string? CI_PROJECT_DESCRIPTION { get; set; }

    /// <summary>
    /// The HTTP(S) address of the project.
    /// </summary>
    public string? CI_PROJECT_URL { get; set; }

    /// <summary>
    /// The project visibility. Can be `internal`, `private`, or `public`.
    /// </summary>
    public string? CI_PROJECT_VISIBILITY { get; set; }

    /// <summary>
    /// The project external authorization classification label.
    /// </summary>
    public string? CI_PROJECT_CLASSIFICATION_LABEL { get; set; }

    /// <summary>
    /// The address of the project's Container Registry. Only available if the Container Registry is enabled for the project.
    /// </summary>
    public string? CI_REGISTRY_IMAGE { get; set; }

    /// <summary>
    /// The password to push containers to the project's GitLab Container Registry. Only available if the Container Registry is enabled for the project. This password value is the same as the `CI_JOB_TOKEN` and is valid only as long as the job is running. Use the `CI_DEPLOY_PASSWORD` for long-lived access to the registry
    /// </summary>
    public string? CI_REGISTRY_PASSWORD { get; set; }

    /// <summary>
    /// The username to push containers to the project's GitLab Container Registry. Only available if the Container Registry is enabled for the project.
    /// </summary>
    public string? CI_REGISTRY_USER { get; set; }

    /// <summary>
    /// The address of the GitLab Container Registry. Only available if the Container Registry is enabled for the project. This variable includes a `:port` value if one is specified in the registry configuration.
    /// </summary>
    public string? CI_REGISTRY { get; set; }

    /// <summary>
    /// 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`.
    /// </summary>
    public string? CI_REPOSITORY_URL { get; set; }

    /// <summary>
    /// The description of the runner.
    /// </summary>
    public string? CI_RUNNER_DESCRIPTION { get; set; }

    /// <summary>
    /// The OS/architecture of the GitLab Runner executable. Might not be the same as the environment of the executor.
    /// </summary>
    public string? CI_RUNNER_EXECUTABLE_ARCH { get; set; }

    /// <summary>
    /// The unique ID of the runner being used.
    /// </summary>
    public string? CI_RUNNER_ID { get; set; }

    /// <summary>
    /// The revision of the runner running the job.
    /// </summary>
    public string? CI_RUNNER_REVISION { get; set; }

    /// <summary>
    /// The runner's unique ID, used to authenticate new job requests. In GitLab 14.9 and later, the token contains a prefix, and the first 17 characters are used. Prior to 14.9, the first eight characters are used.
    /// </summary>
    public string? CI_RUNNER_SHORT_TOKEN { get; set; }

    /// <summary>
    /// A comma-separated list of the runner tags.
    /// </summary>
    public string? CI_RUNNER_TAGS { get; set; }

    /// <summary>
    /// The version of the GitLab Runner running the job.
    /// </summary>
    public string? CI_RUNNER_VERSION { get; set; }

    /// <summary>
    /// The host of the GitLab instance URL, without protocol or port. For example `gitlab.example.com`.
    /// </summary>
    public string? CI_SERVER_HOST { get; set; }

    /// <summary>
    /// The name of CI/CD server that coordinates jobs.
    /// </summary>
    public string? CI_SERVER_NAME { get; set; }

    /// <summary>
    /// The port of the GitLab instance URL, without host or protocol. For example `8080`.
    /// </summary>
    public string? CI_SERVER_PORT { get; set; }

    /// <summary>
    /// The protocol of the GitLab instance URL, without host or port. For example `https`.
    /// </summary>
    public string? CI_SERVER_PROTOCOL { get; set; }

    /// <summary>
    /// The SSH host of the GitLab instance, used for access to Git repositories via SSH. For example `gitlab.com`.
    /// </summary>
    public string? CI_SERVER_SHELL_SSH_HOST { get; set; }

    /// <summary>
    /// The SSH port of the GitLab instance, used for access to Git repositories via SSH. For example `22`.
    /// </summary>
    public string? CI_SERVER_SHELL_SSH_PORT { get; set; }

    /// <summary>
    /// GitLab revision that schedules jobs.
    /// </summary>
    public string? CI_SERVER_REVISION { get; set; }

    /// <summary>
    /// File containing the TLS CA certificate to verify the GitLab server when `tls-ca-file` set in runner settings.
    /// </summary>
    public string? CI_SERVER_TLS_CA_FILE { get; set; }

    /// <summary>
    /// File containing the TLS certificate to verify the GitLab server when `tls-cert-file` set in runner settings.
    /// </summary>
    public string? CI_SERVER_TLS_CERT_FILE { get; set; }

    /// <summary>
    /// File containing the TLS key to verify the GitLab server when `tls-key-file` set in runner settings.
    /// </summary>
    public string? CI_SERVER_TLS_KEY_FILE { get; set; }

    /// <summary>
    /// The base URL of the GitLab instance, including protocol and port. For example `https://gitlab.example.com:8080`.
    /// </summary>
    public string? CI_SERVER_URL { get; set; }

    /// <summary>
    /// The major version of the GitLab instance. For example, if the GitLab version is `13.6.1`, the `CI_SERVER_VERSION_MAJOR` is `13`.
    /// </summary>
    public string? CI_SERVER_VERSION_MAJOR { get; set; }

    /// <summary>
    /// The minor version of the GitLab instance. For example, if the GitLab version is `13.6.1`, the `CI_SERVER_VERSION_MINOR` is `6`.
    /// </summary>
    public string? CI_SERVER_VERSION_MINOR { get; set; }

    /// <summary>
    /// The patch version of the GitLab instance. For example, if the GitLab version is `13.6.1`, the `CI_SERVER_VERSION_PATCH` is `1`.
    /// </summary>
    public string? CI_SERVER_VERSION_PATCH { get; set; }

    /// <summary>
    /// The full version of the GitLab instance.
    /// </summary>
    public string? CI_SERVER_VERSION { get; set; }

    /// <summary>
    /// Available for all jobs executed in CI/CD. `yes` when available.
    /// </summary>
    public string? CI_SERVER { get; set; }

    /// <summary>
    /// Only available if the job is executed in a shared environment (something that is persisted across CI/CD invocations, like the `shell` or `ssh` executor). `true` when available.
    /// </summary>
    public bool? CI_SHARED_ENVIRONMENT { get; set; }

    /// <summary>
    /// The host of the registry used by CI/CD templates. Defaults to `registry.gitlab.com`.
    /// </summary>
    public string? CI_TEMPLATE_REGISTRY_HOST { get; set; }

    /// <summary>
    /// Available for all jobs executed in CI/CD. `true` when available.
    /// </summary>
    public bool? GITLAB_CI { get; set; }

    /// <summary>
    /// The comma-separated list of licensed features available for the GitLab instance and license.
    /// </summary>
    public string? GITLAB_FEATURES { get; set; }

    /// <summary>
    /// The email of the user who started the pipeline, unless the job is a manual job. In manual jobs, the value is the email of the user who started the job.
    /// </summary>
    public string? GITLAB_USER_EMAIL { get; set; }

    /// <summary>
    /// The ID of the user who started the pipeline, unless the job is a manual job. In manual jobs, the value is the ID of the user who started the job.
    /// </summary>
    public string? GITLAB_USER_ID { get; set; }

    /// <summary>
    /// The username of the user who started the pipeline, unless the job is a manual job. In manual jobs, the value is the username of the user who started the job.
    /// </summary>
    public string? GITLAB_USER_LOGIN { get; set; }

    /// <summary>
    /// The name of the user who started the pipeline, unless the job is a manual job. In manual jobs, the value is the name of the user who started the job.
    /// </summary>
    public string? GITLAB_USER_NAME { get; set; }

    /// <summary>
    /// The path to the `kubeconfig` file with contexts for every shared agent connection. Only available when a GitLab agent is authorized to access the project.
    /// </summary>
    public string? KUBECONFIG { get; set; }

    /// <summary>
    /// The webhook payload. Only available when a pipeline is triggered with a webhook.
    /// </summary>
    public string? TRIGGER_PAYLOAD { get; set; }
}
public class GitLabCICDMergeRequestPipelineVariables
{
    /// <summary>
    /// Approval status of the merge request. `true` when merge request approvals is available and the merge request has been approved.
    /// </summary>
    public bool? CI_MERGE_REQUEST_APPROVED { get; set; }

    /// <summary>
    /// Comma-separated list of usernames of assignees for the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_ASSIGNEES { get; set; }

    /// <summary>
    /// The instance-level ID of the merge request. This is a unique ID across all projects on GitLab.
    /// </summary>
    public string? CI_MERGE_REQUEST_ID { get; set; }

    /// <summary>
    /// The project-level IID (internal ID) of the merge request. This ID is unique for the current project.
    /// </summary>
    public string? CI_MERGE_REQUEST_IID { get; set; }

    /// <summary>
    /// Comma-separated label names of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_LABELS { get; set; }

    /// <summary>
    /// The milestone title of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_MILESTONE { get; set; }

    /// <summary>
    /// The ID of the project of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_PROJECT_ID { get; set; }

    /// <summary>
    /// The path of the project of the merge request. For example `namespace/awesome-project`.
    /// </summary>
    public string? CI_MERGE_REQUEST_PROJECT_PATH { get; set; }

    /// <summary>
    /// The URL of the project of the merge request. For example, `http://192.168.10.15:3000/namespace/awesome-project`.
    /// </summary>
    public string? CI_MERGE_REQUEST_PROJECT_URL { get; set; }

    /// <summary>
    /// The ref path of the merge request. For example, `refs/merge-requests/1/head`.
    /// </summary>
    public string? CI_MERGE_REQUEST_REF_PATH { get; set; }

    /// <summary>
    /// The source branch name of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_SOURCE_BRANCH_NAME { get; set; }

    /// <summary>
    /// 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.
    /// </summary>
    public string? CI_MERGE_REQUEST_SOURCE_BRANCH_SHA { get; set; }

    /// <summary>
    /// The ID of the source project of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_SOURCE_PROJECT_ID { get; set; }

    /// <summary>
    /// The path of the source project of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_SOURCE_PROJECT_PATH { get; set; }

    /// <summary>
    /// The URL of the source project of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_SOURCE_PROJECT_URL { get; set; }

    /// <summary>
    /// The target branch name of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_TARGET_BRANCH_NAME { get; set; }

    /// <summary>
    /// The protection status for the target branch of the merge request.
    /// </summary>
    public bool? CI_MERGE_REQUEST_TARGET_BRANCH_PROTECTED { get; set; }

    /// <summary>
    /// 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.
    /// </summary>
    public string? CI_MERGE_REQUEST_TARGET_BRANCH_SHA { get; set; }

    /// <summary>
    /// The title of the merge request.
    /// </summary>
    public string? CI_MERGE_REQUEST_TITLE { get; set; }

    /// <summary>
    /// The event type of the merge request. Can be `detached`, `merged_result` or `merge_train`.
    /// </summary>
    public string? CI_MERGE_REQUEST_EVENT_TYPE { get; set; }

    /// <summary>
    /// The version of the merge request diff.
    /// </summary>
    public string? CI_MERGE_REQUEST_DIFF_ID { get; set; }

    /// <summary>
    /// The base SHA of the merge request diff.
    /// </summary>
    public string? CI_MERGE_REQUEST_DIFF_BASE_SHA { get; set; }
}
public class GitLabCICDExternalPullRequestPipelineVariables
{
    /// <summary>
    /// Pull request ID from GitHub.
    /// </summary>
    public string? CI_EXTERNAL_PULL_REQUEST_IID { get; set; }

    /// <summary>
    /// The source repository name of the pull request.
    /// </summary>
    public string? CI_EXTERNAL_PULL_REQUEST_SOURCE_REPOSITORY { get; set; }

    /// <summary>
    /// The target repository name of the pull request.
    /// </summary>
    public string? CI_EXTERNAL_PULL_REQUEST_TARGET_REPOSITORY { get; set; }

    /// <summary>
    /// The source branch name of the pull request.
    /// </summary>
    public string? CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME { get; set; }

    /// <summary>
    /// The HEAD SHA of the source branch of the pull request.
    /// </summary>
    public string? CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_SHA { get; set; }

    /// <summary>
    /// The target branch name of the pull request.
    /// </summary>
    public string? CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME { get; set; }

    /// <summary>
    /// The HEAD SHA of the target branch of the pull request.
    /// </summary>
    public string? CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_SHA { get; set; }
}

You can bind this to a configuration:

var config = new ConfigurationBuilder()
  .AddEnvironmentVariables()
  .Build();
  
var predefinedVariables = new GitLabCICDPredefinesVariables();
config.Bind(predefinedVariables);

var mergeRequestPipelineVariables = new GitLabCICDMergeRequestPipelineVariables();
config.Bind(mergeRequestPipelineVariables);

var externalPullRequestPipelineVariables = new GitLabCICDExternalPullRequestPipelineVariables();
config.Bind(externalPullRequestPipelineVariables);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment