Documentation
¶
Index ¶
- Constants
- Variables
- func Checksum(content string) string
- func FileChecksum(filename string) (string, error)
- func IsTemplatedString(s string) bool
- type Config
- func (config *Config) Display() error
- func (config *Config) EnsureLocalScm() error
- func (config *Config) GetChangelogTitle(ID string, fallback string) (title string)
- func (c *Config) IsManifestDifferentThanOnDisk() (bool, error)
- func (config *Config) Reset()
- func (c *Config) SaveOnDisk() error
- func (config *Config) Update(data interface{}) (err error)
- func (config *Config) Validate() error
- func (config *Config) ValidateManifestCompatibility() error
- type Option
- type Spec
- type Template
Constants ¶
const ( // LOCALSCMIDENTIFIER defines the scm id used to configure the local scm directory LOCALSCMIDENTIFIER string = "local" )
Variables ¶
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, // updatecli tries to access en environment variable not set. ErrNoEnvironmentVariableSet = errors.New("environment variable doesn't exist") // ErrNoKeyDefined is returned when during the templating process, updatecli 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 as map key ErrNotAllowedTemplatedKey = errors.New("not allowed templated key") )
var ( // Define indentation used to encode yaml data YAMLSetIdent int = 4 /* GolangTemplatingDiff is used to enable or disable the diff feature. Showing the diff may leak sensitive information like credentials. */ GolangTemplatingDiff bool )
Functions ¶
func FileChecksum ¶ added in v0.27.0
FileChecksum returns sha256 checksum based on a file content.
func IsTemplatedString ¶
IsTemplatedString test if a string contains go template information
Types ¶
type Config ¶
type Config struct {
// Spec describe an updatecli manifest
Spec Spec
// contains filtered or unexported fields
}
Config contains cli configuration
func (*Config) EnsureLocalScm ¶ added in v0.28.0
EnsureLocalScm ensures the config receiver has a "local" SCM configuration if needed
func (*Config) GetChangelogTitle ¶ added in v0.10.0
GetChangelogTitle try to guess a specific target based on various information available for a specific job
func (*Config) IsManifestDifferentThanOnDisk ¶ added in v0.27.0
IsManifestDifferentThanOnDisk checks if an Updatecli manifest in memory is the same than the one on disk
func (*Config) SaveOnDisk ¶ added in v0.27.0
SaveOnDisk saves an updatecli manifest to disk
func (*Config) Update ¶
Update updates its own configuration file It's used when the configuration expected a value defined a runtime
func (*Config) Validate ¶
Validate run various validation test on the configuration and update fields if necessary
func (*Config) ValidateManifestCompatibility ¶ added in v0.27.0
type Option ¶ added in v0.27.0
type Option struct {
// ManifestFile contains the updatecli manifest full file path
ManifestFile string
// ValuesFiles contains the list of updatecli values full file path
ValuesFiles []string
// SecretsFiles contains the list of updatecli sops secrets full file path
SecretsFiles []string
// DisableTemplating specifies if needs to be done
DisableTemplating bool
}
Option contains configuration options such as filepath located on disk,etc.
type Spec ¶ added in v0.27.0
type Spec struct {
/*
"name" defines a pipeline name
example:
* "name: 'deps: update nodejs version to latest stable'"
remark:
* using a short sentence describing the pipeline is a good way to name your pipeline.
* using conventional commits convention is a good way to name your pipeline.
* "name" is often used a default values for other configuration such as pullrequest title.
* "name" shouldn't contain any dynamic information such as source output.
*/
Name string `yaml:",omitempty" jsonschema:"required"`
/*
"pipelineid" allows to identify a full pipeline run.
example:
* "pipelineid: nodejs/dependencies"
* "pipelineid: gomod/github.com/updatecli/updatecli"
* "pipelineid: autodiscovery/gomodules/minor"
remark:
* "pipelineid" is used to generate uniq branch name for target update relying on scm configuration.
* The same "pipelineid" may be used by different Updatecli manifest" to ensure they are updated in the same workflow including pullrequest.
*/
PipelineID string `yaml:",omitempty"`
/*
"autodiscovery" defines the configuration to automatically discover new versions update.
example:
---
autodiscovery:
scmid: default
actionid: default
groupby: all
crawlers:
golang/gomod:
versionfilter:
kind: semver
pattern: patch
---
*/
AutoDiscovery autodiscovery.Config `yaml:",omitempty"`
/*
"title" is deprecated, please use "name" instead.
*/
Title string `yaml:",omitempty" jsonschema:"-"`
/*
!Deprecated in favor of `actions`
*/
PullRequests map[string]action.Config `yaml:",omitempty" jsonschema:"-"`
/*
"actions" defines the list of action configurations which need to be managed.
examples:
---
actions:
default:
kind: github/pullrequest
scmid: default
spec:
automerge: true
labels:
- "dependencies"
---
*/
Actions map[string]action.Config `yaml:",omitempty"`
/*
"scms" defines the list of repository configuration used to fetch content from.
examples:
---
scms:
default:
kind: github
spec:
owner: "updatecli"
repository: "updatecli"
token: "${{ env "GITHUB_TOKEN" }}"
branch: "main"
---
*/
SCMs map[string]scm.Config `yaml:"scms,omitempty"`
/*
"sources" defines the list of Updatecli source definition.
example:
---
sources:
# Source to retrieve the latest version of nodejs
nodejs:
name: Get latest nodejs version
kind: json
spec:
file: https://nodejs.org/dist/index.json
key: .(lts!=false).version
---
*/
Sources map[string]source.Config `yaml:",omitempty"`
/*
"conditions" defines the list of Updatecli condition definition.
example:
---
conditions:
container:
name: Check if Updatecli container image for tag "v0.63.0" exists
kind: dockerimage
spec:
image: "updatecli/updatecli:latest"
tag: "v0.63.0"
---
*/
Conditions map[string]condition.Config `yaml:",omitempty"`
/*
"targets" defines the list of Updatecli target definition.
example:
---
targets:
default:
name: 'ci: update Golangci-lint version to {{ source "default" }}'
kind: yaml
spec:
file: .github/workflows/go.yaml
key: $.jobs.build.steps[2].with.version
scmid: default
sourceid: default
---
*/
Targets map[string]target.Config `yaml:",omitempty"`
/*
"version" defines the minimum Updatecli version compatible with the manifest
*/
Version string `yaml:",omitempty"`
}
Spec contains pipeline configuration
type Template ¶
type Template struct {
// CfgFile is the updatecli configuration file
CfgFile string
// ValuesFiles contains one or multiple yaml files containing key/values
ValuesFiles []string
// SecretsFiles contains one or multiple sops files containing secrets
SecretsFiles []string
// Values contains key/value extracted from a values file
Values map[string]interface{} `yaml:"-,inline"`
// Secrets contains key/value extracted from a sops file
Secrets map[string]interface{} `yaml:"-,inline"`
// contains filtered or unexported fields
}
Template contains template information used to generate updatecli configuration struct