Skip to content

Commit

Permalink
Renovate workflow (#122)
Browse files Browse the repository at this point in the history
* add renovate

* initial renovate setup

* empty file to enable the bot

* clarify

* newline

* update groups

* update excecutionMode

* bump app once, even if multiple deps are changed

* update filters

* restrict more

* use bugclerk as author

* mount socket and add script
  • Loading branch information
stavros-k authored Aug 29, 2024
1 parent 01cccd1 commit 0e93a7b
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/renovate-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module.exports = {
extends: [],
// https://docs.renovatebot.com/self-hosted-configuration/#dryrun
dryRun: false,
// https://docs.renovatebot.com/configuration-options/#gitauthor
gitAuthor: "bugclerk <[email protected]>",
// https://docs.renovatebot.com/self-hosted-configuration/#onboarding
onboarding: false,
// https://docs.renovatebot.com/configuration-options/#dependencydashboard
dependencyDashboard: true,
// https://docs.renovatebot.com/self-hosted-configuration/#platform
platform: "github",
// https://docs.renovatebot.com/self-hosted-configuration/#repositories
repositories: ["truenas/apps"],
// https://docs.renovatebot.com/self-hosted-configuration/#allowpostupgradecommandtemplating
allowPostUpgradeCommandTemplating: true,
// https://docs.renovatebot.com/self-hosted-configuration/#allowedpostupgradecommands
// TODO: Restrict this.
allowedPostUpgradeCommands: ["^.*"],
enabledManagers: ["regex", "github-actions"],
customManagers: [
{
// Match only ix_values.yaml files in the ix-dev directory
fileMatch: ["^ix-dev/.*/ix_values\\.yaml$"],
// Matches the repository name and the tag of each image
matchStrings: [
'\\s{4}repository: (?<depName>[^\\s]+)\\n\\s{4}tag: "?(?<currentValue>[^\\s"]+)"?',
],
// Use the docker datasource on matched images
datasourceTemplate: "docker",
},
],
packageRules: [
{
matchManagers: ["regex"],
matchDatasources: ["docker"],
postUpgradeTasks: {
// What to "git add" after the commands are run
fileFilters: [
"ix-dev/**/app.yaml", // For the version update
"ix-dev/**/templates/**", // For the app lib versioned dir
],
// Execute the following commands for every dep.
executionMode: "update",
commands: [
"./.github/scripts/renovate_bump.sh {{{packageFileDir}}} {{{updateType}}}",
],
},
},
{
matchDatasources: ["docker"],
matchUpdateTypes: ["major"],
labels: ["major"],
},
{
matchDatasources: ["docker"],
matchUpdateTypes: ["minor"],
groupName: "updates-patch-minor",
labels: ["minor"],
},
{
matchDatasources: ["docker"],
matchUpdateTypes: ["patch"],
groupName: "updates-patch-minor",
labels: ["patch"],
},
],
};
1 change: 1 addition & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
28 changes: 28 additions & 0 deletions .github/scripts/renovate_bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

app_path=$1
update_type=$2
log_path="./renovate.log"

if [[ -z "$app_path" ]]; then
echo "Missing app_path"
exit 1
fi

if [[ -z "$update_type" ]]; then
echo "Missing update_type"
exit 1
fi

if grep "{{{packageFileDir}}}" "$log_path"; then
exit 0
fi

docker run --quiet --rm \
--platform linux/amd64 \
-v ./:/workspace \
ghcr.io/truenas/apps_validation:latest app_bump_version \
--path /workspace/"$app_path" \
--bump "$update_type"

echo "$app_path" >>"$log_path"
26 changes: 26 additions & 0 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Renovate

on:
workflow_dispatch:

concurrency:
group: renovate
cancel-in-progress: false

jobs:
renovate:
runs-on: actions-runner-large
steps:
- name: Checkout
uses: actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Self-hosted Renovate
uses: renovatebot/[email protected]
env:
RENOVATE_PR_HOURLY_LIMIT: 10
with:
configurationFile: .github/renovate-config.js
# TODO: https://github.com/renovatebot/github-action/tree/main?tab=readme-ov-file
token: ${{ secrets.RENOVATE_TOKEN }}
mount-docker-socket: true
3 changes: 3 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ words:
- cpus
- creds
- cuda
- datasource
- datasources
- ddns
- ddnss
- desec
Expand Down Expand Up @@ -177,6 +179,7 @@ words:
- tailscaled
- tautulli
- tdarr
- templating
- tensorchord
- tftpd
- tmpfs
Expand Down

0 comments on commit 0e93a7b

Please sign in to comment.