Skip to content
Hands-on IT IT Drills

Day 11: Org presets

Goal: You store the organization’s Renovate rules centrally in presets/renovate-config, version them with Git tags and roll out changes to several repos in a controlled way. · Duration: approx. 120 min · Prerequisite: Day 3, Day 9

Briefing

  • A preset is a JSON file in a repo. local>presets/renovate-config loads default.json from the platform Renovate is currently running on – here Forgejo, with the bot’s token.
  • :go loads go.json, //platform/k8s loads platform/k8s.json, (a, b) fills {{arg0}} and {{arg1}}.
  • #v1.0.0 reads the preset from a Git tag. Without a tag, main applies: every push to the preset repo takes effect in all repos on the next run.
  • If the bot cannot read the preset, Renovate stops the repo with a config error issue.
  • Globally it also works without extends in the repo: globalExtends and inheritConfig.
 presets/renovate-config (Tags v1.0.0, v1.1.0)
 ├── default.json ◄──────┬──── shop-worker   local>…  +  local>…:go
 ├── go.json             ├──── shop-deploy   local>…#v1.1.0 + :docker + //platform/k8s
 ├── docker.json         ├──── shop-api      local>… + :automerge-dev + :team(…)
 ├── automerge-dev.json  └──── shop-notify   no renovate.json at all (inheritConfig)
 ├── team.json
 ├── platform/k8s.json
 └── org-inherited-config.json   (Drill 8)

Drill 1: The preset repo

A fresh state for shop-api, then take a look at the preset files from the companion code.

source ~/renovate-lab/setup/env.sh
export RENOVATE_GITHUB_COM_TOKEN=$(gh auth token)   # optional, see Day 0
curl -s -o /dev/null -w '%{http_code}\n' -u "$ADMIN" \
  -X DELETE "$FORGEJO/api/v1/repos/shop/shop-api"
git -C ~/renovate-lab/shop-api push -q forgejo:shop/shop-api.git main
mkdir -p ~/renovate-lab/tag11 && cd ~/renovate-lab/tag11
T=~/renovate-lab/code/tag11          # companion code for the day
API="$FORGEJO/api/v1"
cd $T/renovate-config && cat default.json

Expected (abridged):

204
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "description": "Org-Standard für alle Repos der Organisation shop",
  "extends": ["config:recommended"],
  "timezone": "Europe/Berlin",
  "labels": ["dependencies"],
  "packageRules": [
    {
      "description": "shop: Minor und Patch in einem PR bündeln",
      "matchUpdateTypes": ["minor", "patch"],
      "groupName": "non-major"
    },
    {
      "description": "shop: Majors nur montags vor 7 Uhr",
      "matchUpdateTypes": ["major"],
      "schedule": ["* 0-6 * * 1"]
    }
  ]
}

Every rule starts its description with shop:. That way you can later tell immediately in the resolved config which rule comes from the org preset. Preset files are repo config, so you check them with --no-global:

renovate-config-validator --no-global *.json platform/*.json | tail -2

Expected:

 INFO: Validating platform/k8s.json as repo config
 INFO: Config validated successfully against 6 file(s)

The validator checks options and syntax but does not load presets (Drill 6). The preset repo gets its own organization presets without a bot team: the team bots in shop would have write access to everything, but for presets the bot only needs read access.

cd ~/renovate-lab/tag11
curl -s -u "$ADMIN" -X POST --json '{"username":"presets"}' "$API/orgs" | jq -r .username
rm -rf start-renovate-config
cp -R $T/renovate-config start-renovate-config
git -C start-renovate-config init -q -b main
git -C start-renovate-config add -A
git -C start-renovate-config commit -qm "Org-Presets"
git -C start-renovate-config push -q forgejo:presets/renovate-config.git main
curl -s -o /dev/null -w '%{http_code}\n' -u "$ADMIN" -X PUT --json '{"permission":"read"}' \
  "$API/repos/presets/renovate-config/collaborators/renovate-bot"
curl -s -H "Authorization: token $RENOVATE_TOKEN" \
  "$API/repos/presets/renovate-config" | jq -c .permissions

Expected:

presets
204
{"admin":false,"push":false,"pull":true}

local> means “on the same platform”; the organization may be a different one. Today you make changes to the repos in the local copies start-…: copy the file, commit, push. You get the resolved config with --print-config=true (Drill 2).

Save your progress? Sign up for free

Drill 2: Using the org standard

shop-worker and shop-deploy from Day 3 are added fresh. Forgejo silently discards unknown labels, so you create the labels once at the org level. Renovate finds org labels just like repo labels.

for r in shop-worker shop-deploy; do
  curl -s -o /dev/null -u "$ADMIN" -X DELETE "$API/repos/shop/$r"
  rm -rf start-$r
  cp -R ~/renovate-lab/code/tag03/$r start-$r
  git -C start-$r init -q -b main
  git -C start-$r add -A
  git -C start-$r commit -qm "Initialer Stand"
  git -C start-$r push -q forgejo:shop/$r.git main
done
for l in dependencies go docker team-shop; do
  curl -s -u "$ADMIN" -X POST "$API/orgs/shop/labels" --json "{\"name\":\"$l\",\"color\":\"#0075ca\"}" \
    >/dev/null
done
cat > worker.json <<'EOF'
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["local>presets/renovate-config"]
}
EOF
cp worker.json start-shop-worker/renovate.json
git -C start-shop-worker add -A
git -C start-shop-worker commit -qm "renovate.json aktualisiert"
git -C start-shop-worker push -q

Expected:

What arrives in the repo? --print-config=true logs the fully resolved config – more than 7000 lines, because all defaults are included. With LOG_FORMAT=json it sits in a single log line that you find with jq. The first query shows time zone and labels, the second the rules from the org preset (description starts with shop:):

LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-worker > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'

Expected:

timezone: "Europe/Berlin"
labels: ["dependencies"]
rule: shop: Minor und Patch in einem PR bündeln
rule: shop: Majors nur montags vor 7 Uhr

Now a real run:

renovate shop/shop-worker > worker.log 2>&1
curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/pulls" \
  | jq -r 'sort_by(.number)[] | "#\(.number) \(.title) \([.labels[].name])"'
curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/issues?type=issues" | jq -r '.[] | "#\(.number) \(.title)"'

Expected:

#1 Update non-major [dependencies]
#2 Dependency Dashboard

One PR for all three Go modules, with a label. No onboarding PR, because renovate.json is already on main.

Save your progress? Sign up for free

Drill 3: Named presets and paths

Next to default.json there are special presets. This is how Renovate translates the references:

Reference in extends File in the preset repo
local>presets/renovate-config default.json
local>presets/renovate-config:go go.json
local>presets/renovate-config//platform/k8s platform/k8s.json
local>presets/renovate-config:go/x key x in go.json

The last line is a sub-preset, not a path: :platform/k8s looks for platform.json and fails. shop-worker gets the Go preset, shop-deploy the Docker preset and the Kubernetes patterns from Day 3 from the subfolder:

cat $T/shop-worker/renovate.json $T/shop-deploy/renovate.json | grep 'local>'
cp $T/shop-worker/renovate.json start-shop-worker/renovate.json
git -C start-shop-worker add -A
git -C start-shop-worker commit -qm "renovate.json aktualisiert"
git -C start-shop-worker push -q
cp $T/shop-deploy/renovate.json start-shop-deploy/renovate.json
git -C start-shop-deploy add -A
git -C start-shop-deploy commit -qm "renovate.json aktualisiert"
git -C start-shop-deploy push -q
LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-worker > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'
LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-deploy > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'
jq -c 'select(.msg | startswith("Full resolved")) | .config.kubernetes.managerFilePatterns' \
  cfg.json

Expected:

    "local>presets/renovate-config",
    "local>presets/renovate-config:go"
    "local>presets/renovate-config",
    "local>presets/renovate-config:docker",
    "local>presets/renovate-config//platform/k8s"
postUpdateOptions: ["gomodTidy"]
rule: shop:go Label go
k8s: ["/(^|/)k8s/.+\\.yaml$/"]
rule: shop:docker Label docker
rule: shop:docker examples/ ignorieren

The remaining lines from default.json are included unchanged. The presets add up: labels from the default, addLabels from the special presets. One run over both repos:

renovate shop/shop-worker shop/shop-deploy > repos.log 2>&1
curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/pulls" \
  | jq -r 'sort_by(.number)[] | "#\(.number) \(.title) \([.labels[].name])"'
curl -s -u "$ADMIN" "$API/repos/shop/shop-deploy/pulls" \
  | jq -r 'sort_by(.number)[] | "#\(.number) \(.title) \([.labels[].name])"'

Expected:

#1 Update non-major [dependencies,go]
#1 Update non-major [dependencies,docker]

The existing PR in shop-worker got the new label go. The majors of postgres and redis are listed in the dashboard of shop-deploy under “Awaiting Schedule”: they wait for Monday morning, as the org rule demands.

Save your progress? Sign up for free

Drill 4: Parameters

A preset can contain placeholders. The team preset sets label and reviewer:

cat $T/renovate-config/team.json; grep 'local>' $T/shop-api/renovate.json

Expected:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "description": "Team-Zuordnung, Aufruf: :team(<label>, <reviewer>)",
  "addLabels": ["{{arg0}}"],
  "reviewers": ["{{arg1}}"]
}
    "local>presets/renovate-config",
    "local>presets/renovate-config:automerge-dev",
    "local>presets/renovate-config:team(team-shop, lab-admin)"

Renovate splits the arguments at the comma and strips spaces. {{args}} delivers the entire content of the parentheses. Parameters work with local> just as with github>:

rm -rf start-shop-api
git clone -q forgejo:shop/shop-api.git start-shop-api
cp $T/shop-api/renovate.json start-shop-api/renovate.json
git -C start-shop-api add -A
git -C start-shop-api commit -qm "renovate.json aktualisiert"
git -C start-shop-api push -q
LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-api > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'
renovate shop/shop-api > api.log 2>&1
curl -s -u "$ADMIN" "$API/repos/shop/shop-api/pulls" \
  | jq -r 'sort_by(.number)[] | "#\(.number) \(.title) \([.labels[].name])"'

Expected:

addLabels: ["team-shop"]
reviewers: ["lab-admin"]
rule: shop:automerge-dev devDependencies automatisch mergen
#1 Update dependency prettier to v3.9.10 [dependencies,team-shop]
#2 Update non-major [dependencies,team-shop] review: lab-admin

The automerge PR for prettier (group dev-tools, branch renovate/dev-tools) gets no reviewer: assignAutomerge is false by default. Your target versions are probably newer.

Save your progress? Sign up for free

Drill 5: Versioned presets

So far all repos read main of the preset repo. From now on, shop-deploy should only get released states. You create the first tag via the API:

curl -s -u "$ADMIN" -X POST "$API/repos/presets/renovate-config/tags" \
  --json '{"tag_name":"v1.0.0","target":"main","message":"Org-Presets v1.0.0"}' \
  | jq -r '"\(.name) \(.commit.sha[0:7])"'
cp $T/shop-deploy/renovate-v1.0.0.json deploy.json
grep 'local>' deploy.json
cp deploy.json start-shop-deploy/renovate.json
git -C start-shop-deploy add -A
git -C start-shop-deploy commit -qm "renovate.json aktualisiert"
git -C start-shop-deploy push -q

Expected (your hash will differ):

v1.0.0 9941228
    "local>presets/renovate-config#v1.0.0",
    "local>presets/renovate-config:docker#v1.0.0",
    "local>presets/renovate-config//platform/k8s#v1.0.0"

Each reference needs its own # tag, otherwise states get mixed. Now the platform team changes default.json on main, the normal way with Git: a new rule shop: Basis-Images zuerst (“base images first”) gives node, golang and alpine a prPriority of 5.

git clone -q forgejo:presets/renovate-config.git
cd renovate-config
cp $T/v1.1/default.json default.json
git diff --stat
renovate-config-validator --no-global default.json
git commit -qam "Basis-Images priorisieren" && git push -q origin main
cd ..
for r in shop-worker shop-deploy; do
  LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/$r \
    > cfg-$r.json 2>&1
  echo "$r: $(grep -c 'Basis-Images' cfg-$r.json)"
done

Expected:

 default.json | 5 +++++
 1 file changed, 5 insertions(+)
 INFO: Validating default.json as repo config
 INFO: Config validated successfully against 1 file(s)
shop-worker: 1
shop-deploy: 0

shop-worker (without a tag) has the new rule immediately, shop-deploy (on v1.0.0) does not. Release it as v1.1.0, this time with git tag, and then shop-deploy follows:

git -C renovate-config tag -a v1.1.0 -m "Org-Presets v1.1.0"
git -C renovate-config push -q origin v1.1.0
curl -s -u "$ADMIN" "$API/repos/presets/renovate-config/tags" \
  | jq -r '.[] | "\(.name) \(.commit.sha[0:7])"'
sed 's/#v1.0.0/#v1.1.0/' deploy.json > deploy-v1.1.json
cp deploy-v1.1.json start-shop-deploy/renovate.json
git -C start-shop-deploy add -A
git -C start-shop-deploy commit -qm "renovate.json aktualisiert"
git -C start-shop-deploy push -q
LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-deploy > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'

Expected:

v1.1.0 47f2af0
v1.0.0 9941228
rule: shop: Basis-Images zuerst

Doesn’t Renovate propose the tag change by itself? No. The renovate-config manager does read the extends entries (in the dashboard under “Detected Dependencies”), but reports skipReason: unsupported-datasource for local>. For local> the tag change remains manual work – and that is exactly what makes it controllable.

Save your progress? Sign up for free

Drill 6: Read permission and failure pattern

The preset repo becomes private, and someone removes the bot as a collaborator:

curl -s -u "$ADMIN" -X PATCH "$API/repos/presets/renovate-config" --json '{"private":true}' \
  | jq -r '"private=\(.private)"'
curl -s -u "$ADMIN" -X DELETE "$API/repos/presets/renovate-config/collaborators/renovate-bot"
curl -s -o /dev/null -w '%{http_code}\n' -H "Authorization: token $RENOVATE_TOKEN" \
  "$API/repos/presets/renovate-config/contents/default.json"
renovate shop/shop-worker > denied.log 2>&1
grep -E 'Throwing|invalid config|"validationError"' denied.log | head -3
curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/issues?type=issues" | jq -r '.[] | "#\(.number) \(.title)"'
curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/issues/3" | jq -r .body | fold -s -w 88

Expected:

private=true
404
 INFO: Throwing preset error (repository=shop/shop-worker)
       "validationError": "Cannot find preset's package (local>presets/renovate-config)"
 WARN: Repository has invalid config (repository=shop/shop-worker)
#3 Action Required: Fix Renovate Configuration
#2 Dependency Dashboard
There is an error with this repository's Renovate configuration that needs to be fixed.
As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (local>presets/renovate-config)

Forgejo answers a request for a private repo without permission with 404. To Renovate this looks exactly like a typo in the name. The open PR #1 stays; there are no new PRs until the repair. Restore read access:

curl -s -u "$ADMIN" -X PUT "$API/repos/presets/renovate-config/collaborators/renovate-bot" \
  --json '{"permission":"read"}'
renovate shop/shop-worker > fixed.log 2>&1
curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/issues?type=issues" | jq -r '.[] | "#\(.number) \(.title)"'
curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/issues/3" | jq -r .state

Expected:

#2 Dependency Dashboard
closed

Renovate closes the error issue itself. By the way, renovate-config-validator reports a typo like :gooo as valid, because it does not load presets. Only a run shows Cannot find preset's package – even a --dry-run=extract, without creating an issue.

Save your progress? Sign up for free

Drill 7: Onboarding and globalExtends

A new repo without renovate.json – the same Go code, a different name:

rm -rf start-shop-notify
cp -R $T/shop-notify start-shop-notify
git -C start-shop-notify init -q -b main
git -C start-shop-notify add -A
git -C start-shop-notify commit -qm "Initialer Stand"
git -C start-shop-notify push -q forgejo:shop/shop-notify.git main
LOG_LEVEL=debug renovate shop/shop-notify 2>&1 | grep 'Found preset' | sort -u
curl -s -u "$ADMIN" "$API/repos/shop/shop-notify/pulls" \
  | jq -r 'sort_by(.number)[] | "#\(.number) \(.title) \([.labels[].name])"'
curl -s -u "$ADMIN" "$API/repos/shop/shop-notify/raw/renovate.json?ref=renovate/configure" \
  | jq -c .extends

Expected (abridged):

DEBUG: Found preset local>presets/renovate-config - using it in onboarding config ...
#1 Configure Renovate [dependencies]
["local>presets/renovate-config"]

During onboarding, Renovate itself looks for <org>/renovate-config with default.json (then for <org>/.forgejo with renovate-config.json). For shop-notify that would be shop/renovate-config – which does not exist here; your preset lives in presets. If Renovate finds none, the global onboardingConfig (Day 9) applies, so without config.js only $schema. If the preset repo lives in the same org, Renovate writes exactly this reference without a tag into the onboarding PR.

globalExtends attaches presets to the global config and thus takes effect in every repo, no matter what its renovate.json says. Renovate reads config.js from the current directory automatically. The obvious first attempt:

cat > config.js <<'EOF'
module.exports = {
  globalExtends: ['local>presets/renovate-config#v1.1.0'],
};
EOF
renovate --dry-run=extract shop/shop-notify > ge.log 2>&1; echo "exit=$?"
grep -E '^(ERROR|FATAL)' ge.log; grep -m1 -o "Cannot find[^\"]*" ge.log
LOG_LEVEL=debug renovate --dry-run=extract shop/shop-notify 2>&1 \
  | grep -m1 'GET https://api.github.com' | cut -c1-88

Expected:

exit=2
ERROR: Error resolving config preset
FATAL: Unknown error
Cannot find preset's package (local>presets/renovate-config#v1.1.0)
DEBUG: GET https://api.github.com/repos/presets/renovate-config/contents/default.json?ref=v

globalExtends is resolved before Renovate knows the platform. local> therefore ends up at GitHub, and hostRules do not apply yet either. What remains is a URL readable without a token. Presets contain no secrets, so the repo may be public:

curl -s -u "$ADMIN" -X PATCH "$API/repos/presets/renovate-config" --json '{"private":false}' \
  | jq -r '"private=\(.private)"'
cp $T/config-globalextends.js config.js
grep http config.js
LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-notify > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'

Expected:

private=false
    'http://127.0.0.1:3000/presets/renovate-config/raw/tag/v1.1.0/default.json',
timezone: "Europe/Berlin"
labels: ["dependencies"]
rule: shop: Minor und Patch in einem PR bündeln
rule: shop: Majors nur montags vor 7 Uhr
rule: shop: Basis-Images zuerst

shop-notify has no config on main yet, but the org standard v1.1.0 applies anyway. Without config.js, cfg returns not a single line here. The warning about internalHostAccess in the log concerns the HTTP request to 127.0.0.1 (Day 8) and is harmless in the lab.

Save your progress? Sign up for free

Drill 8: inheritConfig

inheritConfig: true fetches the file org-inherited-config.json per repo from {{parentOrg}}/renovate-config – via the platform API with the bot token, so also from private repos. For shop/shop-notify that would be shop/renovate-config; because your preset repo lives in presets, config-inherit.js additionally sets inheritConfigRepoName: 'presets/renovate-config'. The file may also contain onboarding and requireConfig:

cat $T/org-inherited-config.json
(cd $T && renovate-config-validator org-inherited-config.json)
git -C renovate-config pull -q
cp $T/org-inherited-config.json renovate-config/
git -C renovate-config add -A
git -C renovate-config commit -qm "Geerbte Org-Config"
git -C renovate-config push -q
cp $T/config-inherit.js config.js     # inheritConfig and inheritConfigRepoName

Expected:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "onboarding": false,
  "requireConfig": "optional",
  "extends": ["local>presets/renovate-config#v1.1.0"]
}
 INFO: Validating org-inherited-config.json as global config
 INFO: Config validated successfully against 1 file(s)

With --no-global, the validator warns here that onboarding and requireConfig are global-only. It has no dedicated mode for inherited config; Renovate itself accepts both options there. Now the run:

renovate shop/shop-notify > inherit.log 2>&1
curl -s -u "$ADMIN" "$API/repos/shop/shop-notify/pulls" \
  | jq -r 'sort_by(.number)[] | "#\(.number) \(.title) \([.labels[].name])"'
curl -s -u "$ADMIN" "$API/repos/shop/shop-notify/issues?type=issues" | jq -r '.[] | "#\(.number) \(.title)"'
curl -s -u "$ADMIN" "$API/repos/shop/shop-notify/pulls/1" | jq -r '"#1 \(.state) \(.title)"'
LOG_LEVEL=debug renovate --dry-run=extract shop/shop-notify 2>&1 \
  | grep -E 'inherited config file|Repo is onboarded' | cut -c1-88

Expected:

#2 Update non-major [dependencies]
#3 Dependency Dashboard
#1 closed Configure Renovate - autoclosed
DEBUG: Checking for inherited config file org-inherited-config.json in repo shop/renovat
DEBUG: Repo is onboarded (repository=shop/shop-notify)

Forgejo fully supports inheritConfig. shop-notify counts as onboarded without a file of its own; Renovate closes the open onboarding PR and works according to the org standard. The inherited config comes before the repo config: repos with their own extends then get the org rules twice, which is harmless but confusing. For the rest of the day you switch it off again:

mv config.js config-inherit.js

Save your progress? Sign up for free

Checkpoint

The preset repo has both tags; the bot may read but not write:

cd ~/renovate-lab/tag11
API="$FORGEJO/api/v1"
curl -s -u "$ADMIN" "$API/repos/presets/renovate-config/tags" | jq -r '.[].name'
curl -s -H "Authorization: token $RENOVATE_TOKEN" \
  "$API/repos/presets/renovate-config" | jq -c .permissions

Expected:

v1.1.0
v1.0.0
{"admin":false,"push":false,"pull":true}

shop-deploy uses versioned presets, the PR in shop-api carries the team label:

curl -s -u "$ADMIN" "$API/repos/shop/shop-deploy/raw/renovate.json" | jq -r '.extends[]'
curl -s -u "$ADMIN" "$API/repos/shop/shop-api/pulls" | jq -c '.[] | [.labels[].name]'

Expected:

R11_KP1

No error issue is open in shop-worker; shop-notify has PRs without its own renovate.json:

curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/issues?type=issues" | jq -r '.[].title'
curl -s -u "$ADMIN" "$API/repos/shop/shop-notify/pulls" | jq -r '.[].title'
curl -s -o /dev/null -w '%{http_code}\n' -u "$ADMIN" \
  "$API/repos/shop/shop-notify/raw/renovate.json"

Expected:

R11_KP2

Challenge

The platform team renames go.json to golang.json; the label will be called golang from now on. Publish this as v2.0.0 and roll it out so that at no point does a repo get stuck with a config error: first shop-deploy as the canary, then shop-worker.

Hint: shop-worker still reads main – pin it to v1.1.0 first, before the breaking change lands on main.

Solution

First pin, then rename, tag and push:

cd ~/renovate-lab/tag11
sed 's/:go"/:go#v1.1.0"/; s/config"/config#v1.1.0"/' \
  $T/shop-worker/renovate.json > worker-v1.1.json
grep 'local>' worker-v1.1.json
cp worker-v1.1.json start-shop-worker/renovate.json
git -C start-shop-worker add -A
git -C start-shop-worker commit -qm "renovate.json aktualisiert"
git -C start-shop-worker push -q
cd renovate-config && git pull -q
git mv go.json golang.json
cp $T/v2/golang.json golang.json
renovate-config-validator --no-global golang.json
git add -A && git commit -qm "go.json heißt jetzt golang.json (Breaking Change)"
git tag -a v2.0.0 -m "Org-Presets v2.0.0" && git push -q origin main v2.0.0
cd ..
LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-worker > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'

Expected:

    "local>presets/renovate-config#v1.1.0",
    "local>presets/renovate-config:go#v1.1.0"
 INFO: Validating golang.json as repo config
 INFO: Config validated successfully against 1 file(s)
rule: shop:go Label go

shop-worker notices nothing of the breaking change. The canary shop-deploy uses no Go preset and can move to v2.0.0 right away:

sed 's/#v1.1.0/#v2.0.0/' deploy-v1.1.json > deploy-v2.json
cp deploy-v2.json start-shop-deploy/renovate.json
git -C start-shop-deploy add -A
git -C start-shop-deploy commit -qm "renovate.json aktualisiert"
git -C start-shop-deploy push -q
LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-deploy > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'

Expected:

5

For shop-worker it is not enough to just swap the tag – go.json no longer exists in v2.0.0. You check this beforehand via the API, without touching main:

for f in go golang; do echo "$f.json $(curl -s -o /dev/null -w '%{http_code}' \
  -H "Authorization: token $RENOVATE_TOKEN" \
  "$API/repos/presets/renovate-config/contents/$f.json?ref=v2.0.0")"; done
sed 's/#v1.1.0/#v2.0.0/; s/:go#/:golang#/' worker-v1.1.json > worker-v2.json
grep 'local>' worker-v2.json
cp worker-v2.json start-shop-worker/renovate.json
git -C start-shop-worker add -A
git -C start-shop-worker commit -qm "renovate.json aktualisiert"
git -C start-shop-worker push -q
curl -s -u "$ADMIN" -X POST "$API/orgs/shop/labels" --json '{"name":"golang","color":"#00add8"}' \
  | jq -r .name
LOG_FORMAT=json renovate --print-config=true --dry-run=extract shop/shop-worker > cfg.json 2>&1
jq -c 'select(.msg | startswith("Full resolved")) | .config
  | {timezone, labels, addLabels, reviewers, postUpdateOptions}' cfg.json
jq -r 'select(.msg | startswith("Full resolved")) | .config.packageRules[]
  | .description[0]?' cfg.json | grep '^shop:'
renovate shop/shop-worker > rollout.log 2>&1
curl -s -u "$ADMIN" "$API/repos/shop/shop-worker/pulls" \
  | jq -r 'sort_by(.number)[] | "#\(.number) \(.title) \([.labels[].name])"'

Expected:

go.json 404
golang.json 200
    "local>presets/renovate-config#v2.0.0",
    "local>presets/renovate-config:golang#v2.0.0"
golang
rule: shop:golang Label golang
#1 Update non-major [dependencies,golang]

Renovate switches the label on the existing PR from go to golang. In real teams, this step runs per repo as a PR with review instead of a direct putfile to main.

Save your progress? Sign up for free

Enterprise Note

  • Treat the preset repo like code: branch protection, review, CI with renovate-config-validator --no-global and SemVer tags with a changelog. Breaking changes (renamed presets, new mandatory rules) only with a new major tag.
  • The bot only needs read access to the preset repo, ideally via an org team with read permissions. inheritConfig uses the same token, globalExtends none – it needs a public URL or an npm package instead.
  • Renovate does not propose tag bumps for local>. Plan them as a rollout with a canary. With github>/gitlab> presets and #tag, the renovate-config manager detects new tags by itself.
  • With hundreds of repos, every run reloads the presets per repo. presetCachePersistence: true (global) keeps them in the package cache for 15 minutes.
  • A repo can override everything that comes from presets and inheritConfig. Whatever is not negotiable belongs in force in the global config (Day 9).