Custom version format for Mend Renovate

I use Mend Renovate to keep docker images of applications I run up-to-date.

Today I noticed that my umami analytics dashboard said it had an update available, but renovate hadn’t told me about it. On closer inspection it was because the docker tag format umami use is slightly unusual: they have a prefix with the database driver to use, followed by the version number (e.g. postgresql-v1.17.0 or mysql-v1.17.0).

Renovate didn’t understand how to parse this format, so I had to add a custom package rule in my renovate.json to tell it how to interpret them:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  // Rest of config here
  "packageRules": [
    {
      "matchDatasources": ["docker"],
      "matchPackageNames": ["ghcr.io/umami-software/umami"],
      "versioning": "regex:^postgresql-v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$"
    }
  ]
}

Here I’ve fixed it to postgres only, as otherwise renovate just picks between postgres and mysql at random, which isn’t going to work well!