Documentation
¶
Index ¶
- Constants
- Variables
- func Base64ToHex(base64String string) (string, error)
- func BuildBranchName(settings *BranchNameBuilderSettings) (string, error)
- func BuildTitle(settings *TitleBuilderSettings) (string, error)
- func DecodeBase64(base64String string) ([]byte, error)
- func EncodeToHex(bytes []byte) string
- func FileExists(filePath string) (bool, error)
- func FilePathMatchesPattern(filePath string, patterns ...string) (bool, error)
- func FindAllNamedMatchesWithIndex(regex *regexp.Regexp, str string, includeNotMatchedOptional bool, n int) []map[string][]*CapturedGroup
- func FindNamedMatchesWithIndex(regex *regexp.Regexp, str string, includeNotMatchedOptional bool) map[string][]*CapturedGroup
- func NormalizeString(value string, maxLength int) string
- func ReplaceMatchesInRegex(regex *regexp.Regexp, str string, replacementMap map[string]string) (string, int)
- func SearchFiles(rootPath string, matchPaths []string, ignorePatterns []string) ([]string, error)
- type BranchNameBuilderSettings
- type CapturedGroup
- type DatasourceSettings
- type DatasourceType
- type Dependency
- type DependencyWithUpdate
- type DevcontainerManagerFeatureDependency
- type DevcontainerManagerSettings
- type GonovateCache
- type HostRule
- type IDatasource
- type IEngine
- type IManager
- type ManagerInfo
- type ManagerSettings
- type ManagerType
- type PlatformSettings
- type PlatformType
- type Project
- type RegexManagerSettings
- type ReleaseInfo
- type TitleBuilderSettings
- type UpdateGroup
- type UpdateType
Constants ¶
const ( ContentTypeNone = "" ContentTypeBinary = "application/octet-stream" ContentTypeForm = "application/x-www-form-urlencoded" ContentTypeJSON = "application/json" ContentTypeHTML = "text/html; charset=utf-8" ContentTypeText = "text/plain; charset=utf-8" )
Variables ¶
var Execute execute = execute{}
var FalsePtr *bool = &[]bool{false}[0]
var Git git = git{}
var HttpUtil httpUtil
exported global variable
var TruePtr *bool = &[]bool{true}[0]
Functions ¶
func Base64ToHex ¶
func BuildBranchName ¶ added in v0.16.0
func BuildBranchName(settings *BranchNameBuilderSettings) (string, error)
func BuildTitle ¶ added in v0.16.0
func BuildTitle(settings *TitleBuilderSettings) (string, error)
func DecodeBase64 ¶
func EncodeToHex ¶
func FileExists ¶
func FilePathMatchesPattern ¶
Checks if the given filePath matches at least one of the given patterns.
func FindAllNamedMatchesWithIndex ¶
func FindAllNamedMatchesWithIndex(regex *regexp.Regexp, str string, includeNotMatchedOptional bool, n int) []map[string][]*CapturedGroup
Find all named matches in the given string, returning an list of objects with start/end-index and the value for each named match
func NormalizeString ¶
Types ¶
type BranchNameBuilderSettings ¶ added in v0.16.0
type BranchNameBuilderSettings struct {
BranchNameTemplate string
BaseBranch string
DependencyName string
GroupName string
NewRelease *ReleaseInfo
}
type CapturedGroup ¶
func (*CapturedGroup) String ¶
func (cg *CapturedGroup) String() string
type DatasourceSettings ¶
type DatasourceType ¶
type DatasourceType string
const ( DATASOURCE_TYPE_ANTVERSION DatasourceType = "ant-version" DATASOURCE_TYPE_ARTIFACTORY DatasourceType = "artifactory" DATASOURCE_TYPE_BROWSERVERSION DatasourceType = "browser-version" DATASOURCE_TYPE_DOCKER DatasourceType = "docker" DATASOURCE_TYPE_GITEA_RELEASES DatasourceType = "gitea-releases" DATASOURCE_TYPE_GIT_TAGS DatasourceType = "git-tags" DATASOURCE_TYPE_GITHUB_RELEASES DatasourceType = "github-releases" DATASOURCE_TYPE_GITHUB_TAGS DatasourceType = "github-tags" DATASOURCE_TYPE_GITLAB_PACKAGES DatasourceType = "gitlab-packages" DATASOURCE_TYPE_GOMOD DatasourceType = "go-mod" DATASOURCE_TYPE_GOVERSION DatasourceType = "go-version" DATASOURCE_TYPE_GRADLEVERSION DatasourceType = "gradle-version" DATASOURCE_TYPE_HELM DatasourceType = "helm" DATASOURCE_TYPE_JAVAVERSION DatasourceType = "java-version" DATASOURCE_TYPE_MAVEN DatasourceType = "maven" DATASOURCE_TYPE_NODEJS DatasourceType = "nodejs" DATASOURCE_TYPE_NPM DatasourceType = "npm" )
type Dependency ¶
type Dependency struct {
// The name of the dependency.
Name string
// The current version of the dependency (unprocessed).
Version string
// An optional digest either in addition to the version or instead a version.
Digest string
// The type of the dependency. Used to allow different handlings per type in the manager. Optional.
Type string
// The datasource of the dependency.
Datasource DatasourceType
// A map that contains additional data about the dependency (for example a digest).
AdditionalData map[string]string
// The filepath from where this dependency was found.
FilePath string
// A list of update types that are allowed. Can be "major", "minor", or "patch".
UpdateTypes []UpdateType
// This flag defines if unstable releases are allowed. Unstable usually means a version that also has parts with text.
AllowUnstable *bool
// A list of registry urls to use. Allows overwriting the default. Depends on the datasource.
RegistryUrls []string
// Defines the regexp to use to parse the version into separate parts. See https://github.com/Roemer/gover for more details.
Versioning string
// An optional regexp that is used to separate the version part from the rest of the raw version string.
ExtractVersion string
// A flag to indicate if versions from a remote that do not match the versioning should be ignored or give an exception.
IgnoreNonMatching *bool
// A flag that allows disabling individual dependencies.
Skip *bool
// An optional text to describe, why a dependency was disabled.
SkipReason string
// Flag to indicate if the version check should be skipped (eg. for versions like latest or jdk8 where there is still a digest)
SkipVersionCheck *bool
// Allows defining regexes that replace further information from dependencies (like hash) after updating.
PostUpgradeReplacements []string
// An optional name of a group to group dependency updates together.
GroupName string
// A list of labels to add to the created PR for this dependency.
Labels []string
// A list of reviewers to add to the created PR for this dependency.
Reviewers []string
// A template for the title when committing and creating an MR/PR.
TitleTemplate string
// A template for the branch name when creating an MR/PR.
BranchNameTemplate string
// Contains information about the manager from which this dependency was found from. Is "nil" if the dependency is not from a manager.
ManagerInfo *ManagerInfo
}
This type represents a concrete dependency.
func (*Dependency) HasDigest ¶
func (d *Dependency) HasDigest() bool
func (*Dependency) String ¶
func (d *Dependency) String() string
type DependencyWithUpdate ¶ added in v0.16.0
type DependencyWithUpdate struct {
Dependency *Dependency
NewRelease *ReleaseInfo
}
Contains a dependency and the information about the update to this dependency.
type DevcontainerManagerFeatureDependency ¶
type DevcontainerManagerFeatureDependency struct {
Property string
Datasource DatasourceType
DependencyName string
}
type DevcontainerManagerSettings ¶
type DevcontainerManagerSettings struct {
FeatureDependencies map[string][]*DevcontainerManagerFeatureDependency
}
Settings relevant for the devcontainer manager.
type GonovateCache ¶ added in v0.16.0
type GonovateCache struct {
ReleaseCache *cache.FileCache[[]*ReleaseInfo]
GitLabUserIdCache *cache.MemoryCache[int64]
}
func NewGonovateCache ¶ added in v0.16.0
func NewGonovateCache(cacheDir string, logger *slog.Logger) *GonovateCache
type HostRule ¶
type HostRule struct {
// The host that needs to match in order to use this rule.
MatchHost string `json:"matchHost" yaml:"matchHost"`
// The username to authenticate with the host.
Username string `json:"username" yaml:"username"`
// The password to authenticate with the host.
Password string `json:"password" yaml:"password"`
// A token to authenticate with the host.
Token string `json:"token" yaml:"token"`
}
A host rule that is applied when using a certain host.
func (*HostRule) PasswordExpanded ¶
Expands the password with environment variables.
func (*HostRule) TokenExpanded ¶ added in v0.16.0
Expands the token with environment variables.
func (*HostRule) UsernameExpanded ¶
Expands the username with environment variables.
type IDatasource ¶
type IDatasource interface {
// Gets all possible releases for the dependency.
GetReleases(dependency *Dependency) ([]*ReleaseInfo, error)
// Gets the digest for the dependency.
GetDigest(dependency *Dependency, releaseVersion string) (string, error)
// Gets additional data for the dependency and the new release.
GetAdditionalData(dependency *Dependency, newRelease *ReleaseInfo, dataType string) (string, error)
// Handles the dependency update searching.
SearchDependencyUpdates(dependency *Dependency) ([]*ReleaseInfo, error)
}
This is the interface that needs to be implemented by all datasources.
type IEngine ¶
type IEngine interface {
// Gets the logger for the engine.
Logger() *slog.Logger
// Gets the desired manager.
GetManager(managerSettings *ManagerSettings) (IManager, error)
// Resolves match-strings with presets.
ResolveMatchString(matchString string) (string, error)
// Resolves versioning-strings with presets.
ResolveVersioning(versioning string) (string, error)
}
This is the interface for the gonovate engine.
type IManager ¶
type IManager interface {
// Gets the id of the manager.
Id() string
// Gets the type of the manager.
Type() ManagerType
// Gets the settings with which the manager was created.
Settings() *ManagerSettings
// Extracts all dependencies from the manager.
ExtractDependencies(filePath string) ([]*Dependency, error)
// Applies a dependency update with the manager.
ApplyDependencyUpdate(dependency *Dependency, newRelease *ReleaseInfo) error
}
This is the interface that needs to be implemented by all managers.
type ManagerInfo ¶
type ManagerInfo struct {
// The id of the manager from which this dependency was found.
ManagerId string
// An object that can contain data which is set/read from the manager to process the dependency.
ManagerData interface{}
}
Object with information about a manager.
type ManagerSettings ¶
type ManagerSettings struct {
// The logger to use for the manager.
Logger *slog.Logger
// A flag which is set when the manager is disabled.
Disabled *bool
// A list of patterns with the files that the manager should process.
FilePatterns []string
// Settings for the RegexManager.
RegexManagerSettings *RegexManagerSettings
// Settings for the DevcontainerManager.
DevcontainerManagerSettings *DevcontainerManagerSettings
}
This struct contains settings relevant for managers.
type ManagerType ¶
type ManagerType string
const ( MANAGER_TYPE_DEVCONTAINER ManagerType = "devcontainer" MANAGER_TYPE_DOCKER_COMPOSE ManagerType = "docker-compose" MANAGER_TYPE_DOCKERFILE ManagerType = "dockerfile" MANAGER_TYPE_GOMOD ManagerType = "go-mod" MANAGER_TYPE_HELM ManagerType = "helm" MANAGER_TYPE_INLINE ManagerType = "inline" MANAGER_TYPE_KUBERNETES ManagerType = "kubernetes" MANAGER_TYPE_REGEX ManagerType = "regex" MANAGER_TYPE_NPM ManagerType = "npm" )
type PlatformSettings ¶
type PlatformSettings struct {
// The logger to use for the platform.
Logger *slog.Logger
// The type of the platform.
Platform PlatformType
// The token which is used to interact with the platform. Is expanded from environment variables.
Token string
// The endpoint to use when interacting with the platform.
Endpoint string
// The author to use when interacting with git.
GitAuthor string
// The name of the base branch.
BaseBranch string
// Cache for gitlab user id lookups.
GitLabUserIdCache *cache.MemoryCache[int64]
}
func (*PlatformSettings) EndpointExpanded ¶ added in v0.10.1
func (ps *PlatformSettings) EndpointExpanded() string
func (*PlatformSettings) TokenExpanded ¶ added in v0.16.0
func (ps *PlatformSettings) TokenExpanded() string
type PlatformType ¶
type PlatformType string
const ( PLATFORM_TYPE_GIT PlatformType = "git" PLATFORM_TYPE_GITEA PlatformType = "gitea" PLATFORM_TYPE_GITHUB PlatformType = "github" PLATFORM_TYPE_GITLAB PlatformType = "gitlab" PLATFORM_TYPE_NOOP PlatformType = "noop" )
type RegexManagerSettings ¶
type RegexManagerSettings struct {
MatchStringPresets map[string]*presets.MatchStringPreset
MatchStrings []string
}
Settings relevant for the regex manager.
type ReleaseInfo ¶
type ReleaseInfo struct {
// The time when the release was created
ReleaseDate time.Time `json:"releaseDate,omitzero"`
// The original versionstring of the release
VersionString string `json:"versionString"`
// The parsed version of the release
Version *gover.Version `json:"-"`
// The digest of the release
Digest string `json:"digest,omitempty"`
// The type of the update this release would be. Can be "major", "minor", or "patch"
UpdateType UpdateType `json:"-"`
// Can contain additional data for the release like hashes or urls
AdditionalData map[string]string `json:"additionalData,omitempty"`
}
This type contains information about a release of a dependency
func (*ReleaseInfo) Clone ¶ added in v0.16.0
func (r *ReleaseInfo) Clone() *ReleaseInfo
type TitleBuilderSettings ¶ added in v0.16.0
type TitleBuilderSettings struct {
TitleTemplate string
DependencyName string
GroupName string
NewRelease *ReleaseInfo
}
type UpdateGroup ¶
type UpdateGroup struct {
Title string
BranchName string
Dependencies []*DependencyWithUpdate
Labels []string
Reviewers []string
}
type UpdateType ¶
type UpdateType string
const ( UPDATE_TYPE_MAJOR UpdateType = "major" UPDATE_TYPE_MINOR UpdateType = "minor" UPDATE_TYPE_PATCH UpdateType = "patch" )
func (UpdateType) IsLessSignificant ¶ added in v0.16.0
func (a UpdateType) IsLessSignificant(b UpdateType) bool