internal

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: BSD-3-Clause Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyUpdate added in v0.4.1

func ApplyUpdate(dir string, config Config, cacheProvider CacheProvider, action Action, changeSet ChangeSet) 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 MapMap added in v0.7.0

func MapMap[K comparable, V any, E any](slice map[K]V, mapFn func(v V, k K) E) []E

func SetLogVerbosity

func SetLogVerbosity(value bool)

func SliceFilter added in v0.7.0

func SliceFilter[E any](slice []E, filterFn func(e E) bool) []E

func SliceFlatMap added in v0.7.0

func SliceFlatMap[E any, E2 any](slice []E, mapFn func(e E) []E2) []E2

func SliceGroupBy added in v0.7.0

func SliceGroupBy[E any](slice []E, keyFn func(e E) string) map[string][]E

func SliceMap added in v0.7.0

func SliceMap[E any, E2 any](slice []E, mapFn func(e E) E2) []E2

func SliceUnique added in v0.7.0

func SliceUnique[E comparable](slice []E) []E

Types

type Action

type Action interface {
	Identifier() string
	Apply(dir string, changeSet ChangeSet) error
}

type Augmenter added in v0.5.0

type Augmenter interface {
	RenderMessage(config Config, change Change) (string, string, error)
}

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"`
	CacheKey     string    `yaml:"cacheKey,omitempty"`
}

type Change

type Change struct {
	RegistryName   string
	ResourceName   string
	OldVersion     string
	NewVersion     string
	File           string
	FileFormat     FileFormat
	LineNum        int
	OldValue       string
	NewValue       string
	Exec           []string
	Group          string
	RenderComments func() (string, 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 ChangeSet added in v0.7.0

type ChangeSet struct {
	Group   string
	Changes []Change
}

func (ChangeSet) Branch added in v0.7.0

func (cs ChangeSet) Branch(prefix string) string

func (ChangeSet) BranchFindPrefix added in v0.7.0

func (cs ChangeSet) BranchFindPrefix(prefix string) string

func (ChangeSet) GroupHash added in v0.7.0

func (cs ChangeSet) GroupHash() string

func (ChangeSet) Hash added in v0.7.0

func (cs ChangeSet) Hash() string

func (ChangeSet) Message added in v0.7.0

func (cs ChangeSet) Message() (string, string)

func (ChangeSet) Push added in v0.7.0

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

func (ChangeSet) Title added in v0.7.0

func (cs ChangeSet) Title() string

type Config

type Config struct {
	Files      ConfigFiles
	Registries map[string]Registry
	Policies   map[string]Policy
	Augmenters []Augmenter
	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

func (DockerRegistry) RetrieveLabels added in v0.5.0

func (r DockerRegistry) RetrieveLabels(repository string, version string) (map[string]string, error)

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
	SignKey *openpgp.Entity
}

type GitHubGitProvider

type GitHubGitProvider struct {
	Author        GitAuthor
	AccessToken   string
	InheritLabels GitHubGitProviderInheritLabels
}

func (*GitHubGitProvider) ExtractInheritedLabels added in v0.6.1

func (p *GitHubGitProvider) ExtractInheritedLabels(pullRequests []*github.PullRequest) []string

func (GitHubGitProvider) Push

func (p GitHubGitProvider) Push(dir string, changeSet ChangeSet, callbacks ...func() error) error

func (GitHubGitProvider) Request

func (p GitHubGitProvider) Request(dir string, changeSet ChangeSet, callbacks ...func() error) error

type GitHubGitProviderInheritLabels added in v0.6.1

type GitHubGitProviderInheritLabels struct {
	Enabled  bool
	Includes []string
	Excludes []string
}

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 GitLabGitProvider added in v0.2.1

type GitLabGitProvider struct {
	Author      GitAuthor
	URL         string
	AccessToken string
	AssigneeIDs []int
}

func (GitLabGitProvider) Push added in v0.2.1

func (p GitLabGitProvider) Push(dir string, changeSet ChangeSet, callbacks ...func() error) error

func (GitLabGitProvider) Request added in v0.2.1

func (p GitLabGitProvider) Request(dir string, changeSet ChangeSet, callbacks ...func() error) error

type GitProvider

type GitProvider interface {
	Push(dir string, changeSet ChangeSet, callbacks ...func() error) error
	Request(dir string, changeSet ChangeSet, callbacks ...func() error) error
}

type GithubAugmenter added in v0.5.0

type GithubAugmenter struct {
	AccessToken string
}

func (GithubAugmenter) ExtractPullRequestReferences added in v0.7.1

func (a GithubAugmenter) ExtractPullRequestReferences(text string) (string, []GithubPullRequestReference)

func (GithubAugmenter) RenderMessage added in v0.5.0

func (a GithubAugmenter) RenderMessage(config Config, change Change) (string, string, error)
type GithubLink struct {
	Title string
	URL   string
}

func (GithubLink) Render added in v0.5.0

func (l GithubLink) Render() string

type GithubPullRequestReference added in v0.7.1

type GithubPullRequestReference struct {
	Owner  string
	Repo   string
	Number int
}

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) Push

func (p LocalGitProvider) Push(dir string, changeSet ChangeSet, callbacks ...func() error) error

func (LocalGitProvider) Request

func (p LocalGitProvider) Request(dir string, changeSet ChangeSet, 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) Apply

func (a PushAction) Apply(dir string, changeSet ChangeSet) error

func (PushAction) Identifier added in v0.4.1

func (c PushAction) Identifier() string

type RawConfig

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

type RawConfigAugmenterGithub added in v0.5.0

type RawConfigAugmenterGithub struct {
	AccessToken string `yaml:"accessToken"`
}

type RawConfigFiles

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

type RawConfigGit

type RawConfigGit struct {
	Author  RawConfigGitAuthor  `yaml:"author"`
	SignKey string              `yaml:"signKey"`
	GitHub  *RawConfigGitGitHub `yaml:"gitHub"`
	GitLab  *RawConfigGitGitLab `yaml:"gitLab"`
}

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"`
	InheritLabels RawConfigGitGitHubInheritLabels `yaml:"inheritLabels"`
}

type RawConfigGitGitHubInheritLabels added in v0.6.1

type RawConfigGitGitHubInheritLabels struct {
	Enabled  bool     `yaml:"enabled"`
	Includes []string `yaml:"includes"`
	Excludes []string `yaml:"excludes"`
}

type RawConfigGitGitLab added in v0.2.1

type RawConfigGitGitLab struct {
	URL         string `yaml:"url"`
	AccessToken string `yaml:"accessToken"`
	AssigneeIDs []int  `yaml:"assigneeIDs"`
}

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) Apply

func (a RequestAction) Apply(dir string, changeSet ChangeSet) error

func (RequestAction) Identifier added in v0.4.1

func (c RequestAction) Identifier() string

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
	Action *Action
}

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