Skip to content

Commit

Permalink
Merge pull request #2059 from 0x53A/patch-1
Browse files Browse the repository at this point in the history
[GITLAB] Add all environment variables
  • Loading branch information
matthid authored Aug 11, 2018
2 parents 2237a6f + 484cd22 commit 6821684
Showing 1 changed file with 120 additions and 1 deletion.
121 changes: 120 additions & 1 deletion src/app/Fake.BuildServer.GitLab/GitLab.fs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,129 @@ module GitLabImportExtensions =
[<RequireQualifiedAccess>]
module GitLab =

/// https://docs.gitlab.com/ee/ci/variables/
type Environment =
static member CommitSha = Environment.environVar "CI_COMMIT_SHA"

/// The branch or tag name for which project is built
static member CommitRefName = Environment.environVar "CI_COMMIT_REF_NAME"
/// $CI_COMMIT_REF_NAME lowercased, 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.
static member CommitRefSlug = Environment.environVar "CI_COMMIT_REF_SLUG"
/// The commit revision for which project is built
static member CommitSha = Environment.environVar "CI_COMMIT_SHA"
/// The previous latest commit present on a branch before a push request.
static member CommitBeforeSha = Environment.environVar "CI_COMMIT_BEFORE_SHA"
/// The commit tag name. Present only when building tags.
static member CommitTag = Environment.environVar "CI_COMMIT_TAG"
/// The full commit message.
static member CommitMessage = Environment.environVar "CI_COMMIT_MESSAGE"
/// The title of the commit - the full first line of the message
static member CommitTitle = Environment.environVar "CI_COMMIT_TITLE"
/// The description of the commit: the message without first line, if the title is shorter than 100 characters; full message in other case.
static member CommitDescription = Environment.environVar "CI_COMMIT_DESCRIPTION"
/// The path to CI config file. Defaults to .gitlab-ci.yml
static member ConfigPath = Environment.environVar "CI_CONFIG_PATH"
/// Whether debug tracing is enabled
static member DebugTrace = Environment.hasEnvironVar "CI_DEBUG_TRACE"
/// Authentication username of the GitLab Deploy Token, only present if the Project has one related.
static member DeployUser = Environment.environVar "CI_DEPLOY_USER"
/// Authentication password of the GitLab Deploy Token, only present if the Project has one related.
static member DeployPassword = Environment.environVar "CI_DEPLOY_PASSWORD"
/// Marks that 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). If the environment is disposable, it is set to true, otherwise it is not defined at all.
static member DisposableEnvironment = Environment.hasEnvironVar "CI_DISPOSABLE_ENVIRONMENT"
/// The name of the environment for this job
static member EnvironmentName = Environment.environVar "CI_ENVIRONMENT_NAME"
/// A simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, etc.
static member EnvironmentSlug = Environment.environVar "CI_ENVIRONMENT_SLUG"
/// The URL of the environment for this job
static member EnvironmentUrl = Environment.environVar "CI_ENVIRONMENT_URL"
/// The unique id of the current job that GitLab CI uses internally
static member JobId = Environment.environVar "CI_JOB_ID"
/// The flag to indicate that job was manually started
static member JobManual = Environment.environVar "CI_JOB_MANUAL"
/// The name of the job as defined in .gitlab-ci.yml
static member JobName = Environment.environVar "CI_JOB_NAME"
/// The name of the stage as defined in .gitlab-ci.yml
static member JobStage = Environment.environVar "CI_JOB_STAGE"
/// Token used for authenticating with GitLab Container Registry, downloading dependent repositories, authenticate with multi-project pipelines when triggers are involved, and for downloading job artifacts
static member JobToken = Environment.environVar "CI_JOB_TOKEN"
/// Job details URL
static member JobUrl = Environment.environVar "CI_JOB_URL"
/// The URL to clone the Git repository
static member RepositoryUrl = Environment.environVar "CI_REPOSITORY_URL"
/// The description of the runner as saved in GitLab
static member RunnerDescription = Environment.environVar "CI_RUNNER_DESCRIPTION"
/// The unique id of runner being used
static member RunnerId = Environment.environVar "CI_RUNNER_ID"
/// The defined runner tags
static member RunnerTags = Environment.environVar "CI_RUNNER_TAGS"
/// GitLab Runner version that is executing the current job
static member RunnerVersion = Environment.environVar "CI_RUNNER_VERSION"
/// GitLab Runner revision that is executing the current job
static member RunnerRevision = Environment.environVar "CI_RUNNER_REVISION"
/// The OS/architecture of the GitLab Runner executable (note that this is not necessarily the same as the environment of the executor)
static member RunnerExecutableArch = Environment.environVar "CI_RUNNER_EXECUTABLE_ARCH"
/// The unique id of the current pipeline that GitLab CI uses internally
static member PipelineId = Environment.environVar "CI_PIPELINE_ID"
/// The unique id of the current pipeline scoped to project
static member PipelineIID = Environment.environVar "CI_PIPELINE_IID"
/// The flag to indicate that job was triggered
static member PipelineTriggered = Environment.hasEnvironVar "CI_PIPELINE_TRIGGERED"
/// Indicates how the pipeline was triggered. Possible options are: push, web, trigger, schedule, api, and pipeline. For pipelines created before GitLab 9.5, this will show as unknown
static member PipelineSource = Environment.environVar "CI_PIPELINE_SOURCE"
/// The full path where the repository is cloned and where the job is run
static member ProjectDir = Environment.environVar "CI_PROJECT_DIR"
/// The unique id of the current project that GitLab CI uses internally
static member ProjectId = Environment.environVar "CI_PROJECT_ID"
/// The project name that is currently being built (actually it is project folder name)
static member ProjectName = Environment.environVar "CI_PROJECT_NAME"
/// The project namespace (username or groupname) that is currently being built
static member ProjectNamespace = Environment.environVar "CI_PROJECT_NAMESPACE"
/// The namespace with project name
static member ProjectPath = Environment.environVar "CI_PROJECT_PATH"
/// $CI_PROJECT_PATH lowercased and with everything except 0-9 and a-z replaced with -. Use in URLs and domain names.
static member ProjectPathSlug = Environment.environVar "CI_PROJECT_PATH_SLUG"
/// Pipeline details URL
static member PipelineUrl = Environment.environVar "CI_PIPELINE_URL"
/// The HTTP address to access project
static member ProjectUrl = Environment.environVar "CI_PROJECT_URL"
/// The project visibility (internal, private, public)
static member ProjectVisibility = Environment.environVar "CI_PROJECT_VISIBILITY"
/// If the Container Registry is enabled it returns the address of GitLab's Container Registry
static member Registry = Environment.environVar "CI_REGISTRY"
/// If the Container Registry is enabled for the project it returns the address of the registry tied to the specific project
static member RegistryImage = Environment.environVar "CI_REGISTRY_IMAGE"
/// The password to use to push containers to the GitLab Container Registry
static member RegistryPassword = Environment.environVar "CI_REGISTRY_PASSWORD"
/// The username to use to push containers to the GitLab Container Registry
static member RegistryUser = Environment.environVar "CI_REGISTRY_USER"
/// Mark that job is executed in CI environment
static member Server = Environment.hasEnvironVar "CI_SERVER"
/// The name of CI server that is used to coordinate jobs
static member ServerName = Environment.environVar "CI_SERVER_NAME"
/// GitLab revision that is used to schedule jobs
static member ServerRevision = Environment.environVar "CI_SERVER_REVISION"
/// GitLab version that is used to schedule jobs
static member ServerVersion = Environment.environVar "CI_SERVER_VERSION"
/// Marks that the job is executed in a shared environment (something that is persisted across CI invocations like shell or ssh executor). If the environment is shared, it is set to true, otherwise it is not defined at all.
static member SharedEnvironment = Environment.hasEnvironVar "CI_SHARED_ENVIRONMENT"
/// Number of attempts to fetch sources running a job
static member GetSourcesAttempts = Environment.environVar "GET_SOURCES_ATTEMPTS"
/// Mark that job is executed in GitLab CI environment
static member GitlabCI = Environment.environVar "GITLAB_CI"
/// The email of the user who started the job
static member GitlabUserEmail = Environment.environVar "GITLAB_USER_EMAIL"
/// The id of the user who started the job
static member GitlabUserId = Environment.environVar "GITLAB_USER_ID"
/// The login username of the user who started the job
static member GitlabUserLogin = Environment.environVar "GITLAB_USER_LOGIN"
/// The real name of the user who started the job
static member GitlabUserName = Environment.environVar "GITLAB_USER_NAME"
/// The comma separated list of licensed features available for your instance and plan
static member GitlabFeatures = Environment.environVar "GITLAB_FEATURES"
/// Number of attempts to restore the cache running a job
static member RestoreCacheAttempts = Environment.environVar "RESTORE_CACHE_ATTEMPTS"

/// Implements a TraceListener for TeamCity build servers.
/// ## Parameters
Expand Down

0 comments on commit 6821684

Please sign in to comment.