Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateShellScript(buildStage BuildStage, info ShellScriptInfo) (string, error)
- func GetCommands() []cli.Command
- func GetDefaultShell() string
- func GetExecutors() []string
- func GetShells() []string
- func RegisterCommand(command cli.Command)
- func RegisterCommand2(name, usage string, data Commander, flags ...cli.Flag)
- func RegisterExecutor(executor string, provider ExecutorProvider)
- func RegisterShell(shell Shell)
- type AppVersionInfo
- type Artifact
- type ArtifactPaths
- type ArtifactWhen
- type Artifacts
- type Build
- func (b *Build) CurrentExecutorStage() ExecutorStage
- func (b *Build) FullProjectDir() string
- func (b *Build) GetAllVariables() (variables JobVariables)
- func (b *Build) GetDefaultVariables() JobVariables
- func (b *Build) GetDockerAuthConfig() string
- func (b *Build) GetDownloadArtifactsAttempts() int
- func (b *Build) GetGetSourcesAttempts() int
- func (b *Build) GetGitDepth() string
- func (b *Build) GetGitStrategy() GitStrategy
- func (b *Build) GetRestoreCacheAttempts() int
- func (b *Build) GetSubmoduleStrategy() SubmoduleStrategy
- func (b *Build) IsDebugTraceEnabled() bool
- func (b *Build) Log() *logrus.Entry
- func (b *Build) ProjectSlug() (string, error)
- func (b *Build) ProjectUniqueDir(sharedDir bool) string
- func (b *Build) ProjectUniqueName() string
- func (b *Build) Run(globalConfig *Config, trace JobTrace) (err error)
- func (b *Build) StartBuild(rootDir, cacheDir string, sharedDir bool)
- func (b *Build) String() string
- type BuildError
- type BuildLogger
- func (e *BuildLogger) Debugln(args ...interface{})
- func (e *BuildLogger) Errorln(args ...interface{})
- func (e *BuildLogger) Infoln(args ...interface{})
- func (e *BuildLogger) Println(args ...interface{})
- func (e *BuildLogger) SoftErrorln(args ...interface{})
- func (e *BuildLogger) Warningln(args ...interface{})
- type BuildRuntimeState
- type BuildStage
- type Cache
- type CacheConfig
- type Caches
- type Commander
- type Config
- type Credentials
- type Dependencies
- type Dependency
- type DependencyArtifactsFile
- type DockerConfig
- type DockerMachine
- type DockerPullPolicy
- type DownloadState
- type Executor
- type ExecutorCommand
- type ExecutorData
- type ExecutorProvider
- type ExecutorStage
- type FeaturesInfo
- type GitInfo
- type GitInfoRefType
- type GitStrategy
- type Image
- type JobCredentials
- type JobInfo
- type JobRequest
- type JobResponse
- type JobState
- type JobTrace
- type JobTracePatch
- type JobVariable
- type JobVariables
- type KubernetesConfig
- type KubernetesPullPolicy
- type MockBuildTrace
- type MockBuildTracePatch
- type MockCommander
- type MockExecutor
- func (m *MockExecutor) Cleanup()
- func (m *MockExecutor) Finish(err error)
- func (m *MockExecutor) GetCurrentStage() ExecutorStage
- func (m *MockExecutor) Prepare(globalConfig *Config, config *RunnerConfig, build *Build) error
- func (m *MockExecutor) Run(cmd ExecutorCommand) error
- func (m *MockExecutor) SetCurrentStage(stage ExecutorStage)
- func (m *MockExecutor) Shell() *ShellScriptInfo
- type MockExecutorData
- type MockExecutorProvider
- func (m *MockExecutorProvider) Acquire(config *RunnerConfig) (ExecutorData, error)
- func (m *MockExecutorProvider) CanCreate() bool
- func (m *MockExecutorProvider) Create() Executor
- func (m *MockExecutorProvider) GetFeatures(features *FeaturesInfo)
- func (m *MockExecutorProvider) Release(config *RunnerConfig, data ExecutorData) error
- type MockNetwork
- func (m *MockNetwork) DownloadArtifacts(config JobCredentials, artifactsFile string) DownloadState
- func (m *MockNetwork) PatchTrace(config RunnerConfig, buildCredentials *JobCredentials, tracePart JobTracePatch) UpdateState
- func (m *MockNetwork) ProcessJob(config RunnerConfig, jobCredentials *JobCredentials) JobTrace
- func (m *MockNetwork) RegisterRunner(config RunnerCredentials, description string, tags string, ...) *RegisterRunnerResponse
- func (m *MockNetwork) RequestJob(config RunnerConfig) (*JobResponse, bool)
- func (m *MockNetwork) UnregisterRunner(config RunnerCredentials) bool
- func (m *MockNetwork) UpdateJob(config RunnerConfig, jobCredentials *JobCredentials, id int, state JobState, ...) UpdateState
- func (m *MockNetwork) UploadArtifacts(config JobCredentials, artifactsFile string) UploadState
- func (m *MockNetwork) UploadRawArtifacts(config JobCredentials, reader io.Reader, baseName string, expireIn string) UploadState
- func (m *MockNetwork) VerifyRunner(config RunnerCredentials) bool
- type MockShell
- func (m *MockShell) GenerateScript(buildStage BuildStage, info ShellScriptInfo) (string, error)
- func (m *MockShell) GetConfiguration(info ShellScriptInfo) (*ShellConfiguration, error)
- func (m *MockShell) GetFeatures(features *FeaturesInfo)
- func (m *MockShell) GetName() string
- func (m *MockShell) IsDefault() bool
- type Network
- type ParallelsConfig
- type RegisterRunnerRequest
- type RegisterRunnerResponse
- type RunnerConfig
- type RunnerCredentials
- type RunnerInfo
- type RunnerSettings
- type Services
- type Shell
- type ShellConfiguration
- type ShellScriptInfo
- type ShellType
- type Step
- type StepName
- type StepScript
- type StepWhen
- type Steps
- type SubmoduleStrategy
- type Trace
- type UnregisterRunnerRequest
- type UpdateJobRequest
- type UpdateState
- type UploadState
- type VerifyRunnerRequest
- type VersionInfo
- type VirtualBoxConfig
Constants ¶
View Source
const ( PullPolicyAlways = "always" PullPolicyNever = "never" PullPolicyIfNotPresent = "if-not-present" )
View Source
const CheckInterval = 3 * time.Second
View Source
const DefaultArtifactDownloadAttempts = 1
View Source
const DefaultExecTimeout = 1800
View Source
const DefaultGetSourcesAttempts = 1
View Source
const DefaultOutputLimit = 4096 // 4MB in kilobytes
View Source
const DefaultRestoreCacheAttempts = 1
View Source
const DefaultTimeout = 7200
View Source
const DefaultWaitForServicesTimeout = 30
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
Variables ¶
View Source
var BRANCH = "HEAD"
View Source
var BUILT = "now"
View Source
var NAME = "gitlab-ci-multi-runner"
View Source
var PreparationRetryInterval = 3 * time.Second
View Source
var REVISION = "HEAD"
View Source
var VERSION = "dev"
Functions ¶
func GenerateShellScript ¶
func GenerateShellScript(buildStage BuildStage, info ShellScriptInfo) (string, error)
func GetCommands ¶
func GetDefaultShell ¶
func GetDefaultShell() string
func GetExecutors ¶
func GetExecutors() []string
func RegisterCommand ¶
func RegisterCommand2 ¶
func RegisterExecutor ¶
func RegisterExecutor(executor string, provider ExecutorProvider)
func RegisterShell ¶
func RegisterShell(shell Shell)
Types ¶
type AppVersionInfo ¶ added in v1.4.0
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 time.Time `json:"built_at"` OS string `json:"os"` Architecture string `json:"architecture"` }
var AppVersion AppVersionInfo
func (*AppVersionInfo) Extended ¶ added in v1.4.0
func (v *AppVersionInfo) Extended() string
func (*AppVersionInfo) Line ¶ added in v1.4.0
func (v *AppVersionInfo) Line() string
func (*AppVersionInfo) NewMetricsCollector ¶ added in v1.8.0
func (v *AppVersionInfo) NewMetricsCollector() *prometheus.GaugeVec
NewMetricsCollector returns a prometheus.Collector which represents current build information.
func (*AppVersionInfo) Printer ¶ added in v1.4.0
func (v *AppVersionInfo) Printer(c *cli.Context)
func (*AppVersionInfo) ShortLine ¶ added in v1.4.0
func (v *AppVersionInfo) ShortLine() string
func (*AppVersionInfo) UserAgent ¶ added in v1.4.0
func (v *AppVersionInfo) UserAgent() string
type Artifact ¶
type Artifact struct { Name string `json:"name"` Untracked bool `json:"untracked"` Paths ArtifactPaths `json:"paths"` When ArtifactWhen `json:"when"` ExpireIn string `json:"expire_in"` }
type ArtifactPaths ¶
type ArtifactPaths []string
type ArtifactWhen ¶
type ArtifactWhen string
const ( ArtifactWhenOnFailure ArtifactWhen = "on_failure" ArtifactWhenOnSuccess ArtifactWhen = "on_success" ArtifactWhenAlways ArtifactWhen = "always" )
type Build ¶
type Build struct { JobResponse `yaml:",inline"` Trace JobTrace 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 // 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 // contains filtered or unexported fields }
func (*Build) CurrentExecutorStage ¶
func (b *Build) CurrentExecutorStage() ExecutorStage
func (*Build) FullProjectDir ¶
func (*Build) GetAllVariables ¶
func (b *Build) GetAllVariables() (variables JobVariables)
func (*Build) GetDefaultVariables ¶
func (b *Build) GetDefaultVariables() JobVariables
func (*Build) GetDockerAuthConfig ¶ added in v1.8.0
func (*Build) GetDownloadArtifactsAttempts ¶ added in v1.9.0
func (*Build) GetGetSourcesAttempts ¶ added in v1.9.0
func (*Build) GetGitDepth ¶ added in v1.3.0
func (*Build) GetGitStrategy ¶ added in v1.3.0
func (b *Build) GetGitStrategy() GitStrategy
func (*Build) GetRestoreCacheAttempts ¶ added in v1.9.0
func (*Build) GetSubmoduleStrategy ¶ added in v1.10.0
func (b *Build) GetSubmoduleStrategy() SubmoduleStrategy
func (*Build) IsDebugTraceEnabled ¶ added in v1.7.0
func (*Build) ProjectSlug ¶
func (*Build) ProjectUniqueDir ¶
func (*Build) ProjectUniqueName ¶
func (*Build) StartBuild ¶
type BuildError ¶ added in v1.4.0
type BuildError struct {
Inner error
}
func (*BuildError) Error ¶ added in v1.4.0
func (b *BuildError) Error() string
type BuildLogger ¶ added in v1.4.0
type BuildLogger struct {
// contains filtered or unexported fields
}
func NewBuildLogger ¶ added in v1.4.0
func NewBuildLogger(log JobTrace, entry *logrus.Entry) BuildLogger
func (*BuildLogger) Debugln ¶ added in v1.4.0
func (e *BuildLogger) Debugln(args ...interface{})
func (*BuildLogger) Errorln ¶ added in v1.4.0
func (e *BuildLogger) Errorln(args ...interface{})
func (*BuildLogger) Infoln ¶ added in v1.4.0
func (e *BuildLogger) Infoln(args ...interface{})
func (*BuildLogger) Println ¶ added in v1.4.0
func (e *BuildLogger) Println(args ...interface{})
func (*BuildLogger) SoftErrorln ¶ added in v1.4.0
func (e *BuildLogger) SoftErrorln(args ...interface{})
func (*BuildLogger) Warningln ¶ added in v1.4.0
func (e *BuildLogger) Warningln(args ...interface{})
type BuildRuntimeState ¶ added in v1.9.0
type BuildRuntimeState string
const ( BuildRunStatePending BuildRuntimeState = "pending" BuildRunRuntimeRunning BuildRuntimeState = "running" BuildRunRuntimeFinished BuildRuntimeState = "finished" BuildRunRuntimeCanceled BuildRuntimeState = "canceled" BuildRunRuntimeTerminated BuildRuntimeState = "terminated" BuildRunRuntimeTimedout BuildRuntimeState = "timedout" )
type BuildStage ¶ added in v1.9.0
type BuildStage string
const ( 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" BuildStageUploadArtifacts BuildStage = "upload_artifacts" )
type Cache ¶
type Cache struct { Key string `json:"key"` Untracked bool `json:"untracked"` Paths ArtifactPaths `json:"paths"` }
type CacheConfig ¶
type CacheConfig struct { Type string `toml:"Type,omitempty" long:"type" env:"CACHE_TYPE" description:"Select caching method: s3, to use S3 buckets"` ServerAddress string `` /* 138-byte string literal not displayed */ AccessKey string `toml:"AccessKey,omitempty" long:"s3-access-key" env:"S3_ACCESS_KEY" description:"S3 Access Key"` SecretKey string `toml:"SecretKey,omitempty" long:"s3-secret-key" env:"S3_SECRET_KEY" description:"S3 Secret Key"` BucketName string `` /* 130-byte string literal not displayed */ BucketLocation string `toml:"BucketLocation,omitempty" long:"s3-bucket-location" env:"S3_BUCKET_LOCATION" description:"Name of S3 region"` Insecure bool `toml:"Insecure,omitempty" long:"s3-insecure" env:"S3_CACHE_INSECURE" description:"Use insecure mode (without https)"` Path string `toml:"Path,omitempty" long:"s3-cache-path" env:"S3_CACHE_PATH" description:"Name of the path to prepend to the cache URL"` }
type Config ¶
type Config struct { MetricsServerAddress string `toml:"metrics_server,omitempty" json:"metrics_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)"` 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 (*Config) GetCheckInterval ¶ added in v1.3.0
func (*Config) LoadConfig ¶
func (*Config) SaveConfig ¶
func (*Config) StatConfig ¶
type Credentials ¶
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 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"` CPUSetCPUs string `` /* 159-byte string literal not displayed */ 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 */ 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"` 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 `toml:"volumes,omitempty" json:"volumes" long:"volumes" env:"DOCKER_VOLUMES" description:"Bind mount a volumes"` 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 */ }
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 ¶ added in v1.7.0
func (c *DockerMachine) CompileOffPeakPeriods() (err error)
func (*DockerMachine) GetIdleCount ¶ added in v1.7.0
func (c *DockerMachine) GetIdleCount() int
func (*DockerMachine) GetIdleTime ¶ added in v1.7.0
func (c *DockerMachine) GetIdleTime() int
type DockerPullPolicy ¶
type DockerPullPolicy string
func (DockerPullPolicy) Get ¶
func (p DockerPullPolicy) Get() (DockerPullPolicy, error)
Get returns one of the predefined values or returns an error if the value can't match the predefined
type DownloadState ¶
type DownloadState int
const ( DownloadSucceeded DownloadState = iota DownloadForbidden DownloadFailed DownloadNotFound )
type Executor ¶
type Executor interface { Shell() *ShellScriptInfo Prepare(globalConfig *Config, config *RunnerConfig, build *Build) error Run(cmd ExecutorCommand) error Finish(err error) Cleanup() GetCurrentStage() ExecutorStage SetCurrentStage(stage ExecutorStage) }
func NewExecutor ¶
type ExecutorCommand ¶ added in v1.2.0
type ExecutorData ¶
type ExecutorData interface{}
type ExecutorProvider ¶
type ExecutorProvider interface { CanCreate() bool Create() Executor Acquire(config *RunnerConfig) (ExecutorData, error) Release(config *RunnerConfig, data ExecutorData) error GetFeatures(features *FeaturesInfo) }
func GetExecutor ¶
func GetExecutor(executor string) ExecutorProvider
func GetExecutorProviders ¶ added in v1.9.0
func GetExecutorProviders() (providers []ExecutorProvider)
type ExecutorStage ¶
type ExecutorStage string
const ( ExecutorStageCreated ExecutorStage = "created" ExecutorStagePrepare ExecutorStage = "prepare" ExecutorStageFinish ExecutorStage = "finish" ExecutorStageCleanup ExecutorStage = "cleanup" )
type FeaturesInfo ¶
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"` }
type GitInfoRefType ¶
type GitInfoRefType string
const ( RefTypeBranch GitInfoRefType = "branch" RefTypeTag GitInfoRefType = "tag" )
type GitStrategy ¶ added in v1.3.0
type GitStrategy int
const ( GitClone GitStrategy = iota GitFetch GitNone )
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 */ }
func (*JobCredentials) GetTLSCAFile ¶
func (j *JobCredentials) GetTLSCAFile() string
func (*JobCredentials) GetToken ¶
func (j *JobCredentials) GetToken() string
func (*JobCredentials) GetURL ¶
func (j *JobCredentials) GetURL() string
type JobRequest ¶
type JobRequest struct { Info VersionInfo `json:"info,omitempty"` Token string `json:"token,omitempty"` LastUpdate string `json:"last_update,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"` TLSCAChain string `json:"-"` }
func GetFailedBuild ¶ added in v1.8.0
func GetFailedBuild() (JobResponse, error)
func GetLongRunningBuild ¶ added in v1.8.0
func GetLongRunningBuild() (JobResponse, error)
func GetRemoteFailedBuild ¶ added in v1.8.0
func GetRemoteFailedBuild() (JobResponse, error)
func GetRemoteLongRunningBuild ¶ added in v1.8.0
func GetRemoteLongRunningBuild() (JobResponse, error)
func GetRemoteSuccessfulBuild ¶ added in v1.8.0
func GetRemoteSuccessfulBuild() (JobResponse, error)
func GetSuccessfulBuild ¶ added in v1.8.0
func GetSuccessfulBuild() (JobResponse, error)
func (*JobResponse) RepoCleanURL ¶
func (j *JobResponse) RepoCleanURL() string
type JobTracePatch ¶
type JobVariable ¶
type JobVariable struct { Key string `json:"key"` Value string `json:"value"` Public bool `json:"public"` Internal bool `json:"-"` File bool `json:"file"` }
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) PublicOrInternal ¶
func (b JobVariables) PublicOrInternal() (variables JobVariables)
func (JobVariables) StringList ¶
func (b JobVariables) StringList() (variables []string)
type KubernetesConfig ¶ added in v1.6.0
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 */ 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 `` /* 239-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 */ }
func (*KubernetesConfig) GetHelperImage ¶ added in v1.9.0
func (c *KubernetesConfig) GetHelperImage() string
func (*KubernetesConfig) GetPollAttempts ¶ added in v1.10.0
func (c *KubernetesConfig) GetPollAttempts() int
func (*KubernetesConfig) GetPollInterval ¶ added in v1.10.0
func (c *KubernetesConfig) GetPollInterval() int
type KubernetesPullPolicy ¶ added in v1.8.0
type KubernetesPullPolicy string
func (KubernetesPullPolicy) Get ¶ added in v1.8.0
func (p KubernetesPullPolicy) Get() (KubernetesPullPolicy, error)
Get returns one of the predefined values in kubernetes notation or returns an error if the value can't match the predefined
type MockBuildTrace ¶ added in v1.5.0
func (*MockBuildTrace) Aborted ¶ added in v1.5.0
func (m *MockBuildTrace) Aborted() chan interface{}
func (*MockBuildTrace) Fail ¶ added in v1.5.0
func (m *MockBuildTrace) Fail(err error)
func (*MockBuildTrace) IsStdout ¶ added in v1.5.0
func (m *MockBuildTrace) IsStdout() bool
func (*MockBuildTrace) Success ¶ added in v1.5.0
func (m *MockBuildTrace) Success()
type MockBuildTracePatch ¶ added in v1.5.0
func (*MockBuildTracePatch) Limit ¶ added in v1.5.0
func (m *MockBuildTracePatch) Limit() int
func (*MockBuildTracePatch) Offset ¶ added in v1.5.0
func (m *MockBuildTracePatch) Offset() int
func (*MockBuildTracePatch) Patch ¶ added in v1.5.0
func (m *MockBuildTracePatch) Patch() []byte
func (*MockBuildTracePatch) SetNewOffset ¶ added in v1.5.0
func (m *MockBuildTracePatch) SetNewOffset(newOffset int)
func (*MockBuildTracePatch) ValidateRange ¶ added in v1.9.0
func (m *MockBuildTracePatch) ValidateRange() bool
type MockCommander ¶ added in v1.5.0
func (*MockCommander) Execute ¶ added in v1.5.0
func (m *MockCommander) Execute(c *cli.Context)
type MockExecutor ¶ added in v1.5.0
func (*MockExecutor) Cleanup ¶ added in v1.5.0
func (m *MockExecutor) Cleanup()
func (*MockExecutor) Finish ¶ added in v1.5.0
func (m *MockExecutor) Finish(err error)
func (*MockExecutor) GetCurrentStage ¶
func (m *MockExecutor) GetCurrentStage() ExecutorStage
func (*MockExecutor) Prepare ¶ added in v1.5.0
func (m *MockExecutor) Prepare(globalConfig *Config, config *RunnerConfig, build *Build) error
func (*MockExecutor) Run ¶ added in v1.5.0
func (m *MockExecutor) Run(cmd ExecutorCommand) error
func (*MockExecutor) SetCurrentStage ¶
func (m *MockExecutor) SetCurrentStage(stage ExecutorStage)
func (*MockExecutor) Shell ¶ added in v1.5.0
func (m *MockExecutor) Shell() *ShellScriptInfo
type MockExecutorData ¶ added in v1.5.0
type MockExecutorProvider ¶ added in v1.5.0
func (*MockExecutorProvider) Acquire ¶ added in v1.5.0
func (m *MockExecutorProvider) Acquire(config *RunnerConfig) (ExecutorData, error)
func (*MockExecutorProvider) CanCreate ¶ added in v1.5.0
func (m *MockExecutorProvider) CanCreate() bool
func (*MockExecutorProvider) Create ¶ added in v1.5.0
func (m *MockExecutorProvider) Create() Executor
func (*MockExecutorProvider) GetFeatures ¶ added in v1.5.0
func (m *MockExecutorProvider) GetFeatures(features *FeaturesInfo)
func (*MockExecutorProvider) Release ¶ added in v1.5.0
func (m *MockExecutorProvider) Release(config *RunnerConfig, data ExecutorData) error
type MockNetwork ¶ added in v1.5.0
func (*MockNetwork) DownloadArtifacts ¶ added in v1.5.0
func (m *MockNetwork) DownloadArtifacts(config JobCredentials, artifactsFile string) DownloadState
func (*MockNetwork) PatchTrace ¶ added in v1.5.0
func (m *MockNetwork) PatchTrace(config RunnerConfig, buildCredentials *JobCredentials, tracePart JobTracePatch) UpdateState
func (*MockNetwork) ProcessJob ¶
func (m *MockNetwork) ProcessJob(config RunnerConfig, jobCredentials *JobCredentials) JobTrace
func (*MockNetwork) RegisterRunner ¶ added in v1.5.0
func (m *MockNetwork) RegisterRunner(config RunnerCredentials, description string, tags string, runUntagged, locked bool) *RegisterRunnerResponse
func (*MockNetwork) RequestJob ¶
func (m *MockNetwork) RequestJob(config RunnerConfig) (*JobResponse, bool)
func (*MockNetwork) UnregisterRunner ¶
func (m *MockNetwork) UnregisterRunner(config RunnerCredentials) bool
func (*MockNetwork) UpdateJob ¶
func (m *MockNetwork) UpdateJob(config RunnerConfig, jobCredentials *JobCredentials, id int, state JobState, trace *string) UpdateState
func (*MockNetwork) UploadArtifacts ¶ added in v1.5.0
func (m *MockNetwork) UploadArtifacts(config JobCredentials, artifactsFile string) UploadState
func (*MockNetwork) UploadRawArtifacts ¶ added in v1.5.0
func (m *MockNetwork) UploadRawArtifacts(config JobCredentials, reader io.Reader, baseName string, expireIn string) UploadState
func (*MockNetwork) VerifyRunner ¶ added in v1.5.0
func (m *MockNetwork) VerifyRunner(config RunnerCredentials) bool
type MockShell ¶ added in v1.5.0
func (*MockShell) GenerateScript ¶ added in v1.5.0
func (m *MockShell) GenerateScript(buildStage BuildStage, info ShellScriptInfo) (string, error)
func (*MockShell) GetConfiguration ¶ added in v1.5.0
func (m *MockShell) GetConfiguration(info ShellScriptInfo) (*ShellConfiguration, error)
func (*MockShell) GetFeatures ¶ added in v1.5.0
func (m *MockShell) GetFeatures(features *FeaturesInfo)
type Network ¶
type Network interface { RegisterRunner(config RunnerCredentials, description, tags string, runUntagged, locked bool) *RegisterRunnerResponse VerifyRunner(config RunnerCredentials) bool UnregisterRunner(config RunnerCredentials) bool RequestJob(config RunnerConfig) (*JobResponse, bool) UpdateJob(config RunnerConfig, jobCredentials *JobCredentials, id int, state JobState, trace *string) UpdateState PatchTrace(config RunnerConfig, jobCredentials *JobCredentials, tracePart JobTracePatch) UpdateState DownloadArtifacts(config JobCredentials, artifactsFile string) DownloadState UploadRawArtifacts(config JobCredentials, reader io.Reader, baseName string, expireIn string) UploadState UploadArtifacts(config JobCredentials, artifactsFile string) UploadState ProcessJob(config RunnerConfig, buildCredentials *JobCredentials) JobTrace }
type ParallelsConfig ¶
type RegisterRunnerRequest ¶
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) GetRequestConcurrency ¶ added in v1.10.8
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 */ }
func (*RunnerCredentials) GetTLSCAFile ¶
func (c *RunnerCredentials) GetTLSCAFile() string
func (*RunnerCredentials) GetToken ¶
func (c *RunnerCredentials) GetToken() string
func (*RunnerCredentials) GetURL ¶
func (c *RunnerCredentials) GetURL() string
func (*RunnerCredentials) Log ¶
func (c *RunnerCredentials) Log() *log.Entry
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 */ 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 */ Shell string `toml:"shell,omitempty" json:"shell" long:"shell" env:"RUNNER_SHELL" description:"Select bash, cmd or powershell"` 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"` }
type Shell ¶
type Shell interface { GetName() string GetFeatures(features *FeaturesInfo) IsDefault() bool GetConfiguration(info ShellScriptInfo) (*ShellConfiguration, error) GenerateScript(buildStage BuildStage, info ShellScriptInfo) (string, error) }
type ShellConfiguration ¶ added in v1.3.0
type ShellConfiguration struct { Environment []string DockerCommand []string Command string Arguments []string PassFile bool Extension string }
func GetShellConfiguration ¶ added in v1.3.0
func GetShellConfiguration(info ShellScriptInfo) (*ShellConfiguration, error)
func (*ShellConfiguration) GetCommandWithArguments ¶ added in v1.3.0
func (s *ShellConfiguration) GetCommandWithArguments() []string
func (*ShellConfiguration) String ¶ added in v1.3.0
func (s *ShellConfiguration) String() string
type ShellScriptInfo ¶
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 StepScript ¶
type StepScript []string
type SubmoduleStrategy ¶ added in v1.10.0
type SubmoduleStrategy int
const ( SubmoduleInvalid SubmoduleStrategy = iota SubmoduleNone SubmoduleNormal SubmoduleRecursive )
type UnregisterRunnerRequest ¶
type UnregisterRunnerRequest struct {
Token string `json:"token,omitempty"`
}
type UpdateJobRequest ¶
type UpdateJobRequest struct { Info VersionInfo `json:"info,omitempty"` Token string `json:"token,omitempty"` State JobState `json:"state,omitempty"` Trace *string `json:"trace,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"` Features FeaturesInfo `json:"features"` }
type VirtualBoxConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.