common

package
v1.11.1-0...-769674b Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PullPolicyAlways       = "always"
	PullPolicyNever        = "never"
	PullPolicyIfNotPresent = "if-not-present"
)
View Source
const (
	TestAlpineImage       = "alpine:3.7"
	TestAlpineNoRootImage = "registry.gitlab.com/gitlab-org/gitlab-runner/alpine-no-root:latest"
	TestDockerDindImage   = "docker:18-dind"
	TestDockerGitImage    = "docker:18-git"
)
View Source
const AfterScriptTimeout = 5 * time.Minute
View Source
const CheckInterval = 3 * time.Second
View Source
const DefaultArtifactDownloadAttempts = 1
View Source
const DefaultCacheRequestTimeout = 10
View Source
const DefaultExecTimeout = 1800
View Source
const DefaultGetSourcesAttempts = 1
View Source
const DefaultMetricsServerPort = 9252
View Source
const DefaultNetworkClientTimeout = 60 * time.Minute
View Source
const DefaultOutputLimit = 4 * 1024 * 1024 // in bytes
View Source
const DefaultRestoreCacheAttempts = 1
View Source
const DefaultSessionTimeout = 30 * time.Minute
View Source
const DefaultTimeout = 7200
View Source
const DefaultTracePatchLimit = 1024 * 1024 // in bytes
View Source
const DefaultWaitForServicesTimeout = 30
View Source
const (
	FilesLFSFile1LFSsize = int64(2097152)
)
View Source
const ForceTraceSentInterval = 30 * time.Second
View Source
const HealthCheckInterval = 3600
View Source
const HealthyChecks = 3
View Source
const KubernetesPollInterval = 3
View Source
const KubernetesPollTimeout = 180
View Source
const NotHealthyCheckInterval = 300
View Source
const PreparationRetries = 3
View Source
const ReloadConfigInterval = 3
View Source
const ShutdownTimeout = 30
View Source
const UpdateInterval = 3 * time.Second
View Source
const UpdateRetryInterval = 3 * time.Second
View Source
const WaitForBuildFinishTimeout = 5 * time.Minute

Variables

View Source
var BRANCH = "HEAD"
View Source
var BUILT = "unknown"
View Source
var NAME = "gitlab-runner"
View Source
var PreparationRetryInterval = 3 * time.Second
View Source
var REVISION = "HEAD"
View Source
var VERSION = "development version"

Functions

func GenerateShellScript

func GenerateShellScript(buildStage BuildStage, info ShellScriptInfo) (string, error)

func GetCommands

func GetCommands() []cli.Command

func GetDefaultShell

func GetDefaultShell() string

func GetExecutors

func GetExecutors() []string

func GetShells

func GetShells() []string

func MakeBuildError

func MakeBuildError(format string, args ...interface{}) error

func RegisterCommand

func RegisterCommand(command cli.Command)

func RegisterCommand2

func RegisterCommand2(name, usage string, data Commander, flags ...cli.Flag)

func RegisterExecutor

func RegisterExecutor(executor string, provider ExecutorProvider)

func RegisterShell

func RegisterShell(shell Shell)

Types

type AppVersionInfo

type AppVersionInfo struct {
	Name         string `json:"name"`
	Version      string `json:"version"`
	Revision     string `json:"revision"`
	Branch       string `json:"branch"`
	GOVersion    string `json:"go_version"`
	BuiltAt      string `json:"built_at"`
	OS           string `json:"os"`
	Architecture string `json:"architecture"`
}
var AppVersion AppVersionInfo

func (*AppVersionInfo) Extended

func (v *AppVersionInfo) Extended() string

func (*AppVersionInfo) Line

func (v *AppVersionInfo) Line() string

func (*AppVersionInfo) NewMetricsCollector

func (v *AppVersionInfo) NewMetricsCollector() *prometheus.GaugeVec

NewMetricsCollector returns a prometheus.Collector which represents current build information.

func (*AppVersionInfo) Printer

func (v *AppVersionInfo) Printer(c *cli.Context)

func (*AppVersionInfo) ShortLine

func (v *AppVersionInfo) ShortLine() string

func (*AppVersionInfo) UserAgent

func (v *AppVersionInfo) UserAgent() string

func (*AppVersionInfo) Variables

func (v *AppVersionInfo) Variables() JobVariables

type Artifact

type Artifact struct {
	Name      string         `json:"name"`
	Untracked bool           `json:"untracked"`
	Paths     ArtifactPaths  `json:"paths"`
	When      ArtifactWhen   `json:"when"`
	Type      string         `json:"artifact_type"`
	Format    ArtifactFormat `json:"artifact_format"`
	ExpireIn  string         `json:"expire_in"`
}

type ArtifactFormat

type ArtifactFormat string
const (
	ArtifactFormatDefault ArtifactFormat = ""
	ArtifactFormatZip     ArtifactFormat = "zip"
	ArtifactFormatGzip    ArtifactFormat = "gzip"
	ArtifactFormatRaw     ArtifactFormat = "raw"
)

type ArtifactPaths

type ArtifactPaths []string

type ArtifactWhen

type ArtifactWhen string
const (
	ArtifactWhenOnFailure ArtifactWhen = "on_failure"
	ArtifactWhenOnSuccess ArtifactWhen = "on_success"
	ArtifactWhenAlways    ArtifactWhen = "always"
)

func (ArtifactWhen) OnFailure

func (when ArtifactWhen) OnFailure() bool

func (ArtifactWhen) OnSuccess

func (when ArtifactWhen) OnSuccess() bool

type Artifacts

type Artifacts []Artifact

type ArtifactsOptions

type ArtifactsOptions struct {
	BaseName string
	ExpireIn string
	Format   ArtifactFormat
	Type     string
}

type Build

type Build struct {
	JobResponse `yaml:",inline"`

	SystemInterrupt  chan os.Signal `json:"-" yaml:"-"`
	RootDir          string         `json:"-" yaml:"-"`
	BuildDir         string         `json:"-" yaml:"-"`
	CacheDir         string         `json:"-" yaml:"-"`
	Hostname         string         `json:"-" yaml:"-"`
	Runner           *RunnerConfig  `json:"runner"`
	ExecutorData     ExecutorData
	ExecutorFeatures FeaturesInfo `json:"-" yaml:"-"`

	// Unique ID for all running builds on this runner
	RunnerID int `json:"runner_id"`

	// Unique ID for all running builds on this runner and this project
	ProjectRunnerID int `json:"project_runner_id"`

	CurrentStage BuildStage
	CurrentState BuildRuntimeState

	Session *session.Session
	// contains filtered or unexported fields
}

func NewBuild

func NewBuild(jobData JobResponse, runnerConfig *RunnerConfig, systemInterrupt chan os.Signal, executorData ExecutorData) (*Build, error)

func (*Build) CurrentExecutorStage

func (b *Build) CurrentExecutorStage() ExecutorStage

func (*Build) Duration

func (b *Build) Duration() time.Duration

func (*Build) FullProjectDir

func (b *Build) FullProjectDir() string

func (*Build) GetAllVariables

func (b *Build) GetAllVariables() JobVariables

func (*Build) GetBuildTimeout

func (b *Build) GetBuildTimeout() time.Duration

func (*Build) GetCITLSVariables

func (b *Build) GetCITLSVariables() JobVariables

func (*Build) GetCacheRequestTimeout

func (b *Build) GetCacheRequestTimeout() int

func (*Build) GetDefaultFeatureFlagsVariables

func (b *Build) GetDefaultFeatureFlagsVariables() JobVariables

func (*Build) GetDefaultVariables

func (b *Build) GetDefaultVariables() JobVariables

func (*Build) GetDockerAuthConfig

func (b *Build) GetDockerAuthConfig() string

func (*Build) GetDownloadArtifactsAttempts

func (b *Build) GetDownloadArtifactsAttempts() int

func (*Build) GetGetSourcesAttempts

func (b *Build) GetGetSourcesAttempts() int

func (*Build) GetGitCheckout

func (b *Build) GetGitCheckout() bool

func (*Build) GetGitCleanFlags

func (b *Build) GetGitCleanFlags() []string

func (*Build) GetGitStrategy

func (b *Build) GetGitStrategy() GitStrategy

func (*Build) GetRemoteURL

func (b *Build) GetRemoteURL() string

GetRemoteURL checks if the default clone URL is overwritten by the runner configuration option: 'CloneURL'. If it is, we use that to create the clone URL.

func (*Build) GetRestoreCacheAttempts

func (b *Build) GetRestoreCacheAttempts() int

func (*Build) GetSharedEnvVariable

func (b *Build) GetSharedEnvVariable() JobVariable

func (*Build) GetSubmoduleStrategy

func (b *Build) GetSubmoduleStrategy() SubmoduleStrategy

func (*Build) GetTLSVariables

func (b *Build) GetTLSVariables(caFile, certFile, keyFile string) JobVariables

func (*Build) IsDebugTraceEnabled

func (b *Build) IsDebugTraceEnabled() bool

func (*Build) IsFeatureFlagOn

func (b *Build) IsFeatureFlagOn(name string) bool

func (*Build) IsLFSSmudgeDisabled

func (b *Build) IsLFSSmudgeDisabled() bool

func (*Build) IsSharedEnv

func (b *Build) IsSharedEnv() bool

func (*Build) Log

func (b *Build) Log() *logrus.Entry

func (*Build) ProjectSlug

func (b *Build) ProjectSlug() (string, error)

func (*Build) ProjectUniqueDir

func (b *Build) ProjectUniqueDir(sharedDir bool) string

func (*Build) ProjectUniqueName

func (b *Build) ProjectUniqueName() string

func (*Build) Run

func (b *Build) Run(globalConfig *Config, trace JobTrace) (err error)

func (*Build) StartBuild

func (b *Build) StartBuild(rootDir, cacheDir string, customBuildDirEnabled, sharedDir bool) error

func (*Build) String

func (b *Build) String() string

func (*Build) TmpProjectDir

func (b *Build) TmpProjectDir() string

type BuildError

type BuildError struct {
	Inner         error
	FailureReason JobFailureReason
}

func (*BuildError) Error

func (b *BuildError) Error() string

type BuildLogger

type BuildLogger struct {
	// contains filtered or unexported fields
}

func NewBuildLogger

func NewBuildLogger(log JobTrace, entry *logrus.Entry) BuildLogger

func (*BuildLogger) Debugln

func (e *BuildLogger) Debugln(args ...interface{})

func (*BuildLogger) Errorln

func (e *BuildLogger) Errorln(args ...interface{})

func (*BuildLogger) Infoln

func (e *BuildLogger) Infoln(args ...interface{})

func (*BuildLogger) Println

func (e *BuildLogger) Println(args ...interface{})

func (*BuildLogger) SendRawLog

func (e *BuildLogger) SendRawLog(args ...interface{})

func (*BuildLogger) SoftErrorln

func (e *BuildLogger) SoftErrorln(args ...interface{})

func (*BuildLogger) Warningln

func (e *BuildLogger) Warningln(args ...interface{})

func (*BuildLogger) WithFields

func (e *BuildLogger) WithFields(fields logrus.Fields) BuildLogger

func (*BuildLogger) WriterLevel

func (e *BuildLogger) WriterLevel(level logrus.Level) *io.PipeWriter

type BuildRuntimeState

type BuildRuntimeState string
const (
	BuildRunStatePending      BuildRuntimeState = "pending"
	BuildRunRuntimeRunning    BuildRuntimeState = "running"
	BuildRunRuntimeFinished   BuildRuntimeState = "finished"
	BuildRunRuntimeCanceled   BuildRuntimeState = "canceled"
	BuildRunRuntimeTerminated BuildRuntimeState = "terminated"
	BuildRunRuntimeTimedout   BuildRuntimeState = "timedout"
)

type BuildStage

type BuildStage string
const (
	BuildStagePrepareExecutor          BuildStage = "prepare_executor"
	BuildStagePrepare                  BuildStage = "prepare_script"
	BuildStageGetSources               BuildStage = "get_sources"
	BuildStageRestoreCache             BuildStage = "restore_cache"
	BuildStageDownloadArtifacts        BuildStage = "download_artifacts"
	BuildStageUserScript               BuildStage = "build_script"
	BuildStageAfterScript              BuildStage = "after_script"
	BuildStageArchiveCache             BuildStage = "archive_cache"
	BuildStageUploadOnSuccessArtifacts BuildStage = "upload_artifacts_on_success"
	BuildStageUploadOnFailureArtifacts BuildStage = "upload_artifacts_on_failure"
)

type Cache

type Cache struct {
	Key       string        `json:"key"`
	Untracked bool          `json:"untracked"`
	Policy    CachePolicy   `json:"policy"`
	Paths     ArtifactPaths `json:"paths"`
}

func (Cache) CheckPolicy

func (c Cache) CheckPolicy(wanted CachePolicy) (bool, error)

type CacheConfig

type CacheConfig struct {
	Type   string `toml:"Type,omitempty" long:"type" env:"CACHE_TYPE" description:"Select caching method"`
	Path   string `toml:"Path,omitempty" long:"path" env:"CACHE_PATH" description:"Name of the path to prepend to the cache URL"`
	Shared bool   `toml:"Shared,omitempty" long:"shared" env:"CACHE_SHARED" description:"Enable cache sharing between runners."`

	S3  *CacheS3Config  `toml:"s3,omitempty" json:"s3" namespace:"s3"`
	GCS *CacheGCSConfig `toml:"gcs,omitempty" json:"gcs" namespace:"gcs"`
}

func (*CacheConfig) GetPath

func (c *CacheConfig) GetPath() string

func (*CacheConfig) GetShared

func (c *CacheConfig) GetShared() bool

type CacheGCSConfig

type CacheGCSConfig struct {
	CacheGCSCredentials
	CredentialsFile string `` /* 169-byte string literal not displayed */
	BucketName      string `` /* 134-byte string literal not displayed */
}

type CacheGCSCredentials

type CacheGCSCredentials struct {
	AccessID   string `` /* 135-byte string literal not displayed */
	PrivateKey string `` /* 126-byte string literal not displayed */
}

type CachePolicy

type CachePolicy string
const (
	CachePolicyUndefined CachePolicy = ""
	CachePolicyPullPush  CachePolicy = "pull-push"
	CachePolicyPull      CachePolicy = "pull"
	CachePolicyPush      CachePolicy = "push"
)

type CacheS3Config

type CacheS3Config struct {
	ServerAddress  string `` /* 141-byte string literal not displayed */
	AccessKey      string `toml:"AccessKey,omitempty" long:"access-key" env:"CACHE_S3_ACCESS_KEY" description:"S3 Access Key"`
	SecretKey      string `toml:"SecretKey,omitempty" long:"secret-key" env:"CACHE_S3_SECRET_KEY" description:"S3 Secret Key"`
	BucketName     string `` /* 133-byte string literal not displayed */
	BucketLocation string `toml:"BucketLocation,omitempty" long:"bucket-location" env:"CACHE_S3_BUCKET_LOCATION" description:"Name of S3 region"`
	Insecure       bool   `toml:"Insecure,omitempty" long:"insecure" env:"CACHE_S3_INSECURE" description:"Use insecure mode (without https)"`
}

func (*CacheS3Config) ShouldUseIAMCredentials

func (c *CacheS3Config) ShouldUseIAMCredentials() bool

type Caches

type Caches []Cache

type Commander

type Commander interface {
	Execute(c *cli.Context)
}

type Config

type Config struct {
	ListenAddress string        `toml:"listen_address,omitempty" json:"listen_address"`
	SessionServer SessionServer `toml:"session_server,omitempty" json:"session_server"`

	Concurrent    int             `toml:"concurrent" json:"concurrent"`
	CheckInterval int             `toml:"check_interval" json:"check_interval" description:"Define active checking interval of jobs"`
	LogLevel      *string         `toml:"log_level" json:"log_level" description:"Define log level (one of: panic, fatal, error, warning, info, debug)"`
	LogFormat     *string         `toml:"log_format" json:"log_format" description:"Define log format (one of: runner, text, json)"`
	User          string          `toml:"user,omitempty" json:"user"`
	Runners       []*RunnerConfig `toml:"runners" json:"runners"`
	SentryDSN     *string         `toml:"sentry_dsn"`
	ModTime       time.Time       `toml:"-"`
	Loaded        bool            `toml:"-"`
}

func NewConfig

func NewConfig() *Config

func (*Config) GetCheckInterval

func (c *Config) GetCheckInterval() time.Duration

func (*Config) LoadConfig

func (c *Config) LoadConfig(configFile string) error

func (*Config) SaveConfig

func (c *Config) SaveConfig(configFile string) error

func (*Config) StatConfig

func (c *Config) StatConfig(configFile string) error

type Credentials

type Credentials struct {
	Type     string `json:"type"`
	URL      string `json:"url"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type CustomBuildDir

type CustomBuildDir struct {
	Enabled bool `` /* 137-byte string literal not displayed */
}

type CustomConfig

type CustomConfig struct {
	ConfigExec        string   `` /* 175-byte string literal not displayed */
	ConfigArgs        []string `toml:"config_args,omitempty" json:"config_args" long:"config-args" description:"Arguments for the config executable"`
	ConfigExecTimeout *int     `` /* 184-byte string literal not displayed */

	PrepareExec        string   `` /* 143-byte string literal not displayed */
	PrepareArgs        []string `toml:"prepare_args,omitempty" json:"prepare_args" long:"prepare-args" description:"Arguments for the prepare executable"`
	PrepareExecTimeout *int     `` /* 189-byte string literal not displayed */

	RunExec string   `` /* 131-byte string literal not displayed */
	RunArgs []string `toml:"run_args,omitempty" json:"run_args" long:"run-args" description:"Arguments for the run executable"`

	CleanupExec        string   `` /* 153-byte string literal not displayed */
	CleanupArgs        []string `toml:"cleanup_args,omitempty" json:"cleanup_args" long:"cleanup-args" description:"Arguments for the cleanup executable"`
	CleanupExecTimeout *int     `` /* 189-byte string literal not displayed */

	GracefulKillTimeout *int `` /* 312-byte string literal not displayed */
	ForceKillTimeout    *int `` /* 309-byte string literal not displayed */
}

type Dependencies

type Dependencies []Dependency

type Dependency

type Dependency struct {
	ID            int                     `json:"id"`
	Token         string                  `json:"token"`
	Name          string                  `json:"name"`
	ArtifactsFile DependencyArtifactsFile `json:"artifacts_file"`
}

type DependencyArtifactsFile

type DependencyArtifactsFile struct {
	Filename string `json:"filename"`
	Size     int64  `json:"size"`
}

type DockerConfig

type DockerConfig struct {
	docker_helpers.DockerCredentials
	Hostname                   string            `toml:"hostname,omitempty" json:"hostname" long:"hostname" env:"DOCKER_HOSTNAME" description:"Custom container hostname"`
	Image                      string            `toml:"image" json:"image" long:"image" env:"DOCKER_IMAGE" description:"Docker image to be used"`
	Runtime                    string            `toml:"runtime,omitempty" json:"runtime" long:"runtime" env:"DOCKER_RUNTIME" description:"Docker runtime to be used"`
	Memory                     string            `` /* 175-byte string literal not displayed */
	MemorySwap                 string            `` /* 201-byte string literal not displayed */
	MemoryReservation          string            `` /* 213-byte string literal not displayed */
	CPUSetCPUs                 string            `` /* 159-byte string literal not displayed */
	CPUS                       string            `toml:"cpus,omitempty" json:"cpus" long:"cpus" env:"DOCKER_CPUS" description:"Number of CPUs"`
	CPUShares                  int64             `toml:"cpu_shares,omitzero" json:"cpu_shares" long:"cpu-shares" env:"DOCKER_CPU_SHARES" description:"Number of CPU shares"`
	DNS                        []string          `toml:"dns,omitempty" json:"dns" long:"dns" env:"DOCKER_DNS" description:"A list of DNS servers for the container to use"`
	DNSSearch                  []string          `` /* 130-byte string literal not displayed */
	Privileged                 bool              `` /* 138-byte string literal not displayed */
	DisableEntrypointOverwrite bool              `` /* 254-byte string literal not displayed */
	UsernsMode                 string            `toml:"userns_mode,omitempty" json:"userns_mode" long:"userns" env:"DOCKER_USERNS_MODE" description:"User namespace to use"`
	CapAdd                     []string          `toml:"cap_add" json:"cap_add" long:"cap-add" env:"DOCKER_CAP_ADD" description:"Add Linux capabilities"`
	CapDrop                    []string          `toml:"cap_drop" json:"cap_drop" long:"cap-drop" env:"DOCKER_CAP_DROP" description:"Drop Linux capabilities"`
	OomKillDisable             bool              `` /* 200-byte string literal not displayed */
	OomScoreAdjust             int               `` /* 141-byte string literal not displayed */
	SecurityOpt                []string          `toml:"security_opt" json:"security_opt" long:"security-opt" env:"DOCKER_SECURITY_OPT" description:"Security Options"`
	Devices                    []string          `toml:"devices" json:"devices" long:"devices" env:"DOCKER_DEVICES" description:"Add a host device to the container"`
	DisableCache               bool              `` /* 142-byte string literal not displayed */
	Volumes                    []string          `` /* 284-byte string literal not displayed */
	VolumeDriver               string            `` /* 138-byte string literal not displayed */
	CacheDir                   string            `` /* 129-byte string literal not displayed */
	ExtraHosts                 []string          `` /* 137-byte string literal not displayed */
	VolumesFrom                []string          `` /* 161-byte string literal not displayed */
	NetworkMode                string            `` /* 143-byte string literal not displayed */
	Links                      []string          `toml:"links,omitempty" json:"links" long:"links" env:"DOCKER_LINKS" description:"Add link to another container"`
	Services                   []string          `` /* 136-byte string literal not displayed */
	WaitForServicesTimeout     int               `` /* 197-byte string literal not displayed */
	AllowedImages              []string          `` /* 142-byte string literal not displayed */
	AllowedServices            []string          `` /* 152-byte string literal not displayed */
	PullPolicy                 DockerPullPolicy  `` /* 154-byte string literal not displayed */
	ShmSize                    int64             `` /* 141-byte string literal not displayed */
	Tmpfs                      map[string]string `` /* 344-byte string literal not displayed */
	ServicesTmpfs              map[string]string `` /* 388-byte string literal not displayed */
	SysCtls                    DockerSysCtls     `` /* 178-byte string literal not displayed */
	HelperImage                string            `` /* 195-byte string literal not displayed */
}

func (*DockerConfig) GetMemory

func (c *DockerConfig) GetMemory() int64

func (*DockerConfig) GetMemoryReservation

func (c *DockerConfig) GetMemoryReservation() int64

func (*DockerConfig) GetMemorySwap

func (c *DockerConfig) GetMemorySwap() int64

func (*DockerConfig) GetNanoCPUs

func (c *DockerConfig) GetNanoCPUs() (int64, error)

func (*DockerConfig) GetOomKillDisable

func (c *DockerConfig) GetOomKillDisable() *bool

type DockerMachine

type DockerMachine struct {
	IdleCount      int      `long:"idle-nodes" env:"MACHINE_IDLE_COUNT" description:"Maximum idle machines"`
	IdleTime       int      `toml:"IdleTime,omitzero" long:"idle-time" env:"MACHINE_IDLE_TIME" description:"Minimum time after node can be destroyed"`
	MaxBuilds      int      `` /* 128-byte string literal not displayed */
	MachineDriver  string   `long:"machine-driver" env:"MACHINE_DRIVER" description:"The driver to use when creating machine"`
	MachineName    string   `long:"machine-name" env:"MACHINE_NAME" description:"The template for machine name (needs to include %s)"`
	MachineOptions []string `long:"machine-options" env:"MACHINE_OPTIONS" description:"Additional machine creation options"`

	OffPeakPeriods   []string `long:"off-peak-periods" env:"MACHINE_OFF_PEAK_PERIODS" description:"Time periods when the scheduler is in the OffPeak mode"`
	OffPeakTimezone  string   `long:"off-peak-timezone" env:"MACHINE_OFF_PEAK_TIMEZONE" description:"Timezone for the OffPeak periods (defaults to Local)"`
	OffPeakIdleCount int      `` /* 138-byte string literal not displayed */
	OffPeakIdleTime  int      `` /* 158-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*DockerMachine) CompileOffPeakPeriods

func (c *DockerMachine) CompileOffPeakPeriods() (err error)

func (*DockerMachine) GetIdleCount

func (c *DockerMachine) GetIdleCount() int

func (*DockerMachine) GetIdleTime

func (c *DockerMachine) GetIdleTime() int

type DockerPullPolicy

type DockerPullPolicy string

func (DockerPullPolicy) Get

Get returns one of the predefined values or returns an error if the value can't match the predefined

type DockerSysCtls

type DockerSysCtls map[string]string

type DownloadState

type DownloadState int
const (
	DownloadSucceeded DownloadState = iota
	DownloadForbidden
	DownloadFailed
	DownloadNotFound
)

type Executor

type Executor interface {
	Shell() *ShellScriptInfo
	Prepare(options ExecutorPrepareOptions) error
	Run(cmd ExecutorCommand) error
	Finish(err error)
	Cleanup()
	GetCurrentStage() ExecutorStage
	SetCurrentStage(stage ExecutorStage)
}

func NewExecutor

func NewExecutor(executor string) Executor

type ExecutorCommand

type ExecutorCommand struct {
	Script     string
	Stage      BuildStage
	Predefined bool
	Context    context.Context
}

type ExecutorData

type ExecutorData interface{}

type ExecutorPrepareOptions

type ExecutorPrepareOptions struct {
	Config  *RunnerConfig
	Build   *Build
	Trace   JobTrace
	User    string
	Context context.Context
}

type ExecutorProvider

type ExecutorProvider interface {
	CanCreate() bool
	Create() Executor
	Acquire(config *RunnerConfig) (ExecutorData, error)
	Release(config *RunnerConfig, data ExecutorData)
	GetFeatures(features *FeaturesInfo) error
	GetDefaultShell() string
}

func GetExecutor

func GetExecutor(executor string) ExecutorProvider

func GetExecutorProviders

func GetExecutorProviders() (providers []ExecutorProvider)

type ExecutorStage

type ExecutorStage string
const (
	ExecutorStageCreated ExecutorStage = "created"
	ExecutorStagePrepare ExecutorStage = "prepare"
	ExecutorStageFinish  ExecutorStage = "finish"
	ExecutorStageCleanup ExecutorStage = "cleanup"
)

type FailuresCollector

type FailuresCollector interface {
	RecordFailure(reason JobFailureReason, runnerDescription string)
}

type FeaturesInfo

type FeaturesInfo struct {
	Variables               bool `json:"variables"`
	Image                   bool `json:"image"`
	Services                bool `json:"services"`
	Artifacts               bool `json:"artifacts"`
	Cache                   bool `json:"cache"`
	Shared                  bool `json:"shared"`
	UploadMultipleArtifacts bool `json:"upload_multiple_artifacts"`
	UploadRawArtifacts      bool `json:"upload_raw_artifacts"`
	Session                 bool `json:"session"`
	Terminal                bool `json:"terminal"`
	Refspecs                bool `json:"refspecs"`
	Masking                 bool `json:"masking"`
	Proxy                   bool `json:"proxy"`
}

type GitInfo

type GitInfo struct {
	RepoURL   string         `json:"repo_url"`
	Ref       string         `json:"ref"`
	Sha       string         `json:"sha"`
	BeforeSha string         `json:"before_sha"`
	RefType   GitInfoRefType `json:"ref_type"`
	Refspecs  []string       `json:"refspecs"`
	Depth     int            `json:"depth"`
}

func GetGitInfo

func GetGitInfo(url string) GitInfo

func GetLFSGitInfo

func GetLFSGitInfo(url string) GitInfo

func GetSubmoduleLFSGitInfo

func GetSubmoduleLFSGitInfo(url string) GitInfo

type GitInfoRefType

type GitInfoRefType string
const (
	RefTypeBranch GitInfoRefType = "branch"
	RefTypeTag    GitInfoRefType = "tag"
)

type GitStrategy

type GitStrategy int
const (
	GitClone GitStrategy = iota
	GitFetch
	GitNone
)

type GitlabFeatures

type GitlabFeatures struct {
	TraceSections bool `json:"trace_sections"`
}

type Image

type Image struct {
	Name       string   `json:"name"`
	Alias      string   `json:"alias,omitempty"`
	Command    []string `json:"command,omitempty"`
	Entrypoint []string `json:"entrypoint,omitempty"`
	Ports      []Port   `json:"ports,omitempty"`
}

type JobCredentials

type JobCredentials struct {
	ID          int    `long:"id" env:"CI_JOB_ID" description:"The build ID to upload artifacts for"`
	Token       string `long:"token" env:"CI_JOB_TOKEN" required:"true" description:"Build token"`
	URL         string `long:"url" env:"CI_SERVER_URL" required:"true" description:"GitLab CI URL"`
	TLSCAFile   string `` /* 129-byte string literal not displayed */
	TLSCertFile string `` /* 141-byte string literal not displayed */
	TLSKeyFile  string `` /* 139-byte string literal not displayed */
}

func (*JobCredentials) GetTLSCAFile

func (j *JobCredentials) GetTLSCAFile() string

func (*JobCredentials) GetTLSCertFile

func (j *JobCredentials) GetTLSCertFile() string

func (*JobCredentials) GetTLSKeyFile

func (j *JobCredentials) GetTLSKeyFile() string

func (*JobCredentials) GetToken

func (j *JobCredentials) GetToken() string

func (*JobCredentials) GetURL

func (j *JobCredentials) GetURL() string

type JobFailureReason

type JobFailureReason string
const (
	NoneFailure         JobFailureReason = ""
	ScriptFailure       JobFailureReason = "script_failure"
	RunnerSystemFailure JobFailureReason = "runner_system_failure"
	JobExecutionTimeout JobFailureReason = "job_execution_timeout"
)

type JobInfo

type JobInfo struct {
	Name        string `json:"name"`
	Stage       string `json:"stage"`
	ProjectID   int    `json:"project_id"`
	ProjectName string `json:"project_name"`
}

type JobRequest

type JobRequest struct {
	Info       VersionInfo  `json:"info,omitempty"`
	Token      string       `json:"token,omitempty"`
	LastUpdate string       `json:"last_update,omitempty"`
	Session    *SessionInfo `json:"session,omitempty"`
}

type JobResponse

type JobResponse struct {
	ID            int            `json:"id"`
	Token         string         `json:"token"`
	AllowGitFetch bool           `json:"allow_git_fetch"`
	JobInfo       JobInfo        `json:"job_info"`
	GitInfo       GitInfo        `json:"git_info"`
	RunnerInfo    RunnerInfo     `json:"runner_info"`
	Variables     JobVariables   `json:"variables"`
	Steps         Steps          `json:"steps"`
	Image         Image          `json:"image"`
	Services      Services       `json:"services"`
	Artifacts     Artifacts      `json:"artifacts"`
	Cache         Caches         `json:"cache"`
	Credentials   []Credentials  `json:"credentials"`
	Dependencies  Dependencies   `json:"dependencies"`
	Features      GitlabFeatures `json:"features"`

	TLSCAChain  string `json:"-"`
	TLSAuthCert string `json:"-"`
	TLSAuthKey  string `json:"-"`
}

func GetFailedBuild

func GetFailedBuild() (JobResponse, error)

func GetLocalBuildResponse

func GetLocalBuildResponse(commands ...string) (JobResponse, error)

func GetLongRunningBuild

func GetLongRunningBuild() (JobResponse, error)

func GetMultilineBashBuild

func GetMultilineBashBuild() (JobResponse, error)

func GetMultilineBashBuildCmd

func GetMultilineBashBuildCmd() (JobResponse, error)

func GetMultilineBashBuildPowerShell

func GetMultilineBashBuildPowerShell() (JobResponse, error)

func GetRemoteBrokenTLSBuild

func GetRemoteBrokenTLSBuild() (JobResponse, error)

func GetRemoteBuildResponse

func GetRemoteBuildResponse(commands ...string) (JobResponse, error)

func GetRemoteFailedBuild

func GetRemoteFailedBuild() (JobResponse, error)

func GetRemoteGitLabComTLSBuild

func GetRemoteGitLabComTLSBuild() (JobResponse, error)

func GetRemoteLongRunningBuild

func GetRemoteLongRunningBuild() (JobResponse, error)

func GetRemoteSuccessfulBuild

func GetRemoteSuccessfulBuild() (JobResponse, error)

func GetRemoteSuccessfulBuildWithAfterScript

func GetRemoteSuccessfulBuildWithAfterScript() (JobResponse, error)

func GetRemoteSuccessfulBuildWithDumpedVariables

func GetRemoteSuccessfulBuildWithDumpedVariables() (JobResponse, error)

func GetRemoteSuccessfulLFSBuild

func GetRemoteSuccessfulLFSBuild() (JobResponse, error)

func GetSuccessfulBuild

func GetSuccessfulBuild() (JobResponse, error)

func (*JobResponse) RepoCleanURL

func (j *JobResponse) RepoCleanURL() string

type JobState

type JobState string
const (
	Pending JobState = "pending"
	Running JobState = "running"
	Failed  JobState = "failed"
	Success JobState = "success"
)

type JobTrace

type JobTrace interface {
	io.Writer
	Success()
	Fail(err error, failureReason JobFailureReason)
	SetCancelFunc(cancelFunc context.CancelFunc)
	SetFailuresCollector(fc FailuresCollector)
	SetMasked(values []string)
	IsStdout() bool
}

type JobVariable

type JobVariable struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	Public   bool   `json:"public"`
	Internal bool   `json:"-"`
	File     bool   `json:"file"`
	Masked   bool   `json:"masked"`
}

func ParseVariable

func ParseVariable(text string) (variable JobVariable, err error)

func (JobVariable) String

func (b JobVariable) String() string

type JobVariables

type JobVariables []JobVariable

func (JobVariables) Expand

func (b JobVariables) Expand() (variables JobVariables)

func (JobVariables) ExpandValue

func (b JobVariables) ExpandValue(value string) string

func (JobVariables) Get

func (b JobVariables) Get(key string) string

func (JobVariables) Masked

func (b JobVariables) Masked() (masked []string)

func (JobVariables) PublicOrInternal

func (b JobVariables) PublicOrInternal() (variables JobVariables)

func (JobVariables) StringList

func (b JobVariables) StringList() (variables []string)

type KubernetesConfig

type KubernetesConfig struct {
	Host                           string                       `` /* 151-byte string literal not displayed */
	CertFile                       string                       `` /* 145-byte string literal not displayed */
	KeyFile                        string                       `` /* 141-byte string literal not displayed */
	CAFile                         string                       `` /* 140-byte string literal not displayed */
	BearerTokenOverwriteAllowed    bool                         `` /* 248-byte string literal not displayed */
	BearerToken                    string                       `` /* 181-byte string literal not displayed */
	Image                          string                       `` /* 137-byte string literal not displayed */
	Namespace                      string                       `` /* 127-byte string literal not displayed */
	NamespaceOverwriteAllowed      string                       `` /* 220-byte string literal not displayed */
	Privileged                     bool                         `` /* 156-byte string literal not displayed */
	CPULimit                       string                       `` /* 146-byte string literal not displayed */
	MemoryLimit                    string                       `` /* 164-byte string literal not displayed */
	ServiceCPULimit                string                       `` /* 186-byte string literal not displayed */
	ServiceMemoryLimit             string                       `` /* 204-byte string literal not displayed */
	HelperCPULimit                 string                       `` /* 181-byte string literal not displayed */
	HelperMemoryLimit              string                       `` /* 199-byte string literal not displayed */
	CPURequest                     string                       `` /* 159-byte string literal not displayed */
	MemoryRequest                  string                       `` /* 174-byte string literal not displayed */
	ServiceCPURequest              string                       `` /* 199-byte string literal not displayed */
	ServiceMemoryRequest           string                       `` /* 213-byte string literal not displayed */
	HelperCPURequest               string                       `` /* 194-byte string literal not displayed */
	HelperMemoryRequest            string                       `` /* 208-byte string literal not displayed */
	PullPolicy                     KubernetesPullPolicy         `` /* 231-byte string literal not displayed */
	NodeSelector                   map[string]string            `` /* 270-byte string literal not displayed */
	NodeTolerations                map[string]string            `` /* 344-byte string literal not displayed */
	ImagePullSecrets               []string                     `` /* 205-byte string literal not displayed */
	HelperImage                    string                       `` /* 199-byte string literal not displayed */
	TerminationGracePeriodSeconds  int64                        `` /* 330-byte string literal not displayed */
	PollInterval                   int                          `` /* 224-byte string literal not displayed */
	PollTimeout                    int                          `` /* 325-byte string literal not displayed */
	PodLabels                      map[string]string            `` /* 268-byte string literal not displayed */
	ServiceAccount                 string                       `` /* 195-byte string literal not displayed */
	ServiceAccountOverwriteAllowed string                       `` /* 240-byte string literal not displayed */
	PodAnnotations                 map[string]string            `` /* 296-byte string literal not displayed */
	PodAnnotationsOverwriteAllowed string                       `` /* 243-byte string literal not displayed */
	PodSecurityContext             KubernetesPodSecurityContext `` /* 130-byte string literal not displayed */
	Volumes                        KubernetesVolumes            `toml:"volumes"`
	Services                       []Service                    `toml:"services,omitempty" json:"services" long:"services" description:"Add service that is started with container"`
}

func (*KubernetesConfig) GetNodeTolerations

func (c *KubernetesConfig) GetNodeTolerations() []api.Toleration

func (*KubernetesConfig) GetPodSecurityContext

func (c *KubernetesConfig) GetPodSecurityContext() *api.PodSecurityContext

func (*KubernetesConfig) GetPollAttempts

func (c *KubernetesConfig) GetPollAttempts() int

func (*KubernetesConfig) GetPollInterval

func (c *KubernetesConfig) GetPollInterval() int

type KubernetesConfigMap

type KubernetesConfigMap struct {
	Name      string            `toml:"name" json:"name" description:"The name of the volume and ConfigMap to use"`
	MountPath string            `toml:"mount_path" description:"Path where volume should be mounted inside of container"`
	ReadOnly  bool              `toml:"read_only,omitempty" description:"If this volume should be mounted read only"`
	Items     map[string]string `toml:"items,omitempty" description:"Key-to-path mapping for keys from the config map that should be used."`
}

type KubernetesEmptyDir

type KubernetesEmptyDir struct {
	Name      string `toml:"name" json:"name" description:"The name of the volume and EmptyDir to use"`
	MountPath string `toml:"mount_path" description:"Path where volume should be mounted inside of container"`
	Medium    string `toml:"medium,omitempty" description:"Set to 'Memory' to have a tmpfs"`
}

type KubernetesHostPath

type KubernetesHostPath struct {
	Name      string `toml:"name" json:"name" description:"The name of the volume"`
	MountPath string `toml:"mount_path" description:"Path where volume should be mounted inside of container"`
	ReadOnly  bool   `toml:"read_only,omitempty" description:"If this volume should be mounted read only"`
	HostPath  string `toml:"host_path,omitempty" description:"Path from the host that should be mounted as a volume"`
}

type KubernetesPVC

type KubernetesPVC struct {
	Name      string `toml:"name" json:"name" description:"The name of the volume and PVC to use"`
	MountPath string `toml:"mount_path" description:"Path where volume should be mounted inside of container"`
	ReadOnly  bool   `toml:"read_only,omitempty" description:"If this volume should be mounted read only"`
}

type KubernetesPodSecurityContext

type KubernetesPodSecurityContext struct {
	FSGroup            *int64  `` /* 171-byte string literal not displayed */
	RunAsGroup         *int64  `` /* 169-byte string literal not displayed */
	RunAsNonRoot       *bool   `` /* 180-byte string literal not displayed */
	RunAsUser          *int64  `` /* 166-byte string literal not displayed */
	SupplementalGroups []int64 `` /* 189-byte string literal not displayed */
}

type KubernetesPullPolicy

type KubernetesPullPolicy string

func (KubernetesPullPolicy) Get

Get returns one of the predefined values in kubernetes notation or returns an error if the value can't match the predefined

type KubernetesSecret

type KubernetesSecret struct {
	Name      string            `toml:"name" json:"name" description:"The name of the volume and Secret to use"`
	MountPath string            `toml:"mount_path" description:"Path where volume should be mounted inside of container"`
	ReadOnly  bool              `toml:"read_only,omitempty" description:"If this volume should be mounted read only"`
	Items     map[string]string `toml:"items,omitempty" description:"Key-to-path mapping for keys from the secret that should be used."`
}

type KubernetesVolumes

type KubernetesVolumes struct {
	HostPaths  []KubernetesHostPath  `toml:"host_path" description:"The host paths which will be mounted"`
	PVCs       []KubernetesPVC       `toml:"pvc" description:"The persistent volume claims that will be mounted"`
	ConfigMaps []KubernetesConfigMap `toml:"config_map" description:"The config maps which will be mounted as volumes"`
	Secrets    []KubernetesSecret    `toml:"secret" description:"The secret maps which will be mounted"`
	EmptyDirs  []KubernetesEmptyDir  `toml:"empty_dir" description:"The empty dirs which will be mounted"`
}

type MockCommander

type MockCommander struct {
	mock.Mock
}

MockCommander is an autogenerated mock type for the Commander type

func (*MockCommander) Execute

func (_m *MockCommander) Execute(c *cli.Context)

Execute provides a mock function with given fields: c

type MockExecutor

type MockExecutor struct {
	mock.Mock
}

MockExecutor is an autogenerated mock type for the Executor type

func (*MockExecutor) Cleanup

func (_m *MockExecutor) Cleanup()

Cleanup provides a mock function with given fields:

func (*MockExecutor) Finish

func (_m *MockExecutor) Finish(err error)

Finish provides a mock function with given fields: err

func (*MockExecutor) GetCurrentStage

func (_m *MockExecutor) GetCurrentStage() ExecutorStage

GetCurrentStage provides a mock function with given fields:

func (*MockExecutor) Prepare

func (_m *MockExecutor) Prepare(options ExecutorPrepareOptions) error

Prepare provides a mock function with given fields: options

func (*MockExecutor) Run

func (_m *MockExecutor) Run(cmd ExecutorCommand) error

Run provides a mock function with given fields: cmd

func (*MockExecutor) SetCurrentStage

func (_m *MockExecutor) SetCurrentStage(stage ExecutorStage)

SetCurrentStage provides a mock function with given fields: stage

func (*MockExecutor) Shell

func (_m *MockExecutor) Shell() *ShellScriptInfo

Shell provides a mock function with given fields:

type MockExecutorData

type MockExecutorData struct {
	mock.Mock
}

MockExecutorData is an autogenerated mock type for the ExecutorData type

type MockExecutorProvider

type MockExecutorProvider struct {
	mock.Mock
}

MockExecutorProvider is an autogenerated mock type for the ExecutorProvider type

func (*MockExecutorProvider) Acquire

func (_m *MockExecutorProvider) Acquire(config *RunnerConfig) (ExecutorData, error)

Acquire provides a mock function with given fields: config

func (*MockExecutorProvider) CanCreate

func (_m *MockExecutorProvider) CanCreate() bool

CanCreate provides a mock function with given fields:

func (*MockExecutorProvider) Create

func (_m *MockExecutorProvider) Create() Executor

Create provides a mock function with given fields:

func (*MockExecutorProvider) GetDefaultShell

func (_m *MockExecutorProvider) GetDefaultShell() string

GetDefaultShell provides a mock function with given fields:

func (*MockExecutorProvider) GetFeatures

func (_m *MockExecutorProvider) GetFeatures(features *FeaturesInfo) error

GetFeatures provides a mock function with given fields: features

func (*MockExecutorProvider) Release

func (_m *MockExecutorProvider) Release(config *RunnerConfig, data ExecutorData)

Release provides a mock function with given fields: config, data

type MockFailuresCollector

type MockFailuresCollector struct {
	mock.Mock
}

MockFailuresCollector is an autogenerated mock type for the FailuresCollector type

func (*MockFailuresCollector) RecordFailure

func (_m *MockFailuresCollector) RecordFailure(reason JobFailureReason, runnerDescription string)

RecordFailure provides a mock function with given fields: reason, runnerDescription

type MockJobTrace

type MockJobTrace struct {
	mock.Mock
}

MockJobTrace is an autogenerated mock type for the JobTrace type

func (*MockJobTrace) Fail

func (_m *MockJobTrace) Fail(err error, failureReason JobFailureReason)

Fail provides a mock function with given fields: err, failureReason

func (*MockJobTrace) IsStdout

func (_m *MockJobTrace) IsStdout() bool

IsStdout provides a mock function with given fields:

func (*MockJobTrace) SetCancelFunc

func (_m *MockJobTrace) SetCancelFunc(cancelFunc context.CancelFunc)

SetCancelFunc provides a mock function with given fields: cancelFunc

func (*MockJobTrace) SetFailuresCollector

func (_m *MockJobTrace) SetFailuresCollector(fc FailuresCollector)

SetFailuresCollector provides a mock function with given fields: fc

func (*MockJobTrace) SetMasked

func (_m *MockJobTrace) SetMasked(values []string)

SetMasked provides a mock function with given fields: values

func (*MockJobTrace) Success

func (_m *MockJobTrace) Success()

Success provides a mock function with given fields:

func (*MockJobTrace) Write

func (_m *MockJobTrace) Write(p []byte) (int, error)

Write provides a mock function with given fields: p

type MockNetwork

type MockNetwork struct {
	mock.Mock
}

MockNetwork is an autogenerated mock type for the Network type

func (*MockNetwork) DownloadArtifacts

func (_m *MockNetwork) DownloadArtifacts(config JobCredentials, artifactsFile string) DownloadState

DownloadArtifacts provides a mock function with given fields: config, artifactsFile

func (*MockNetwork) PatchTrace

func (_m *MockNetwork) PatchTrace(config RunnerConfig, jobCredentials *JobCredentials, content []byte, startOffset int) (int, UpdateState)

PatchTrace provides a mock function with given fields: config, jobCredentials, content, startOffset

func (*MockNetwork) ProcessJob

func (_m *MockNetwork) ProcessJob(config RunnerConfig, buildCredentials *JobCredentials) (JobTrace, error)

ProcessJob provides a mock function with given fields: config, buildCredentials

func (*MockNetwork) RegisterRunner

func (_m *MockNetwork) RegisterRunner(config RunnerCredentials, parameters RegisterRunnerParameters) *RegisterRunnerResponse

RegisterRunner provides a mock function with given fields: config, parameters

func (*MockNetwork) RequestJob

func (_m *MockNetwork) RequestJob(config RunnerConfig, sessionInfo *SessionInfo) (*JobResponse, bool)

RequestJob provides a mock function with given fields: config, sessionInfo

func (*MockNetwork) UnregisterRunner

func (_m *MockNetwork) UnregisterRunner(config RunnerCredentials) bool

UnregisterRunner provides a mock function with given fields: config

func (*MockNetwork) UpdateJob

func (_m *MockNetwork) UpdateJob(config RunnerConfig, jobCredentials *JobCredentials, jobInfo UpdateJobInfo) UpdateState

UpdateJob provides a mock function with given fields: config, jobCredentials, jobInfo

func (*MockNetwork) UploadRawArtifacts

func (_m *MockNetwork) UploadRawArtifacts(config JobCredentials, reader io.Reader, options ArtifactsOptions) UploadState

UploadRawArtifacts provides a mock function with given fields: config, reader, options

func (*MockNetwork) VerifyRunner

func (_m *MockNetwork) VerifyRunner(config RunnerCredentials) bool

VerifyRunner provides a mock function with given fields: config

type MockShell

type MockShell struct {
	mock.Mock
}

MockShell is an autogenerated mock type for the Shell type

func (*MockShell) GenerateScript

func (_m *MockShell) GenerateScript(buildStage BuildStage, info ShellScriptInfo) (string, error)

GenerateScript provides a mock function with given fields: buildStage, info

func (*MockShell) GetConfiguration

func (_m *MockShell) GetConfiguration(info ShellScriptInfo) (*ShellConfiguration, error)

GetConfiguration provides a mock function with given fields: info

func (*MockShell) GetFeatures

func (_m *MockShell) GetFeatures(features *FeaturesInfo)

GetFeatures provides a mock function with given fields: features

func (*MockShell) GetName

func (_m *MockShell) GetName() string

GetName provides a mock function with given fields:

func (*MockShell) IsDefault

func (_m *MockShell) IsDefault() bool

IsDefault provides a mock function with given fields:

type Network

type Network interface {
	RegisterRunner(config RunnerCredentials, parameters RegisterRunnerParameters) *RegisterRunnerResponse
	VerifyRunner(config RunnerCredentials) bool
	UnregisterRunner(config RunnerCredentials) bool
	RequestJob(config RunnerConfig, sessionInfo *SessionInfo) (*JobResponse, bool)
	UpdateJob(config RunnerConfig, jobCredentials *JobCredentials, jobInfo UpdateJobInfo) UpdateState
	PatchTrace(config RunnerConfig, jobCredentials *JobCredentials, content []byte, startOffset int) (int, UpdateState)
	DownloadArtifacts(config JobCredentials, artifactsFile string) DownloadState
	UploadRawArtifacts(config JobCredentials, reader io.Reader, options ArtifactsOptions) UploadState
	ProcessJob(config RunnerConfig, buildCredentials *JobCredentials) (JobTrace, error)
}

type ParallelsConfig

type ParallelsConfig struct {
	BaseName         string `toml:"base_name" json:"base_name" long:"base-name" env:"PARALLELS_BASE_NAME" description:"VM name to be used"`
	TemplateName     string `` /* 142-byte string literal not displayed */
	DisableSnapshots bool   `` /* 174-byte string literal not displayed */
	TimeServer       string `` /* 176-byte string literal not displayed */
}

type Port

type Port struct {
	Number   int    `json:"number,omitempty"`
	Protocol string `json:"protocol,omitempty"`
	Name     string `json:"name,omitempty"`
}

type RegisterRunnerParameters

type RegisterRunnerParameters struct {
	Description    string `json:"description,omitempty"`
	Tags           string `json:"tag_list,omitempty"`
	RunUntagged    bool   `json:"run_untagged"`
	Locked         bool   `json:"locked"`
	AccessLevel    string `json:"access_level,omitempty"`
	MaximumTimeout int    `json:"maximum_timeout,omitempty"`
	Active         bool   `json:"active"`
}

type RegisterRunnerRequest

type RegisterRunnerRequest struct {
	RegisterRunnerParameters
	Info  VersionInfo `json:"info,omitempty"`
	Token string      `json:"token,omitempty"`
}

type RegisterRunnerResponse

type RegisterRunnerResponse struct {
	Token string `json:"token,omitempty"`
}

type RunnerConfig

type RunnerConfig struct {
	Name               string `toml:"name" json:"name" short:"name" long:"description" env:"RUNNER_NAME" description:"Runner name"`
	Limit              int    `` /* 130-byte string literal not displayed */
	OutputLimit        int    `` /* 126-byte string literal not displayed */
	RequestConcurrency int    `` /* 146-byte string literal not displayed */

	RunnerCredentials
	RunnerSettings
}

func (*RunnerConfig) DeepCopy

func (c *RunnerConfig) DeepCopy() (*RunnerConfig, error)

DeepCopy attempts to make a deep clone of the object

func (*RunnerConfig) GetRequestConcurrency

func (c *RunnerConfig) GetRequestConcurrency() int

func (*RunnerConfig) GetVariables

func (c *RunnerConfig) GetVariables() JobVariables

func (*RunnerConfig) String

func (c *RunnerConfig) String() string

type RunnerCredentials

type RunnerCredentials struct {
	URL         string `toml:"url" json:"url" short:"u" long:"url" env:"CI_SERVER_URL" required:"true" description:"Runner URL"`
	Token       string `toml:"token" json:"token" short:"t" long:"token" env:"CI_SERVER_TOKEN" required:"true" description:"Runner token"`
	TLSCAFile   string `` /* 177-byte string literal not displayed */
	TLSCertFile string `` /* 181-byte string literal not displayed */
	TLSKeyFile  string `` /* 177-byte string literal not displayed */
}

func (*RunnerCredentials) GetTLSCAFile

func (c *RunnerCredentials) GetTLSCAFile() string

func (*RunnerCredentials) GetTLSCertFile

func (c *RunnerCredentials) GetTLSCertFile() string

func (*RunnerCredentials) GetTLSKeyFile

func (c *RunnerCredentials) GetTLSKeyFile() string

func (*RunnerCredentials) GetToken

func (c *RunnerCredentials) GetToken() string

func (*RunnerCredentials) GetURL

func (c *RunnerCredentials) GetURL() string

func (*RunnerCredentials) Log

func (c *RunnerCredentials) Log() *logrus.Entry

func (*RunnerCredentials) SameAs

func (c *RunnerCredentials) SameAs(other *RunnerCredentials) bool

func (*RunnerCredentials) ShortDescription

func (c *RunnerCredentials) ShortDescription() string

func (*RunnerCredentials) UniqueID

func (c *RunnerCredentials) UniqueID() string

type RunnerInfo

type RunnerInfo struct {
	Timeout int `json:"timeout"`
}

type RunnerSettings

type RunnerSettings struct {
	Executor  string `` /* 140-byte string literal not displayed */
	BuildsDir string `` /* 135-byte string literal not displayed */
	CacheDir  string `` /* 135-byte string literal not displayed */
	CloneURL  string `` /* 151-byte string literal not displayed */

	Environment     []string `` /* 148-byte string literal not displayed */
	PreCloneScript  string   `` /* 187-byte string literal not displayed */
	PreBuildScript  string   `` /* 214-byte string literal not displayed */
	PostBuildScript string   `` /* 220-byte string literal not displayed */

	DebugTraceDisabled bool `` /* 230-byte string literal not displayed */

	Shell string `toml:"shell,omitempty" json:"shell" long:"shell" env:"RUNNER_SHELL" description:"Select bash, cmd or powershell"`

	CustomBuildDir *CustomBuildDir   `toml:"custom_build_dir,omitempty" json:"custom_build_dir" group:"custom build dir configuration" namespace:"custom_build_dir"`
	SSH            *ssh.Config       `toml:"ssh,omitempty" json:"ssh" group:"ssh executor" namespace:"ssh"`
	Docker         *DockerConfig     `toml:"docker,omitempty" json:"docker" group:"docker executor" namespace:"docker"`
	Parallels      *ParallelsConfig  `toml:"parallels,omitempty" json:"parallels" group:"parallels executor" namespace:"parallels"`
	VirtualBox     *VirtualBoxConfig `toml:"virtualbox,omitempty" json:"virtualbox" group:"virtualbox executor" namespace:"virtualbox"`
	Cache          *CacheConfig      `toml:"cache,omitempty" json:"cache" group:"cache configuration" namespace:"cache"`
	Machine        *DockerMachine    `toml:"machine,omitempty" json:"machine" group:"docker machine provider" namespace:"machine"`
	Kubernetes     *KubernetesConfig `toml:"kubernetes,omitempty" json:"kubernetes" group:"kubernetes executor" namespace:"kubernetes"`
	Custom         *CustomConfig     `toml:"custom,omitempty" json:"custom" group:"custom executor" namespace:"custom"`
}

type Service

type Service struct {
	Name string `toml:"name" long:"name" description:"The image path for the service"`
}

type Services

type Services []Image

type SessionInfo

type SessionInfo struct {
	URL           string `json:"url,omitempty"`
	Certificate   string `json:"certificate,omitempty"`
	Authorization string `json:"authorization,omitempty"`
}

type SessionServer

type SessionServer struct {
	ListenAddress    string `toml:"listen_address,omitempty" json:"listen_address" description:"Address that the runner will communicate directly with"`
	AdvertiseAddress string `` /* 150-byte string literal not displayed */
	SessionTimeout   int    `` /* 147-byte string literal not displayed */
}

func (*SessionServer) GetSessionTimeout

func (c *SessionServer) GetSessionTimeout() time.Duration

type Shell

type Shell interface {
	GetName() string
	GetFeatures(features *FeaturesInfo)
	IsDefault() bool

	GetConfiguration(info ShellScriptInfo) (*ShellConfiguration, error)
	GenerateScript(buildStage BuildStage, info ShellScriptInfo) (string, error)
}

func GetShell

func GetShell(shell string) Shell

type ShellConfiguration

type ShellConfiguration struct {
	Environment   []string
	DockerCommand []string
	Command       string
	Arguments     []string
	PassFile      bool
	Extension     string
}

func GetShellConfiguration

func GetShellConfiguration(info ShellScriptInfo) (*ShellConfiguration, error)

func (*ShellConfiguration) GetCommandWithArguments

func (s *ShellConfiguration) GetCommandWithArguments() []string

func (*ShellConfiguration) String

func (s *ShellConfiguration) String() string

type ShellScriptInfo

type ShellScriptInfo struct {
	Shell           string
	Build           *Build
	Type            ShellType
	User            string
	RunnerCommand   string
	PreCloneScript  string
	PreBuildScript  string
	PostBuildScript string
}

type ShellType

type ShellType int
const (
	NormalShell ShellType = iota
	LoginShell
)

type Step

type Step struct {
	Name         StepName   `json:"name"`
	Script       StepScript `json:"script"`
	Timeout      int        `json:"timeout"`
	When         StepWhen   `json:"when"`
	AllowFailure bool       `json:"allow_failure"`
}

type StepName

type StepName string
const (
	StepNameScript      StepName = "script"
	StepNameAfterScript StepName = "after_script"
)

type StepScript

type StepScript []string

type StepWhen

type StepWhen string
const (
	StepWhenOnFailure StepWhen = "on_failure"
	StepWhenOnSuccess StepWhen = "on_success"
	StepWhenAlways    StepWhen = "always"
)

type Steps

type Steps []Step

type SubmoduleStrategy

type SubmoduleStrategy int
const (
	SubmoduleInvalid SubmoduleStrategy = iota
	SubmoduleNone
	SubmoduleNormal
	SubmoduleRecursive
)

type Trace

type Trace struct {
	Writer     io.Writer
	CancelFunc context.CancelFunc
	// contains filtered or unexported fields
}

func (*Trace) Fail

func (s *Trace) Fail(err error, failureReason JobFailureReason)

func (*Trace) IsStdout

func (s *Trace) IsStdout() bool

func (*Trace) SetCancelFunc

func (s *Trace) SetCancelFunc(cancelFunc context.CancelFunc)

func (*Trace) SetFailuresCollector

func (s *Trace) SetFailuresCollector(fc FailuresCollector)

func (*Trace) SetMasked

func (s *Trace) SetMasked(values []string)

func (*Trace) Success

func (s *Trace) Success()

func (*Trace) Write

func (s *Trace) Write(p []byte) (n int, err error)

type UnregisterRunnerRequest

type UnregisterRunnerRequest struct {
	Token string `json:"token,omitempty"`
}

type UpdateJobInfo

type UpdateJobInfo struct {
	ID            int
	State         JobState
	FailureReason JobFailureReason
}

type UpdateJobRequest

type UpdateJobRequest struct {
	Info          VersionInfo      `json:"info,omitempty"`
	Token         string           `json:"token,omitempty"`
	State         JobState         `json:"state,omitempty"`
	FailureReason JobFailureReason `json:"failure_reason,omitempty"`
}

type UpdateState

type UpdateState int
const (
	UpdateSucceeded UpdateState = iota
	UpdateNotFound
	UpdateAbort
	UpdateFailed
	UpdateRangeMismatch
)

type UploadState

type UploadState int
const (
	UploadSucceeded UploadState = iota
	UploadTooLarge
	UploadForbidden
	UploadFailed
)

type VerifyRunnerRequest

type VerifyRunnerRequest struct {
	Token string `json:"token,omitempty"`
}

type VersionInfo

type VersionInfo struct {
	Name         string       `json:"name,omitempty"`
	Version      string       `json:"version,omitempty"`
	Revision     string       `json:"revision,omitempty"`
	Platform     string       `json:"platform,omitempty"`
	Architecture string       `json:"architecture,omitempty"`
	Executor     string       `json:"executor,omitempty"`
	Shell        string       `json:"shell,omitempty"`
	Features     FeaturesInfo `json:"features"`
}

type VirtualBoxConfig

type VirtualBoxConfig struct {
	BaseName         string `toml:"base_name" json:"base_name" long:"base-name" env:"VIRTUALBOX_BASE_NAME" description:"VM name to be used"`
	BaseSnapshot     string `` /* 165-byte string literal not displayed */
	DisableSnapshots bool   `` /* 175-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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