Repository navigation
How to use two versioning schemes for the same dependency in the same file #22836
Replies: 9 comments 18 replies
|
Use a Regex manager for the second one |
|
I tried this instead, but still only getting one update for each dependency. {
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", "docker:enableMajor"],
"docker": {
"pinDigests": false
},
"regexManagers": [
{
"description": "Override versioning to manage image tags with OS versions",
"fileMatch": ["\\.gitlab-ci\\.yml$", "Dockerfile"],
"matchStrings": [
"(?:image:\\s+name:\\s*|image:\\s*|services:\\s+-\\s+|FROM\\s+)(?<depName>[\\S]+):(?<currentValue>[\\S]+)"
],
"versioningTemplate": "regex:^(?<compatibility>[\\S]*\\d+\\.\\d+\\.\\d+(?:[\\S]*)?-alpine)(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?$",
"datasourceTemplate": "docker"
}
],
"prHourlyLimit": 0,
"timezone": "America/Chicago"
}It seems to be finding all of the appropriate updates for each of the managers, but the behavior is a little different depending on the available updates. For Log for Python with version and Alpine updates |
|
It appears Renovate is stopping it. Looking at the debug log again, after listing all of the dependencies and updates, it says {
"name": "renovate",
"hostname": "runner-jhcjxvh-project-28849687-concurrent-0",
"pid": 15,
"level": 20,
"logContext": "vYoiyHyvFndUwd-IgX9V4",
"repository": "aarongoldenthal/renovate-track-image-os",
"msg": "6 flattened updates found: python, python, python, python, docker, docker",
"time": "2023-06-17T16:32:31.792Z",
"v": 0
}
{
"name": "renovate",
"hostname": "runner-jhcjxvh-project-28849687-concurrent-0",
"pid": 15,
"level": 20,
"logContext": "vYoiyHyvFndUwd-IgX9V4",
"repository": "aarongoldenthal/renovate-track-image-os",
"msg": "Returning 2 branch(es)",
"time": "2023-06-17T16:32:31.793Z",
"v": 0
}
{
"name": "renovate",
"hostname": "runner-jhcjxvh-project-28849687-concurrent-0",
"pid": 15,
"level": 30,
"logContext": "vYoiyHyvFndUwd-IgX9V4",
"repository": "aarongoldenthal/renovate-track-image-os",
"branch": "renovate/python-3.x",
"manager": "regex",
"packageFile": ".gitlab-ci.yml",
"depName": "python",
"currentValue": "3.11.3-alpine3.17",
"previousNewValue": "3.11.4-alpine3.17",
"thisNewValue": "3.11.3-alpine3.18",
"msg": "Ignoring upgrade collision",
"time": "2023-06-17T16:32:31.793Z",
"v": 0
}
{
"name": "renovate",
"hostname": "runner-jhcjxvh-project-28849687-concurrent-0",
"pid": 15,
"level": 30,
"logContext": "vYoiyHyvFndUwd-IgX9V4",
"repository": "aarongoldenthal/renovate-track-image-os",
"branch": "renovate/python-3.x",
"manager": "regex",
"packageFile": "Dockerfile",
"depName": "python",
"currentValue": "3.11.3-alpine3.17",
"previousNewValue": "3.11.4-alpine3.17",
"thisNewValue": "3.11.3-alpine3.18",
"msg": "Ignoring upgrade collision",
"time": "2023-06-17T16:32:31.794Z",
"v": 0
} |
|
Hi there, Get your issue fixed faster by creating a minimal reproduction. This means a repository dedicated to reproducing this issue with the minimal dependencies and config possible. Before we start working on your issue we need to know exactly what's causing the current behavior. A minimal reproduction helps us with this. To get started, please read our guide on creating a minimal reproduction. We may close the issue if you, or someone else, haven't created a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment. Good luck, The Renovate team |
|
I stripped it down to a minimal reproduction and pushed to GitHub here, and its's behaving the same. |
|
If I merge the Python update then the Alpine update is pushed. That's not a terrible solution, the OS updates are only twice a year. |
|
I tried, but it doesn't find any updates. For a Dockerfile with In the Alpine case, I had it capture the entire tag as the |
Yes, you can use custom capture group names to build any xTemplate field |
One more question... I expanded this example to include the digest and getting unexpected results. There's a reproduction at https://github.com/aarongoldenthal/renovate-track-debian-images based on
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
How are you running Renovate?
Self-hosted
If you're self-hosting Renovate, tell us what version of Renovate you run.
https://gitlab.com/renovate-bot/renovate-runner (latest)
If you're self-hosting Renovate, select which platform you are using.
gitlab.com
Was this something which used to work for you, and then stopped?
I never saw this working
Wanted end result.
I'm trying to find a way to have Renovate track OS versions in container image tags with an application and OS in the tag, e.g.
docker:23.0.6-alpine3.17. As is well detailed in the versioning documentation "Renovate treats the text after the first hyphen as a type of platform/compatibility indicator".For cases like this, renovate will not identify when a newer OS version is available for the given dependency version. It will also limit dependency version updates based on the compatibility, e.g. Renovate will not try to update to Docker v24 since it does not have an Alpine 3.17 image, only 3.18.
What you tried so far.
Using package rules, the versioning scheme can be reversed to treat the dependency version as
compatibilityand the OS as major/minor version, as in the following config:{ "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:base", "docker:enableMajor"], "docker": { "packageRules": [ { "description": "Override versioning to manage image tags with OS versions", "matchPackageNames": ["docker", "python"], "versioning": "regex:^(?<compatibility>\\d+\\.\\d+\\.\\d+-alpine)(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?$" } ], "pinDigests": false }, "prHourlyLimit": 0 }As can be seen in the example project here, this has the desired effect - Renovate creates a merge request with the
docker:23.0.6-alpine3.18image. The problem is it now no longer tracks the application dependency version.I have tried adding another package rule to add back the
dockerversioning, but as is expected the last rule sets the versioning and only that is used. So, I'm trying to see if there was a way I wasn't seeing to set multiple versioning schemes for the same dependency in the same file to cover this case.If not, the best alternative I've come up with is to run Renovate twice with the different configurations. I didn't see a way to set a config name outside of the default names, but the GitLab CI job for this case could certainly be written to just overwrite the config file beforehand (a benefit of self-hosted 😉).
Relevant debug logs
No response
All reactions