Regex manager mutates depName when updating currentValue without autoReplaceStringTemplate #44680
Unanswered
Boemeltrein
asked this question in
Request Help
Replies: 1 comment 2 replies
-
|
Having what I believe to be the same problem, it used to work, but recently stopped working
DEBUG: depName mismatch (branch="renovate/quay.io-prometheus-busybox")
{
"manager": "jsonata",
"packageFile": ".goreleaser.yml",
"currentDepName": "quay.io/prometheus/busybox",
"newDepName": "quay.io/prometheus/busybox@quay.io/prometheus/busybox"
}Extract of the config: {
"customManagers": [
{
"description": "Update base image in .goreleaser.yml",
"customType": "jsonata",
"fileFormat": "yaml",
"managerFilePatterns": ["/(^|/)\\.goreleaser\\.ya?ml$/"],
"matchStrings": [
"kos.$match(base_image, /^(.+?)(?::(.+?))?(?:@(sha256:.+))?$/).{ 'depName': groups[0], 'currentValue': groups[1], 'currentDigest': groups[2] }"
],
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
"datasourceTemplate": "docker",
"depTypeTemplate": "kos.base_image",
"versioningTemplate": "docker"
}
]
}Full config: maxbrunet/prometheus-elasticache-sd@ Last working PR: maxbrunet/prometheus-elasticache-sd#1311 (Renovate v43.235.0) Could that be caused by this PR? It says "support", but I had it working 🙃 Other recent discussion mentioning problems with |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 Renovate CLI
Which platform you running Renovate on?
Other (please specify)
Kubernetes, container ghcr.io/mend/renovate-ce
Which version of Renovate are you using?
"renovateVersion": "43.259.2"
Please tell us more about your question or problem
I figured this out together with ChatGPT and enabled
LOG_LEVEL=debugAs I not that great in a nice english summary hereby the AI generated version.
Sorry about that.
Regex manager mutates depName when updating currentValue without autoReplaceStringTemplate
Description
I believe I've found an issue with the regex custom manager when using a numeric depName and no autoReplaceStringTemplate.
The dependency is extracted correctly, but during a subsequent branch update Renovate reports a depName mismatch because the depName has been unexpectedly modified. Adding an explicit autoReplaceStringTemplate resolves the issue.
Renovate configuration
Example input
The regex extracts:
The Grafana datasource returns revision 8.
Expected behavior
The dependency should update to:
The depName should remain 13768.
Actual behavior
On a subsequent run, Renovate fails while updating the existing branch with:
Another example shows the same behavior:
In both cases, the new version appears to have been applied to the depName rather than only to currentValue.
The dashboard IDs (13768 and 22604) do not change, and the Grafana API also returns the correct IDs.
Workaround
Adding an explicit autoReplaceStringTemplate makes the problem disappear:
With this template, Renovate correctly updates:
to
and no depName mismatch occurs.
Additional information
The dependency is extracted correctly.
The custom datasource works correctly.
The Grafana API returns the correct dashboard ID.
The issue only occurs when relying on the default replacement behavior of the regex manager.
Providing an explicit autoReplaceStringTemplate consistently avoids the problem.
This makes me suspect that the default replacement logic for the regex manager is unintentionally mutating depName when currentValue is updated.
Logs (if relevant)
Logs
Beta Was this translation helpful? Give feedback.
All reactions