common

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2016 License: MIT Imports: 24 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 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) 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 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 added in v1.3.0

func (b *Build) GetGitDepth() string

func (*Build) GetGitStrategy added in v1.3.0

func (b *Build) GetGitStrategy() GitStrategy

func (*Build) Log added in v1.3.0

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 added in v1.4.0

type BuildError struct {
	Inner error
}

func (*BuildError) Error added in v1.4.0

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 added in v1.4.0

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

func NewBuildLogger added in v1.4.0

func NewBuildLogger(log BuildTrace, 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 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 added in v1.1.1

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

func (*BuildOptions) Sanitize added in v1.1.1

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 added in v1.3.0

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

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 `toml:"ServerAddress,omitempty" long:"s3-server-address" env:"S3_SERVER_ADDRESS" description:"S3 Server Address"`
	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 `toml:"BucketName,omitempty" long:"s3-bucket-name" env:"S3_BUCKET_NAME" description:"S3 bucket name"`
	BucketLocation string `toml:"BucketLocation,omitempty" long:"s3-bucket-location" env:"S3_BUCKET_LOCATION" description:"S3 location"`
	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 added in v1.3.0

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

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 added in v1.2.0

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 added in v1.4.0

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

type GitStrategy added in v1.3.0

type GitStrategy int
const (
	GitClone GitStrategy = iota
	GitFetch
)

type MockBuildTrace added in v1.5.0

type MockBuildTrace struct {
	mock.Mock
}

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

type MockBuildTracePatch struct {
	mock.Mock
}

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)

type MockCommander added in v1.5.0

type MockCommander struct {
	mock.Mock
}

func (*MockCommander) Execute added in v1.5.0

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

type MockExecutor added in v1.5.0

type MockExecutor struct {
	mock.Mock
}

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) 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) Shell added in v1.5.0

func (m *MockExecutor) Shell() *ShellScriptInfo

type MockExecutorData added in v1.5.0

type MockExecutorData struct {
	mock.Mock
}

type MockExecutorProvider added in v1.5.0

type MockExecutorProvider struct {
	mock.Mock
}

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

type MockNetwork struct {
	mock.Mock
}

func (*MockNetwork) DeleteRunner added in v1.5.0

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

func (*MockNetwork) DownloadArtifacts added in v1.5.0

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

func (*MockNetwork) GetBuild added in v1.5.0

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

func (*MockNetwork) PatchTrace added in v1.5.0

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

func (*MockNetwork) ProcessBuild added in v1.5.0

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

func (*MockNetwork) RegisterRunner added in v1.5.0

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

func (*MockNetwork) UpdateBuild added in v1.5.0

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

func (*MockNetwork) UploadArtifacts added in v1.5.0

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

func (*MockNetwork) UploadRawArtifacts added in v1.5.0

func (m *MockNetwork) UploadRawArtifacts(config BuildCredentials, 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

type MockShell struct {
	mock.Mock
}

func (*MockShell) GenerateScript added in v1.5.0

func (m *MockShell) GenerateScript(scriptType ShellScriptType, 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)

func (*MockShell) GetName added in v1.5.0

func (m *MockShell) GetName() string

func (*MockShell) GetSupportedOptions added in v1.5.0

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

func (*MockShell) IsDefault added in v1.5.0

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

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

	SSH        *ssh.Config       `toml:"ssh" json:"ssh" group:"ssh executor" namespace:"ssh"`
	Docker     *DockerConfig     `toml:"docker" json:"docker" group:"docker executor" namespace:"docker"`
	Parallels  *ParallelsConfig  `toml:"parallels" json:"parallels" group:"parallels executor" namespace:"parallels"`
	VirtualBox *VirtualBoxConfig `toml:"virtualbox" json:"virtualbox" group:"virtualbox executor" namespace:"virtualbox"`
	Cache      *CacheConfig      `toml:"cache" json:"cache" group:"cache configuration" namespace:"cache"`
	Machine    *DockerMachine    `toml:"machine" json:"machine" group:"docker machine provider" namespace:"machine"`
}

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 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 ShellScriptInfo struct {
	Shell         string
	Build         *Build
	Type          ShellType
	User          string
	RunnerCommand string
}

type ShellScriptType added in v1.3.0

type ShellScriptType string

type ShellType

type ShellType int
const (
	NormalShell ShellType = iota
	LoginShell
)

type Trace added in v1.4.0

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

func (*Trace) Aborted added in v1.4.0

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

func (*Trace) Fail added in v1.4.0

func (s *Trace) Fail(err error)

func (*Trace) IsStdout added in v1.4.0

func (s *Trace) IsStdout() bool

func (*Trace) Success added in v1.4.0

func (s *Trace) Success()

func (*Trace) Write added in v1.4.0

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

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