From f05fefd4cdfa1f557af75fd979c2cb11db71a66c Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Mon, 16 Dec 2024 19:46:59 +0530 Subject: [PATCH] chore: add more renovate config fields Add more renovate config fields. Signed-off-by: Noel Georgi --- .github/renovate.json | 8 +++++++- .kres.yaml | 7 +++++-- internal/output/renovate/types.go | 9 +++++++-- internal/project/common/renovate.go | 6 +++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index 75ed317..bae2e93 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,6 +1,6 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "description": "THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.\n\nGenerated on 2024-12-16T13:00:41Z by kres fb2c01d-dirty.\n\n", + "description": "THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.\n\nGenerated on 2024-12-16T14:18:24Z by kres 071772c-dirty.\n\n", "prHeader": "Update Request | Renovate Bot", "extends": [ ":dependencyDashboard", @@ -31,6 +31,12 @@ "digest" ] }, + { + "versioning": "regex:^(?\\d+)\\.(?\\d+)\\.?(?\\d+)?$", + "matchPackageNames": [ + "golang/go" + ] + }, { "versioning": "regex:^v(?\\d+)", "matchPackageNames": [ diff --git a/.kres.yaml b/.kres.yaml index 1109841..46251d1 100644 --- a/.kres.yaml +++ b/.kres.yaml @@ -76,13 +76,16 @@ spec: - '\/\/\s+renovate: datasource=(?.*?)(?:\s+extractVersion=(?.+?))?(?:\s+versioning=(?.+?))?\s+depName=(?.+?)?\s.*Version\s+=\s+\"(?.+?)\"' versioningTemplate: "{{#if versioning}}{{versioning}}{{else}}semver{{/if}}" packageRules: + - matchPackageNames: + - golang/go + versioning: 'regex:^(?\d+)\.(?\d+)\.?(?\d+)?$' - matchPackageNames: - actions/checkout - docker/login-action - crazy-max/ghaction-github-release - docker/setup-buildx-action - slackapi/slack-github-action - versioning: "regex:^v(?\\d+)" + versioning: 'regex:^v(?\d+)' - matchPackageNames: - potiuk/get-workflow-origin - versioning: "regex:^v(?\\d+)_(?\\d+)_?(?\\d+)?$" + versioning: 'regex:^v(?\d+)_(?\d+)_?(?\d+)?$' diff --git a/internal/output/renovate/types.go b/internal/output/renovate/types.go index 86610b1..6576c2c 100644 --- a/internal/output/renovate/types.go +++ b/internal/output/renovate/types.go @@ -18,6 +18,8 @@ type Renovate struct { // CustomManager represents a custom manager. type CustomManager struct { CustomType string `json:"customType"` + DataSourceTemplate string `json:"datasourceTemplate,omitempty"` + DepNameTemplate string `json:"depNameTemplate,omitempty"` VersioningTemplate string `json:"versioningTemplate"` FileMatch []string `json:"fileMatch"` MatchStrings []string `json:"matchStrings"` @@ -25,8 +27,11 @@ type CustomManager struct { // PackageRule represents a package rule. type PackageRule struct { - GroupName string `json:"groupName,omitempty"` - Versioning string `json:"versioning,omitempty"` + DataSourceTemplate string `json:"datasourceTemplate,omitempty"` + DepNameTemplate string `json:"depNameTemplate,omitempty"` + GroupName string `json:"groupName,omitempty"` + Versioning string `json:"versioning,omitempty"` + VersioningTemplate string `json:"versioningTemplate,omitempty"` MatchPackageNames []string `json:"matchPackageNames,omitempty"` MatchUpdateTypes []string `json:"matchUpdateTypes,omitempty"` diff --git a/internal/project/common/renovate.go b/internal/project/common/renovate.go index 5c5200a..ef28dc7 100644 --- a/internal/project/common/renovate.go +++ b/internal/project/common/renovate.go @@ -25,8 +25,10 @@ type Renovate struct { // CustomManager represents a custom manager. type CustomManager struct { - VersioningTemplate string `yaml:"versioningTemplate"` CustomType string `yaml:"customType"` + DataSourceTemplate string `yaml:"datasourceTemplate,omitempty"` + DepNameTemplate string `yaml:"depNameTemplate,omitempty"` + VersioningTemplate string `yaml:"versioningTemplate"` FileMatch []string `yaml:"fileMatch"` MatchStrings []string `yaml:"matchStrings"` } @@ -58,6 +60,8 @@ func (r *Renovate) CompileRenovate(o *renovate.Output) error { o.CustomManagers(xslices.Map(r.CustomManagers, func(cm CustomManager) renovate.CustomManager { return renovate.CustomManager{ CustomType: cm.CustomType, + DataSourceTemplate: cm.DataSourceTemplate, + DepNameTemplate: cm.DepNameTemplate, FileMatch: cm.FileMatch, MatchStrings: cm.MatchStrings, VersioningTemplate: cm.VersioningTemplate,