ciutil

package
v1.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2020 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCI

func IsCI() bool

IsCI returns true if we are running in a known CI system.

Types

type SystemName

type SystemName string

SystemName is a recognized CI system.

const (
	AppVeyor                    SystemName = "AppVeyor"
	AWSCodeBuild                SystemName = "AWS CodeBuild"
	AtlassianBamboo             SystemName = "Atlassian Bamboo"
	AtlassianBitbucketPipelines SystemName = "Atlassian Bitbucket Pipelines"
	AzurePipelines              SystemName = "Azure Pipelines"
	Buildkite                   SystemName = "Buildkite"
	CircleCI                    SystemName = "CircleCI"
	Codefresh                   SystemName = "Codefresh"
	Codeship                    SystemName = "Codeship"
	Drone                       SystemName = "Drone"

	// GenericCI is used when a CI system in which the CLI is being run,
	// is not recognized by it. Users can set the relevant env vars
	// as a fallback so that the CLI would still pick-up the metadata related
	// to their CI build.
	GenericCI SystemName = "Generic CI"

	GitHub      SystemName = "GitHub"
	GitLab      SystemName = "GitLab"
	GoCD        SystemName = "GoCD"
	Hudson      SystemName = "Hudson"
	Jenkins     SystemName = "Jenkins"
	MagnumCI    SystemName = "Magnum CI"
	Semaphore   SystemName = "Semaphore"
	TaskCluster SystemName = "TaskCluster"
	TeamCity    SystemName = "TeamCity"
	Travis      SystemName = "Travis CI"
)

CI system constants.

type Vars

type Vars struct {
	// Name is a required friendly name of the CI system.
	Name SystemName
	// BuildID is an optional unique identifier for the current build/job.
	// In some CI systems the build ID is a system-wide unique internal ID
	// and the `BuildNumber` is the repo/project-specific unique ID.
	BuildID string
	// BuildNumber is the unique identifier of a build within a project/repository.
	// This is only set for CI systems that expose both the internal ID, as well as
	// a project/repo-specific ID.
	BuildNumber string
	// BuildType is an optional friendly type name of the build/job type.
	BuildType string
	// BuildURL is an optional URL for this build/job's webpage.
	BuildURL string
	// SHA is the SHA hash of the code repo at which this build/job is running.
	SHA string
	// BranchName is the name of the feature branch currently being built.
	BranchName string
	// CommitMessage is the full message of the Git commit being built.
	CommitMessage string
	// PRNumber is the pull-request ID/number in the source control system.
	PRNumber string
}

Vars contains a set of metadata variables about a CI system.

func DetectVars

func DetectVars() Vars

DetectVars detects and returns the CI variables for the current environment. Not all fields of the `Vars` struct are applicable to every CI system, and may be left blank.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL