Search code examples
bitbucket-serverrenovate

Custom renovate presets on Butbucket-server


I just tried to create a custom preset for renovate as described here. My goal was to ban certain versions of dependencies. So I created a JSON file my.json like this:

{
    "packageRules": [
        {
            "matchPackageNames": ["commons-logging"],
            "allowedVersions": "!/.*-does-not-exist$/"
        }
    ]
}

As we are using bitbucket-server, I've put it into a repository called renovate-config in a project lets say XYZ. I changed the renovate.json file on the master branch of one service to:

{
    "$schema": "https://docs.renovatebot.com/renovate-schema.json",
    "extends": [
        "config:base",
        "local>XYZ/renovate-config//my"
    ]
}

Unfortunately renovate is not picking this up. The provider is configured correctly and renovate is fully working with our bitbucket-server instance, but it is either not picking up the preset, or anything else is going amiss.

Any help welcome.


Solution

  • Ok. Here is the solution: Actually my approach was correct. And the preset was retrieved and applied. I just made a mistake in formulating the rules:

    This works:

    {
        "packageRules": [
            {
                "matchPackageNames": [".*:commons-logging"],
                "allowedVersions": "!/.*-does-not-exist$/"
            }
        ]
    }
    

    Mind the .*: added at the beginning of the package name. For Maven artifacts this needs to include the groupId.

    I also found that when activating debug or trace logging it is pretty clear what happens.