Documentation
¶
Overview ¶
Package config contains functions related to config files
Index ¶
- func GetManifestPath(manifestFile string, manifestType string) string
- func GetManifestType(fullPath string) string
- func IsRegistryUsed(manifestFile string, manifestPath string, defaultRegistry DefaultRegistry, ...) bool
- func PathWithEndingSlash(path string) string
- func ScanFileList(files []string, manifests map[string]string)
- func ScanLocalDirectory(baseDirectory string, directory string, manifests map[string]string)
- type Allow
- type ChangeInfo
- type CheckDirectoryExists
- type CheckDirectoryExistsParameters
- type CommitMessage
- type Cooldown
- type DefaultRegistries
- type DefaultRegistry
- type DependabotConfig
- func (config *DependabotConfig) IsManifestCovered(manifestFile string, manifestType string, updateRegistries []string) bool
- func (config *DependabotConfig) Parse(data []byte) error
- func (config *DependabotConfig) ProcessManifest(manifestFile string, manifestType string, toolConfig ToolConfig, ...)
- func (config *DependabotConfig) ToYaml() []byte
- func (config *DependabotConfig) UpdateConfig(manifests map[string]string, toolConfig ToolConfig, loadFileFn LoadFileContent, ...) ChangeInfo
- type Group
- type Ignore
- type KeyValue
- type LoadFileContent
- type LoadFileContentParameters
- type PullRequestParameters
- type Registry
- type RegistryInfo
- type RemoteClient
- type Schedule
- type ToolConfig
- type Update
- type UpdateDefaults
- type UpdateInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetManifestPath ¶ added in v0.3.0
GetManifestPath returns the path of the absolute path of a manifest file
func GetManifestType ¶
GetManifestType returns the type of manifest file, if any.
func IsRegistryUsed ¶ added in v0.3.0
func IsRegistryUsed(manifestFile string, manifestPath string, defaultRegistry DefaultRegistry, loadFileFn LoadFileContent, loadFileParams LoadFileContentParameters, ) bool
IsRegistryUsed returns if a registry is used by a manifest file
func PathWithEndingSlash ¶ added in v0.3.2
PathWithEndingSlash returns a path with an added slash, if needed
func ScanFileList ¶
ScanFileList looks for manifest files, in a list of file names (incl. path)
Types ¶
type Allow ¶ added in v0.2.0
type Allow struct {
DependencyName string `yaml:"dependency-name,omitempty"`
DependencyType string `yaml:"dependency-type,omitempty"`
}
Allow holds the config items of an allow definition
type ChangeInfo ¶
type ChangeInfo struct {
NewRegistries []RegistryInfo
RemovedRegistries []RegistryInfo
NewUpdates []UpdateInfo
FixedUpdates []UpdateInfo
RemovedUpdates []UpdateInfo
}
ChangeInfo holds the changes applied to a config.
type CheckDirectoryExists ¶ added in v0.7.0
type CheckDirectoryExists func(directory string, params CheckDirectoryExistsParameters) bool
CheckDirectoryExists is a function type for checking if a folder exists.
type CheckDirectoryExistsParameters ¶ added in v0.7.0
type CheckDirectoryExistsParameters struct {
Client RemoteClient
Org string
Repo string
Directory string
}
CheckDirectoryExistsParameters holds all parameters needed for the CheckDirectoryExists function implementations.
type CommitMessage ¶
type CommitMessage struct {
Prefix string `yaml:"prefix,omitempty"`
PrefixDevelopment string `yaml:"prefix-development,omitempty"`
Include string `yaml:"include,omitempty"`
}
CommitMessage holds the config items for the commit message
type Cooldown ¶ added in v0.8.0
type Cooldown struct {
SemverMajorDays int `yaml:"semver-major-days,omitempty"`
SemverMinorDays int `yaml:"semver-minor-days,omitempty"`
SemverPatchDays int `yaml:"semver-patch-days,omitempty"`
DefaultDays int `yaml:"default-days,omitempty"`
Include []string `yaml:"include,omitempty"`
Exclude []string `yaml:"exclude,omitempty"`
}
Cooldown holds the cooldown configuration for different semver update types
type DefaultRegistries ¶
type DefaultRegistries map[string]DefaultRegistry
DefaultRegistries holds the default registries for new update definitions
type DefaultRegistry ¶ added in v0.2.0
type DefaultRegistry struct {
Type string `yaml:"type"`
URL string `yaml:"url"`
Username string `yaml:"username,omitempty"`
Password string `yaml:"password,omitempty"`
URLMatchRequired bool `yaml:"url-match-required,omitempty"`
URLMatchAdditionalFiles []string `yaml:"url-match-additional-files,omitempty"`
}
DefaultRegistry holds the config items of a default registry
type DependabotConfig ¶
type DependabotConfig struct {
Version int `yaml:"version"`
Registries map[string]Registry `yaml:"registries,omitempty"`
Updates []Update `yaml:"updates"`
EnableBetaEcoSystems bool `yaml:"enable-beta-ecosystems,omitempty"`
}
DependabotConfig holds the configuration defined in dependabot.yml
func ParseDependabotConfig ¶
func ParseDependabotConfig(fileContent []byte) (*DependabotConfig, error)
ParseDependabotConfig parses the config file
func (*DependabotConfig) IsManifestCovered ¶
func (config *DependabotConfig) IsManifestCovered(manifestFile string, manifestType string, updateRegistries []string) bool
IsManifestCovered returns if a manifest file is covered within a dependabot.yml config
func (*DependabotConfig) Parse ¶
func (config *DependabotConfig) Parse(data []byte) error
Parse parses the dependabot.yml format
func (*DependabotConfig) ProcessManifest ¶ added in v0.3.3
func (config *DependabotConfig) ProcessManifest(manifestFile string, manifestType string, toolConfig ToolConfig, changeInfo *ChangeInfo, loadFileFn LoadFileContent, loadFileParams LoadFileContentParameters, )
ProcessManifest adds config for a new manifest file to dependabot.yml if necessary
func (*DependabotConfig) ToYaml ¶
func (config *DependabotConfig) ToYaml() []byte
ToYaml returns a YAML representation of a dependabot config.
func (*DependabotConfig) UpdateConfig ¶
func (config *DependabotConfig) UpdateConfig(manifests map[string]string, toolConfig ToolConfig, loadFileFn LoadFileContent, loadFileParams LoadFileContentParameters, checkDirectoryExists CheckDirectoryExists, checkDirectoryExistsParams CheckDirectoryExistsParameters, ) ChangeInfo
UpdateConfig updates a dependabot config with a list of manifests found and the tool's config.
type Group ¶ added in v0.4.0
type Group struct {
Separator string `yaml:"dependency-type,omitempty"`
Patterns []string `yaml:"patterns,omitempty"`
ExcludePatterns []string `yaml:"exclude-patterns,omitempty"`
UpdateTypes []string `yaml:"update-types,omitempty"`
AppliesTo string `yaml:"applies-to,omitempty"`
}
Group holds the config items of a group definition
type Ignore ¶ added in v0.2.0
type Ignore struct {
DependencyName string `yaml:"dependency-name"`
Versions []string `yaml:"versions,omitempty"`
UpdateTypes []string `yaml:"update-types,omitempty"`
}
Ignore holds the config items of an ignore definition
type KeyValue ¶ added in v0.3.2
KeyValue holds a key/value pair of strings. Used as a sortable key/value map.
type LoadFileContent ¶ added in v0.2.0
type LoadFileContent func(file string, params LoadFileContentParameters) string
LoadFileContent is a function type for loading the content of a file.
type LoadFileContentParameters ¶ added in v0.2.0
type LoadFileContentParameters struct {
Client RemoteClient
Org string
Repo string
Directory string
}
LoadFileContentParameters holds all parameters needed for the LoadFileContent function implementations.
type PullRequestParameters ¶
type PullRequestParameters struct {
AuthorName string `yaml:"author-name"`
AuthorEmail string `yaml:"author-email"`
CommitMessage string `yaml:"commit-message"`
PRTitle string `yaml:"pr-title"`
BranchName string `yaml:"branch-name"`
BranchNameRandomSuffix bool `yaml:"branch-name-random-suffix"`
SleepAfterPRAction int `yaml:"sleep-after-pr-action"`
PRLabels []string `yaml:"pr-labels,omitempty"`
}
PullRequestParameters holds the parameters for PRs created by dependabutler
type Registry ¶
type Registry struct {
Type string `yaml:"type"`
URL string `yaml:"url"`
Username string `yaml:"username,omitempty"`
Password string `yaml:"password,omitempty"`
Key string `yaml:"key,omitempty"`
Token string `yaml:"token,omitempty"`
ReplacesBase string `yaml:"replaces-base,omitempty"`
}
Registry holds the config items of a registry definition
type RegistryInfo ¶
RegistryInfo holds the properties of a registry, for the change message.
type RemoteClient ¶ added in v0.9.5
type RemoteClient interface {
GetFileContent(org string, repo string, path string, branchName string) ([]byte, error)
CheckDirectoryExists(org string, repo string, directory string, branchName string) (bool, error)
}
RemoteClient is the GitHub API client used by the remote LoadFileContent and CheckDirectoryExists implementations. It is declared here, as the interface this package needs, so that this package does not have to import the package implementing it - which imports this one.
type Schedule ¶
type Schedule struct {
Interval string `yaml:"interval"`
Day string `yaml:"day,omitempty"`
Time string `yaml:"time,omitempty"`
Timezone string `yaml:"timezone,omitempty"`
}
Schedule holds the config items of a schedule
type ToolConfig ¶
type ToolConfig struct {
UpdateDefaults UpdateDefaults `yaml:"update-defaults"`
UpdateOverrides map[string]UpdateDefaults `yaml:"update-overrides"`
Registries map[string]DefaultRegistries `yaml:"registries"`
ManifestPatterns map[string]string `yaml:"manifest-patterns"`
ManifestIgnorePattern string `yaml:"manifest-ignore-pattern"`
PullRequestParameters PullRequestParameters `yaml:"pull-request-parameters"`
StableGroupPrefixes *bool `yaml:"stable-group-prefixes,omitempty"`
UpdateMissingCooldownSettings *bool `yaml:"update-missing-cooldown-settings,omitempty"`
}
ToolConfig holds the tool's configuration defined in config.yml
func ParseToolConfig ¶
func ParseToolConfig(fileContent []byte) (*ToolConfig, error)
ParseToolConfig parses the config file
func (*ToolConfig) InitializePatterns ¶ added in v0.5.0
func (config *ToolConfig) InitializePatterns()
InitializePatterns pre-compiles manifest file name patterns
func (*ToolConfig) Parse ¶
func (config *ToolConfig) Parse(data []byte) error
Parse parses the config.yml format
type Update ¶
type Update struct {
PackageEcosystem string `yaml:"package-ecosystem"`
Directory string `yaml:"directory,omitempty"`
Directories []string `yaml:"directories,omitempty"`
Schedule Schedule `yaml:"schedule,omitempty"`
Registries []string `yaml:"registries,omitempty"`
CommitMessage CommitMessage `yaml:"commit-message,omitempty"`
OpenPullRequestsLimit *int `yaml:"open-pull-requests-limit,omitempty"`
Assignees []string `yaml:"assignees,omitempty"`
Allow []Allow `yaml:"allow,omitempty"`
Ignore []Ignore `yaml:"ignore,omitempty"`
Groups map[string]Group `yaml:"groups,omitempty"`
InsecureExternalCodeExecution string `yaml:"insecure-external-code-execution,omitempty"`
Labels []string `yaml:"labels,omitempty"`
Milestone int `yaml:"milestone,omitempty"`
PullRequestBranchName struct {
Separator string `yaml:"separator"`
} `yaml:"pull-request-branch-name,omitempty"`
RebaseStrategy string `yaml:"rebase-strategy,omitempty"`
Reviewers []string `yaml:"reviewers,omitempty"`
TargetBranch string `yaml:"target-branch,omitempty"`
Vendor bool `yaml:"vendor,omitempty"`
VersioningStrategy string `yaml:"versioning-strategy,omitempty"`
Cooldown Cooldown `yaml:"cooldown,omitempty"`
}
Update holds the config items of an update definition
type UpdateDefaults ¶
type UpdateDefaults struct {
Schedule Schedule `yaml:"schedule"`
CommitMessage CommitMessage `yaml:"commit-message"`
OpenPullRequestsLimit *int `yaml:"open-pull-requests-limit,omitempty"`
InsecureExternalCodeExecution string `yaml:"insecure-external-code-execution"`
RebaseStrategy string `yaml:"rebase-strategy"`
Cooldown Cooldown `yaml:"cooldown"`
}
UpdateDefaults holds the default config for new update definitions
type UpdateInfo ¶
UpdateInfo holds the properties of an update, for the change message.