Skip to content
Snippets Groups Projects
Unverified Commit 79151e10 authored by Alessio Caiazza's avatar Alessio Caiazza
Browse files

feat: allow custom post-renovate-upgrade.sh

Projects can define a ./scripts/post-renovate-upgrade.sh script and it will be invoked by renovate on .tool-versions upgrades with depName and packageFile as parameters.
parent 6fa8a8a8
No related branches found
No related tags found
No related merge requests found
Pipeline #23714969 passed
Loading
Loading
@@ -169,6 +169,17 @@ variables:
 
Renovate supports multiple datasources: <https://docs.renovatebot.com/modules/datasource/>, giving flexibility in how new versions are looked up.
 
### Post Upgrade Tasks for `.tool-versions`
If a project has an executable `./scripts/renovate-migrations/tool-version-upgrade.sh`, it will be executed automatically with the following environment variables:
- `RENOVATE_POSTUPG_DEP_NAME`: The name of the dependency being updated
- `RENOVATE_POSTUPG_PACKAGE_FILE`: The filename that the dependency was found in
- `RENOVATE_POSTUPG_DEP_TYPE`: The dependency type (if extracted - manager-dependent)
This is necessary becaus Renovate will only run a single `postUpgradeTasks` for each dependency, if you override it for a package
that is managed by `.tool-versions` it will break the existing script resulting in a merge requist with a failed pipeline.
### Pinning dependency versions
 
If you need Renovate to pin to a specific version of a dependency, add a `constraints` object into `renovate.json`. Simply removing the manual annotation may not work as Renovate will [automatically detect and update some `asdf` dependencies](https://docs.renovatebot.com/modules/manager/asdf/).
Loading
Loading
Loading
Loading
@@ -28,6 +28,14 @@ main() {
./scripts/update-asdf-version-variables.sh
fi
 
if [[ -x ./scripts/renovate-migrations/tool-version-upgrade.sh ]]; then
echo "Running ./scripts/renovate-migrations/tool-version-upgrade.sh..."
env RENOVATE_POSTUPG_DEP_NAME="$dep_name" \
RENOVATE_POSTUPG_PACKAGE_FILE="$package_file" \
./scripts/renovate-migrations/tool-version-upgrade.sh
fi
# When shfmt is updated, rerun the command to apply any new rules
if { [[ $dep_name == 'mvdan/sh' ]] || [[ $dep_name == 'shfmt' ]]; } && [[ $package_file == '.tool-versions' ]]; then
echo "Running ${script_dir}/renovate-upgrade-scripts/shfmt.sh..."
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment