renovate
renovate copied to clipboard
Regex versioning relies on semver in a way which blocks 4-part versions
Describe the proposed change(s).
Example code: https://github.com/renovatebot/renovate/blob/fe56ee0d7c4160838a7f3b5ac6fe44d838b57a5f/lib/modules/versioning/regex/index.ts#L116-L130
This means that regex versioning like this isn't fully supported: "versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)\\.(?<build>\\d+)$"
🤔 it's working fine for bitnami docker image updates which have 5 parts.
Maybe getSatisfyingVersion() wasn't ever called except when my changes triggered it
maybe. do you have a reproduction?
oh, I see. here are some versions no longer detected
- https://github.com/visualon/docker-images/issues/214
- https://github.com/visualon/docker-images/blob/175ee674e5426fba2f7cdfb9de5d6e97cd1bcad5/linux/forgejo/Dockerfile#L1
so this is a critical bug
repro: https://github.com/renovate-reproductions/27510-multipart-regex-versioning
bitnami versioning works, but forgejo not 🤔
DEBUG: packageFiles with updates (repository=renovate-reproductions/27510-multipart-regex-versioning, baseBranch=main)
"config": {
"dockerfile": [
{
"deps": [
{
"depName": "codeberg.org/forgejo/forgejo",
"currentValue": "1.21.5-0-rootless",
"replaceString": "codeberg.org/forgejo/forgejo:1.21.5-0-rootless",
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
"datasource": "docker",
"depType": "stage",
"updates": [],
"packageName": "codeberg.org/forgejo/forgejo",
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)-(?<build>\\d+)(?:-(?<compatibility>.+))?$",
"warnings": [],
"registryUrl": "https://codeberg.org",
"currentVersion": "1.21.5",
"skipReason": "invalid-version"
},
{
"depName": "codeberg.org/forgejo/forgejo",
"currentValue": "1.21.5-0-rootless",
"currentDigest": "sha256:f23f56a0a1f53fa9f3ffbbb19aad3afef180fad7f8d4250174363ecab80d5166",
"replaceString": "codeberg.org/forgejo/forgejo:1.21.5-0-rootless@sha256:f23f56a0a1f53fa9f3ffbbb19aad3afef180fad7f8d4250174363ecab80d5166",
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
"datasource": "docker",
"depType": "stage",
"updates": [],
"packageName": "codeberg.org/forgejo/forgejo",
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)-(?<build>\\d+)(?:-(?<compatibility>.+))?$",
"warnings": [],
"registryUrl": "https://codeberg.org",
"currentVersion": "1.21.5",
"skipReason": "invalid-version"
},
{
"depName": "bitnami/nginx",
"currentValue": "1.24.0-debian-12-r15",
"replaceString": "bitnami/nginx:1.24.0-debian-12-r15",
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
"datasource": "docker",
"depType": "stage",
"updates": [
{
"bucket": "non-major",
"newVersion": "1.25.4-debian-12-r2",
"newValue": "1.25.4-debian-12-r2",
"newMajor": 1,
"newMinor": 25,
"updateType": "minor",
"branchName": "renovate-test/bitnami-nginx-1.x"
}
],
"packageName": "bitnami/nginx",
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)(:?-(?<compatibility>.+)-(?<build>\\d+)(?:-r(?<revision>\\d+))?)?$",
"warnings": [],
"registryUrl": "https://index.docker.io",
"currentVersion": "1.24.0",
"isSingleVersion": true,
"fixedVersion": "1.24.0-debian-12-r15"
},
{
"depName": "bitnami/nginx",
"currentValue": "1.24.0-debian-12-r15",
"currentDigest": "sha256:a842d93d1903fab7b7cf01a226331bd62e45dc5e39a5e19517e054d977ef9bc3",
"replaceString": "bitnami/nginx:1.24.0-debian-12-r15@sha256:a842d93d1903fab7b7cf01a226331bd62e45dc5e39a5e19517e054d977ef9bc3",
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
"datasource": "docker",
"depType": "final",
"updates": [
{
"bucket": "non-major",
"newVersion": "1.25.4-debian-12-r2",
"newValue": "1.25.4-debian-12-r2",
"newMajor": 1,
"newMinor": 25,
"updateType": "minor",
"newDigest": "sha256:8936f5a21ad81326147fc75795222882a083bec04e8e46e4b22adb5ef56d662f",
"branchName": "renovate-test/bitnami-nginx-1.x"
}
],
"packageName": "bitnami/nginx",
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)(:?-(?<compatibility>.+)-(?<build>\\d+)(?:-r(?<revision>\\d+))?)?$",
"warnings": [],
"registryUrl": "https://index.docker.io",
"currentVersion": "1.24.0",
"isSingleVersion": true,
"fixedVersion": "1.24.0-debian-12-r15"
}
],
"packageFile": "Dockerfile"
}
]
}
my repro is a different issue
https://github.com/renovatebot/renovate/blob/29e9707a6cc0f98ab97ddf1f2e50daa33606d64a/lib/workers/repository/process/lookup/index.ts#L319-L323
currentVersion
is of cause not a valid version on my regex!
https://github.com/renovatebot/renovate/blob/29e9707a6cc0f98ab97ddf1f2e50daa33606d64a/lib/workers/repository/process/lookup/current.ts#L40-L47
getSatisfyingVersion
needs to return the original version, not the coerced.
I'm not sure if this also impacts the fifth version element revision
as the referenced MR only mentioned it being a partial fix?
Renovate Hosted did not detect updates for revision updates of the linuxserver images when using a regex with major
, minor
, patch
, build
and revision
, e.g. for image tags like 5.8.3.8933-ls231
or 4.3.2-ls173
.
Ignoring the build
number and using revision
as build
as shown in the following regex was a workaround that helped me until this completely fixed (assuming this is the reason revision
is not working).
Sry it's ugly, see tests at https://regex101.com/r/10qWia/1:
...
packageRules: [
{
matchPackagePatterns: ["(^|\\/)linuxserver\\/.*$"],
versioning: "regex:^(?<prerelease>develop-)?v?(?<major>\\d+)\\.?(?<minor>\\d+)?\\.?(?<patch>\\d+)?(?:ubu\\d+)?(?:\\.|-)?(?<build_old>\\w?\\d+)?-ls(?<build>\\d+)$",
}
],
...
this definitly works: https://github.com/renovatebot/renovate/blob/de48a2b01b44c01b16eac6f61a516983c1da75a7/lib/config/presets/internal/workarounds.ts#L28-L44
@rarkins maybe we should close this issue as that specifc issue is fixed. I know there are other issues in regex manager, but they are only related and not same cause.