config

package
v1.11.1-0...-d84bc69 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const InfluxField = "field"

InfluxField is the constant for an Influx field

View Source
const InfluxTag = "tag"

InfluxTag is the constant for an Influx field

Variables

This section is empty.

Functions

func AvailableFlagValues

func AvailableFlagValues(cmd *cobra.Command, filters *StepFilters) map[string]interface{}

AvailableFlagValues returns all flags incl. values which are available to the command.

func GetJSON

func GetJSON(data interface{}) (string, error)

GetJSON returns JSON representation of an object

func MarkFlagsWithValue

func MarkFlagsWithValue(cmd *cobra.Command, stepConfig StepConfig)

MarkFlagsWithValue marks a flag as changed if value is available for the flag through the step configuration.

func OpenPiperFile

func OpenPiperFile(name string) (io.ReadCloser, error)

OpenPiperFile provides functionality to retrieve configuration via file or http

Types

type Alias

type Alias struct {
	Name       string `json:"name,omitempty"`
	Deprecated bool   `json:"deprecated,omitempty"`
}

Alias defines a step input parameter alias

type Condition

type Condition struct {
	ConditionRef string  `json:"conditionRef"`
	Params       []Param `json:"params"`
}

Condition defines an condition which decides when the parameter, resource or container is valid

type Config

type Config struct {
	CustomDefaults []string                          `json:"customDefaults,omitempty"`
	General        map[string]interface{}            `json:"general"`
	Stages         map[string]map[string]interface{} `json:"stages"`
	Steps          map[string]map[string]interface{} `json:"steps"`
	// contains filtered or unexported fields
}

Config defines the structure of the config files

func (*Config) ApplyAliasConfig

func (c *Config) ApplyAliasConfig(parameters []StepParameters, filters StepFilters, stageName, stepName string)

ApplyAliasConfig adds configuration values available on aliases to primary configuration parameters

func (*Config) GetStepConfig

func (c *Config) GetStepConfig(flagValues map[string]interface{}, paramJSON string, configuration io.ReadCloser, defaults []io.ReadCloser, filters StepFilters, parameters []StepParameters, envParameters map[string]interface{}, stageName, stepName string) (StepConfig, error)

GetStepConfig provides merged step configuration using defaults, config, if available

func (*Config) ReadConfig

func (c *Config) ReadConfig(configuration io.ReadCloser) error

ReadConfig loads config and returns its content

type Container

type Container struct {
	//ToDo: check dockerOptions, dockerVolumeBind, containerPortMappings, sidecarOptions, sidecarVolumeBind
	Command         []string    `json:"command"`
	EnvVars         []EnvVar    `json:"env"`
	Image           string      `json:"image"`
	ImagePullPolicy string      `json:"imagePullPolicy"`
	Name            string      `json:"name"`
	ReadyCommand    string      `json:"readyCommand"`
	Shell           string      `json:"shell"`
	WorkingDir      string      `json:"workingDir"`
	Conditions      []Condition `json:"conditions,omitempty"`
	Options         []Option    `json:"options,omitempt"`
}

Container defines an execution container

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

EnvVar defines an environment variable

type Option

type Option struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Option defines an docker option

type Param

type Param struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Param defines the parameters serving as inputs to the condition

type ParseError

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

ParseError defines an error type for configuration parsing errors

func NewParseError

func NewParseError(message string) *ParseError

NewParseError creates a new ParseError

func (*ParseError) Error

func (e *ParseError) Error() string

Error returns the message of the ParseError

type PipelineDefaults

type PipelineDefaults struct {
	Defaults []Config `json:"defaults"`
}

PipelineDefaults defines the structure of the pipeline defaults

func (*PipelineDefaults) ReadPipelineDefaults

func (d *PipelineDefaults) ReadPipelineDefaults(defaultSources []io.ReadCloser) error

ReadPipelineDefaults loads defaults and returns its content

type ResourceReference

type ResourceReference struct {
	Name  string `json:"name"`
	Param string `json:"param"`
}

ResourceReference defines the parameters of a resource reference

type StepConfig

type StepConfig struct {
	Config map[string]interface{}
}

StepConfig defines the structure for merged step configuration

func GetStepConfigWithJSON

func GetStepConfigWithJSON(flagValues map[string]interface{}, stepConfigJSON string, filters StepFilters) StepConfig

GetStepConfigWithJSON provides merged step configuration using a provided stepConfigJSON with additional flags provided

type StepData

type StepData struct {
	Metadata StepMetadata `json:"metadata"`
	Spec     StepSpec     `json:"spec"`
}

StepData defines the metadata for a step, like step descriptions, parameters, ...

func (*StepData) GetContextDefaults

func (m *StepData) GetContextDefaults(stepName string) (io.ReadCloser, error)

GetContextDefaults retrieves context defaults like container image, name, env vars, resources, ... It only supports scenarios with one container and optionally one sidecar

func (*StepData) GetContextParameterFilters

func (m *StepData) GetContextParameterFilters() StepFilters

GetContextParameterFilters retrieves all scope dependent parameter filters

func (*StepData) GetParameterFilters

func (m *StepData) GetParameterFilters() StepFilters

GetParameterFilters retrieves all scope dependent parameter filters

func (*StepData) GetResourceParameters

func (m *StepData) GetResourceParameters(path, name string) map[string]interface{}

GetResourceParameters retrieves parameters from a named pipeline resource with a defined path

func (*StepData) ReadPipelineStepData

func (m *StepData) ReadPipelineStepData(metadata io.ReadCloser) error

ReadPipelineStepData loads step definition in yaml format

type StepFilters

type StepFilters struct {
	All        []string
	General    []string
	Stages     []string
	Steps      []string
	Parameters []string
	Env        []string
}

StepFilters defines the filter parameters for the different sections

type StepInputs

type StepInputs struct {
	Parameters []StepParameters `json:"params"`
	Resources  []StepResources  `json:"resources,omitempty"`
	Secrets    []StepSecrets    `json:"secrets,omitempty"`
}

StepInputs defines the spec details for a step, like step inputs, containers, sidecars, ...

type StepMetadata

type StepMetadata struct {
	Name            string `json:"name"`
	Description     string `json:"description"`
	LongDescription string `json:"longDescription,omitempty"`
}

StepMetadata defines the metadata for a step, like step descriptions, parameters, ...

type StepOutputs

type StepOutputs struct {
	Resources []StepResources `json:"resources,omitempty"`
}

StepOutputs defines the outputs of a step step, typically one or multiple resources

type StepParameters

type StepParameters struct {
	Name            string              `json:"name"`
	Description     string              `json:"description"`
	LongDescription string              `json:"longDescription,omitempty"`
	ResourceRef     []ResourceReference `json:"resourceRef,omitempty"`
	Scope           []string            `json:"scope"`
	Type            string              `json:"type"`
	Mandatory       bool                `json:"mandatory,omitempty"`
	Default         interface{}         `json:"default,omitempty"`
	Aliases         []Alias             `json:"aliases,omitempty"`
	Conditions      []Condition         `json:"conditions,omitempty"`
}

StepParameters defines the parameters for a step

type StepResources

type StepResources struct {
	Name        string                   `json:"name"`
	Description string                   `json:"description,omitempty"`
	Type        string                   `json:"type,omitempty"`
	Parameters  []map[string]interface{} `json:"params,omitempty"`
	Conditions  []Condition              `json:"conditions,omitempty"`
}

StepResources defines the resources to be provided by the step context, e.g. Jenkins pipeline

type StepSecrets

type StepSecrets struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type,omitempty"`
}

StepSecrets defines the secrets to be provided by the step context, e.g. Jenkins pipeline

type StepSpec

type StepSpec struct {
	Inputs     StepInputs  `json:"inputs,omitempty"`
	Outputs    StepOutputs `json:"outputs,omitempty"`
	Containers []Container `json:"containers,omitempty"`
	Sidecars   []Container `json:"sidecars,omitempty"`
}

StepSpec defines the spec details for a step, like step inputs, containers, sidecars, ...

Jump to

Keyboard shortcuts

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