diff --git a/docs/howtos/renovatebot/post-upgrade-tasks.md b/docs/howtos/renovatebot/post-upgrade-tasks.md new file mode 100644 index 0000000000000000000000000000000000000000..f01b3f299e63256f4f7fddf51ba90064df04dc55 --- /dev/null +++ b/docs/howtos/renovatebot/post-upgrade-tasks.md @@ -0,0 +1,49 @@ +--- +title: Post-upgrade tasks +--- +# Running post-upgrade tasks + +[Post-upgrade tasks](https://docs.renovatebot.com/configuration-options/#postupgradetasks) that are +executed before a commit is made by Renovate. + +Post-upgrade tasks are commands that are executed by Renovate after a dependency has been updated +but before the commit is created. The intention is to run any other command line tools that would +modify existing files or generate new files when a dependency changes. + +Each command must match at least one of the patterns defined in allowedCommands (a global-only +configuration option) in order to be executed. +[Our configuration](https://gitlab.developers.cam.ac.uk/uis/devops/infra/gitlab-bots-deployment/-/blob/main/renovatebot-config.js?ref_type=heads#L97) +is set up such that it can call scripts in the `./.renovate/` directory in the root that start with `post-upgrade*`. + +Note: make sure that the script is executable. + +Examples usages: + +{% raw %} + +```json + "postUpgradeTasks": { + "commands": [ + "./.renovate/post-upgrade.py '{{{ toJSON upgrades }}}'" + ], + "executionMode": "branch", + "fileFilters": ["CHANGELOG.md"] + } +``` + +{% endraw %} + +Or: + +{% raw %} + +```json + "postUpgradeTasks": { + "commands": [ + ".renovate/post-upgrade.sh \"{{{depName}}}\" \"{{{currentVersion}}}\" \"{{{newVersion}}}\"" + ], + "fileFilters": ["CHANGELOG.md"] + } +``` + +{% endraw %} diff --git a/mkdocs.yml b/mkdocs.yml index 5000cb1f49839b99713429f0d1cfc6ce896189b5..407abed0edcc70d61b532521c8c07776d563474d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -206,6 +206,7 @@ nav: - howtos/renovatebot/trigger-renovatebot-from-gitlab-ui.md - howtos/renovatebot/trigger-renovatebot-from-cli.md - howtos/renovatebot/trigger-renovatebot-from-ci.md + - howtos/renovatebot/post-upgrade-tasks.md - "Tutorials": - tutorials/index.md - tutorials/automating-gitlab-releases.md diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..e35b998707425df6402ff6ba9fa9fcdd2ed870ba --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.poe.tasks.fix] +help = "Run pre-commit checks to fix formatting errors" +cmd = "pre-commit run --all-files"