Skip to content

Commit 191561f

Browse files
committed
reset old FileMatch values
1 parent 106c1c7 commit 191561f

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

pkg/makefile/make_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ var _ = Describe("Make", func() {
113113
Ω(withRenovate).Should(BeTrue())
114114
Ω(string(cfg)).Should(Equal(readFile(testDataDir, "renovate.other-managers.expected.json")))
115115
})
116+
It("should add the toolbox customManager with fileMatch", func() {
117+
withRenovate, cfg, err := updateRenovateConfInternal(
118+
filepath.Join(testDataDir, "renovate.other-managers-fileMatch.json"),
119+
)
120+
Ω(err).ShouldNot(HaveOccurred())
121+
Ω(withRenovate).Should(BeTrue())
122+
Ω(string(cfg)).Should(Equal(readFile(testDataDir, "renovate.other-managers.expected.json")))
123+
})
116124
It("should update the toolbox customManager", func() {
117125
withRenovate, cfg, err := updateRenovateConfInternal(
118126
filepath.Join(testDataDir, "renovate.incorrect-managers.json"),

pkg/makefile/renovate.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ func updateRenovateConfInternal(renovateCfgFile string) (bool, []byte, error) {
4242
found = true
4343
manager.UpdateParams()
4444
cms[i] = manager
45+
} else {
46+
if len(manager.FileMatch) > 0 && len(manager.ManagerFilePatterns) == 0 {
47+
manager.ManagerFilePatterns = manager.FileMatch
48+
manager.FileMatch = nil
49+
cms[i] = manager
50+
}
4551
}
4652
}
4753
if !found {

pkg/types/renovate/renovate.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,21 @@ type CustomManagers []CustomManager
2525
type CustomManager struct {
2626
CustomType string `json:"customType"`
2727
Description string `json:"description"`
28-
ManagerFilePatterns []string `json:"managerFilePatterns"`
28+
ManagerFilePatterns []string `json:"managerFilePatterns,omitempty"`
29+
FileMatch []string `json:"fileMatch,omitempty"`
2930
MatchStrings []string `json:"matchStrings"`
3031
DatasourceTemplate string `json:"datasourceTemplate"`
3132
}
3233

3334
func (m *CustomManager) UpdateParams() {
3435
m.Description = Description
36+
if len(m.FileMatch) > 0 {
37+
m.FileMatch = nil
38+
}
3539
m.ManagerFilePatterns = []string{ManagerFilePatterns}
3640
m.MatchStrings = []string{MatchString}
3741
m.DatasourceTemplate = DatasourceTemplate
42+
3843
}
3944

4045
func (m *CustomManager) IsToolbox() bool {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"customManagers": [
4+
{
5+
"customType": "regex",
6+
"datasourceTemplate": "go",
7+
"description": "this is an existing manager and should not be touched",
8+
"fileMatch": [
9+
"^Dockerfile"
10+
],
11+
"matchStrings": [
12+
"..."
13+
]
14+
}
15+
]
16+
}

0 commit comments

Comments
 (0)