dockerdockerfilerenovate

Prevent Renovate Bot from updating AlmaLinux 8 to 9 in multiple Dockerfiles


I have configured Renovate Bot in my self-hosted GitLab CE instance using a renovate.json file. My project contains two different Dockerfiles located at:

project root  
  /build-1/Dockerfile  
  /build-2/Dockerfile  

However, Renovate Bot is incorrectly attempting to update the AlmaLinux 8 image to version 9.

How can I configure Renovate Bot to ensure that /build-1/Dockerfile only receives updates within AlmaLinux 8, and /build-2/Dockerfile only updates within AlmaLinux 9?

My current renovate.json file:

{
  "packageRules": [
    {
      "packageNames": ["almalinux"],
      "matchUpdateTypes": ["minor", "patch", "pin", "digest"],
      "schedule": ["after 6pm"],
      "automerge": true
    }
  ]
}

Any guidance would be greatly appreciated.


Solution

  • You can implement a package rule dedicated to one file where you restrict the max version using matchFileNames and allowedVersions.

    Something like this:

    "packageRules": [
        {
          "packageNames": ["almalinux"],
          "matchFileNames": ["/build-1/Dockerfile"],
          "allowedVersions": "<9"
        }
      ]
    

    This can be combined with other rules that you already have, you don't need to merge everything in a single rule.