common

package
v0.0.0-...-93f324c Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2016 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Pending BuildState = "pending"
	Running            = "running"
	Failed             = "failed"
	Success            = "success"
)
View Source
const (
	DockerPullPolicyAlways       DockerPullPolicy = "always"
	DockerPullPolicyNever                         = "never"
	DockerPullPolicyIfNotPresent                  = "if-not-present"
)
View Source
const (
	ShellPrepareScript   ShellScriptType = "prepare_script"
	ShellBuildScript                     = "build_script"
	ShellAfterScript                     = "after_script"
	ShellArchiveCache                    = "archive_cache"
	ShellUploadArtifacts                 = "upload_artifacts"
)
View Source
const CheckInterval = 3 * time.Second
View Source
const DefaultExecTimeout = 1800
View Source
const DefaultOutputLimit = 4096 // 4MB in kilobytes
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 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 FailedBuild = GetBuildResponse{
	RepoURL:   repoURL,
	Commands:  "exit 1",
	Sha:       repoSHA,
	BeforeSha: repoBeforeSHA,
	RefName:   repoRefName,
}
View Source
var LongRunningBuild = GetBuildResponse{
	RepoURL:   repoURL,
	Commands:  "sleep 3600",
	Sha:       repoSHA,
	BeforeSha: repoBeforeSHA,
	RefName:   repoRefName,
}
View Source
var NAME = "gitlab-ci-multi-runner"
View Source
var PreparationRetryInterval = 3 * time.Second
View Source
var REVISION = "HEAD"
View Source
var SuccessfulBuild = GetBuildResponse{
	RepoURL:   repoURL,
	Commands:  "echo Hello World",
	Sha:       repoSHA,
	BeforeSha: repoBeforeSHA,
	RefName:   repoRefName,
}
View Source
var VERSION = "dev"

Functions

func GenerateShellScript

func GenerateShellScript(scriptType ShellScriptType, 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 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      time.Time `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) Printer

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

func (*AppVersionInfo) ShortLine

func (v *AppVersionInfo) ShortLine() string

func (*AppVersionInfo) UserAgent

func (v *AppVersionInfo) UserAgent() string

type Build

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

	Trace           BuildTrace
	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"`
}

func (*Build) FullProjectDir

func (b *Build) FullProjectDir() string

func (*Build) GetAllVariables

func (b *Build) GetAllVariables() BuildVariables

func (*Build) GetDefaultVariables

func (b *Build) GetDefaultVariables() BuildVariables

func (*Build) GetGitDepth

func (b *Build) GetGitDepth() string

func (*Build) GetGitStrategy

func (b *Build) GetGitStrategy() GitStrategy

func (*Build) IsDebugTraceEnabled

func (b *Build) IsDebugTraceEnabled() 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 BuildTrace) (err error)

func (*Build) StartBuild

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

func (*Build) String

func (b *Build) String() string

type BuildArtifacts

type BuildArtifacts struct {
	Filename string `json:"filename,omitempty"`
	Size     int64  `json:"size,omitempty"`
}

type BuildCredentials

type BuildCredentials struct {
	ID        int    `long:"id" env:"CI_BUILD_ID" description:"The build ID to upload artifacts for"`
	Token     string `long:"token" env:"CI_BUILD_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 */
}

type BuildError

type BuildError struct {
	Inner error
}

func (*BuildError) Error

func (b *BuildError) Error() string

type BuildInfo

type BuildInfo struct {
	ID        int             `json:"id,omitempty"`
	Sha       string          `json:"sha,omitempty"`
	RefName   string          `json:"ref,omitempty"`
	Token     string          `json:"token"`
	Name      string          `json:"name"`
	Stage     string          `json:"stage"`
	Tag       bool            `json:"tag"`
	Artifacts *BuildArtifacts `json:"artifacts_file"`
}

type BuildLogger

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

func NewBuildLogger

func NewBuildLogger(log BuildTrace, 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) SoftErrorln

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

func (*BuildLogger) Warningln

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

type BuildOptions

type BuildOptions map[string]interface{}

func (*BuildOptions) Decode

func (m *BuildOptions) Decode(result interface{}, keys ...string) error

func (*BuildOptions) Get

func (m *BuildOptions) Get(keys ...string) (interface{}, bool)

func (*BuildOptions) GetString

func (m *BuildOptions) GetString(keys ...string) (result string, ok bool)

func (*BuildOptions) GetSubOptions

func (m *BuildOptions) GetSubOptions(keys ...string) (result BuildOptions, ok bool)

func (*BuildOptions) Sanitize

func (m *BuildOptions) Sanitize() (err error)

type BuildState

type BuildState string

type BuildTrace

type BuildTrace interface {
	io.Writer
	Success()
	Fail(err error)
	Aborted() chan interface{}
	IsStdout() bool
}

type BuildTracePatch

type BuildTracePatch interface {
	Patch() []byte
	Offset() int
	Limit() int
	SetNewOffset(newOffset int)
	ValidateRange() bool
}

type BuildVariable

type BuildVariable struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	Public   bool   `json:"public"`
	Internal bool   `json:"-"`
	File     bool   `json:"-"`
}

func ParseVariable

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

func (BuildVariable) String

func (b BuildVariable) String() string

type BuildVariables

type BuildVariables []BuildVariable

func (BuildVariables) Expand

func (b BuildVariables) Expand() (variables BuildVariables)

func (BuildVariables) ExpandValue

func (b BuildVariables) ExpandValue(value string) string

func (BuildVariables) Get

func (b BuildVariables) Get(key string) string

func (BuildVariables) PublicOrInternal

func (b BuildVariables) PublicOrInternal() (variables BuildVariables)

func (BuildVariables) StringList

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

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)"`
}

type Commander

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

type Config

type Config struct {
	Concurrent    int             `toml:"concurrent" json:"concurrent"`
	CheckInterval int             `toml:"check_interval" json:"check_interval" description:"Define active checking interval of jobs"`
	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 DeleteRunnerRequest

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

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"`
	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 */
}

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"`
	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 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()
}

func NewExecutor

func NewExecutor(executor string) Executor

type ExecutorCommand

type ExecutorCommand struct {
	Script     string
	Predefined bool
	Abort      chan interface{}
}

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

type FeaturesInfo

type FeaturesInfo struct {
	Variables bool `json:"variables"`
	Image     bool `json:"image"`
	Services  bool `json:"services"`
	Artifacts bool `json:"features"`
	Cache     bool `json:"cache"`
}

type GetBuildRequest

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

type GetBuildResponse

type GetBuildResponse struct {
	ID              int            `json:"id,omitempty"`
	ProjectID       int            `json:"project_id,omitempty"`
	Commands        string         `json:"commands,omitempty"`
	RepoURL         string         `json:"repo_url,omitempty"`
	Sha             string         `json:"sha,omitempty"`
	RefName         string         `json:"ref,omitempty"`
	BeforeSha       string         `json:"before_sha,omitempty"`
	AllowGitFetch   bool           `json:"allow_git_fetch,omitempty"`
	Timeout         int            `json:"timeout,omitempty"`
	Variables       BuildVariables `json:"variables"`
	Options         BuildOptions   `json:"options"`
	Token           string         `json:"token"`
	Name            string         `json:"name"`
	Stage           string         `json:"stage"`
	Tag             bool           `json:"tag"`
	DependsOnBuilds []BuildInfo    `json:"depends_on_builds"`
	TLSCAChain      string         `json:"-"`
}

func (*GetBuildResponse) RepoCleanURL

func (b *GetBuildResponse) RepoCleanURL() (ret string)

type GitStrategy

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

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 */
	Image         string `` /* 137-byte string literal not displayed */
	Namespace     string `` /* 127-byte string literal not displayed */
	Privileged    bool   `` /* 156-byte string literal not displayed */
	CPUs          string `` /* 126-byte string literal not displayed */
	Memory        string `` /* 140-byte string literal not displayed */
	ServiceCPUs   string `` /* 166-byte string literal not displayed */
	ServiceMemory string `` /* 180-byte string literal not displayed */
}

type MockBuildTrace

type MockBuildTrace struct {
	mock.Mock
}

func (*MockBuildTrace) Aborted

func (m *MockBuildTrace) Aborted() chan interface{}

func (*MockBuildTrace) Fail

func (m *MockBuildTrace) Fail(err error)

func (*MockBuildTrace) IsStdout

func (m *MockBuildTrace) IsStdout() bool

func (*MockBuildTrace) Success

func (m *MockBuildTrace) Success()

type MockBuildTracePatch

type MockBuildTracePatch struct {
	mock.Mock
}

func (*MockBuildTracePatch) Limit

func (m *MockBuildTracePatch) Limit() int

func (*MockBuildTracePatch) Offset

func (m *MockBuildTracePatch) Offset() int

func (*MockBuildTracePatch) Patch

func (m *MockBuildTracePatch) Patch() []byte

func (*MockBuildTracePatch) SetNewOffset

func (m *MockBuildTracePatch) SetNewOffset(newOffset int)

type MockCommander

type MockCommander struct {
	mock.Mock
}

func (*MockCommander) Execute

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

type MockExecutor

type MockExecutor struct {
	mock.Mock
}

func (*MockExecutor) Cleanup

func (m *MockExecutor) Cleanup()

func (*MockExecutor) Finish

func (m *MockExecutor) Finish(err error)

func (*MockExecutor) Prepare

func (m *MockExecutor) Prepare(globalConfig *Config, config *RunnerConfig, build *Build) error

func (*MockExecutor) Run

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

func (*MockExecutor) Shell

func (m *MockExecutor) Shell() *ShellScriptInfo

type MockExecutorData

type MockExecutorData struct {
	mock.Mock
}

type MockExecutorProvider

type MockExecutorProvider struct {
	mock.Mock
}

func (*MockExecutorProvider) Acquire

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

func (*MockExecutorProvider) CanCreate

func (m *MockExecutorProvider) CanCreate() bool

func (*MockExecutorProvider) Create

func (m *MockExecutorProvider) Create() Executor

func (*MockExecutorProvider) GetFeatures

func (m *MockExecutorProvider) GetFeatures(features *FeaturesInfo)

func (*MockExecutorProvider) Release

func (m *MockExecutorProvider) Release(config *RunnerConfig, data ExecutorData) error

type MockNetwork

type MockNetwork struct {
	mock.Mock
}

func (*MockNetwork) DeleteRunner

func (m *MockNetwork) DeleteRunner(config RunnerCredentials) bool

func (*MockNetwork) DownloadArtifacts

func (m *MockNetwork) DownloadArtifacts(config BuildCredentials, artifactsFile string) DownloadState

func (*MockNetwork) GetBuild

func (m *MockNetwork) GetBuild(config RunnerConfig) (*GetBuildResponse, bool)

func (*MockNetwork) PatchTrace

func (m *MockNetwork) PatchTrace(config RunnerConfig, buildCredentials *BuildCredentials, tracePart BuildTracePatch) UpdateState

func (*MockNetwork) ProcessBuild

func (m *MockNetwork) ProcessBuild(config RunnerConfig, buildCredentials *BuildCredentials) BuildTrace

func (*MockNetwork) RegisterRunner

func (m *MockNetwork) RegisterRunner(config RunnerCredentials, description string, tags string) *RegisterRunnerResponse

func (*MockNetwork) UpdateBuild

func (m *MockNetwork) UpdateBuild(config RunnerConfig, id int, state BuildState, trace *string) UpdateState

func (*MockNetwork) UploadArtifacts

func (m *MockNetwork) UploadArtifacts(config BuildCredentials, artifactsFile string) UploadState

func (*MockNetwork) UploadRawArtifacts

func (m *MockNetwork) UploadRawArtifacts(config BuildCredentials, reader io.Reader, baseName string, expireIn string) UploadState

func (*MockNetwork) VerifyRunner

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

type MockShell

type MockShell struct {
	mock.Mock
}

func (*MockShell) GenerateScript

func (m *MockShell) GenerateScript(scriptType ShellScriptType, info ShellScriptInfo) (string, error)

func (*MockShell) GetConfiguration

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

func (*MockShell) GetFeatures

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

func (*MockShell) GetName

func (m *MockShell) GetName() string

func (*MockShell) GetSupportedOptions

func (m *MockShell) GetSupportedOptions() []string

func (*MockShell) IsDefault

func (m *MockShell) IsDefault() bool

type Network

type Network interface {
	GetBuild(config RunnerConfig) (*GetBuildResponse, bool)
	RegisterRunner(config RunnerCredentials, description, tags string) *RegisterRunnerResponse
	DeleteRunner(config RunnerCredentials) bool
	VerifyRunner(config RunnerCredentials) bool
	UpdateBuild(config RunnerConfig, id int, state BuildState, trace *string) UpdateState
	PatchTrace(config RunnerConfig, buildCredentials *BuildCredentials, tracePart BuildTracePatch) UpdateState
	DownloadArtifacts(config BuildCredentials, artifactsFile string) DownloadState
	UploadRawArtifacts(config BuildCredentials, reader io.Reader, baseName string, expireIn string) UploadState
	UploadArtifacts(config BuildCredentials, artifactsFile string) UploadState
	ProcessBuild(config RunnerConfig, buildCredentials *BuildCredentials) BuildTrace
}

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 */
}

type RegisterRunnerRequest

type RegisterRunnerRequest struct {
	Info        VersionInfo `json:"info,omitempty"`
	Token       string      `json:"token,omitempty"`
	Description string      `json:"description,omitempty"`
	Tags        string      `json:"tag_list,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 */

	RunnerCredentials
	RunnerSettings
}

func (*RunnerConfig) GetVariables

func (c *RunnerConfig) GetVariables() BuildVariables

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) Log

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

func (*RunnerCredentials) ShortDescription

func (c *RunnerCredentials) ShortDescription() string

func (*RunnerCredentials) UniqueID

func (c *RunnerCredentials) UniqueID() string

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 */

	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
	GetSupportedOptions() []string
	GetFeatures(features *FeaturesInfo)
	IsDefault() bool

	GetConfiguration(info ShellScriptInfo) (*ShellConfiguration, error)
	GenerateScript(scriptType ShellScriptType, 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
}

type ShellScriptType

type ShellScriptType string

type ShellType

type ShellType int
const (
	NormalShell ShellType = iota
	LoginShell
)

type Trace

type Trace struct {
	Writer io.Writer
	Abort  chan interface{}
}

func (*Trace) Aborted

func (s *Trace) Aborted() chan interface{}

func (*Trace) Fail

func (s *Trace) Fail(err error)

func (*Trace) IsStdout

func (s *Trace) IsStdout() bool

func (*Trace) Success

func (s *Trace) Success()

func (*Trace) Write

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

type UpdateBuildRequest

type UpdateBuildRequest struct {
	Info  VersionInfo `json:"info,omitempty"`
	Token string      `json:"token,omitempty"`
	State BuildState  `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

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