config

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConfigFileTypeNotSupported is returned when updatecli try to read
	// an unsupported file type.
	ErrConfigFileTypeNotSupported = errors.New("file extension not supported")

	// ErrBadConfig is returned when updatecli try to read
	// a wrong configuration.
	ErrBadConfig = errors.New("wrong updatecli configuration")

	// ErrNoEnvironmentVariableSet is returned when during the templating process,
	// it tries to access en environment variable not set.
	ErrNoEnvironmentVariableSet = errors.New("environment variable doesn't exist")

	// ErrNoKeyDefined is returned when during the templating process, it tries to
	// retrieve a key value which is not defined in the configuration
	ErrNoKeyDefined = errors.New("key not defined in configuration")

	// ErrNotAllowedTemplatedKey is returned when
	// we are planning to template at runtime unauthorized keys such map key
	ErrNotAllowedTemplatedKey = errors.New("not allowed templated key")
)

Functions

func Checksum

func Checksum(filename string) (string, error)

Checksum return a file checksum using sha256.

func IsTemplatedString

func IsTemplatedString(s string) bool

IsTemplatedString test if a string contains go template information

func Merge

func Merge(valuesFiles ...map[string]interface{}) (results map[string]interface{})

Merge merges one are multiple updatecli value files content into one

func ReadFile

func ReadFile(filename string, values *map[string]interface{}, encrypted bool) (err error)

ReadFile reads an udpatecli values file, it can also read encrypted sops files

Types

type Config

type Config struct {
	Name         string
	PipelineID   string                        // PipelineID allows to identify a full pipeline run, this value is propagated into each target if not defined at that level
	Title        string                        // Title is used for the full pipeline
	Source       source.Config                 // **Deprecated** 2021/02/18 Is replaced by Sources, this setting will be deleted in a future release
	PullRequests map[string]pullrequest.Config // PullRequests defines the list of Pull Request configuration which need to be managed
	SCMs         map[string]scm.Config         `yaml:"scms"` // SCMs defines the list of repository configuration used to fetch content from.
	Sources      map[string]source.Config      // Sources defines the list of source configuration
	Conditions   map[string]condition.Config   // Conditions defines the list of condition configuration
	Targets      map[string]target.Config      // Targets defines the list of target configuration
}

Config contains cli configuration

func New

func New(cfgFile string, valuesFiles, secretsFiles []string) (config Config, err error)

New reads an updatecli configuration file

func (*Config) Display

func (config *Config) Display() error

Display shows updatecli configuration including secrets !

func (*Config) GetChangelogTitle added in v0.10.0

func (config *Config) GetChangelogTitle(ID string, fallback string) (title string)

GetChangelogTitle try to guess a specific target based on various information available for a specific job

func (*Config) Reset

func (config *Config) Reset()

Reset reset configuration

func (*Config) Update

func (config *Config) Update(data interface{}) (err error)

Update updates its own configuration file It's used when the configuration expected a value defined a runtime

func (*Config) Validate

func (config *Config) Validate() error

Validate run various validation test on the configuration and update fields if necessary

type Template

type Template struct {
	CfgFile      string                 // Specify updatecli configuration file
	ValuesFiles  []string               // Specify value filename
	SecretsFiles []string               // Specify sops secrets filename
	Values       map[string]interface{} `yaml:"-,inline"` // Contains key/value extracted from a yaml file
	Secrets      map[string]interface{} `yaml:"-,inline"` // Contains mozilla/sops information using yaml format
}

Template contains template information used to generate updatecli configuration struct

func (*Template) Init

func (t *Template) Init(config *Config) error

Init parses a golang template then return an updatecli configuration as a struct

Jump to

Keyboard shortcuts

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