Day 9: Running self-hosted
Goal: A bot with a global
config.jstakes care of all repos in an organization, onboards new repos with your standard and produces logs you can evaluate. · Duration: approx. 120 min · Prerequisite: Day 3
Briefing
- Global config (bot):
config.js<RENOVATE_*env < CLI flags. Platform, token, repo selection, onboarding, caches. - Repo config (
renovate.json): may only contain repo options. autodiscoverfinds all repos the bot is allowed to write to; filters narrow it down.- If the repo config is missing,
onboardingandrequireConfigdecide. - Operations: JSON logs, exit codes, persistent
cacheDir, container.
config.js ─┐
RENOVATE_* ├─► global config ─► autodiscover + filter ─► shop/a shop/b shop/c
CLI flags ─┘ │
per repo: renovate.json present? ─┤ yes ─► Updates
└ no ─► Onboarding PR
Drill 1: Four repos, two organizations
You reset shop-api to its Day 0 state, recreate
shop-worker and shop-deploy from Day 3 and
build a second organization, lager. It has no bot team: the
bot only gets lager-app as a collaborator; it cannot see
lager-archiv.
source ~/renovate-lab/setup/env.sh
export RENOVATE_GITHUB_COM_TOKEN=$(gh auth token) # optional, see Day 0
mkdir -p ~/renovate-lab/tag09 && cd ~/renovate-lab/tag09
API="$FORGEJO/api/v1"
for r in shop-api shop-worker shop-deploy; do
curl -s -o /dev/null -w "$r %{http_code}\n" -u "$ADMIN" -X DELETE "$API/repos/shop/$r"
done
git -C ~/renovate-lab/shop-api push -q forgejo:shop/shop-api.git main
for r in shop-worker shop-deploy; do
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
curl -s -u "$ADMIN" -X POST --json '{"username":"lager"}' "$API/orgs" | jq -r .username
for r in lager-app lager-archiv; do
rm -rf start-$r
cp -R ~/renovate-lab/code/tag09/lager-app 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:lager/$r.git main
done
curl -s -o /dev/null -w '%{http_code}\n' -u "$ADMIN" -X PUT \
--json '{"permission":"write"}' "$API/repos/lager/lager-app/collaborators/renovate-bot"Expected:
shop-api 204
shop-worker 204
shop-deploy 204
lager
204
shop-worker and shop-deploy have a
renovate.json; shop-api and the
lager repos do not. Today you make changes to the repos in
the copies start-… and push them.
Save your progress? Sign up for free
Drill 2: From env variables to config.js
So far everything came from env.sh. A service needs a
file that is versioned and reviewed. Renovate reads
config.js from the current directory; a different path goes
through RENOVATE_CONFIG_FILE.
env | grep '^RENOVATE_' | cut -d= -f1 | sort
cat > config.js <<'EOF'
// config.js – global configuration of the lab bot (Day 9)
module.exports = {
platform: 'forgejo',
endpoint: 'http://127.0.0.1:3000/api/v1',
token: process.env.RENOVATE_TOKEN, // never write the token into the file
gitAuthor: 'Renovate Bot <[email protected]>',
repositories: ['shop/shop-worker'],
};
EOF
unset RENOVATE_PLATFORM RENOVATE_ENDPOINT RENOVATE_GIT_AUTHOR
renovate-config-validator config.js
renovate --dry-run=extract 2>&1 | grep -E 'Repository (started|finished)|durationMs'Expected:
RENOVATE_ENDPOINT
RENOVATE_GIT_AUTHOR
RENOVATE_GITHUB_COM_TOKEN
RENOVATE_PLATFORM
RENOVATE_TOKEN
INFO: Validating config.js as global config
INFO: Config validated successfully against 1 file(s)
INFO: Repository started (repository=shop/shop-worker)
INFO: Repository finished (repository=shop/shop-worker)
"durationMs": 1898,
Without a repo argument, Renovate takes repositories
from the file. With a file argument, the validator always checks it as a
global config. Now the precedence:
RENOVATE_REPOSITORIES=shop/shop-deploy renovate --dry-run=extract 2>&1 \
| grep -E 'Repository started|WARN'
RENOVATE_REPOSITORIES=shop/shop-deploy renovate --dry-run=extract shop/shop-api 2>&1 \
| grep -E 'Repository started|CLI config'
mv config.js bot.config.js
RENOVATE_CONFIG_FILE=bot.config.js renovate --dry-run=extract 2>&1 \
| grep 'Repository started'
RENOVATE_CONFIG_FILE=fehlt.js renovate 2>&1 | grep FATAL; echo "exit=${pipestatus[1]}"
mv bot.config.js config.jsExpected:
INFO: Repository started (repository=shop/shop-deploy)
WARN: CLI config is overridding the `repositories` config previously set
INFO: Repository started (repository=shop/shop-api)
INFO: Repository started (repository=shop/shop-worker)
FATAL: Custom config file specified in RENOVATE_CONFIG_FILE must exist
exit=1
Env beats file, CLI beats both. This comes from
parseConfigs(): Renovate merges the file first, then env,
then CLI. exit=${pipestatus[1]} is for zsh; in bash it is
${PIPESTATUS[0]}.
Warning: Every new shell with
source env.shsetsRENOVATE_ENDPOINTand friends again and thus overrides the file. In a service you set onlyRENOVATE_TOKENas env; everything else lives inconfig.js.
Save your progress? Sign up for free
Drill 3: Global vs. repo options
Options with globalOnly only take effect in the bot
config. Some of them:
| Area | Global only |
|---|---|
| Platform | platform, endpoint, token,
username, gitUrl |
| Repo selection | repositories, autodiscover,
autodiscoverFilter, …Namespaces |
| Onboarding | onboarding, onboardingConfig,
onboardingBranch, requireConfig |
| Operations | baseDir, cacheDir,
repositoryCache, persistRepoData,
dryRun |
| Security | allowedCommands, allowedEnv,
secrets, exposeAllEnv |
The complete list comes from the globalOnly field in
tools/node_modules/renovate/dist/config/options/index.js.
What happens when such an option ends up in
renovate.json?
mkdir -p repo-cfg && cat > repo-cfg/renovate.json <<'EOF'
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"requireConfig": "optional",
"repositoryCache": "enabled"
}
EOF
(cd repo-cfg && renovate-config-validator 2>&1 | grep -o '"The .* global option')
(cd repo-cfg && renovate-config-validator >/dev/null 2>&1; echo "exit=$?")
cp repo-cfg/renovate.json start-shop-worker/renovate.json
git -C start-shop-worker commit -qam "Globale Optionen im Repo"
git -C start-shop-worker push -q
renovate > global.log 2>&1; echo "exit=$?"
grep -E '^ WARN|"result"' global.log
cp ~/renovate-lab/code/tag03/shop-worker/renovate.json start-shop-worker/renovate.json
git -C start-shop-worker commit -qam "Nur Repo-Optionen"
git -C start-shop-worker push -qExpected:
"The \"repositoryCache\" option is a global option
"The \"requireConfig\" option is a global option
exit=1
exit=0
WARN: Found renovate config warnings (repository=shop/shop-worker)
"result": "done",
The validator reports an error (exit 1). The real run merely ignores
the two options, warns and carries on. The Dependency Dashboard of
shop-worker shows under “Repository Problems”:
⚠️ WARN: Found renovate config warnings. Afterwards you
restore the clean config.
Save your progress? Sign up for free
Drill 4: autodiscover and filters
Instead of a repo list, Renovate asks the platform. On Forgejo it searches for repos the bot user has access to and discards all without push permission.
curl -s -H "Authorization: token $RENOVATE_TOKEN" \
"$FORGEJO/api/v1/repos/search?limit=50" \
| jq -r '.data[] | "\(.full_name) push=\(.permissions.push)"'
renovate --autodiscover --write-discovered-repos=repos.json >/dev/null 2>&1
cat repos.json; echoExpected:
lager/lager-app push=true
lager/lager-archiv push=false
shop/shop-api push=true
shop/shop-deploy push=true
shop/shop-worker push=true
["lager/lager-app","shop/shop-api","shop/shop-deploy","shop/shop-worker"]
lager-archiv is public and therefore visible, but it is
missing: no collaborator, no push. --write-discovered-repos
writes the list and exits Renovate without touching a single repo. Ideal
for testing filters:
for f in 'shop/*' '/^lager\//' '!shop/shop-deploy' 'shop/shop-{api,worker}'; do
renovate --autodiscover --autodiscover-filter="$f" \
--write-discovered-repos=repos.json >/dev/null 2>&1
printf '%-24s %s\n' "$f" "$(cat repos.json)"
doneExpected:
shop/* ["shop/shop-api","shop/shop-deploy","shop/shop-worker"]
/^lager\// ["lager/lager-app"]
!shop/shop-deploy ["lager/lager-app","shop/shop-api","shop/shop-worker"]
shop/shop-{api,worker} ["shop/shop-worker"]
Glob, /regex/ and ! negation work as with
matchPackageNames (Day 2). The last line is a trap: on the
command line Renovate splits lists at the comma, turning the glob into
two broken patterns. In config.js,
{api,worker} works. Multiple patterns work together:
['*/*', '!lager/*'] means “everything except lager”.
Warning:
autodiscoverNamespaces: ['lager']lists the org repos directly and does not check push permissions. In the lab,lager/lager-archivthen shows up again. By the way, withautodiscoveractive, repo arguments on the command line are not a filter: Renovate still processes all repos it found.
Save your progress? Sign up for free
Drill 5: Onboarding with an org standard
Without onboardingConfig, the onboarding PR only writes
$schema (Day 1). Now the bot sets the standard. From here
on, this config.js replaces the one from Drill 2.
cat > config.js <<'EOF'
// config.js – global configuration of the lab bot (Day 9)
module.exports = {
platform: 'forgejo',
endpoint: 'http://127.0.0.1:3000/api/v1',
token: process.env.RENOVATE_TOKEN, // never write the token into the file
gitAuthor: 'Renovate Bot <[email protected]>',
autodiscover: true,
autodiscoverFilter: ['shop/*'],
onboardingBranch: 'renovate/onboarding',
onboardingConfig: {
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: ['config:recommended', ':timezone(Europe/Berlin)'],
},
};
EOF
renovate-config-validator config.js | tail -1
LOG_FORMAT=json renovate > onboarding.json 2>&1; echo "exit=$?"
jq -r 'select(.msg == "Repository finished") | "\(.repository) \(.result)"' onboarding.json
curl -s -u "$ADMIN" "$API/repos/shop/shop-api/pulls" \
| jq -r '.[] | "#\(.number) \(.state) \(.head.ref) | \(.title)"'
curl -s -u "$ADMIN" "$API/repos/shop/shop-api/raw/renovate.json?ref=renovate/onboarding"Expected:
INFO: Config validated successfully against 1 file(s)
exit=0
shop/shop-api onboarding
shop/shop-deploy done
shop/shop-worker done
#1 open renovate/onboarding | Configure Renovate
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":timezone(Europe/Berlin)"
]
}
Only shop-api has no config and gets the onboarding PR,
now on the branch renovate/onboarding and with your
standard. The other two are already onboarded and get update PRs. On Day
11, extends points to a preset repo instead
(local>presets/renovate-config), and then the standard
changes centrally.
Save your progress? Sign up for free
Drill 6: requireConfig and disabling repos
Two ways to shut down a repo: close the onboarding PR or set
"enabled": false in the config.
curl -s -u "$ADMIN" -X PATCH "$FORGEJO/api/v1/repos/shop/shop-api/pulls/1" --json '{"state":"closed"}' \
| jq -r '"#\(.number) \(.state)"'
cat > aus.json <<'EOF'
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"enabled": false
}
EOF
cp aus.json start-shop-deploy/renovate.json
git -C start-shop-deploy commit -qam "Renovate abschalten"
git -C start-shop-deploy push -q
LOG_FORMAT=json renovate > aus.json 2>&1
jq -r 'select(.msg == "Repository finished") | "\(.repository) \(.result)"' aus.json
curl -s -u "$ADMIN" "$FORGEJO/api/v1/repos/shop/shop-api/issues/1/comments" | jq -r '.[].body' \
| cut -c1-88 | head -3Expected:
#1 closed
shop/shop-api disabled-closed-onboarding
shop/shop-deploy disabled-by-config
shop/shop-worker done
### Renovate is disabled
Renovate is disabled because there is no Renovate configuration file. To enable Renovate
How binding the repo config is, is controlled by
requireConfig:
| Value | Repo without config | Config in the repo |
|---|---|---|
required (default) |
onboarding PR; skipped with onboarding: false |
applies |
optional |
runs with the global config (even after a closed PR!) | applies |
ignored |
runs with the global config | is not read |
Try the other two values as a dry run via env:
for rc in optional ignored; do
echo "== requireConfig=$rc"
LOG_FORMAT=json RENOVATE_REQUIRE_CONFIG=$rc renovate --dry-run=full > rc-$rc.json 2>&1
jq -r 'select(.msg == "Repository finished") | "\(.repository) \(.result)"' rc-$rc.json
grep -c 'Would commit files' rc-$rc.json
doneExpected:
== requireConfig=optional
shop/shop-api done
shop/shop-deploy disabled-by-config
shop/shop-worker done
8
== requireConfig=ignored
shop/shop-api done
shop/shop-deploy done
shop/shop-worker done
8
Two surprises. With optional, the closed onboarding PR
no longer counts: shop-api would get eight branches, and
only with Renovate’s defaults, because the global config has no
extends. With ignored, the bot even overrides
"enabled": false. Only set either of them deliberately, and
tell the teams.
Save your progress? Sign up for free
Drill 7: JSON logs, run summary, exit codes
For a service you want machine-readable logs.
LOG_FORMAT=json switches stdout to one JSON line per entry
(bunyan); LOG_FILE additionally writes a file with its own
level LOG_FILE_LEVEL (default debug).
LOG_FORMAT=json renovate > lauf.json 2>&1
head -1 lauf.json | jq -c '{level, msg, time}'
jq -r 'select(.msg == "Repository finished")
| "\(.repository) \(.durationMs) ms cloned=\(.cloned) \(.result)"' lauf.json
mkdir -p logs
LOG_FILE=logs/renovate.ndjson LOG_FILE_LEVEL=debug renovate > lauf.txt 2>&1
wc -l < lauf.txt; jq -r .level logs/renovate.ndjson | sort | uniq -cExpected:
{"level":30,"msg":"Renovate started","time":"2026-10-12T16:31:06.433Z"}
shop/shop-api 481 ms cloned=true disabled-closed-onboarding
shop/shop-deploy 387 ms cloned=true disabled-by-config
shop/shop-worker 2162 ms cloned=true done
47
537 20
16 30
Levels: 20 debug, 30 info, 40 warn, 50 error, 60 fatal. The console
stays at info (47 lines); the file has all 553 entries.
summary reads the “Repository finished” entry per repo.
Without LOG_FORMAT it looks like this:
INFO: Repository finished (repository=shop/shop-worker)
"cloned": true,
"durationMs": 1558,
"result": "done",
"status": "onboarded",
"enabled": true,
"onboarded": true,
"exitCode": 0
And the exit codes? Give lager/lager-app a broken config
and take a look. --autodiscover=false with a repo argument
overrides config.js for this call.
printf '{\n "extends": ["config:recommended",]\n' > kaputt.json
cp kaputt.json start-lager-app/renovate.json
git -C start-lager-app commit -qam "Kaputte Config"
git -C start-lager-app push -q
renovate --autodiscover=false lager/lager-app >x.log 2>&1; echo "exit=$?"
renovate --autodiscover=false --exit-code-for-errors=true lager/lager-app >x.log 2>&1
echo "exit=$?"
renovate --autodiscover=false shop/gibtsnicht >x.log 2>&1; echo "exit=$?"Expected:
exit=0
exit=5
exit=1
| Exit | Meaning |
|---|---|
| 0 | finished, even if a repo has a broken config (issue in the repo) |
| 1 | FATAL at startup or a log entry with level
ERROR |
| 3–8 | only with exitCodeForErrors: true: 3 system, 4
platform, 5 config, … 8 unknown |
So without exitCodeForErrors, your CronJob notices
nothing about a broken repo config. Instead,
lager/lager-app contains the issue “Action Required: Fix
Renovate Configuration”.
Save your progress? Sign up for free
Drill 8: baseDir, cacheDir and repository cache
Renovate works in baseDir (default
$TMPDIR/renovate): clones under repos/, caches
under cache/ (= cacheDir). With
repositoryCache: "enabled" it additionally remembers
extraction, branches and PRs per repo. Measure three runs:
export RENOVATE_BASE_DIR=~/renovate-lab/tag09/work LOG_FORMAT=json
cp ~/renovate-lab/code/tag03/shop-deploy/renovate.json start-shop-deploy/renovate.json
git -C start-shop-deploy commit -qam "Renovate wieder an"
git -C start-shop-deploy push -q
rm -rf work
for i in 1 2; do
LOG_FILE=logs/cache$i.ndjson renovate --repository-cache=enabled > cache$i.json 2>&1
echo "-- Lauf $i"
jq -r 'select(.msg == "Repository finished")
| "\(.repository) \(.durationMs) ms cloned=\(.cloned) \(.result)"' cache$i.json
done
echo "-- Lauf 3 (ohne Repo-Cache)"
renovate > cache3.json 2>&1
jq -r 'select(.msg == "Repository finished")
| "\(.repository) \(.durationMs) ms cloned=\(.cloned) \(.result)"' cache3.jsonExpected:
-- Lauf 1
shop/shop-api 649 ms cloned=true disabled-closed-onboarding
shop/shop-deploy 20716 ms cloned=true done
shop/shop-worker 4784 ms cloned=true done
-- Lauf 2
shop/shop-api 384 ms cloned=true disabled-closed-onboarding
shop/shop-deploy 3203 ms cloned=true done
shop/shop-worker 1086 ms cloned=true done
-- Lauf 3 (ohne Repo-Cache)
shop/shop-api 479 ms cloned=true disabled-closed-onboarding
shop/shop-deploy 3919 ms cloned=true done
shop/shop-worker 2265 ms cloned=true done
Summed up: 26.1 s cold, 4.7 s warm with the repository cache, 6.7 s
warm without. The big jump comes from the package cache in
cacheDir (datasource responses), the rest from the
repository cache
(work/cache/renovate/repository/forgejo/shop/*.json). How
you recognize it:
jq -r 'select(.msg | startswith("Cached extract")) | "\(.repository): \(.msg)"' \
logs/cache2.ndjson | cut -c1-88Expected:
shop/shop-deploy: Cached extract for sha=1a5ba53e57f7f59dca653f92f9b8ec2157416ced is val
shop/shop-worker: Cached extract for sha=0d43ad6ba4a9751bf5f54dc616b357564039d1bc is val
If main has not moved, Renovate skips the extraction.
work/repos stays empty because Renovate deletes the clone
after each repo. persistRepoData keeps it:
for i in 1 2; do
LOG_FILE=logs/persist$i.ndjson renovate --repository-cache=enabled \
--persist-repo-data=true > p$i.json 2>&1
done
for i in 1 2; do jq -r 'select(.msg | test("(clone|fetch) completed")) | .msg' \
logs/persist$i.ndjson | sort | uniq -c; doneExpected:
3 git clone completed
3 git fetch completed
For the lab repos, fetch instead of clone
saves hardly any time. For large monorepos it pays off, but permanently
costs disk space per repo. For the rest of the day:
unset LOG_FORMAT.
Tip: In a container or CronJob,
/tmpis gone after every run. Without a persistent volume forcacheDir, every run is a cold start like run 1 (Day 10).
Save your progress? Sign up for free
Drill 9: The official Docker image
In production, Renovate usually runs as the container
ghcr.io/renovatebot/renovate. First check the size without
pulling the image:
IMG=ghcr.io/renovatebot/renovate:44.153.1
ARCH=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')
D=$(docker manifest inspect $IMG | jq -r --arg a "$ARCH" \
'.manifests[] | select(.platform.architecture == $a) | .digest')
docker manifest inspect ghcr.io/renovatebot/renovate@$D \
| jq -r '[.layers[].size] | add / 1024 / 1024 | floor | "\(.) MiB komprimiert"'Expected:
405 MiB komprimiert
Unpacked, it needs several times that. The 44.153.1-full
variant with all tools (go, helm, …) is 2454 MiB compressed. The image
runs as user 12021 in the directory /usr/src/app, and that
is where it looks for config.js.
The real problem is the network: inside the container,
127.0.0.1 is the container itself. Test the options with
the Forgejo image you already have (it contains git):
I=codeberg.org/forgejo/forgejo:16.0.6-rootless
docker run --rm --network bridge --entrypoint git $I \
ls-remote http://127.0.0.1:3000/shop/shop-api.git main >/dev/null 2>&1; echo "Exit: $?"
docker run --rm --network bridge --entrypoint git $I \
ls-remote http://host.docker.internal:3000/shop/shop-api.git main >/dev/null 2>&1
echo "Exit: $?"
docker run --rm --network host --entrypoint git $I \
ls-remote http://127.0.0.1:3000/shop/shop-api.git main >/dev/null 2>&1; echo "Exit: $?"Expected (Colima on macOS; 128 means: no
connection):
Exit: 128
Exit: 0
Exit: 0
Under Colima, --network host is the network of the Linux
VM in which Forgejo publishes its port. That is why it works here,
contrary to what is often claimed. Under Docker Desktop the behavior
depends on version and settings. host.docker.internal works
in both cases and is the portable way.
One trap remains: Forgejo reports its ROOT_URL as the
clone URL, i.e. http://127.0.0.1:3000/.... With
gitUrl: "endpoint", Renovate builds the clone URL from the
endpoint. You can prove this locally:
for g in default endpoint; do
LOG_LEVEL=debug RENOVATE_ENDPOINT=http://localhost:3000/api/v1 RENOVATE_GIT_URL=$g \
renovate --autodiscover=false --dry-run=extract shop/shop-worker 2>&1 \
| grep -E 'Using HTTP URL|using URL based|"url": "http.*\.git"' | cut -c1-88
doneExpected:
DEBUG: Using HTTP URL: http://127.0.0.1:3000/shop/shop-worker.git (repository=shop/shop-
DEBUG: using URL based on configured endpoint (repository=shop/shop-worker)
"url": "http://**redacted**@localhost:3000/shop/shop-worker.git"
The container run takes config.js from Drill 5 and
overrides endpoint and gitUrl via env:
docker run --rm \
-e RENOVATE_TOKEN -e RENOVATE_GITHUB_COM_TOKEN -e LOG_FORMAT=json \
-e RENOVATE_ENDPOINT=http://host.docker.internal:3000/api/v1 \
-e RENOVATE_GIT_URL=endpoint \
-v "$PWD/config.js:/usr/src/app/config.js:ro" \
ghcr.io/renovatebot/renovate:44.153.1 > docker.json
jq -r 'select(.msg == "Repository finished")
| "\(.repository) \(.durationMs) ms cloned=\(.cloned) \(.result)"' docker.json
docker rmi ghcr.io/renovatebot/renovate:44.153.1Expected (not tested live, may differ depending on the version): one
line per shop repo as with summary in Drill 7,
with run times like run 1 from Drill 8, because the cache in the
container is empty. Unpacked, the pull needs a good 1 GB on the Docker
disk: check docker system df beforehand, delete the image
afterwards. You build a writable cache volume for the container user on
Day 10.
Save your progress? Sign up for free
Checkpoint
config.js is a valid global config and reads the token
from the environment:
cd ~/renovate-lab/tag09
source ~/renovate-lab/setup/env.sh
unset RENOVATE_PLATFORM RENOVATE_ENDPOINT RENOVATE_GIT_AUTHOR RENOVATE_CONFIG_FILE
API="$FORGEJO/api/v1"
renovate-config-validator config.js | tail -1
grep -c 'process.env.RENOVATE_TOKEN' config.jsExpected:
INFO: Config validated successfully against 1 file(s)
1
autodiscover finds shop, but not lager:
renovate --write-discovered-repos=k.json >/dev/null 2>&1
cat k.json; echoExpected:
R09_KP1
The onboarding PR in shop-api is closed,
shop-deploy is active again:
curl -s -u "$ADMIN" "$API/repos/shop/shop-api/pulls?state=closed" | jq -r '.[].head.ref'
curl -s -u "$ADMIN" "$API/repos/shop/shop-deploy/raw/renovate.json" | jq .enabledExpected:
renovate/onboarding
null
Repository cache and JSON log are present:
ls work/cache/renovate/repository/forgejo/shop/
jq -r 'select(.msg == "Repository finished") | .repository' cache1.jsonExpected:
R09_KP2
Challenge
Write challenge.config.js for the org bot: autodiscover
across all repos except the org lager, repo config
mandatory, onboarding on renovate/onboarding with the
standard config:recommended, time zone Berlin and updates
only early on Mondays, repository cache on, exit code on repo errors. A
new repo shop/shop-katalog must get the onboarding PR with
exactly this standard.
Hint: One positive and one negative pattern in
autodiscoverFilter, and schedule:earlyMondays
is a ready-made preset.
Solution
cd ~/renovate-lab/tag09
API="$FORGEJO/api/v1"
cat > challenge.config.js <<'EOF'
// challenge.config.js – org bot for shop only (Day 9, Challenge)
module.exports = {
platform: 'forgejo',
endpoint: 'http://127.0.0.1:3000/api/v1',
token: process.env.RENOVATE_TOKEN,
gitAuthor: 'Renovate Bot <[email protected]>',
autodiscover: true,
autodiscoverFilter: ['*/*', '!lager/*'],
requireConfig: 'required',
onboardingBranch: 'renovate/onboarding',
onboardingConfig: {
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
'config:recommended',
':timezone(Europe/Berlin)',
'schedule:earlyMondays',
],
},
repositoryCache: 'enabled',
exitCodeForErrors: true,
};
EOF
cp -R ~/renovate-lab/code/tag09/lager-app start-shop-katalog
git -C start-shop-katalog init -q -b main
git -C start-shop-katalog add -A
git -C start-shop-katalog commit -qm "Initialer Stand"
git -C start-shop-katalog push -q forgejo:shop/shop-katalog.git main
renovate-config-validator challenge.config.js | tail -1
export RENOVATE_CONFIG_FILE=$PWD/challenge.config.js
renovate --write-discovered-repos=repos.json >/dev/null 2>&1; cat repos.json; echo
LOG_FORMAT=json renovate > challenge.json 2>&1; echo "exit=$?"
jq -r 'select(.msg == "Repository finished") | "\(.repository) \(.result)"' challenge.json
curl -s -u "$ADMIN" "$API/repos/shop/shop-katalog/pulls" \
| jq -r '.[] | "#\(.number) \(.state) \(.head.ref) | \(.title)"'
curl -s -u "$ADMIN" \
"$API/repos/shop/shop-katalog/raw/renovate.json?ref=renovate/onboarding" | jq -c .extends
unset RENOVATE_CONFIG_FILEExpected:
INFO: Config validated successfully against 1 file(s)
["shop/shop-api","shop/shop-deploy","shop/shop-katalog","shop/shop-worker"]
exit=0
shop/shop-api disabled-closed-onboarding
shop/shop-deploy done
shop/shop-katalog onboarding
shop/shop-worker done
#1 open renovate/onboarding | Configure Renovate
["config:recommended",":timezone(Europe/Berlin)","schedule:earlyMondays"]
requireConfig: 'required' is the default, but stating it
explicitly documents the intent. Exit 0 despite
exitCodeForErrors: a disabled repo is not an error.
lager/lager-app with its broken config stays out. The
schedule preset only takes effect after the onboarding PR is merged.
Save your progress? Sign up for free
Enterprise Note
- One bot account per tenant or org group. What the bot is not allowed
to write to,
autodiscoverdoes not find. That is your actual access control; filters are only the second line. config.jsbelongs in Git and in review, tokens never do:process.envplus a secret from Vault, a Kubernetes Secret or a CI variable (Day 10, Day 12).- Put
cacheDiron a persistent volume. With several parallel instances, move the package cache to Redis (redisUrl) and the repository cache to S3 (repositoryCacheType). - JSON logs into central logging, alert on
exitCodeForErrorsnot equal to 0 and on “Repository finished” with aresultoutside ofdone/onboarding/disabled-*. - Pin the image by tag and digest and let Renovate itself keep it up
to date. Use the
-fullvariant only if lockfiles need tools that cannot be installed on demand (binarySource).