Skip to content

Commit

Permalink
match Renovate removing support for various matching options in packa…
Browse files Browse the repository at this point in the history
…ge rules

ExcludePackagePatterns, MatchPackagePatterns and MatchPackagePrefixes
have all been subsumed into MatchPackageNames which has gained support
for regex matches.

Ref: e.g. <renovatebot/renovate#30621>
  • Loading branch information
majewsky committed Aug 7, 2024
1 parent 6f1d525 commit 4882310
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
12 changes: 5 additions & 7 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@
"allowedVersions": "1.22.x"
},
{
"matchPackagePatterns": [
"^github\\.com\\/sapcc\\/.*"
"matchPackageNames": [
"/^github\\.com\\/sapcc\\/.*/"
],
"automerge": true,
"groupName": "github.com/sapcc"
},
{
"excludePackagePatterns": [
"^github\\.com\\/sapcc\\/.*"
],
"matchPackagePatterns": [
".*"
"matchPackageNames": [
"!/^github\\.com\\/sapcc\\/.*/",
"/.*/"
],
"groupName": "External dependencies"
}
Expand Down
19 changes: 8 additions & 11 deletions internal/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,14 @@ type SecurityChecksWorkflowConfig struct {
}

type PackageRule struct {
ExcludePackagePatterns []string `yaml:"excludePackagePatterns" json:"excludePackagePatterns,omitempty"`
MatchPackageNames []string `yaml:"matchPackageNames" json:"matchPackageNames,omitempty"`
MatchPackagePatterns []string `yaml:"matchPackagePatterns" json:"matchPackagePatterns,omitempty"`
MatchPackagePrefixes []string `yaml:"matchPackagePrefixes" json:"matchPackagePrefixes,omitempty"`
MatchUpdateTypes []string `yaml:"matchUpdateTypes" json:"matchUpdateTypes,omitempty"`
MatchDepTypes []string `yaml:"matchDepTypes" json:"matchDepTypes,omitempty"`
MatchFiles []string `yaml:"matchFiles" json:"matchFiles,omitempty"`
AllowedVersions string `yaml:"allowedVersions" json:"allowedVersions,omitempty"`
AutoMerge bool `yaml:"automerge" json:"automerge,omitempty"`
EnableRenovate *bool `yaml:"enabled" json:"enabled,omitempty"`
GroupName string `yaml:"groupName" json:"groupName,omitempty"`
MatchPackageNames []string `yaml:"matchPackageNames" json:"matchPackageNames,omitempty"`
MatchUpdateTypes []string `yaml:"matchUpdateTypes" json:"matchUpdateTypes,omitempty"`
MatchDepTypes []string `yaml:"matchDepTypes" json:"matchDepTypes,omitempty"`
MatchFiles []string `yaml:"matchFiles" json:"matchFiles,omitempty"`
AllowedVersions string `yaml:"allowedVersions" json:"allowedVersions,omitempty"`
AutoMerge bool `yaml:"automerge" json:"automerge,omitempty"`
EnableRenovate *bool `yaml:"enabled" json:"enabled,omitempty"`
GroupName string `yaml:"groupName" json:"groupName,omitempty"`
}

// RenovateConfig appears in type Configuration.
Expand Down
15 changes: 7 additions & 8 deletions internal/renovate/renovate.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,16 @@ func RenderConfig(cfgRenovate core.RenovateConfig, scanResult golang.ScanResult,

// combine and automerge all dependencies under github.com/sapcc/
cfg.addPackageRule(core.PackageRule{
MatchPackagePatterns: []string{`^github\.com\/sapcc\/.*`},
GroupName: "github.com/sapcc",
AutoMerge: true,
MatchPackageNames: []string{`/^github\.com\/sapcc\/.*/`},
GroupName: "github.com/sapcc",
AutoMerge: true,
})

// combine all dependencies not under github.com/sapcc/
cfg.addPackageRule(core.PackageRule{
MatchPackagePatterns: []string{`.*`},
ExcludePackagePatterns: []string{`^github\.com\/sapcc\/.*`},
GroupName: "External dependencies",
AutoMerge: false,
MatchPackageNames: []string{`!/^github\.com\/sapcc\/.*/`, `/.*/`},
GroupName: "External dependencies",
AutoMerge: false,
})

// Only enable Dockerfile and github-actions updates for go-makefile-maker itself.
Expand All @@ -134,7 +133,7 @@ func RenderConfig(cfgRenovate core.RenovateConfig, scanResult golang.ScanResult,
}
if hasK8sIOPkgs {
cfg.addPackageRule(core.PackageRule{
MatchPackagePrefixes: []string{"k8s.io/"},
MatchPackageNames: []string{`/^k8s.io\//`},
// Since our clusters use k8s v1.26 and k8s has a support policy of -/+ 1 minor version we set the allowedVersions to `0.27.x`.
// k8s.io/* deps use v0.x.y instead of v1.x.y therefore we use 0.x instead of 1.x.
// Ref: https://docs.renovatebot.com/configuration-options/#allowedversions
Expand Down

0 comments on commit 4882310

Please sign in to comment.