Version: v6.2.0+incompatible Latest Latest

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

Go to latest
Published: Jan 10, 2019 License: MIT Imports: 10 Imported by: 12



Package config contains the flags and defaults for Worker configuration.



This section is empty.


View Source
var (

	// Flags is the list of all CLI flags accepted by travis-worker
	Flags = defFlags(defs)


func WriteEnvConfig

func WriteEnvConfig(cfg *Config, out io.Writer)

WriteEnvConfig writes the given configuration to out. The format of the output is a list of environment variables settings suitable to be sourced by a Bourne-like shell.


type Config

type Config struct {
	ProviderName         string        `config:"provider-name"`
	QueueType            string        `config:"queue-type"`
	AmqpURI              string        `config:"amqp-uri"`
	AmqpInsecure         bool          `config:"amqp-insecure"`
	AmqpTlsCert          string        `config:"amqp-tls-cert"`
	AmqpTlsCertPath      string        `config:"amqp-tls-cert-path"`
	AmqpHeartbeat        time.Duration `config:"amqp-heartbeat"`
	AmqpConsumerPriority int           `config:"amqp-consumer-priority"`
	BaseDir              string        `config:"base-dir"`
	PoolSize             int           `config:"pool-size"`
	BuildAPIURI          string        `config:"build-api-uri"`
	QueueName            string        `config:"queue-name"`
	LibratoEmail         string        `config:"librato-email"`
	LibratoToken         string        `config:"librato-token"`
	LibratoSource        string        `config:"librato-source"`
	LogsAmqpURI          string        `config:"logs-amqp-uri"`
	LogsAmqpTlsCert      string        `config:"logs-amqp-tls-cert"`
	LogsAmqpTlsCertPath  string        `config:"logs-amqp-tls-cert-path"`
	SentryDSN            string        `config:"sentry-dsn"`
	Hostname             string        `config:"hostname"`
	DefaultLanguage      string        `config:"default-language"`
	DefaultDist          string        `config:"default-dist"`
	DefaultGroup         string        `config:"default-group"`
	DefaultOS            string        `config:"default-os"`
	JobBoardURL          string        `config:"job-board-url"`
	TravisSite           string        `config:"travis-site"`
	RabbitMQSharding     bool          `config:"rabbitmq-sharding"`

	StateUpdatePoolSize int `config:"state-update-pool-size"`
	LogPoolSize         int `config:"log-pool-size"`

	FilePollingInterval      time.Duration `config:"file-polling-interval"`
	HTTPPollingInterval      time.Duration `config:"http-polling-interval"`
	HTTPRefreshClaimInterval time.Duration `config:"http-refresh-claim-interval"`

	HardTimeout         time.Duration `config:"hard-timeout"`
	InitialSleep        time.Duration `config:"initial-sleep"`
	LogTimeout          time.Duration `config:"log-timeout"`
	MaxLogLength        int           `config:"max-log-length"`
	ScriptUploadTimeout time.Duration `config:"script-upload-timeout"`
	StartupTimeout      time.Duration `config:"startup-timeout"`

	BuildTraceEnabled     bool   `config:"build-trace-enabled"`
	BuildTraceS3Bucket    string `config:"build-trace-s3-bucket"`
	BuildTraceS3KeyPrefix string `config:"build-trace-s3-key-prefix"`
	BuildTraceS3Region    string `config:"build-trace-s3-region"`

	SentryHookErrors           bool `config:"sentry-hook-errors"`
	BuildAPIInsecureSkipVerify bool `config:"build-api-insecure-skip-verify"`
	SkipShutdownOnLogTimeout   bool `config:"skip-shutdown-on-log-timeout"`

	// build script generator options
	BuildCacheFetchTimeout time.Duration `config:"build-cache-fetch-timeout"`
	BuildCachePushTimeout  time.Duration `config:"build-cache-push-timeout"`

	BuildParanoid      bool `config:"build-paranoid"`
	BuildFixResolvConf bool `config:"build-fix-resolv-conf"`
	BuildFixEtcHosts   bool `config:"build-fix-etc-hosts"`

	BuildAptCache               string `config:"build-apt-cache"`
	BuildNpmCache               string `config:"build-npm-cache"`
	BuildCacheType              string `config:"build-cache-type"`
	BuildCacheS3Scheme          string `config:"build-cache-s3-scheme"`
	BuildCacheS3Region          string `config:"build-cache-s3-region"`
	BuildCacheS3Bucket          string `config:"build-cache-s3-bucket"`
	BuildCacheS3AccessKeyID     string `config:"build-cache-s3-access-key-id"`
	BuildCacheS3SecretAccessKey string `config:"build-cache-s3-secret-access-key"`

	PayloadFilterExecutable     string `config:"payload-filter-executable"`
	ProgressType                string `config:"progress-type"`
	Infra                       string `config:"infra"`
	StackdriverTraceAccountJSON string `config:"stackdriver-trace-account-json"`
	StackdriverProjectID        string `config:"stackdriver-project-id"`
	OpencensusTracingEnabled    bool   `config:"opencensus-tracing-enabled"`
	OpencensusSamplingRate      int    `config:"opencensus-sampling-rate"`

	ProviderConfig *ProviderConfig

Config contains all the configuration needed to run the worker.

func FromCLIContext added in v1.3.0

func FromCLIContext(c *cli.Context) *Config

FromCLIContext creates a Config using a cli.Context by pulling configuration from the flags in the context.

type ConfigDef

type ConfigDef struct {
	FieldName string
	Name      string
	EnvVar    string
	Flag      cli.Flag
	HasField  bool

func NewConfigDef

func NewConfigDef(fieldName string, flag cli.Flag) *ConfigDef

type ProviderConfig

type ProviderConfig struct {
	// contains filtered or unexported fields

ProviderConfig is the part of a configuration specific to a provider.

func ProviderConfigFromEnviron

func ProviderConfigFromEnviron(providerName string) *ProviderConfig

ProviderConfigFromEnviron dynamically builds a *ProviderConfig from the environment by loading values from keys with prefixes that match either the uppercase provider name + "_" or "TRAVIS_WORKER_" + uppercase provider name + "_", e.g., for provider "foo":

map equiv: {"BAR": "ham", "BAZ": "bones"}

func ProviderConfigFromMap added in v1.3.0

func ProviderConfigFromMap(cfgMap map[string]string) *ProviderConfig

ProviderConfigFromMap creates a provider configuration backed by the given map. Useful for testing a provider.

func (*ProviderConfig) Each added in v1.3.0

func (pc *ProviderConfig) Each(f func(string, string))

Each loops over all configuration settings and calls the given function with the key and value. The settings are sorted so f i called with the keys in alphabetical order.

func (*ProviderConfig) Get

func (pc *ProviderConfig) Get(key string) string

Get the value of a setting with the given key. The empty string is returned if the setting could not be found.

func (*ProviderConfig) GoString

func (pc *ProviderConfig) GoString() string

GoString formats the ProviderConfig as valid Go syntax. This makes ProviderConfig implement fmt.GoStringer.

func (*ProviderConfig) IsSet

func (pc *ProviderConfig) IsSet(key string) bool

IsSet returns true if a setting with the given key exists, or false if it does not.

func (*ProviderConfig) Set

func (pc *ProviderConfig) Set(key, value string)

Set the value of a setting with the given key.

func (*ProviderConfig) Unset added in v1.3.0

func (pc *ProviderConfig) Unset(key string)

Unset removes the given key from the config map

Jump to

Keyboard shortcuts

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