Skip to content

Commit

Permalink
fix broken renovate config
Browse files Browse the repository at this point in the history
checked with:
podman run -it \
-v ./renovate/defaults.json5:/usr/src/app/renovate.json5:z \
docker.io/renovate/renovate:latest \
renovate-config-validator

Due the nested packageRules section in golang the auto migration is not
working correctly and caused an error for us. This caused renovate to
propse PRs without the proper settings.
Fix the config by (hopefully) migrating correctly to the new format.
The nested packageRule is now on the same level which should fix the
breakage. The config validator is happy now but I have no way of
actually testing if this still works correctly, I guess we will find
out.

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed Jul 12, 2023
1 parent f95465c commit 8f61a71
Showing 1 changed file with 62 additions and 58 deletions.
120 changes: 62 additions & 58 deletions renovate/defaults.json5
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Validate this file before commiting with (from repository root):
// Re-use predefined sets of configuration options to DRY
"extends": [
// https://docs.renovatebot.com/presets-config/#configbase
"config:base",
"config:recommended",

// https://docs.renovatebot.com/presets-default/#gitsignoff
":gitSignOff",
Expand Down Expand Up @@ -74,61 +74,6 @@ Validate this file before commiting with (from repository root):
// it as appropriate.
"rebaseWhen": "never",

/*************************************************
***** Golang-specific configuration options *****
*************************************************/

"golang": {
// disabled by default, safe to enable since "tidy" enforced by CI.
"postUpdateOptions": ["gomodTidy"],

// In case a version in use is retracted, allow going backwards.
// N/B: This is NOT compatible with pseudo versions, see below.
"rollbackPrs": false,

// Preserve (but continue to upgrade) any existing SemVer ranges.
"rangeStrategy": "replace",

// N/B: LAST MATCHING RULE WINS
// https://docs.renovatebot.com/configuration-options/#packagerules
"packageRules": [
// Golang pseudo-version packages will spam with every Commit ID change.
// Limit update frequency.
{
"matchUpdateTypes": ["digest"],
"schedule": ["after 1am and before 11am on the first day of the month"],
},
// Package version retraction (https://go.dev/ref/mod#go-mod-file-retract)
// is broken in Renovate. And no repo should use these retracted versions.
// ref: https://github.com/renovatebot/renovate/issues/13012
{
"matchPackageNames": ["github.com/containers/common"],
// Both v1.0.0 and v1.0.1 should be ignored.
"allowedVersions": "!/v((1.0.0)|(1.0.1))$/"
},
],
},

/*************************************************
***** Rust-specific configuration options *****
*************************************************/

"rust": {
// Update both Cargo.toml and Cargo.lock when possible
// i.e. bump the range even if the new version satisfies the existing range.
// https://docs.renovatebot.com/configuration-options/#rangestrategy
"rangeStrategy": "bump",
},

/*************************************************
***** Python-specific configuration options *****
*************************************************/

"python": {
// Preserve (but continue to upgrade) any existing SemVer ranges.
"rangeStrategy": "replace",
},

/**************************************************
***** Manager-specific configuration options *****
**************************************************/
Expand Down Expand Up @@ -160,12 +105,71 @@ Validate this file before commiting with (from repository root):
// N/B: LAST MATCHING RULE WINS, match statems are ANDed together.
// https://docs.renovatebot.com/configuration-options/#packagerules
"packageRules": [

/*************************************************
***** Rust-specific configuration options *****
*************************************************/
{
"matchCategories": ["rust"],
// Update both Cargo.toml and Cargo.lock when possible
// i.e. bump the range even if the new version satisfies the existing range.
// https://docs.renovatebot.com/configuration-options/#rangestrategy
"rangeStrategy": "bump"
},

/*************************************************
***** Python-specific configuration options *****
*************************************************/
{
"matchCategories": ["python"],
// Preserve (but continue to upgrade) any existing SemVer ranges.
"rangeStrategy": "replace"
},

/*************************************************
***** Golang-specific configuration options *****
*************************************************/
{
"matchCategories": ["golang"],

// disabled by default, safe to enable since "tidy" enforced by CI.
"postUpdateOptions": ["gomodTidy"],

// In case a version in use is retracted, allow going backwards.
// N/B: This is NOT compatible with pseudo versions, see below.
"rollbackPrs": false,

// Preserve (but continue to upgrade) any existing SemVer ranges.
"rangeStrategy": "replace",

// N/B: LAST MATCHING RULE WINS
// https://docs.renovatebot.com/configuration-options/#packagerules
},

// Golang pseudo-version packages will spam with every Commit ID change.
// Limit update frequency.
{
"matchCategories": ["golang"],
"matchUpdateTypes": ["digest"],
"schedule": ["after 1am and before 11am on the first day of the month"],
},

// Package version retraction (https://go.dev/ref/mod#go-mod-file-retract)
// is broken in Renovate. And no repo should use these retracted versions.
// ref: https://github.com/renovatebot/renovate/issues/13012
{
"matchCategories": ["golang"],
"matchPackageNames": ["github.com/containers/common"],
// Both v1.0.0 and v1.0.1 should be ignored.
"allowedVersions": "!/v((1.0.0)|(1.0.1))$/"
},

// Workaround: rollbackPRs are not compatible with digest updates.
// This is a catch-the-rest rule which must appear AFTER the go
// "digest" rule (above).
// Ref: https://github.com/renovatebot/renovate/discussions/18250
{
"matchLanguages": ["go"],
"matchCategories": ["golang"],
// Open rollback PR if updated dep. is removed (i.e. tag pulled
// due to major bug or security issue).
"rollbackPrs": true,
Expand All @@ -188,7 +192,7 @@ Validate this file before commiting with (from repository root):
// images are split across multiple IMG_SFX values that all need to be updated.
{
"matchManagers": ["regex"],
"matchFiles": [".cirrus.yml"], // full-path exact-match
"matchFileNames": [".cirrus.yml"], // full-path exact-match
"groupName": "CI VM Image",
// Somebody(s) need to check image update PRs as soon as they open.
"reviewers": ["cevich"],
Expand Down

0 comments on commit 8f61a71

Please sign in to comment.