Update Alpine version in images with alpine variant #29501
-
What would you like help with?I would like help with my configuration How are you running Renovate?Self-hosted If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.GitLab (latest) Please tell us more about your question or problemWe have a few dependencies to alpine-based images and we would like to receive updates for that part of the dependency as well. For example:
I have seen a prior discussion in #22836 about this and tried what was tested there. So right now I have tried the following: "regexManagers": [
{
"description": "Manage Alpine OS versions in container image tags",
"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"
}
], Based on the dependency dashboard, the dependency is detected and listed under the additional Based on the logs below, is the problem that the current version is still detected as the node version? Logs (if relevant)Logs
/cc @aarongoldenthal |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Issue #27012 mentions making Renovate smarter about tags like |
Beta Was this translation helpful? Give feedback.
-
The preset that I use is here, and it recently triggered Alpine 3.20 updates, so I dug in a little since it was working for me. I didn't have any Node examples specifically, so I included the one above, plus a python and go example that this had worked for. It looks like the Just to confirm, I ran with {
"deps": [
{
"depName": "golang",
"currentValue": "1.22.3-alpine3.19",
"datasource": "docker",
"versioning": "regex:^(?<compatibility>[\\S]*\\d+\\.\\d+(?:\\.\\d+)?(?:[\\S]*)?-alpine-?)(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?$",
"replaceString": "image: golang:1.22.3-alpine3.19",
"updates": [
{
"bucket": "non-major",
"newVersion": "1.22.3-alpine3.20",
"newValue": "1.22.3-alpine3.20",
"newMajor": 3,
"newMinor": 20,
"newPatch": 0,
"updateType": "minor",
"branchName": "renovate/golang-3.x"
}
],
"packageName": "golang",
"warnings": [],
"registryUrl": "https://index.docker.io",
"lookupName": "library/golang",
"currentVersion": "1.22.3-alpine3.19",
"isSingleVersion": true,
"fixedVersion": "1.22.3-alpine3.19"
},
{
"depName": "python",
"currentValue": "3.12.3-alpine3.19",
"datasource": "docker",
"versioning": "regex:^(?<compatibility>[\\S]*\\d+\\.\\d+(?:\\.\\d+)?(?:[\\S]*)?-alpine-?)(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?$",
"replaceString": "image: python:3.12.3-alpine3.19",
"updates": [
{
"bucket": "non-major",
"newVersion": "3.12.3-alpine3.20",
"newValue": "3.12.3-alpine3.20",
"newMajor": 3,
"newMinor": 20,
"newPatch": 0,
"updateType": "minor",
"branchName": "renovate/python-3.x"
}
],
"packageName": "python",
"warnings": [],
"registryUrl": "https://index.docker.io",
"lookupName": "library/python",
"currentVersion": "3.12.3-alpine3.19",
"isSingleVersion": true,
"fixedVersion": "3.12.3-alpine3.19"
},
{
"depName": "node",
"currentValue": "20.14.0-alpine3.19",
"datasource": "docker",
"versioning": "node",
"replaceString": "image: node:20.14.0-alpine3.19",
"updates": [],
"packageName": "node",
"warnings": [],
"sourceUrl": "https://github.com/nodejs/node",
"registryUrl": "https://index.docker.io",
"lookupName": "library/node",
"currentVersion": "20.14.0",
"fixedVersion": "20.14.0"
}
], Without it, everything is as expected: {
"deps": [
{
"depName": "node",
"currentValue": "20.14.0-alpine3.19",
"datasource": "docker",
"versioning": "regex:^(?<compatibility>[\\S]*\\d+\\.\\d+(?:\\.\\d+)?(?:[\\S]*)?-alpine-?)(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?$",
"replaceString": "FROM node:20.14.0-alpine3.19",
"updates": [
{
"bucket": "non-major",
"newVersion": "20.14.0-alpine3.20",
"newValue": "20.14.0-alpine3.20",
"newMajor": 3,
"newMinor": 20,
"newPatch": 0,
"updateType": "minor",
"branchName": "renovate/node-3.x"
}
],
"packageName": "node",
"warnings": [],
"sourceUrl": "https://github.com/nodejs/node",
"registryUrl": "https://index.docker.io",
"lookupName": "library/node",
"currentVersion": "20.14.0-alpine3.19",
"isSingleVersion": true,
"fixedVersion": "20.14.0-alpine3.19"
},
{
"depName": "golang",
"currentValue": "1.22.3-alpine3.19",
"datasource": "docker",
"versioning": "regex:^(?<compatibility>[\\S]*\\d+\\.\\d+(?:\\.\\d+)?(?:[\\S]*)?-alpine-?)(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?$",
"replaceString": "FROM golang:1.22.3-alpine3.19",
"updates": [
{
"bucket": "non-major",
"newVersion": "1.22.3-alpine3.20",
"newValue": "1.22.3-alpine3.20",
"newMajor": 3,
"newMinor": 20,
"newPatch": 0,
"updateType": "minor",
"branchName": "renovate/golang-3.x"
}
],
"packageName": "golang",
"warnings": [],
"registryUrl": "https://index.docker.io",
"lookupName": "library/golang",
"currentVersion": "1.22.3-alpine3.19",
"isSingleVersion": true,
"fixedVersion": "1.22.3-alpine3.19"
},
{
"depName": "python",
"currentValue": "3.12.3-alpine3.19",
"datasource": "docker",
"versioning": "regex:^(?<compatibility>[\\S]*\\d+\\.\\d+(?:\\.\\d+)?(?:[\\S]*)?-alpine-?)(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?$",
"replaceString": "FROM python:3.12.3-alpine3.19",
"updates": [
{
"bucket": "non-major",
"newVersion": "3.12.3-alpine3.20",
"newValue": "3.12.3-alpine3.20",
"newMajor": 3,
"newMinor": 20,
"newPatch": 0,
"updateType": "minor",
"branchName": "renovate/python-3.x"
}
],
"packageName": "python",
"warnings": [],
"registryUrl": "https://index.docker.io",
"lookupName": "library/python",
"currentVersion": "3.12.3-alpine3.19",
"isSingleVersion": true,
"fixedVersion": "3.12.3-alpine3.19"
}
],
"matchStrings": [
"FROM\\s+(?<depName>[\\S]+?):(?<currentValue>[^@\\s]+)(?:@(?<currentDigest>sha256:[a-f0-9]+))?"
],
"datasourceTemplate": "docker",
"versioningTemplate": "regex:^(?<compatibility>[\\S]*\\d+\\.\\d+(?:\\.\\d+)?(?:[\\S]*)?-alpine-?)(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?$",
"packageFile": "Dockerfile"
}, And in my reproduction you can see there are merge requests for all (except the I guess you can use something like |
Beta Was this translation helpful? Give feedback.
The challenge here is it's a set of rules trying to force Renovate to manage container image tags like
node:20.14.0-alpine3.19
as two dependencies - a Node version and an Alpine version. I definitely agree withnode
versioning as it is, and it should be applicable when managing the Node part of this, but not the Alpine part.So, this worked for me - ignore the original Node preset that's applicable to all, but add it back limiting the managers it's applicable to. Since
regex
isn't in the list, it isn't applied to theregexManager
above. Note this is very specific to an example withdockerfile
andgitlabci
managers, so that might have to be changed.