Skip to content

Commit 2096045

Browse files
authored
Merge pull request #75 from SovereignCloudStack/syself/add-renovate
✨ add renovate for bumping dependencies
2 parents 061cd76 + 64c9b49 commit 2096045

File tree

14 files changed

+314
-7
lines changed

14 files changed

+314
-7
lines changed

.github/renovate.json5

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
extends: [
3+
":dependencyDashboard",
4+
":semanticPrefixFixDepsChoreOthers",
5+
":autodetectRangeStrategy",
6+
":disableRateLimiting",
7+
":semanticCommits",
8+
"helpers:pinGitHubActionDigests",
9+
"github>whitesource/merge-confidence:beta",
10+
"github>SovereignCloudStack/cluster-stack-operator//.github/renovate/commitMessage.json5",
11+
"github>SovereignCloudStack/cluster-stack-operator//.github/renovate/approval.json5",
12+
"github>SovereignCloudStack/cluster-stack-operator//.github/renovate/golang.json5",
13+
"github>SovereignCloudStack/cluster-stack-operator//.github/renovate/groups.json5",
14+
"github>SovereignCloudStack/cluster-stack-operator//.github/renovate/labels.json5",
15+
"github>SovereignCloudStack/cluster-stack-operator//.github/renovate/regexManagers.json5"
16+
],
17+
platform: "github",
18+
baseBranches: ["main"],
19+
onboarding: false,
20+
requireConfig: "ignored",
21+
timezone: "Europe/Berlin",
22+
// repo config
23+
repositories: ["SovereignCloudStack/cluster-stack-operator"],
24+
ignorePaths: [
25+
"**/vendor/**",
26+
"**/test/**",
27+
"**/tests/**"
28+
],
29+
username: "cluster-stack-bot[bot]",
30+
gitAuthor: "cluster-stack-bot[bot] <143188378+cluster-stack-bot[bot]@users.noreply.github.com>",
31+
// PR config
32+
dependencyDashboardTitle: "Dependency Dashboard 🤖",
33+
dependencyDashboardHeader: "",
34+
prFooter: "",
35+
suppressNotifications: ["prIgnoreNotification"],
36+
rebaseWhen: "conflicted",
37+
commitBodyTable: true,
38+
prHourlyLimit: 1,
39+
printConfig: true,
40+
pruneStaleBranches: true,
41+
allowPostUpgradeCommandTemplating: true,
42+
separateMajorMinor: true,
43+
separateMultipleMajor: true,
44+
separateMinorPatch: true,
45+
enabledManagers: ["dockerfile", "gomod", "github-actions", "regex"],
46+
recreateClosed: true,
47+
}

.github/renovate/approval.json5

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
packageRules: [
3+
{
4+
matchUpdateTypes: ["major", "minor"],
5+
matchManagers: ["gomod"],
6+
matchDepTypes: ["golang"],
7+
description: "Ask for approval for golang updates",
8+
dependencyDashboardApproval: true,
9+
},
10+
],
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"commitMessagePrefix": ":seedling: ",
3+
"commitMessageTopic": "{{depName}}",
4+
"commitMessageExtra": "to {{newVersion}}",
5+
"commitMessageSuffix": "",
6+
"group": { commitMessageTopic: "{{{groupName}}} group" },
7+
"packageRules": [
8+
{
9+
"matchDatasources": ["helm"],
10+
"commitMessageTopic": "chart {{depName}}"
11+
},
12+
{
13+
"matchDatasources": ["docker"],
14+
"commitMessageTopic": "image {{depName}}",
15+
"commitMessageExtra": "to {{#if isSingleVersion}}v{{{newVersion}}}{{else}}{{{newValue}}}{{/if}}"
16+
}
17+
]
18+
}

.github/renovate/golang.json5

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
golang: {
3+
postUpdateOptions: ["gomodTidy", "gomodUpdateImportPaths"],
4+
},
5+
// https://docs.renovatebot.com/configuration-options/#constraints
6+
"constraints": {
7+
"go": "1.21"
8+
},
9+
packageRules: [
10+
{
11+
description: "Disable Golang update for major and minor versions",
12+
matchManagers: ["dockerfile"],
13+
matchDepNames: ["docker.io/library/golang"],
14+
matchUpdateTypes: ["major", "minor"],
15+
enabled: false,
16+
},
17+
{
18+
description: "Disable slim-sprig",
19+
matchManagers: ["gomod"],
20+
matchDepNames: ["github.com/go-task/slim-sprig"],
21+
matchPaths: ["hack/tools/**"],
22+
enabled: false,
23+
},
24+
{
25+
description: "Disable update controller-tools",
26+
matchManagers: ["gomod"],
27+
matchDepNames: ["sigs.k8s.io/controller-runtime", "sigs.k8s.io/controller-tools", "github.com/google/go-github/v52"],
28+
matchUpdateTypes: ["major", "minor"],
29+
enabled: false,
30+
},
31+
{
32+
description: "Disable update k8s packages",
33+
matchManagers: ["gomod"],
34+
matchDepNames: ["k8s.io/api", "k8s.io/apimachinery", "k8s.io/apiserver", "k8s.io/client-go", "k8s.io/kubectl", "k8s.io/code-generator"],
35+
matchUpdateTypes: ["patch"],
36+
enabled: true,
37+
},
38+
{
39+
description: "Disable update cluster-api",
40+
matchManagers: ["gomod"],
41+
matchDepNames: ["sigs.k8s.io/cluster-api", "sigs.k8s.io/cluster-api/test", "sigs.k8s.io/cluster-api/hack/tools"],
42+
enabled: false,
43+
},
44+
],
45+
}

.github/renovate/groups.json5

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
packageRules: [
3+
{
4+
description: "Update Builder Image",
5+
groupName: "Builder Image",
6+
groupSlug: "cso-builder-image",
7+
commitMessageTopic: "Builder Image group",
8+
matchPaths: ["images/builder/**"],
9+
separateMajorMinor: false,
10+
separateMultipleMajor: false,
11+
separateMinorPatch: false,
12+
schedule: ["on the first day of the month"],
13+
},
14+
{
15+
description: "Update Cso Image",
16+
groupName: "Cso Image",
17+
matchManagers: ["dockerfile", "regex"],
18+
separateMajorMinor: false,
19+
separateMultipleMajor: false,
20+
separateMinorPatch: false,
21+
matchPaths: ["images/cso/**"],
22+
commitMessageTopic: "Cso Image group",
23+
groupSlug: "cso-manager-image",
24+
schedule: ["on monday"],
25+
},
26+
{
27+
description: "Update Makefile",
28+
groupName: "Makefile",
29+
matchManagers: ["regex"],
30+
separateMajorMinor: false,
31+
separateMultipleMajor: false,
32+
separateMinorPatch: false,
33+
matchFiles: ["Makefile"],
34+
commitMessageTopic: "Makefile group",
35+
groupSlug: "makefile",
36+
},
37+
{
38+
description: "Update Github Actions",
39+
groupName: "github-actions",
40+
matchManagers: ["github-actions"],
41+
matchUpdateTypes: ["major", "minor", "patch", "digest", "pin", "pinDigest"],
42+
pinDigests: true,
43+
commitMessageTopic: "Github Actions group",
44+
groupSlug: "github-actions",
45+
schedule: ["on monday"],
46+
},
47+
{
48+
description: "Update Bot Schedule",
49+
matchManagers: ["github-actions"],
50+
matchUpdateTypes: ["major", "minor", "patch"],
51+
matchPackageNames: ["renovatebot/github-action"],
52+
schedule: ["on the first day of the month"],
53+
},
54+
{
55+
description: "Update Go Dev Dependencies",
56+
groupName: "Update Go Dev Dependencies",
57+
matchManagers: ["gomod"],
58+
matchPaths: ["hack/tools/**"],
59+
commitMessageTopic: "Go Dev Dependencies group",
60+
groupSlug: "golang-devs-deps",
61+
},
62+
{
63+
description: "Update Golang Dependencies",
64+
groupName: "Update Golang Dependencies",
65+
matchManagers: ["gomod"],
66+
ignorePaths: ["hack/tools/**"],
67+
commitMessageTopic: "Golang Dependencies group",
68+
groupSlug: "golang-deps",
69+
},
70+
{
71+
description: "disable update of cso builder image",
72+
matchManagers: ["github-actions"],
73+
matchUpdateTypes: ["major", "minor", "patch"],
74+
matchPackageNames: ["ghcr.io/sovereigncloudstack/cso-builder"],
75+
enabled: false,
76+
},
77+
]
78+
}

.github/renovate/labels.json5

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"packageRules": [
3+
{
4+
"matchUpdateTypes": ["major"],
5+
"labels": ["type/major"]
6+
},
7+
{
8+
"matchUpdateTypes": ["minor"],
9+
"labels": ["type/minor"]
10+
},
11+
{
12+
"matchUpdateTypes": ["patch"],
13+
"labels": ["type/patch"]
14+
},
15+
{
16+
"matchDatasources": ["helm"],
17+
"addLabels": ["update/helm"]
18+
},
19+
{
20+
"matchDatasources": ["docker"],
21+
"addLabels": ["update/container"]
22+
},
23+
{
24+
"matchManagers": ["github-actions"],
25+
"addLabels": ["update/github-action"]
26+
},
27+
{
28+
"matchDatasources": ["go"],
29+
"addLabels": ["update/go"]
30+
}
31+
]
32+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"regexManagers": [
3+
{
4+
"fileMatch": [".yaml$", ".yml$", "Makefile", "(^|/|\.)Dockerfile$", "(^|/)Dockerfile[^/]*$"],
5+
"matchStrings": [
6+
".*(@|=|==|:\\s)(?<currentValue>[v0-9.-]+)\\s#\\supdate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( extractVersion=(?<extractVersion>.+?))?( versioning=(?<versioning>.*?))?\\s"
7+
],
8+
"extractVersionTemplate":"{{#if extractVersion}}{{{extractVersion}}}{{/if}}",
9+
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
10+
},
11+
{
12+
"fileMatch": ["(^|/|\.)Dockerfile$", "(^|/)Dockerfile[^/]*$"],
13+
"matchStrings": [
14+
"#\\s*update:\\s*datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\sENV .*?_VERSION=\"(?<currentValue>.*)\"\\s"
15+
],
16+
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
17+
},
18+
]
19+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Schedule - Update Bot
2+
on: # yamllint disable-line rule:truthy
3+
workflow_dispatch:
4+
inputs:
5+
dryRun:
6+
description: "Dry-Run"
7+
default: "false"
8+
required: false
9+
logLevel:
10+
description: "Log-Level"
11+
default: "debug"
12+
required: false
13+
schedule:
14+
- cron: "0 11 * * *"
15+
push:
16+
branches:
17+
- main
18+
paths:
19+
- ".github/renovate.json5"
20+
- ".github/renovate/**.json5"
21+
env:
22+
LOG_LEVEL: info
23+
DRY_RUN: false
24+
RENOVATE_CONFIG_FILE: .github/renovate.json5
25+
# yamllint disable rule:line-length
26+
jobs:
27+
update-bot:
28+
if: github.repository == 'SovereignCloudStack/cluster-stack-operator'
29+
name: Renovate
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
34+
35+
- name: Generate Token
36+
uses: actions/create-github-app-token@f4c6bf6752984b3a29fcc135a5e70eb792c40c6b # v1
37+
id: generate-token
38+
with:
39+
app-id: ${{ secrets.SCS_APP_ID }}
40+
private-key: ${{ secrets.SCS_APP_PRIVATE_KEY }}
41+
42+
- name: Override default config from dispatch variables
43+
run: |
44+
echo "DRY_RUN=${{ github.event.inputs.dryRun || env.DRY_RUN }}" >> "$GITHUB_ENV"
45+
echo "LOG_LEVEL=${{ github.event.inputs.logLevel || env.LOG_LEVEL }}" >> "$GITHUB_ENV"
46+
47+
- name: Renovate
48+
uses: renovatebot/github-action@f9c81dddc9b589e4e6ae0326d1e36f6bc415d230 # v39.2.4
49+
env:
50+
RENOVATE_HOST_RULES: '[{"hostType": "docker", "matchHost": "ghcr.io", "username": "${{ github.actor }}", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
51+
RENOVATE_ALLOWED_POST_UPGRADE_COMMANDS: '[".*"]'
52+
BUILDER_IMAGE: 'ghcr.io/sovereigncloudstack/cso'
53+
RENOVATE_POST_UPGRADE_TASKS: '{ commands: ["BUILD_IMAGE_TOKEN=${{ secrets.GITHUB_TOKEN }} BUILD_IMAGE_USER=${{ github.actor }} CI=true ./hack/upgrade-builder-image.sh"], fileFilters: ["Makefile", ".github/**/*.yml", ".github/**/*.yaml"], executionMode: "branch"}'
54+
with:
55+
configurationFile: ${{ env.RENOVATE_CONFIG_FILE }}
56+
token: "x-access-token:${{ steps.generate-token.outputs.token }}"
57+
mount-docker-socket: "true"

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ jobs:
6464
GIT_REPOSITORY_NAME: cluster-stacks
6565
GO111MODULE: "on"
6666
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
67-
run: make test-integration-workloadcluster
67+
run: make test-integration-workloadcluster

.hadolint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ ignored: []
44
no-color: false
55
no-fail: false
66
strict-labels: false
7-
disable-ignore-pragma: false
7+
disable-ignore-pragma: false

0 commit comments

Comments
 (0)