cfg

package
v26.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProviderConfig

type ProviderConfig struct {
	ProviderType string
	Data         map[string]interface{}
}

The configuration for a provider. This must at least have "providerType", plus any additional provider-specific properties.

func (*ProviderConfig) UnmarshalYAML

func (pc *ProviderConfig) UnmarshalYAML(node *yaml.Node) error

func (*ProviderConfig) Unpack

func (pc *ProviderConfig) Unpack(out interface{}) error

Unpack this ProviderConfig to a provider's configuration struct. This will produce an error for any missing properties. Note that recursion is not supported.

Structs should be tagged with `provider:"name"`, with the name defaulting to the lowercased version of the field name.

type ProviderWorkerConfig

type ProviderWorkerConfig struct {
	Config *WorkerConfig `json:"config,omitempty"`
	Files  []files.File  `json:"files,omitempty"`
}

ProviderWorkerConfig handles the configuration format provided from worker-manager providers: `{<workerName>: {config, files}}`, including some compatibility translations described in the README.

func ParseProviderWorkerConfig

func ParseProviderWorkerConfig(runnercfg *RunnerConfig, body *json.RawMessage) (ProviderWorkerConfig, error)

ParseProviderWorkerConfig takes a RawMessage representing the `workerConfig` field received from worker-manager, and returns the config and files it contains. This requires the runnerConfig in order to determine the worker implementation name.

type RunnerConfig

type RunnerConfig struct {
	Provider             ProviderConfig             `yaml:"provider"`
	WorkerImplementation WorkerImplementationConfig `yaml:"worker"`
	WorkerConfig         *WorkerConfig              `yaml:"workerConfig"`
	GetSecrets           bool                       `yaml:"getSecrets"`
	CacheOverRestarts    string                     `yaml:"cacheOverRestarts"`
}

RunnerConfig defines the configuration for taskcluster-worker-starter. See the usage string for field descriptions

func LoadRunnerConfig

func LoadRunnerConfig(filename string) (*RunnerConfig, error)

Load a configuration file

type WorkerConfig

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

The configuration that will be passed directly to the worker. At the top level, this is a JSON object, but it can contain arbitrary other JSON types within it.

Treat this as a read-only data structure, replacing it as necessary using the methods provided below.

func NewWorkerConfig

func NewWorkerConfig() *WorkerConfig

func (*WorkerConfig) Get

func (wc *WorkerConfig) Get(key string) (interface{}, error)

Get a value at the given dotted path

func (*WorkerConfig) MarshalJSON

func (wc *WorkerConfig) MarshalJSON() ([]byte, error)

func (*WorkerConfig) MarshalYAML

func (wc *WorkerConfig) MarshalYAML() ([]byte, error)

func (*WorkerConfig) Merge

func (wc *WorkerConfig) Merge(other *WorkerConfig) *WorkerConfig

Merge two WorkerConfig objects, preferring values from the second object where both are provided. Where both objects have an object as a value, those objects are merged recursively. Where both objects have an array as a value, those arrays are concatenated.

This returns a new WorkerConfig without modifying either input.

func (*WorkerConfig) MustGet

func (wc *WorkerConfig) MustGet(key string) interface{}

Like Get, but panic on error (for tests)

func (*WorkerConfig) Set

func (wc *WorkerConfig) Set(key string, value interface{}) (*WorkerConfig, error)

Set a value at the given dotted path.

This returns a new WorkerConfig containing the updated value.

func (*WorkerConfig) UnmarshalJSON

func (wc *WorkerConfig) UnmarshalJSON(b []byte) error

func (*WorkerConfig) UnmarshalYAML

func (wc *WorkerConfig) UnmarshalYAML(node *yaml.Node) error

type WorkerImplementationConfig

type WorkerImplementationConfig struct {
	Implementation string
	// contains filtered or unexported fields
}

The configuration for a worker implementation. This must at least have "implementation", plus any additional worker implementation-specific properties.

func (*WorkerImplementationConfig) UnmarshalYAML

func (pc *WorkerImplementationConfig) UnmarshalYAML(node *yaml.Node) error

func (*WorkerImplementationConfig) Unpack

func (pc *WorkerImplementationConfig) Unpack(out interface{}) error

Unpack this WorkerImplementationConfig to a worker implementation's configuration struct. This will produce an error for any missing properties. Note that recursion is not supported.

Structs should be tagged with `workerimpl:"name"`, with the name defaulting to the lowercased version of the field name.

Jump to

Keyboard shortcuts

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