renovate-preview 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- renovate_preview-0.1.0/.gitignore +13 -0
- renovate_preview-0.1.0/LICENSE +21 -0
- renovate_preview-0.1.0/Makefile +80 -0
- renovate_preview-0.1.0/PKG-INFO +241 -0
- renovate_preview-0.1.0/README.md +222 -0
- renovate_preview-0.1.0/docs/good-to-know.org +75 -0
- renovate_preview-0.1.0/examples/README.md +41 -0
- renovate_preview-0.1.0/examples/argocd/README.md +11 -0
- renovate_preview-0.1.0/examples/argocd/application.yaml +14 -0
- renovate_preview-0.1.0/examples/argocd/expected.json +5 -0
- renovate_preview-0.1.0/examples/argocd/renovate.json +6 -0
- renovate_preview-0.1.0/examples/custom-manager-jsonata/README.md +10 -0
- renovate_preview-0.1.0/examples/custom-manager-jsonata/expected.json +5 -0
- renovate_preview-0.1.0/examples/custom-manager-jsonata/grafana.yaml +9 -0
- renovate_preview-0.1.0/examples/custom-manager-jsonata/renovate.json +13 -0
- renovate_preview-0.1.0/examples/custom-manager-regex/README.md +15 -0
- renovate_preview-0.1.0/examples/custom-manager-regex/depname-captured.yaml +5 -0
- renovate_preview-0.1.0/examples/custom-manager-regex/depname-template.yaml +5 -0
- renovate_preview-0.1.0/examples/custom-manager-regex/expected.json +6 -0
- renovate_preview-0.1.0/examples/custom-manager-regex/renovate.json +22 -0
- renovate_preview-0.1.0/examples/kubernetes/README.md +11 -0
- renovate_preview-0.1.0/examples/kubernetes/daemonset.yaml +17 -0
- renovate_preview-0.1.0/examples/kubernetes/expected.json +6 -0
- renovate_preview-0.1.0/examples/kubernetes/renovate.json +6 -0
- renovate_preview-0.1.0/examples/kustomize/README.md +14 -0
- renovate_preview-0.1.0/examples/kustomize/expected.json +5 -0
- renovate_preview-0.1.0/examples/kustomize/kustomization.yaml +9 -0
- renovate_preview-0.1.0/examples/kustomize/renovate.json +3 -0
- renovate_preview-0.1.0/examples/preset-extends/README.md +30 -0
- renovate_preview-0.1.0/examples/preset-extends/expected.json +5 -0
- renovate_preview-0.1.0/examples/preset-extends/kustomization.yaml +8 -0
- renovate_preview-0.1.0/examples/preset-extends/renovate.json +6 -0
- renovate_preview-0.1.0/examples/preset-extends/tests/kustomization.yaml +10 -0
- renovate_preview-0.1.0/examples/separate-multiple-minor/README.md +21 -0
- renovate_preview-0.1.0/examples/separate-multiple-minor/expected.json +5 -0
- renovate_preview-0.1.0/examples/separate-multiple-minor/kustomization.yaml +8 -0
- renovate_preview-0.1.0/examples/separate-multiple-minor/renovate.json +13 -0
- renovate_preview-0.1.0/pyproject.toml +67 -0
- renovate_preview-0.1.0/src/renovate_preview/__init__.py +3 -0
- renovate_preview-0.1.0/src/renovate_preview/__main__.py +8 -0
- renovate_preview-0.1.0/src/renovate_preview/cli.py +515 -0
- renovate_preview-0.1.0/src/renovate_preview/container.py +146 -0
- renovate_preview-0.1.0/src/renovate_preview/index.html +54 -0
- renovate_preview-0.1.0/src/renovate_preview/render.py +160 -0
- renovate_preview-0.1.0/src/renovate_preview/renovate.py +138 -0
- renovate_preview-0.1.0/src/renovate_preview/report.py +167 -0
- renovate_preview-0.1.0/tests/__init__.py +0 -0
- renovate_preview-0.1.0/tests/conftest.py +82 -0
- renovate_preview-0.1.0/tests/data/invalid-config.ndjson +6 -0
- renovate_preview-0.1.0/tests/data/lookup.ndjson +5 -0
- renovate_preview-0.1.0/tests/data/release-age.ndjson +3 -0
- renovate_preview-0.1.0/tests/test_cli.py +438 -0
- renovate_preview-0.1.0/tests/test_container.py +113 -0
- renovate_preview-0.1.0/tests/test_examples.py +46 -0
- renovate_preview-0.1.0/tests/test_render.py +76 -0
- renovate_preview-0.1.0/tests/test_renovate.py +122 -0
- renovate_preview-0.1.0/tests/test_report.py +143 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Quentin Ågren
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# renovate-preview
|
|
2
|
+
#
|
|
3
|
+
# make help show this helpful list
|
|
4
|
+
# make install put renovate-preview on your PATH, running from this checkout
|
|
5
|
+
# make uninstall take it off again
|
|
6
|
+
# make check unit tests (never run Renovate); also: make test
|
|
7
|
+
# make examples check examples/ against a real Renovate, in podman or docker
|
|
8
|
+
# make lint ruff
|
|
9
|
+
# make build wheel and sdist, in dist/
|
|
10
|
+
# make distcheck build, check the metadata, and run the wheel as installed
|
|
11
|
+
# make publish upload dist/ to PyPI (needs UV_PUBLISH_TOKEN)
|
|
12
|
+
# make clean
|
|
13
|
+
#
|
|
14
|
+
# Variables follow the GNU conventions, and can be set on the command line:
|
|
15
|
+
# make install prefix=/usr/local (default: ~/.local, so no root needed)
|
|
16
|
+
# make install DESTDIR=/tmp/stage (a staged install, e.g. for a package)
|
|
17
|
+
# make publish PUBLISH_URL=https://test.pypi.org/legacy/ (TestPyPI first)
|
|
18
|
+
# https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
|
|
19
|
+
# One exception: no `all`. There is nothing to build: `install` runs this checkout.
|
|
20
|
+
|
|
21
|
+
SHELL = /bin/sh
|
|
22
|
+
.SUFFIXES:
|
|
23
|
+
|
|
24
|
+
prefix = $(HOME)/.local
|
|
25
|
+
exec_prefix = $(prefix)
|
|
26
|
+
bindir = $(exec_prefix)/bin
|
|
27
|
+
|
|
28
|
+
INSTALL = install
|
|
29
|
+
PYTHON = python3
|
|
30
|
+
PUBLISH_URL = https://upload.pypi.org/legacy/
|
|
31
|
+
|
|
32
|
+
SRC := $(abspath src)
|
|
33
|
+
LAUNCHER = $(DESTDIR)$(bindir)/renovate-preview
|
|
34
|
+
|
|
35
|
+
export PYTHONPATH := $(SRC)
|
|
36
|
+
|
|
37
|
+
.DEFAULT_GOAL := help
|
|
38
|
+
|
|
39
|
+
.PHONY: help install uninstall check test examples lint build distcheck publish clean
|
|
40
|
+
|
|
41
|
+
help:
|
|
42
|
+
@sed -n 's/^# make/make/p' $(firstword $(MAKEFILE_LIST))
|
|
43
|
+
|
|
44
|
+
# A launcher rather than a copy of the code, so edits to the checkout take effect at once.
|
|
45
|
+
# `rm -f` first: writing through a symlink left by an older install would clobber its target.
|
|
46
|
+
install:
|
|
47
|
+
$(INSTALL) -d $(DESTDIR)$(bindir)
|
|
48
|
+
rm -f $(LAUNCHER)
|
|
49
|
+
printf '#!/bin/sh\nPYTHONPATH="$(SRC)" exec $(PYTHON) -m renovate_preview "$$@"\n' > $(LAUNCHER)
|
|
50
|
+
chmod 755 $(LAUNCHER)
|
|
51
|
+
|
|
52
|
+
uninstall:
|
|
53
|
+
rm -f $(LAUNCHER)
|
|
54
|
+
|
|
55
|
+
check:
|
|
56
|
+
$(PYTHON) -m pytest -q
|
|
57
|
+
|
|
58
|
+
test: check
|
|
59
|
+
|
|
60
|
+
examples:
|
|
61
|
+
RENOVATE_PREVIEW_E2E=1 $(PYTHON) -m pytest tests/test_examples.py -v
|
|
62
|
+
|
|
63
|
+
lint:
|
|
64
|
+
ruff check src tests && ruff format --check src tests
|
|
65
|
+
|
|
66
|
+
# dist/ is emptied first, so that `make publish` uploads this version only.
|
|
67
|
+
build:
|
|
68
|
+
rm -rf dist
|
|
69
|
+
uv build
|
|
70
|
+
|
|
71
|
+
distcheck: build
|
|
72
|
+
uvx twine check --strict dist/*
|
|
73
|
+
uv run --isolated --no-project --with dist/*.whl renovate-preview --version
|
|
74
|
+
|
|
75
|
+
publish: distcheck
|
|
76
|
+
uv publish --publish-url $(PUBLISH_URL) dist/*
|
|
77
|
+
|
|
78
|
+
clean:
|
|
79
|
+
rm -rf dist build
|
|
80
|
+
find src tests -name __pycache__ -type d -exec rm -rf {} +
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: renovate-preview
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Perform a Renovate dry run and preview the results.
|
|
5
|
+
Project-URL: Homepage, https://github.com/kwentine/renovate-preview
|
|
6
|
+
Project-URL: Source, https://github.com/kwentine/renovate-preview
|
|
7
|
+
Author-email: Quentin Ågren <quentin.agren@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: dependencies,devops,dry-run,renovate
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
16
|
+
Classifier: Topic :: Utilities
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# renovate-preview
|
|
21
|
+
|
|
22
|
+
Perform a [Renovate](https://docs.renovatebot.com/) dry run and preview the results.
|
|
23
|
+
|
|
24
|
+
Renovate executes in a container from the
|
|
25
|
+
[`ghcr.io/renovatebot/renovate`](https://docs.renovatebot.com/getting-started/running/#docker-images)
|
|
26
|
+
image, using whichever of [podman](https://podman.io/) or [docker](https://www.docker.com/)
|
|
27
|
+
is installed.
|
|
28
|
+
|
|
29
|
+
The intended benefits are:
|
|
30
|
+
1. Avoiding the need to install it on your machine with `npm`
|
|
31
|
+
2. Sparing you the complex commands to invoke Renovate through `podman` or `docker`
|
|
32
|
+
3. Extracting and summarizing useful information from the profuse Renovate logs
|
|
33
|
+
4. Assessing the behavior of local configuration changes on a remote repository (such as pull request titles).
|
|
34
|
+
|
|
35
|
+
`renovate-preview` is implemented in Python and has no dependencies.
|
|
36
|
+
It is developed with considerable help from [Claude Code](https://claude.com/claude-code), but by no means vibe-coded 🙂.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Use cases
|
|
40
|
+
|
|
41
|
+
### Preview dependencies and available updates from a local repository
|
|
42
|
+
|
|
43
|
+
```console
|
|
44
|
+
$ cd path/to/repo
|
|
45
|
+
$ $EDITOR renovate.json
|
|
46
|
+
$ podman pull ghcr.io/renovatebot/renovate
|
|
47
|
+
$ renovate-preview
|
|
48
|
+
DEPENDENCY CURRENT NEW FILE
|
|
49
|
+
------------- ------- ------- ------------------
|
|
50
|
+
trust-manager v0.22.0 v0.26.0 kustomization.yaml
|
|
51
|
+
trust-manager v0.22.0 v0.22.1 kustomization.yaml
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Test the behavior of a local configuration on a remote repository
|
|
56
|
+
Let's say you have edited a local checkout of `renovate.json`,
|
|
57
|
+
and would like to verify that pull request titles are formatted according to your wishes:
|
|
58
|
+
```
|
|
59
|
+
$ renovate-preview @owner/repo --columns=dependency,current,new,pr-title
|
|
60
|
+
DEPENDENCY CURRENT NEW PR TITLE
|
|
61
|
+
------------- ------- --- --------
|
|
62
|
+
example-chart 1.2.3 1.2.4 chore(deps): Update example-chart to v1.2.4
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Try it
|
|
66
|
+
|
|
67
|
+
No installation needed, only Python 3.9 or later:
|
|
68
|
+
|
|
69
|
+
```console
|
|
70
|
+
$ git clone https://github.com/kwentine/renovate-preview.git
|
|
71
|
+
$ cd renovate-preview/src
|
|
72
|
+
$ python3 -m renovate_preview ~/path/to/my/repo
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Install
|
|
76
|
+
|
|
77
|
+
From PyPI:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
uv tool install renovate-preview # or: pipx install renovate-preview
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
[uv](https://docs.astral.sh/uv/) and [pipx](https://pipx.pypa.io/) install a command
|
|
84
|
+
line tool in an environment of its own.
|
|
85
|
+
|
|
86
|
+
From a local checkout:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
uv tool install . # or,
|
|
90
|
+
make install # a launcher in ~/.local/bin, running this checkout: edits apply at once
|
|
91
|
+
make install prefix=/usr/local # ... elsewhere: in /usr/local/bin
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
renovate-preview # the repository in the current directory
|
|
98
|
+
renovate-preview path/to/repo # another one
|
|
99
|
+
renovate-preview @owner/repo # a GitHub repository (needs RENOVATE_TOKEN)
|
|
100
|
+
renovate-preview @owner/repo --host ghe.example.com # ... on a GitHub Enterprise Server
|
|
101
|
+
renovate-preview @owner/repo --config renovate.json # ... with your config instead of its own
|
|
102
|
+
renovate-preview --pat-url # a link to create that token: read-only, pre-filled
|
|
103
|
+
|
|
104
|
+
renovate-preview --extract # only the dependencies found: fast, offline
|
|
105
|
+
|
|
106
|
+
# Arguments after -- go to Renovate, for example:
|
|
107
|
+
renovate-preview -- --include-paths='base/**' # limit to some paths
|
|
108
|
+
renovate-preview -- --ignore-paths='overlays/**' # skip some (replaces ignorePaths)
|
|
109
|
+
renovate-preview -- --enabled-managers=kubernetes # limit to some managers
|
|
110
|
+
|
|
111
|
+
renovate-preview --columns dependency,new,type,breaking,age # the columns to show
|
|
112
|
+
renovate-preview --columns all # every column; --columns help lists them
|
|
113
|
+
renovate-preview -o json # table (default), json, html
|
|
114
|
+
renovate-preview -o html -w report.html # ... written to a file rather than stdout
|
|
115
|
+
renovate-preview -o raw # Renovate's own log; or its report: -o report
|
|
116
|
+
renovate-preview --from last --columns all # the last run again, other columns: no re-run
|
|
117
|
+
renovate-preview --from run.ndjson # any Renovate JSON log (- for stdin)
|
|
118
|
+
renovate-preview --show-config # also the config Renovate resolved, presets included
|
|
119
|
+
renovate-preview --verbose # what Renovate is doing, as it runs
|
|
120
|
+
renovate-preview --silent # no progress hints or warnings
|
|
121
|
+
|
|
122
|
+
renovate-preview --global-config config.js # a self-hosted (global) config
|
|
123
|
+
renovate-preview --tag 44.115.2 # a given Renovate version
|
|
124
|
+
renovate-preview --just-print # the container command, without running it
|
|
125
|
+
renovate-preview --shell # a shell in that container, instead of Renovate
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Arguments after `--` take precedence over everything else. They are Renovate's own:
|
|
129
|
+
[configuration options](https://docs.renovatebot.com/configuration-options/) such as
|
|
130
|
+
`includePaths`, as command-line flags.
|
|
131
|
+
|
|
132
|
+
Renovate's working directory and caches are kept in the `renovate-preview` volume. To
|
|
133
|
+
clear them: `podman volume rm renovate-preview`.
|
|
134
|
+
|
|
135
|
+
## Environment
|
|
136
|
+
|
|
137
|
+
Renovate gets these variables of yours, by name, so their values never show in the
|
|
138
|
+
command:
|
|
139
|
+
|
|
140
|
+
| Variable | What for |
|
|
141
|
+
|-------------------------------------------------|--------------------------------------------------------------------|
|
|
142
|
+
| `RENOVATE_TOKEN` | GitHub token. Required for `@owner/repo`. |
|
|
143
|
+
| `RENOVATE_GITHUB_COM_TOKEN`, `GITHUB_COM_TOKEN` | Authenticates version lookups on github.com, avoiding rate limits. |
|
|
144
|
+
|
|
145
|
+
`renovate-preview --pat-url` links to GitHub's form for a
|
|
146
|
+
[personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens),
|
|
147
|
+
pre-filled with the read-only permissions a dry run needs.
|
|
148
|
+
|
|
149
|
+
No other variable reaches Renovate unless you name it with `--env NAME`, for example a
|
|
150
|
+
private registry's credentials, as Renovate
|
|
151
|
+
[reads them from the environment](https://docs.renovatebot.com/self-hosted-configuration/#detecthostrulesfromenv):
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
renovate-preview --env DOCKER_REGISTRY_EXAMPLE_COM_USERNAME --env DOCKER_REGISTRY_EXAMPLE_COM_PASSWORD
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Renovate's settings are its arguments, after `--`. For example, `@owner/repo` on GitLab,
|
|
158
|
+
another of Renovate's [platforms](https://docs.renovatebot.com/modules/platform/):
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
renovate-preview @owner/repo -- --platform=gitlab --endpoint=https://gitlab.example.com/api/v4/
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Defaults for renovate-preview's own options can come from its environment.
|
|
165
|
+
|
|
166
|
+
| Variable | Default for |
|
|
167
|
+
|----------------------------------|-------------------|
|
|
168
|
+
| `RENOVATE_PREVIEW_GLOBAL_CONFIG` | `--global-config` |
|
|
169
|
+
| `RENOVATE_PREVIEW_CONFIG` | `--config` |
|
|
170
|
+
| `RENOVATE_PREVIEW_COLUMNS` | `--columns` |
|
|
171
|
+
| `RENOVATE_PREVIEW_HOST` | `--host` |
|
|
172
|
+
|
|
173
|
+
For example, in your shell's profile, so that every preview uses your organisation's
|
|
174
|
+
self-hosted config, and your favourite columns:
|
|
175
|
+
|
|
176
|
+
```sh
|
|
177
|
+
export RENOVATE_PREVIEW_GLOBAL_CONFIG=~/renovate/config.json
|
|
178
|
+
export RENOVATE_PREVIEW_COLUMNS=dependency,current,new,type,age,file
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Configuration
|
|
182
|
+
|
|
183
|
+
### Global
|
|
184
|
+
|
|
185
|
+
`--global-config FILE` gives Renovate a
|
|
186
|
+
[self-hosted (global) config](https://docs.renovatebot.com/self-hosted-configuration/).
|
|
187
|
+
|
|
188
|
+
### Repository
|
|
189
|
+
|
|
190
|
+
For a local repository, the preview uses its `renovate.json`. To test a change, edit it
|
|
191
|
+
and run `renovate-preview` again.
|
|
192
|
+
|
|
193
|
+
For a remote repository, `--config FILE` uses a local config file instead of the
|
|
194
|
+
repository's own. For example, to review a pull request that changes `renovate.json`,
|
|
195
|
+
check out its branch and run `renovate-preview @owner/repo --config renovate.json`. Unlike a
|
|
196
|
+
local preview, this shows PR titles.
|
|
197
|
+
|
|
198
|
+
On a local repository, `--config` is read too, but the repository's own `renovate.json`
|
|
199
|
+
takes precedence.
|
|
200
|
+
|
|
201
|
+
## Good to know
|
|
202
|
+
|
|
203
|
+
For trivia about what can surprise you and why, see: [docs/good-to-know.org](https://github.com/kwentine/renovate-preview/blob/main/docs/good-to-know.org).
|
|
204
|
+
|
|
205
|
+
## With renovate-pretty-log
|
|
206
|
+
|
|
207
|
+
[renovate-pretty-log](https://gitlab.com/tanna.dev/renovate-pretty-log) is for exploring a
|
|
208
|
+
Renovate debug log: a colourised printer, an HTML report, and a TUI with folding and
|
|
209
|
+
search.
|
|
210
|
+
|
|
211
|
+
renovate-preview comes before the log. It runs Renovate for you, with the settings a
|
|
212
|
+
preview needs, and answers one question: which dependencies were found, and which updates
|
|
213
|
+
are available. When that answer is surprising, the log explains why:
|
|
214
|
+
|
|
215
|
+
```sh
|
|
216
|
+
renovate-preview -o raw -w run.log # the same run, as Renovate's own log
|
|
217
|
+
renovate-pretty-log-tui -path run.log # ... explored
|
|
218
|
+
renovate-pretty-log -path run.log -level warn # ... or just its problems
|
|
219
|
+
renovate-preview -o raw | renovate-pretty-log -path /dev/stdin
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Examples
|
|
223
|
+
|
|
224
|
+
[examples/](https://github.com/kwentine/renovate-preview/tree/main/examples) holds one
|
|
225
|
+
small, runnable example per common Renovate configuration:
|
|
226
|
+
|
|
227
|
+
```sh
|
|
228
|
+
renovate-preview examples/custom-manager-regex
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Development
|
|
232
|
+
|
|
233
|
+
The tests need [pytest](https://docs.pytest.org/), and the linter is
|
|
234
|
+
[ruff](https://docs.astral.sh/ruff/): `uv run make test` installs both in `.venv`.
|
|
235
|
+
|
|
236
|
+
```sh
|
|
237
|
+
make test # unit tests (or: make check)
|
|
238
|
+
make examples # check examples/ against a real Renovate, in podman or docker
|
|
239
|
+
make lint
|
|
240
|
+
make distcheck # build the wheel and sdist, check them, run the wheel as installed
|
|
241
|
+
```
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# renovate-preview
|
|
2
|
+
|
|
3
|
+
Perform a [Renovate](https://docs.renovatebot.com/) dry run and preview the results.
|
|
4
|
+
|
|
5
|
+
Renovate executes in a container from the
|
|
6
|
+
[`ghcr.io/renovatebot/renovate`](https://docs.renovatebot.com/getting-started/running/#docker-images)
|
|
7
|
+
image, using whichever of [podman](https://podman.io/) or [docker](https://www.docker.com/)
|
|
8
|
+
is installed.
|
|
9
|
+
|
|
10
|
+
The intended benefits are:
|
|
11
|
+
1. Avoiding the need to install it on your machine with `npm`
|
|
12
|
+
2. Sparing you the complex commands to invoke Renovate through `podman` or `docker`
|
|
13
|
+
3. Extracting and summarizing useful information from the profuse Renovate logs
|
|
14
|
+
4. Assessing the behavior of local configuration changes on a remote repository (such as pull request titles).
|
|
15
|
+
|
|
16
|
+
`renovate-preview` is implemented in Python and has no dependencies.
|
|
17
|
+
It is developed with considerable help from [Claude Code](https://claude.com/claude-code), but by no means vibe-coded 🙂.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Use cases
|
|
21
|
+
|
|
22
|
+
### Preview dependencies and available updates from a local repository
|
|
23
|
+
|
|
24
|
+
```console
|
|
25
|
+
$ cd path/to/repo
|
|
26
|
+
$ $EDITOR renovate.json
|
|
27
|
+
$ podman pull ghcr.io/renovatebot/renovate
|
|
28
|
+
$ renovate-preview
|
|
29
|
+
DEPENDENCY CURRENT NEW FILE
|
|
30
|
+
------------- ------- ------- ------------------
|
|
31
|
+
trust-manager v0.22.0 v0.26.0 kustomization.yaml
|
|
32
|
+
trust-manager v0.22.0 v0.22.1 kustomization.yaml
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Test the behavior of a local configuration on a remote repository
|
|
37
|
+
Let's say you have edited a local checkout of `renovate.json`,
|
|
38
|
+
and would like to verify that pull request titles are formatted according to your wishes:
|
|
39
|
+
```
|
|
40
|
+
$ renovate-preview @owner/repo --columns=dependency,current,new,pr-title
|
|
41
|
+
DEPENDENCY CURRENT NEW PR TITLE
|
|
42
|
+
------------- ------- --- --------
|
|
43
|
+
example-chart 1.2.3 1.2.4 chore(deps): Update example-chart to v1.2.4
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Try it
|
|
47
|
+
|
|
48
|
+
No installation needed, only Python 3.9 or later:
|
|
49
|
+
|
|
50
|
+
```console
|
|
51
|
+
$ git clone https://github.com/kwentine/renovate-preview.git
|
|
52
|
+
$ cd renovate-preview/src
|
|
53
|
+
$ python3 -m renovate_preview ~/path/to/my/repo
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
From PyPI:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
uv tool install renovate-preview # or: pipx install renovate-preview
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
[uv](https://docs.astral.sh/uv/) and [pipx](https://pipx.pypa.io/) install a command
|
|
65
|
+
line tool in an environment of its own.
|
|
66
|
+
|
|
67
|
+
From a local checkout:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
uv tool install . # or,
|
|
71
|
+
make install # a launcher in ~/.local/bin, running this checkout: edits apply at once
|
|
72
|
+
make install prefix=/usr/local # ... elsewhere: in /usr/local/bin
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Usage
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
renovate-preview # the repository in the current directory
|
|
79
|
+
renovate-preview path/to/repo # another one
|
|
80
|
+
renovate-preview @owner/repo # a GitHub repository (needs RENOVATE_TOKEN)
|
|
81
|
+
renovate-preview @owner/repo --host ghe.example.com # ... on a GitHub Enterprise Server
|
|
82
|
+
renovate-preview @owner/repo --config renovate.json # ... with your config instead of its own
|
|
83
|
+
renovate-preview --pat-url # a link to create that token: read-only, pre-filled
|
|
84
|
+
|
|
85
|
+
renovate-preview --extract # only the dependencies found: fast, offline
|
|
86
|
+
|
|
87
|
+
# Arguments after -- go to Renovate, for example:
|
|
88
|
+
renovate-preview -- --include-paths='base/**' # limit to some paths
|
|
89
|
+
renovate-preview -- --ignore-paths='overlays/**' # skip some (replaces ignorePaths)
|
|
90
|
+
renovate-preview -- --enabled-managers=kubernetes # limit to some managers
|
|
91
|
+
|
|
92
|
+
renovate-preview --columns dependency,new,type,breaking,age # the columns to show
|
|
93
|
+
renovate-preview --columns all # every column; --columns help lists them
|
|
94
|
+
renovate-preview -o json # table (default), json, html
|
|
95
|
+
renovate-preview -o html -w report.html # ... written to a file rather than stdout
|
|
96
|
+
renovate-preview -o raw # Renovate's own log; or its report: -o report
|
|
97
|
+
renovate-preview --from last --columns all # the last run again, other columns: no re-run
|
|
98
|
+
renovate-preview --from run.ndjson # any Renovate JSON log (- for stdin)
|
|
99
|
+
renovate-preview --show-config # also the config Renovate resolved, presets included
|
|
100
|
+
renovate-preview --verbose # what Renovate is doing, as it runs
|
|
101
|
+
renovate-preview --silent # no progress hints or warnings
|
|
102
|
+
|
|
103
|
+
renovate-preview --global-config config.js # a self-hosted (global) config
|
|
104
|
+
renovate-preview --tag 44.115.2 # a given Renovate version
|
|
105
|
+
renovate-preview --just-print # the container command, without running it
|
|
106
|
+
renovate-preview --shell # a shell in that container, instead of Renovate
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Arguments after `--` take precedence over everything else. They are Renovate's own:
|
|
110
|
+
[configuration options](https://docs.renovatebot.com/configuration-options/) such as
|
|
111
|
+
`includePaths`, as command-line flags.
|
|
112
|
+
|
|
113
|
+
Renovate's working directory and caches are kept in the `renovate-preview` volume. To
|
|
114
|
+
clear them: `podman volume rm renovate-preview`.
|
|
115
|
+
|
|
116
|
+
## Environment
|
|
117
|
+
|
|
118
|
+
Renovate gets these variables of yours, by name, so their values never show in the
|
|
119
|
+
command:
|
|
120
|
+
|
|
121
|
+
| Variable | What for |
|
|
122
|
+
|-------------------------------------------------|--------------------------------------------------------------------|
|
|
123
|
+
| `RENOVATE_TOKEN` | GitHub token. Required for `@owner/repo`. |
|
|
124
|
+
| `RENOVATE_GITHUB_COM_TOKEN`, `GITHUB_COM_TOKEN` | Authenticates version lookups on github.com, avoiding rate limits. |
|
|
125
|
+
|
|
126
|
+
`renovate-preview --pat-url` links to GitHub's form for a
|
|
127
|
+
[personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens),
|
|
128
|
+
pre-filled with the read-only permissions a dry run needs.
|
|
129
|
+
|
|
130
|
+
No other variable reaches Renovate unless you name it with `--env NAME`, for example a
|
|
131
|
+
private registry's credentials, as Renovate
|
|
132
|
+
[reads them from the environment](https://docs.renovatebot.com/self-hosted-configuration/#detecthostrulesfromenv):
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
renovate-preview --env DOCKER_REGISTRY_EXAMPLE_COM_USERNAME --env DOCKER_REGISTRY_EXAMPLE_COM_PASSWORD
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Renovate's settings are its arguments, after `--`. For example, `@owner/repo` on GitLab,
|
|
139
|
+
another of Renovate's [platforms](https://docs.renovatebot.com/modules/platform/):
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
renovate-preview @owner/repo -- --platform=gitlab --endpoint=https://gitlab.example.com/api/v4/
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Defaults for renovate-preview's own options can come from its environment.
|
|
146
|
+
|
|
147
|
+
| Variable | Default for |
|
|
148
|
+
|----------------------------------|-------------------|
|
|
149
|
+
| `RENOVATE_PREVIEW_GLOBAL_CONFIG` | `--global-config` |
|
|
150
|
+
| `RENOVATE_PREVIEW_CONFIG` | `--config` |
|
|
151
|
+
| `RENOVATE_PREVIEW_COLUMNS` | `--columns` |
|
|
152
|
+
| `RENOVATE_PREVIEW_HOST` | `--host` |
|
|
153
|
+
|
|
154
|
+
For example, in your shell's profile, so that every preview uses your organisation's
|
|
155
|
+
self-hosted config, and your favourite columns:
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
export RENOVATE_PREVIEW_GLOBAL_CONFIG=~/renovate/config.json
|
|
159
|
+
export RENOVATE_PREVIEW_COLUMNS=dependency,current,new,type,age,file
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
### Global
|
|
165
|
+
|
|
166
|
+
`--global-config FILE` gives Renovate a
|
|
167
|
+
[self-hosted (global) config](https://docs.renovatebot.com/self-hosted-configuration/).
|
|
168
|
+
|
|
169
|
+
### Repository
|
|
170
|
+
|
|
171
|
+
For a local repository, the preview uses its `renovate.json`. To test a change, edit it
|
|
172
|
+
and run `renovate-preview` again.
|
|
173
|
+
|
|
174
|
+
For a remote repository, `--config FILE` uses a local config file instead of the
|
|
175
|
+
repository's own. For example, to review a pull request that changes `renovate.json`,
|
|
176
|
+
check out its branch and run `renovate-preview @owner/repo --config renovate.json`. Unlike a
|
|
177
|
+
local preview, this shows PR titles.
|
|
178
|
+
|
|
179
|
+
On a local repository, `--config` is read too, but the repository's own `renovate.json`
|
|
180
|
+
takes precedence.
|
|
181
|
+
|
|
182
|
+
## Good to know
|
|
183
|
+
|
|
184
|
+
For trivia about what can surprise you and why, see: [docs/good-to-know.org](https://github.com/kwentine/renovate-preview/blob/main/docs/good-to-know.org).
|
|
185
|
+
|
|
186
|
+
## With renovate-pretty-log
|
|
187
|
+
|
|
188
|
+
[renovate-pretty-log](https://gitlab.com/tanna.dev/renovate-pretty-log) is for exploring a
|
|
189
|
+
Renovate debug log: a colourised printer, an HTML report, and a TUI with folding and
|
|
190
|
+
search.
|
|
191
|
+
|
|
192
|
+
renovate-preview comes before the log. It runs Renovate for you, with the settings a
|
|
193
|
+
preview needs, and answers one question: which dependencies were found, and which updates
|
|
194
|
+
are available. When that answer is surprising, the log explains why:
|
|
195
|
+
|
|
196
|
+
```sh
|
|
197
|
+
renovate-preview -o raw -w run.log # the same run, as Renovate's own log
|
|
198
|
+
renovate-pretty-log-tui -path run.log # ... explored
|
|
199
|
+
renovate-pretty-log -path run.log -level warn # ... or just its problems
|
|
200
|
+
renovate-preview -o raw | renovate-pretty-log -path /dev/stdin
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Examples
|
|
204
|
+
|
|
205
|
+
[examples/](https://github.com/kwentine/renovate-preview/tree/main/examples) holds one
|
|
206
|
+
small, runnable example per common Renovate configuration:
|
|
207
|
+
|
|
208
|
+
```sh
|
|
209
|
+
renovate-preview examples/custom-manager-regex
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
The tests need [pytest](https://docs.pytest.org/), and the linter is
|
|
215
|
+
[ruff](https://docs.astral.sh/ruff/): `uv run make test` installs both in `.venv`.
|
|
216
|
+
|
|
217
|
+
```sh
|
|
218
|
+
make test # unit tests (or: make check)
|
|
219
|
+
make examples # check examples/ against a real Renovate, in podman or docker
|
|
220
|
+
make lint
|
|
221
|
+
make distcheck # build the wheel and sdist, check them, run the wheel as installed
|
|
222
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#+TITLE: Good to know
|
|
2
|
+
#+OPTIONS: toc:nil num:nil
|
|
3
|
+
|
|
4
|
+
* What Renovate sees
|
|
5
|
+
|
|
6
|
+
** Only files known to git
|
|
7
|
+
Renovate lists files with =git ls-files=, so =git add= a new manifest before previewing it.
|
|
8
|
+
|
|
9
|
+
** Limiting the paths: =--include-paths= and =--ignore-paths=
|
|
10
|
+
Both go after =--=, and they match differently.
|
|
11
|
+
|
|
12
|
+
- =--include-paths= matches whole paths, or globs. A directory needs a glob: =base/**=. A
|
|
13
|
+
bare =base= only matches a /file/ named =base=, so nothing is scanned.
|
|
14
|
+
- =--ignore-paths= matches any path /containing/ what you give, or a glob: =base= also
|
|
15
|
+
ignores =database/=.
|
|
16
|
+
- =--ignore-paths= also /replaces/ Renovate's =ignorePaths=: its defaults
|
|
17
|
+
(=**/node_modules/**=...), your =renovate.json='s list, and its presets'. List what you
|
|
18
|
+
still want ignored, or use =--include-paths= instead. See
|
|
19
|
+
[[file:../examples/preset-extends/][examples/preset-extends]].
|
|
20
|
+
|
|
21
|
+
* What the preview shows
|
|
22
|
+
|
|
23
|
+
** No PR titles for a local repository
|
|
24
|
+
Renovate's local platform stops after version lookups. It silently turns
|
|
25
|
+
=--dry-run=full= into =lookup=, so renovate-preview refuses it. Branch names are known,
|
|
26
|
+
PR titles are not. Against =@owner/repo= the dry run is complete, titles included.
|
|
27
|
+
|
|
28
|
+
** Columns
|
|
29
|
+
| Column | Shows |
|
|
30
|
+
|--------------+-------------------------------------------------------------------------|
|
|
31
|
+
| =dependency= | the dependency's name |
|
|
32
|
+
| =current= | its current version |
|
|
33
|
+
| =new= | the update's version |
|
|
34
|
+
| =type= | major, minor, patch, digest... |
|
|
35
|
+
| =breaking= | as its versioning scheme says: under semver, any 0.x change is breaking |
|
|
36
|
+
| =age= | the new version's age (see below) |
|
|
37
|
+
| =pending= | what waits for its checks (see below) |
|
|
38
|
+
| =manager= | the Renovate manager that found it |
|
|
39
|
+
| =datasource= | where its versions are looked up |
|
|
40
|
+
| =versioning= | its versioning scheme |
|
|
41
|
+
| =file= | the file it's in |
|
|
42
|
+
| =branch= | the branch Renovate would create |
|
|
43
|
+
| =pr-title= | the pull request's title (=@owner/repo= only) |
|
|
44
|
+
|
|
45
|
+
By default: =dependency=, =current= and =file=; =new= too when versions are looked up (not
|
|
46
|
+
with =--extract=); and =pr-title= too for =@owner/repo=. Choose others with =--columns=;
|
|
47
|
+
=--columns help= lists them. =-o json= always has everything.
|
|
48
|
+
|
|
49
|
+
** AGE and PENDING: =minimumReleaseAge=
|
|
50
|
+
- *AGE* is the new version's age. It's empty when the registry gives no release date:
|
|
51
|
+
many container registries don't. Renovate then can't check =minimumReleaseAge=, and by
|
|
52
|
+
default holds the update back.
|
|
53
|
+
- *PENDING* is =yes= when the update itself waits for its checks. Otherwise, it names the
|
|
54
|
+
newest version held back, like the Pending column of Renovate's PRs.
|
|
55
|
+
|
|
56
|
+
=-o html= highlights both.
|
|
57
|
+
|
|
58
|
+
* The config
|
|
59
|
+
|
|
60
|
+
** Every run validates the repository's config
|
|
61
|
+
If it is invalid, Renovate stops, and the reason shows under "Renovate reported". To run
|
|
62
|
+
Renovate's validator yourself, from =renovate-preview --shell=:
|
|
63
|
+
|
|
64
|
+
#+begin_src sh
|
|
65
|
+
LOG_FORMAT= LOG_LEVEL=info renovate-config-validator --no-global renovate.json
|
|
66
|
+
#+end_src
|
|
67
|
+
|
|
68
|
+
=LOG_FORMAT== is there because the shell has renovate-preview's =LOG_FORMAT=json=.
|
|
69
|
+
|
|
70
|
+
* Runs and their logs
|
|
71
|
+
|
|
72
|
+
** =--from last= is the last run only
|
|
73
|
+
Each run keeps its log in =$XDG_STATE_HOME/renovate-preview/last.ndjson= (by default
|
|
74
|
+
=~/.local/state/...=). It is readable by you only, and replaces the previous one. To keep
|
|
75
|
+
a run: =-o raw -w FILE=, then =--from FILE=.
|