Move script, example-configurations and results (formerly reports) into renovate/

This commit is contained in:
Demo committed 2026-10-11 21:50:03 +02:00
1 parent c45f0e927b
commit 2267b21544
14 files changed
+83 -52

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@ node_modules/
bin/ bin/
obj/ obj/
.forgejo-token .forgejo-token
reports/ renovate/results/
+17 -9
View File
@@ -9,17 +9,25 @@ npm/utils/ package.json + package-lock.json (dayjs, typescript)
dotnet/ global.json, Directory.Packages.props, .config/dotnet-tools.json, dotnet/ global.json, Directory.Packages.props, .config/dotnet-tools.json,
src/{Core,Api} with packages.lock.json src/{Core,Api} with packages.lock.json
renovate.json Renovate configuration: one PR for npm and one for NuGet (including major updates) renovate.json Renovate configuration: one PR for npm and one for NuGet (including major updates)
renovate/ script/ (PowerShell scripts), example-configurations/, results/ (output of every run)
``` ```
Requirements: PowerShell, Node.js >= 24.11 (e.g. `volta install node@24`), Git, Podman, Requirements: PowerShell, Node.js >= 24.11 (e.g. `volta install node@24`), Git, Podman,
.NET SDK 8 (Renovate runs `dotnet restore` to update the NuGet lock files). .NET SDK 8 (Renovate runs `dotnet restore` to update the NuGet lock files).
Every run of `renovate-check.ps1` and `renovate-update.ps1` writes `reports/<timestamp>/` Every run of `renovate-check.ps1` and `renovate-update.ps1` writes `renovate/results/<timestamp>/`:
with `renovate-report.json` (Renovate report) and `renovate.log` (console output at debug level).
| File | Content |
|---|---|
| `command.ps1` | the executed Renovate command incl. environment variables (run it from the repository root to repeat the run) |
| `renovate.json` | the Renovate configuration that was used |
| `renovate.log` | console output at debug level |
| `renovate-report.json` | Renovate report |
| `info.json` | `startedAt`, `finishedAt`, `durationSeconds` and (update only) the created `pullRequests` |
## Example configurations ## Example configurations
`example-configurations/` contains alternative `renovate.json` files (copy one over `renovate.json` to use it): `renovate/example-configurations/` contains alternative `renovate.json` files (copy one over `renovate.json` to use it):
| File | PRs | | File | PRs |
|---|---| |---|---|
@@ -33,7 +41,7 @@ with `renovate-report.json` (Renovate report) and `renovate.log` (console output
## Check only ## Check only
```powershell ```powershell
.\script\renovate-check.ps1 .\renovate\script\renovate-check.ps1
``` ```
Renovate runs with `--platform=local` directly on this directory and lists the available updates. Renovate runs with `--platform=local` directly on this directory and lists the available updates.
@@ -44,14 +52,14 @@ This platform can only check, it cannot change files.
For Renovate to create branches and PRs, a Git server is needed - here a local **Forgejo** in Podman. For Renovate to create branches and PRs, a Git server is needed - here a local **Forgejo** in Podman.
```powershell ```powershell
.\script\forgejo-up.ps1 # start Forgejo (once, or after a reboot) .\renovate\script\forgejo-up.ps1 # start Forgejo (once, or after a reboot)
.\script\renovate-update.ps1 # run Renovate (as often as you like) .\renovate\script\renovate-update.ps1 # run Renovate (as often as you like)
.\script\forgejo-down.ps1 # stop Forgejo; with -Purge also delete all data .\renovate\script\forgejo-down.ps1 # stop Forgejo; with -Purge also delete all data
.\script\forgejo-reset.ps1 # reset Forgejo completely (all repos, PRs, tokens gone) and start fresh .\renovate\script\forgejo-reset.ps1 # reset Forgejo completely (all repos, PRs, tokens gone) and start fresh
``` ```
- `forgejo-up.ps1` starts Forgejo (`http://localhost:3000`, login `renovate` / `renovate`), - `forgejo-up.ps1` starts Forgejo (`http://localhost:3000`, login `renovate` / `renovate`),
creates the bot user and stores a fresh access token in `script/.forgejo-token`. creates the bot user and stores a fresh access token in `renovate/script/.forgejo-token`.
- `renovate-update.ps1` only knows Forgejo by endpoint, repository name (`renovate/renovate-test`) and `.forgejo-token`. - `renovate-update.ps1` only knows Forgejo by endpoint, repository name (`renovate/renovate-test`) and `.forgejo-token`.
It pushes `main` (the repository is created automatically on the first push), runs Renovate and fetches the It pushes `main` (the repository is created automatically on the first push), runs Renovate and fetches the
branches into the local repository as `forgejo/renovate/*`. Every run creates **new branches + PRs** branches into the local repository as `forgejo/renovate/*`. Every run creates **new branches + PRs**
File renamed without changes.
File renamed without changes.
File renamed without changes.
+55
View File
@@ -0,0 +1,55 @@
# Check only: Renovate runs with the "local" platform directly on this repository
# and changes nothing. Found updates are read from the JSON report and printed.
# Everything about the run is stored in renovate/results/<timestamp>/:
# command.ps1 the Renovate command that was executed (incl. environment variables)
# renovate.json the Renovate configuration that was used (working directory)
# renovate.log console output at debug level
# renovate-report.json Renovate report
# info.json start, end and duration
# Renovate requires Node.js >= 24.11
if ([version](node -v).TrimStart('v') -lt [version]'24.11.0') { throw "Renovate requires Node.js >= 24.11, found: $(node -v). E.g.: volta install node@24" }
$startedAt = Get-Date
$ts = $startedAt.ToString('yyyy-MM-dd-HH-mm-ss-fff')
Push-Location (Join-Path $PSScriptRoot '../..') # repository root
$outDir = "renovate/results/$ts"
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
# The local platform reads the working directory, so store the renovate.json from there
Copy-Item renovate.json "$outDir/renovate.json"
# Write the Renovate command to command.ps1 and run it.
# LOG_FILE is relative on purpose: Renovate lowercases it, an absolute path would break on case-sensitive file systems.
$command = @'
# Renovate command of run __TS__ - run it from the repository root to repeat it
$env:LOG_FILE = 'renovate/results/__TS__/renovate.log'
$env:LOG_FILE_LEVEL = 'debug'
$env:LOG_FILE_FORMAT = 'pretty'
npx --yes renovate@44.149.3 `
--platform=local --dry-run=lookup `
--report-type=file --report-path=renovate/results/__TS__/renovate-report.json
'@
$command = $command.Replace('__TS__', $ts)
Set-Content -Path "$outDir/command.ps1" -Value $command
& "./$outDir/command.ps1"
Remove-Item Env:LOG_FILE, Env:LOG_FILE_LEVEL, Env:LOG_FILE_FORMAT
$finishedAt = Get-Date
[ordered]@{
startedAt = $startedAt.ToString('yyyy-MM-ddTHH:mm:ss.fffzzz')
finishedAt = $finishedAt.ToString('yyyy-MM-ddTHH:mm:ss.fffzzz')
durationSeconds = [math]::Round(($finishedAt - $startedAt).TotalSeconds, 1)
} | ConvertTo-Json | Set-Content -Path "$outDir/info.json"
Write-Host "`nAvailable updates:" -ForegroundColor Cyan
$packageFiles = (Get-Content "$outDir/renovate-report.json" -Raw -Encoding UTF8 | ConvertFrom-Json).repositories.local.packageFiles
foreach ($manager in $packageFiles.PSObject.Properties) {
foreach ($file in $manager.Value) {
foreach ($dep in $file.deps) {
foreach ($update in $dep.updates) {
Write-Host " [$($manager.Name)] $($file.packageFile): $($dep.depName) $($dep.currentValue) -> $($update.newValue) ($($update.updateType))"
}
}
}
}
Write-Host "Run details: $outDir"
Pop-Location
@@ -1,6 +1,6 @@
# Renovate run against a Forgejo (started locally via script\forgejo-up.ps1). # Renovate run against a Forgejo (started locally via renovate\script\forgejo-up.ps1).
# Every run creates new branches + PRs with a timestamp: renovate/<yyyy-MM-dd-HH-mm-ss-fff>-<group> # Every run creates new branches + PRs with a timestamp: renovate/<yyyy-MM-dd-HH-mm-ss-fff>-<group>
# Everything about the run is stored in reports/<timestamp>/: # Everything about the run is stored in renovate/results/<timestamp>/:
# command.ps1 the Renovate command that was executed (incl. environment variables) # command.ps1 the Renovate command that was executed (incl. environment variables)
# renovate.json the Renovate configuration that was used (committed state of main) # renovate.json the Renovate configuration that was used (committed state of main)
# renovate.log console output at debug level # renovate.log console output at debug level
@@ -13,8 +13,8 @@ $tokenFile = Join-Path $PSScriptRoot '.forgejo-token'
# Renovate requires Node.js >= 24.11 # Renovate requires Node.js >= 24.11
if ([version](node -v).TrimStart('v') -lt [version]'24.11.0') { throw "Renovate requires Node.js >= 24.11, found: $(node -v). E.g.: volta install node@24" } if ([version](node -v).TrimStart('v') -lt [version]'24.11.0') { throw "Renovate requires Node.js >= 24.11, found: $(node -v). E.g.: volta install node@24" }
# Forgejo must be running and a token must exist # Forgejo must be running and a token must exist
try { Invoke-WebRequest "$endpoint/api/healthz" -UseBasicParsing | Out-Null } catch { throw "Forgejo is not reachable at $endpoint - run .\script\forgejo-up.ps1 first" } try { Invoke-WebRequest "$endpoint/api/healthz" -UseBasicParsing | Out-Null } catch { throw "Forgejo is not reachable at $endpoint - run .\renovate\script\forgejo-up.ps1 first" }
if (-not (Test-Path $tokenFile)) { throw "$tokenFile is missing - run .\script\forgejo-up.ps1 first" } if (-not (Test-Path $tokenFile)) { throw "$tokenFile is missing - run .\renovate\script\forgejo-up.ps1 first" }
$token = (Get-Content $tokenFile -Raw).Trim() $token = (Get-Content $tokenFile -Raw).Trim()
$startedAt = Get-Date $startedAt = Get-Date
@@ -22,15 +22,15 @@ $ts = $startedAt.ToString('yyyy-MM-dd-HH-mm-ss-fff') # for the branch nam
$prTimestamp = $startedAt.ToString('yyyy-MM-dd HH:mm:ss.fff') # for the PR title $prTimestamp = $startedAt.ToString('yyyy-MM-dd HH:mm:ss.fff') # for the PR title
$gitUrl = $endpoint -replace '://', "://renovate:$token@" $gitUrl = $endpoint -replace '://', "://renovate:$token@"
$gitUrl = "$gitUrl/$repo.git" $gitUrl = "$gitUrl/$repo.git"
Push-Location (Join-Path $PSScriptRoot '..') # repository root Push-Location (Join-Path $PSScriptRoot '../..') # repository root
$outDir = "reports/$ts" $outDir = "renovate/results/$ts"
New-Item -ItemType Directory -Force -Path $outDir | Out-Null New-Item -ItemType Directory -Force -Path $outDir | Out-Null
# 1. Push the local state of main to Forgejo (without credential helper, the credentials are in the URL) # 1. Push the local state of main to Forgejo (without credential helper, the credentials are in the URL)
git -c credential.helper= push $gitUrl main:main git -c credential.helper= push $gitUrl main:main
if ($LASTEXITCODE -ne 0) { Pop-Location; throw 'git push failed' } if ($LASTEXITCODE -ne 0) { Pop-Location; throw 'git push failed' }
# Renovate reads the configuration from the pushed main, so store exactly that version # Renovate reads the configuration from the pushed main, so store exactly that version
git show main:renovate.json --output="$outDir/renovate.json" git show main:renovate.json | Set-Content -Path "$outDir/renovate.json"
# 2. Write the Renovate command to command.ps1 and run it. # 2. Write the Renovate command to command.ps1 and run it.
# Branch prefix with timestamp => every run creates new branches + PRs. # Branch prefix with timestamp => every run creates new branches + PRs.
@@ -42,13 +42,13 @@ $command = @'
# Renovate command of run __TS__ - run it from the repository root to repeat it # Renovate command of run __TS__ - run it from the repository root to repeat it
$env:RENOVATE_GIT_AUTHOR = 'Renovate Bot <renovate@localhost>' $env:RENOVATE_GIT_AUTHOR = 'Renovate Bot <renovate@localhost>'
$env:RENOVATE_COMMIT_MESSAGE_SUFFIX = '__PR_TIMESTAMP__' $env:RENOVATE_COMMIT_MESSAGE_SUFFIX = '__PR_TIMESTAMP__'
$env:LOG_FILE = 'reports/__TS__/renovate.log' $env:LOG_FILE = 'renovate/results/__TS__/renovate.log'
$env:LOG_FILE_LEVEL = 'debug' $env:LOG_FILE_LEVEL = 'debug'
$env:LOG_FILE_FORMAT = 'pretty' $env:LOG_FILE_FORMAT = 'pretty'
npx --yes renovate@44.149.3 ` npx --yes renovate@44.149.3 `
--platform=forgejo --endpoint=__ENDPOINT__/api/v1 --token=$((Get-Content script/.forgejo-token -Raw).Trim()) ` --platform=forgejo --endpoint=__ENDPOINT__/api/v1 --token=$((Get-Content renovate/script/.forgejo-token -Raw).Trim()) `
--branch-prefix=renovate/__TS__- --branch-prefix-old=renovate/__TS__- ` --branch-prefix=renovate/__TS__- --branch-prefix-old=renovate/__TS__- `
--report-type=file --report-path=reports/__TS__/renovate-report.json ` --report-type=file --report-path=renovate/results/__TS__/renovate-report.json `
__REPO__ __REPO__
'@ '@
$command = $command.Replace('__TS__', $ts).Replace('__PR_TIMESTAMP__', $prTimestamp).Replace('__ENDPOINT__', $endpoint).Replace('__REPO__', $repo) $command = $command.Replace('__TS__', $ts).Replace('__PR_TIMESTAMP__', $prTimestamp).Replace('__ENDPOINT__', $endpoint).Replace('__REPO__', $repo)
-32
View File
@@ -1,32 +0,0 @@
# Check only: Renovate runs with the "local" platform directly on this directory
# and changes nothing. Found updates are read from the JSON report and printed.
# Renovate requires Node.js >= 24.11
if ([version](node -v).TrimStart('v') -lt [version]'24.11.0') { throw "Renovate requires Node.js >= 24.11, found: $(node -v). E.g.: volta install node@24" }
# Report and debug log of this run: reports/<timestamp>/
$ts = Get-Date -Format 'yyyy-MM-dd-HH-mm-ss-fff'
$outDir = Join-Path (Join-Path (Join-Path $PSScriptRoot '..') 'reports') $ts
$report = Join-Path $outDir 'renovate-report.json'
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
Push-Location (Join-Path $PSScriptRoot '..') # repository root
# Debug log file: console output in the same format, but at debug level
# Relative path on purpose: Renovate lowercases LOG_FILE, an absolute path would break on case-sensitive file systems
$env:LOG_FILE = "reports/$ts/renovate.log"
$env:LOG_FILE_LEVEL = 'debug'
$env:LOG_FILE_FORMAT = 'pretty'
npx --yes renovate@44.149.3 --platform=local --dry-run=lookup --report-type=file --report-path=$report
Remove-Item Env:LOG_FILE, Env:LOG_FILE_LEVEL, Env:LOG_FILE_FORMAT
Pop-Location
Write-Host "`nAvailable updates:" -ForegroundColor Cyan
$packageFiles = (Get-Content $report -Raw -Encoding UTF8 | ConvertFrom-Json).repositories.local.packageFiles
foreach ($manager in $packageFiles.PSObject.Properties) {
foreach ($file in $manager.Value) {
foreach ($dep in $file.deps) {
foreach ($update in $dep.updates) {
Write-Host " [$($manager.Name)] $($file.packageFile): $($dep.depName) $($dep.currentValue) -> $($update.newValue) ($($update.updateType))"
}
}
}
}
Write-Host "Report and debug log: $outDir"