config

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasProjectConfig

func HasProjectConfig() (string, error)

Checks if a project has its own configuration.

func SearchConfigFileFromDirEntries

func SearchConfigFileFromDirEntries(baseName string, entries []fs.DirEntry) (string, bool)

func SearchConfigFileFromPath

func SearchConfigFileFromPath(searchPath string) (string, error)

Searches for a config file with the given base name

Types

type DependencyConfig

type DependencyConfig struct {
	// A flag that allows disabling individual dependencies.
	Skip *bool `json:"skip" yaml:"skip"`
	// An optional text to describe, why a dependency was disabled.
	SkipReason string `json:"skipReason" yaml:"skipReason"`
	// Defines how much the dependency is allowed to update. Can be "major", "minor", or "patch".
	MaxUpdateType common.UpdateType `json:"maxUpdateType" yaml:"maxUpdateType"`
	// This flag defines if unstable releases are allowed. Unstable usually means a version that also has parts with text.
	AllowUnstable *bool `json:"allowUnstable" yaml:"allowUnstable"`
	// A list of registry urls to use. Allows overwriting the default. Depends on the datasource.
	RegistryUrls []string `json:"registryUrls" yaml:"registryUrls"`
	// Defines the regexp to use to parse the version into separate parts. See gover for more details.
	Versioning string `json:"versioning" yaml:"versioning"`
	// An optional regexp that is used to separate the version part from the rest from the raw string from external sources.
	ExtractVersion string `json:"extractVersion" yaml:"extractVersion"`
	// A flag to indicate if versions from a remote that do not match the versioning should be ignored or give an exception.
	IgnoreNonMatching *bool `json:"ignoreNonMatching" yaml:"ignoreNonMatching"`
	// Allows hard-coding a dependencyName in rules. Is used if it is not captured via matchString.
	DependencyName string `json:"dependencyName" yaml:"dependencyName"`
	// Allows hard-coding a datasource in rules. Is used if it is not captured via matchString.
	Datasource common.DatasourceType `json:"datasource" yaml:"datasource"`
	// Allows defining regexes that replace further information from dependencies (like hash) after updating
	PostUpgradeReplacements []string `json:"postUpgradeReplacements" yaml:"postUpgradeReplacements"`
	// An optional name of a group to group dependency updates together.
	GroupName string `json:"groupName" yaml:"groupName"`
}

func (*DependencyConfig) MergeWith

func (DependencyConfigA *DependencyConfig) MergeWith(DependencyConfigB *DependencyConfig)

type DevcontainerFeatureDependency

type DevcontainerFeatureDependency struct {
	Property       string                `json:"property" yaml:"property"`
	Datasource     common.DatasourceType `json:"datasource" yaml:"datasource"`
	DependencyName string                `json:"dependencyName" yaml:"dependencyName"`
}

func (*DevcontainerFeatureDependency) MergeWith

type GonovateConfig

type GonovateConfig struct {
	// Settings that are relevant for the platform.
	Platform *PlatformConfig `json:"platform" yaml:"platform"`
	// A map of presets for matchstrings that can be used and referenced.
	MatchStringPresets map[string]*MatchStringPreset `json:"matchStringPresets" yaml:"matchStringPresets"`
	// A map of presets for versionings that can be used and referenced.
	VersioningPresets map[string]string `json:"versioningPresets" yaml:"versioningPresets"`
	// A list of presets to also load before loading this config. All configs are merged together.
	Extends []string `json:"extends" yaml:"extends"`
	// A list of patterns that will be completely ignored.
	IgnorePatterns []string `json:"ignorePatterns" yaml:"ignorePatterns"`
	// A list of configurations for managers
	Managers []*Manager `json:"managers" yaml:"managers"`
	// A list of rules that can apply to managers or dependencies.
	Rules []*Rule `json:"rules" yaml:"rules"`
	// A list of rules that can apply to hosts.
	HostRules []*common.HostRule `json:"hostRules" yaml:"hostRules"`
}

This type represents the gonovate config object.

func Load

func Load(configPath string) (*GonovateConfig, error)

Loads the given configuration

func (*GonovateConfig) ApplyToDependency

func (config *GonovateConfig) ApplyToDependency(dependency *common.Dependency) error

Applies rules and presets to the dependency

func (*GonovateConfig) GetDatasource added in v0.6.2

func (config *GonovateConfig) GetDatasource(datasourceType common.DatasourceType, logger *slog.Logger) (common.IDatasource, error)

Creates a datasource out of the config of the given datasource type.

func (*GonovateConfig) GetManager added in v0.6.1

func (config *GonovateConfig) GetManager(managerId string, managerType common.ManagerType, logger *slog.Logger) (common.IManager, error)

Creates a manager out of the config with the given id and manager type.

func (*GonovateConfig) GetManagerConfigById added in v0.6.1

func (config *GonovateConfig) GetManagerConfigById(managerId string) *Manager

func (*GonovateConfig) GetMergedManagerConfig

func (config *GonovateConfig) GetMergedManagerConfig(managerId string, managerType common.ManagerType) *ManagerConfig

func (*GonovateConfig) MatchStringPresetsToPresets

func (cfg *GonovateConfig) MatchStringPresetsToPresets() map[string]*presets.MatchStringPreset

func (*GonovateConfig) MergeWith

func (configA *GonovateConfig) MergeWith(configB *GonovateConfig)

func (*GonovateConfig) MergeWithAsCopy

func (configA *GonovateConfig) MergeWithAsCopy(configB *GonovateConfig) *GonovateConfig

func (*GonovateConfig) PostLoadProcess

func (c *GonovateConfig) PostLoadProcess()

This method processes the gonovate config object. This should be called on any config object just after loading.

func (*GonovateConfig) ToCommonPlatformSettings

func (cfg *GonovateConfig) ToCommonPlatformSettings(logger *slog.Logger) *common.PlatformSettings

type Manager

type Manager struct {
	Id   string             `json:"id" yaml:"id"`
	Type common.ManagerType `json:"type" yaml:"type"`
	// These settings are immediately converted to rules to keep the right order, so they should not be used directly
	ManagerConfig    *ManagerConfig    `json:"managerConfig" yaml:"managerConfig"`
	DependencyConfig *DependencyConfig `json:"dependencyConfig" yaml:"dependencyConfig"`
}

This type represents an instance of manager with its configs and configs that apply for all dependencies within this manager.

func (*Manager) MergeWith

func (managerA *Manager) MergeWith(managerB *Manager)

type ManagerConfig

type ManagerConfig struct {
	// General settings
	Disabled     *bool    `json:"disabled" yaml:"disabled"`
	FilePatterns []string `json:"filePatterns" yaml:"filePatterns"`
	// Specific settings for RegexManager
	MatchStrings []string `json:"matchStrings" yaml:"matchStrings"`
	// Specific settings for DevcontainerManager
	DevcontainerConfig map[string][]*DevcontainerFeatureDependency `json:"devcontainerConfig" yaml:"devcontainerConfig"`
}

func (*ManagerConfig) MergeWith

func (ManagerConfigA *ManagerConfig) MergeWith(ManagerConfigB *ManagerConfig)

func (*ManagerConfig) ToCommonDevcontainerManagerSettings

func (managerConfig *ManagerConfig) ToCommonDevcontainerManagerSettings() *common.DevcontainerManagerSettings

type MatchStringPreset

type MatchStringPreset struct {
	MatchString       string   `json:"matchString" yaml:"matchString"`
	ParameterDefaults []string `json:"parameterDefaults" yaml:"parameterDefaults"`
}

type PlatformConfig

type PlatformConfig struct {
	// The type of the platform to use.
	Type      common.PlatformType `json:"type" yaml:"type"`
	Token     string              `json:"token" yaml:"token"`
	GitAuthor string              `json:"gitAuthor" yaml:"gitAuthor"`
	Endpoint  string              `json:"endpoint" yaml:"endpoint"`
	Inplace   *bool               `json:"inplace" yaml:"inplace"`
	Projects  []string            `json:"projects" yaml:"projects"`
	// The name of the base branch, defaults to "main".
	BaseBranch string `json:"baseBranch" yaml:"baseBranch"`
	// The prefix for branches created by gonovate. Defaults to "gonovate/".
	BranchPrefix string `json:"branchPrefix" yaml:"branchPrefix"`
}

This type defines configurations regarding the platform.

func (*PlatformConfig) MergeWith

func (platformConfigA *PlatformConfig) MergeWith(platformConfigB *PlatformConfig)

type Rule

type Rule struct {
	Matches          *RuleMatch        `json:"matches" yaml:"matches"`
	ManagerConfig    *ManagerConfig    `json:"managerConfig" yaml:"managerConfig"`
	DependencyConfig *DependencyConfig `json:"dependencyConfig" yaml:"dependencyConfig"`
}

type RuleMatch

type RuleMatch struct {
	Managers        []string                `json:"managers" yaml:"managers"`
	ManagerTypes    []common.ManagerType    `json:"managerTypes" yaml:"managerTypes"`
	Files           []string                `json:"files" yaml:"files"`
	DependencyNames []string                `json:"dependencyNames" yaml:"dependencyNames"`
	Datasources     []common.DatasourceType `json:"datasources" yaml:"datasources"`
}

func (*RuleMatch) IsMatchAll

func (rm *RuleMatch) IsMatchAll() bool

A MatchAll rule is a rule that has no matches defined at all, so it will match everything.

Jump to

Keyboard shortcuts

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