-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support managing renovate via kres so updates are easier. Signed-off-by: Noel Georgi <[email protected]>
- Loading branch information
Showing
17 changed files
with
288 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,52 @@ | ||
{ | ||
"$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", | ||
"prHeader": "Update Request | Renovate Bot", | ||
"extends": [ | ||
":dependencyDashboard", | ||
":gitSignOff", | ||
":semanticCommitScopeDisabled", | ||
"schedule:earlyMondays" | ||
], | ||
"prHeader": "Update Request | Renovate Bot", | ||
"regexManagers": [ | ||
"customManagers": [ | ||
{ | ||
"customType": "regex", | ||
"versioningTemplate": "{{#if versioning}}{{versioning}}{{else}}semver{{/if}}", | ||
"fileMatch": [ | ||
"internal/config/constants.go" | ||
], | ||
"matchStrings": [ | ||
"\\/\\/\\s+renovate: datasource=(?<datasource>.*?)(?:\\s+extractVersion=(?<extractVersion>.+?))?(?:\\s+versioning=(?<versioning>.+?))?\\s+depName=(?<depName>.+?)?\\s.*Version\\s+=\\s+\\\"(?<currentValue>.+?)\\\"" | ||
], | ||
"versioningTemplate": "{{#if versioning}}{{versioning}}{{else}}semver{{/if}}" | ||
] | ||
} | ||
], | ||
"packageRules": [ | ||
{ | ||
"matchPackageNames": [ | ||
"golang/go" | ||
], | ||
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.?(?<patch>\\d+)?$" | ||
"groupName": "dependencies", | ||
"matchUpdateTypes": [ | ||
"major", | ||
"minor", | ||
"patch", | ||
"pin", | ||
"digest" | ||
] | ||
}, | ||
{ | ||
"versioning": "regex:^v(?<major>\\d+)", | ||
"matchPackageNames": [ | ||
"actions/checkout", | ||
"docker/login-action", | ||
"crazy-max/ghaction-github-release", | ||
"docker/setup-buildx-action", | ||
"slackapi/slack-github-action" | ||
], | ||
"versioning": "regex:^v(?<major>\\d+)" | ||
] | ||
}, | ||
{ | ||
"versioning": "regex:^v(?<major>\\d+)_(?<minor>\\d+)_?(?<patch>\\d+)?$", | ||
"matchPackageNames": [ | ||
"potiuk/get-workflow-origin" | ||
], | ||
"versioning": "regex:^v(?<major>\\d+)_(?<minor>\\d+)_?(?<patch>\\d+)?$" | ||
}, | ||
{ | ||
"matchPackagePatterns": [ | ||
"*" | ||
], | ||
"matchDatasources": [ | ||
"docker" | ||
], | ||
"groupName": "container images" | ||
}, | ||
{ | ||
"matchPackagePatterns": [ | ||
"*" | ||
], | ||
"matchDatasources": [ | ||
"go", | ||
"golang-version" | ||
], | ||
"groupName": "go packages" | ||
}, | ||
{ | ||
"matchPackagePatterns": [ | ||
"*" | ||
], | ||
"matchDatasources": [ | ||
"npm" | ||
], | ||
"groupName": "node packages" | ||
}, | ||
{ | ||
"matchPackagePatterns": [ | ||
"*" | ||
], | ||
"matchDatasources": [ | ||
"git-refs", | ||
"git-tags", | ||
"github-tags", | ||
"github-releases" | ||
], | ||
"groupName": "releases" | ||
] | ||
} | ||
] | ||
], | ||
"separateMajorMinor": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
# | ||
# Generated on 2024-12-06T11:22:01Z by kres c401487d. | ||
# Generated on 2024-12-16T13:00:41Z by kres fb2c01d-dirty. | ||
|
||
ARG TOOLCHAIN | ||
|
||
|
@@ -13,10 +13,10 @@ FROM ghcr.io/siderolabs/fhs:v1.9.0 AS image-fhs | |
# runs markdownlint | ||
FROM docker.io/oven/bun:1.1.38-alpine AS lint-markdown | ||
WORKDIR /src | ||
RUN bun i [email protected] sentences-per-line@0.2.1 | ||
RUN bun i [email protected] sentences-per-line@0.3.0 | ||
COPY .markdownlint.json . | ||
COPY ./README.md ./README.md | ||
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js . | ||
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules sentences-per-line . | ||
|
||
# base toolchain image | ||
FROM --platform=${BUILDPLATFORM} ${TOOLCHAIN} AS toolchain | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
// Package renovate implements output to .github/renovate.json | ||
package renovate | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"io" | ||
"slices" | ||
|
||
"github.com/siderolabs/kres/internal/output" | ||
) | ||
|
||
// Output provides output to .github/renovate.json. | ||
type Output struct { | ||
output.FileAdapter | ||
|
||
result *Renovate | ||
|
||
enabled bool | ||
} | ||
|
||
const ( | ||
fileName = ".github/renovate.json" | ||
) | ||
|
||
// NewOutput initializes Output. | ||
func NewOutput() *Output { | ||
o := &Output{} | ||
|
||
o.FileWriter = o | ||
|
||
preamble := output.Preamble("") | ||
|
||
o.result = &Renovate{ | ||
Schema: "https://docs.renovatebot.com/renovate-schema.json", | ||
Description: preamble, | ||
Extends: []string{ | ||
":dependencyDashboard", | ||
":gitSignOff", | ||
":semanticCommitScopeDisabled", | ||
"schedule:earlyMondays", | ||
}, | ||
PRHeader: "Update Request | Renovate Bot", | ||
SeparateMajorMinor: false, | ||
PackageRules: []PackageRule{ | ||
{ | ||
MatchUpdateTypes: []string{ | ||
"major", | ||
"minor", | ||
"patch", | ||
"pin", | ||
"digest", | ||
}, | ||
GroupName: "dependencies", | ||
}, | ||
}, | ||
} | ||
|
||
return o | ||
} | ||
|
||
// Compile implements [output.TypedWriter] interface. | ||
func (o *Output) Compile(compiler Compiler) error { | ||
return compiler.CompileRenovate(o) | ||
} | ||
|
||
// Enable should be called to enable config generation. | ||
func (o *Output) Enable() { | ||
o.enabled = true | ||
} | ||
|
||
// CustomManagers sets custom managers. | ||
func (o *Output) CustomManagers(customManagers []CustomManager) { | ||
o.result.CustomManagers = customManagers | ||
} | ||
|
||
// PackageRules sets package rules. | ||
func (o *Output) PackageRules(packageRules []PackageRule) { | ||
o.result.PackageRules = slices.Concat(o.result.PackageRules, packageRules) | ||
} | ||
|
||
// Filenames implements output.FileWriter interface. | ||
func (o *Output) Filenames() []string { | ||
if !o.enabled { | ||
return nil | ||
} | ||
|
||
return []string{fileName} | ||
} | ||
|
||
// GenerateFile implements output.FileWriter interface. | ||
func (o *Output) GenerateFile(filename string, w io.Writer) error { | ||
switch filename { | ||
case fileName: | ||
return o.renovate(w) | ||
default: | ||
panic("unexpected filename: " + fileName) | ||
} | ||
} | ||
|
||
func (o *Output) renovate(w io.Writer) error { | ||
encoder := json.NewEncoder(w) | ||
|
||
encoder.SetIndent("", " ") | ||
encoder.SetEscapeHTML(false) | ||
|
||
if err := encoder.Encode(o.result); err != nil { | ||
return fmt.Errorf("failed to encode renovate config: %w", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// Compiler is implemented by project blocks which support renovate config generation. | ||
type Compiler interface { | ||
CompileRenovate(*Output) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
package renovate | ||
|
||
// Renovate represents the renovate configuration. | ||
type Renovate struct { | ||
Schema string `json:"$schema"` | ||
Description string `json:"description"` | ||
PRHeader string `json:"prHeader"` | ||
Extends []string `json:"extends"` | ||
CustomManagers []CustomManager `json:"customManagers,omitempty"` | ||
PackageRules []PackageRule `json:"packageRules,omitempty"` | ||
SeparateMajorMinor bool `json:"separateMajorMinor"` | ||
} | ||
|
||
// CustomManager represents a custom manager. | ||
type CustomManager struct { | ||
CustomType string `json:"customType"` | ||
VersioningTemplate string `json:"versioningTemplate"` | ||
FileMatch []string `json:"fileMatch"` | ||
MatchStrings []string `json:"matchStrings"` | ||
} | ||
|
||
// PackageRule represents a package rule. | ||
type PackageRule struct { | ||
GroupName string `json:"groupName,omitempty"` | ||
Versioning string `json:"versioning,omitempty"` | ||
|
||
MatchPackageNames []string `json:"matchPackageNames,omitempty"` | ||
MatchUpdateTypes []string `json:"matchUpdateTypes,omitempty"` | ||
} |
Oops, something went wrong.