internal

package
v0.2.0-rc.8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileList

func FileList(dir string, includes []regexp.Regexp, excludes []regexp.Regexp) ([]string, error)

func FileResolvePath

func FileResolvePath(dir string, file string) string

func LogDebug

func LogDebug(msg string, args ...interface{})

func LogError

func LogError(msg string, args ...interface{})

func LogInfo

func LogInfo(msg string, args ...interface{})

func LogWarning

func LogWarning(msg string, args ...interface{})

func SetLogVerbosity

func SetLogVerbosity(value bool)

Types

type Action

type Action interface {
	Apply(dir string, changes Changes) error
	AlreadyApplied(dir string, changes Changes) bool
}

type Cache

type Cache struct {
	Resources []CacheResource `yaml:"resources"`
}

func (Cache) Equal

func (c1 Cache) Equal(c2 Cache) bool

func (Cache) FindResource

func (c Cache) FindResource(registryName string, resourceName string) *CacheResource

func (Cache) UpdateResource

func (c Cache) UpdateResource(r CacheResource) Cache

type CacheProvider

type CacheProvider interface {
	Load() (*Cache, error)
	Save(cache Cache) error
}

type CacheResource

type CacheResource struct {
	RegistryName string    `yaml:"registry"`
	ResourceName string    `yaml:"resource"`
	Versions     []string  `yaml:"versions"`
	Timestamp    time.Time `yaml:"timestamp"`
}

type Change

type Change struct {
	RegistryName string
	ResourceName string
	OldVersion   string
	NewVersion   string
	File         string
	FileFormat   FileFormat
	LineNum      int
	OldValue     string
	NewValue     string
	Action       *Action
}

func (Change) Hash

func (c Change) Hash() []byte

func (Change) Identifier

func (c Change) Identifier() string

func (Change) Message

func (c Change) Message() string

func (Change) Push

func (c Change) Push(dir string, fileHooks ...func(file string) error) error

type Changes

type Changes []Change

func (Changes) Branch

func (cs Changes) Branch(prefix string) string

func (Changes) BranchFindPrefix

func (cs Changes) BranchFindPrefix(prefix string) string

func (Changes) BranchFindSuffix

func (cs Changes) BranchFindSuffix() string

func (Changes) Hash

func (cs Changes) Hash() []byte

func (Changes) Message

func (cs Changes) Message() string

func (Changes) Push

func (cs Changes) Push(dir string, fileHooks ...func(file string) error) error

func (Changes) Title

func (cs Changes) Title() string

type Config

type Config struct {
	Files      ConfigFiles
	Registries map[string]Registry
	Policies   map[string]Policy
	Git        Git
}

func LoadConfig

func LoadConfig(bytesRaw []byte) (*Config, error)

type ConfigFiles

type ConfigFiles struct {
	Includes []regexp.Regexp
	Excludes []regexp.Regexp
}

type DockerImageFormat

type DockerImageFormat struct{}

func (DockerImageFormat) ExtractVersion

func (f DockerImageFormat) ExtractVersion(str string) (*string, error)

func (DockerImageFormat) ReplaceVersion

func (f DockerImageFormat) ReplaceVersion(str string, version string) (*string, error)

type DockerRegistry

type DockerRegistry struct {
	Interval    time.Duration
	Url         string
	Credentials HttpBasicCredentials
}

func (DockerRegistry) FetchVersions

func (r DockerRegistry) FetchVersions(repository string) ([]string, error)

func (DockerRegistry) GetInterval

func (r DockerRegistry) GetInterval() time.Duration

type Extract

type Extract struct {
	Key      string
	Value    string
	Strategy ExtractStrategy
}

Extract

type ExtractStrategy

type ExtractStrategy interface {
	IsValid(v string) bool
	IsCompatible(v1 string, v2 string) bool
	Compare(v1 string, v2 string) int
	Segments(v string) map[string]string
}

type FileCacheProvider

type FileCacheProvider struct {
	File string
}

func (FileCacheProvider) Load

func (p FileCacheProvider) Load() (*Cache, error)

func (FileCacheProvider) Save

func (p FileCacheProvider) Save(cache Cache) error

type FileFormat added in v0.2.0

type FileFormat interface {
	ExtractAnnotations(all []string) ([]FileFormatAnnotation, error)
	ReadValue(lines []string, lineNum int) (string, error)
	WriteValue(lines []string, lineNum int, value string) error
}

func GuessFileFormatFromExtension added in v0.2.0

func GuessFileFormatFromExtension(file string) (FileFormat, error)

type FileFormatAnnotation added in v0.2.0

type FileFormatAnnotation struct {
	LineNum       int
	AnnotationRaw string
}

type Format

type Format interface {
	ExtractVersion(str string) (*string, error)
	ReplaceVersion(str string, version string) (*string, error)
}

type Git

type Git struct {
	Provider GitProvider
}

type GitAuthor

type GitAuthor struct {
	Name  string
	Email string
}

type GitHubGitProvider

type GitHubGitProvider struct {
	Author      GitAuthor
	AccessToken string
}

func (GitHubGitProvider) AlreadyRequested

func (p GitHubGitProvider) AlreadyRequested(dir string, changes Changes) bool

func (GitHubGitProvider) Push

func (p GitHubGitProvider) Push(dir string, changes Changes, callbacks ...func() error) error

func (GitHubGitProvider) Request

func (p GitHubGitProvider) Request(dir string, changes Changes, callbacks ...func() error) error

type GitHubTagRegistry

type GitHubTagRegistry struct {
	Interval    time.Duration
	Url         string
	Credentials HttpBasicCredentials
}

func (GitHubTagRegistry) FetchVersions

func (r GitHubTagRegistry) FetchVersions(repository string) ([]string, error)

func (GitHubTagRegistry) GetInterval

func (r GitHubTagRegistry) GetInterval() time.Duration

type GitProvider

type GitProvider interface {
	Push(dir string, changes Changes, callbacks ...func() error) error
	Request(dir string, changes Changes, callbacks ...func() error) error
	AlreadyRequested(dir string, changes Changes) bool
}

type HelmRegistry

type HelmRegistry struct {
	Interval    time.Duration
	Url         string
	Credentials HttpBasicCredentials
}

func (HelmRegistry) FetchVersions

func (r HelmRegistry) FetchVersions(chart string) ([]string, error)

func (HelmRegistry) GetInterval

func (r HelmRegistry) GetInterval() time.Duration

type HttpBasicCredentials

type HttpBasicCredentials struct {
	Username string
	Password string
}

type LexicographicExtractStrategy

type LexicographicExtractStrategy struct {
	Pin bool
}

func (LexicographicExtractStrategy) Compare

func (str LexicographicExtractStrategy) Compare(v1 string, v2 string) int

func (LexicographicExtractStrategy) IsCompatible

func (str LexicographicExtractStrategy) IsCompatible(v1 string, v2 string) bool

func (LexicographicExtractStrategy) IsValid

func (str LexicographicExtractStrategy) IsValid(v string) bool

func (LexicographicExtractStrategy) Segments added in v0.2.0

func (str LexicographicExtractStrategy) Segments(v string) map[string]string

type LocalGitProvider

type LocalGitProvider struct {
	Author GitAuthor
}

func (LocalGitProvider) AlreadyRequested

func (p LocalGitProvider) AlreadyRequested(dir string, changes Changes) bool

func (LocalGitProvider) Push

func (p LocalGitProvider) Push(dir string, changes Changes, callbacks ...func() error) error

func (LocalGitProvider) Request

func (p LocalGitProvider) Request(dir string, changes Changes, callbacks ...func() error) error

type NumericExtractStrategy

type NumericExtractStrategy struct {
	Pin bool
}

func (NumericExtractStrategy) Compare

func (str NumericExtractStrategy) Compare(v1 string, v2 string) int

func (NumericExtractStrategy) IsCompatible

func (str NumericExtractStrategy) IsCompatible(v1 string, v2 string) bool

func (NumericExtractStrategy) IsValid

func (str NumericExtractStrategy) IsValid(v string) bool

func (NumericExtractStrategy) Segments added in v0.2.0

func (str NumericExtractStrategy) Segments(v string) map[string]string

type PlainFormat

type PlainFormat struct{}

func (PlainFormat) ExtractVersion

func (f PlainFormat) ExtractVersion(str string) (*string, error)

func (PlainFormat) ReplaceVersion

func (f PlainFormat) ReplaceVersion(str string, version string) (*string, error)

type Policy

type Policy struct {
	Pattern  *regexp.Regexp
	Extracts []Extract
}

func (Policy) Compare

func (p Policy) Compare(v1 string, v2 string, prefix string, suffix string) int

func (Policy) FilterAndSort

func (p Policy) FilterAndSort(currentVersion string, availableVersions []string, prefix string, suffix string, filter map[string]interface{}) ([]string, error)

func (Policy) FindNext

func (p Policy) FindNext(currentVersion string, availableVersions []string, prefix string, suffix string, filter map[string]interface{}) (*string, error)

func (Policy) Parse

func (p Policy) Parse(version string, prefix string, suffix string) (map[string]string, []string, error)

type PushAction

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

func (PushAction) AlreadyApplied

func (a PushAction) AlreadyApplied(dir string, changes Changes) bool

func (PushAction) Apply

func (a PushAction) Apply(dir string, changes Changes) error

type RawConfig

type RawConfig struct {
	Files      RawConfigFiles                    `yaml:"files"`
	Registries map[string]map[string]interface{} `yaml:"registries"`
	Policies   map[string]RawConfigPolicy        `yaml:"policies"`
	Git        RawConfigGit                      `yaml:"git"`
}

type RawConfigFiles

type RawConfigFiles struct {
	Includes []string `yaml:"includes"`
	Excludes []string `yaml:"excludes"`
}

type RawConfigGit

type RawConfigGit struct {
	Author RawConfigGitAuthor  `yaml:"author"`
	GitHub *RawConfigGitGitHub `yaml:"gitHub"`
}

type RawConfigGitAuthor

type RawConfigGitAuthor struct {
	Name  string `yaml:"name"`
	Email string `yaml:"email"`
}

type RawConfigGitGitHub

type RawConfigGitGitHub struct {
	Owner       string `yaml:"owner"`
	Repo        string `yaml:"repo"`
	AccessToken string `yaml:"accessToken"`
}

type RawConfigHttpCredentials

type RawConfigHttpCredentials struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type RawConfigPolicy

type RawConfigPolicy struct {
	Pattern  string                   `yaml:"pattern"`
	Extracts []map[string]interface{} `yaml:"extracts"`
}

type RawConfigPolicyExtractLexicographicStrategy

type RawConfigPolicyExtractLexicographicStrategy struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
	Pin   bool   `yaml:"pin"`
}

type RawConfigPolicyExtractNumericStrategy

type RawConfigPolicyExtractNumericStrategy struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
	Pin   bool   `yaml:"pin"`
}

type RawConfigPolicyExtractSemverStrategy

type RawConfigPolicyExtractSemverStrategy struct {
	Key              string `yaml:"key"`
	Value            string `yaml:"value"`
	PinMajor         bool   `yaml:"pinMajor"`
	PinMinor         bool   `yaml:"pinMinor"`
	PinPatch         bool   `yaml:"pinPatch"`
	AllowPrereleases bool   `yaml:"allowPrereleases"`
	Relaxed          bool   `yaml:"relaxed"`
}

type RawConfigRegistryDocker

type RawConfigRegistryDocker struct {
	Interval    time.Duration            `yaml:"interval"`
	Url         string                   `yaml:"url"`
	Credentials RawConfigHttpCredentials `yaml:"credentials"`
}

type RawConfigRegistryGitHubTag

type RawConfigRegistryGitHubTag struct {
	Interval    time.Duration            `yaml:"interval"`
	Url         string                   `yaml:"url"`
	Credentials RawConfigHttpCredentials `yaml:"credentials"`
}

type RawConfigRegistryHelm

type RawConfigRegistryHelm struct {
	Interval    time.Duration            `yaml:"interval"`
	Url         string                   `yaml:"url"`
	Credentials RawConfigHttpCredentials `yaml:"credentials"`
}

type RegexpFormat

type RegexpFormat struct {
	Pattern regexp.Regexp
}

func (RegexpFormat) ExtractVersion

func (f RegexpFormat) ExtractVersion(str string) (*string, error)

func (RegexpFormat) ReplaceVersion

func (f RegexpFormat) ReplaceVersion(str string, version string) (*string, error)

type Registry

type Registry interface {
	GetInterval() time.Duration
	FetchVersions(resource string) ([]string, error)
}

type RequestAction

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

func (RequestAction) AlreadyApplied

func (a RequestAction) AlreadyApplied(dir string, changes Changes) bool

func (RequestAction) Apply

func (a RequestAction) Apply(dir string, changes Changes) error

type SemverExtractStrategy

type SemverExtractStrategy struct {
	Relaxed          bool
	PinMajor         bool
	PinMinor         bool
	PinPatch         bool
	AllowPrereleases bool
}

func (SemverExtractStrategy) Compare

func (str SemverExtractStrategy) Compare(v1 string, v2 string) int

func (SemverExtractStrategy) IsCompatible

func (str SemverExtractStrategy) IsCompatible(v1 string, v2 string) bool

func (SemverExtractStrategy) IsValid

func (str SemverExtractStrategy) IsValid(v string) bool

func (SemverExtractStrategy) Segments added in v0.2.0

func (str SemverExtractStrategy) Segments(v string) map[string]string

type UpdateVersionResult

type UpdateVersionResult struct {
	Error  error
	Change *Change

	SkipMessage string
}

func ApplyUpdates

func ApplyUpdates(dir string, config Config, cacheProvider CacheProvider, dry bool) []UpdateVersionResult

func DetectUpdates

func DetectUpdates(dir string, config Config, cacheProvider CacheProvider) []UpdateVersionResult

type YamlFileFormat added in v0.2.0

type YamlFileFormat struct{}

func (YamlFileFormat) ExtractAnnotations added in v0.2.0

func (f YamlFileFormat) ExtractAnnotations(lines []string) ([]FileFormatAnnotation, error)

func (YamlFileFormat) ReadValue added in v0.2.0

func (f YamlFileFormat) ReadValue(lines []string, lineNum int) (string, error)

func (YamlFileFormat) WriteValue added in v0.2.0

func (f YamlFileFormat) WriteValue(lines []string, lineNum int, value string) error

Jump to

Keyboard shortcuts

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