WhiteSource Renovate App
GitHub.com
Logs with config file below.
I would like to update Nginx version in my versions.yml file using Renovate.
# renovate: datasource=github-releases depName=grafana/grafana
metrics_grafana_version: 7.1.5
# renovate: datasource=github-tags depName=nginx/nginx
metrics_nginx_version: 1.17.10
# renovate: datasource=github-releases depName=prometheus/prometheus
metrics_prometheus_version: 2.21.0
# renovate: datasource=github-releases depName=influxdata/telegraf
metrics_telegraf_version: 1.15.3
I have a problem with Nginx, because Nginx repo has tags in format release-1.19.2.
With my Renovate config:
{
"extends": ["config:base"],
"regexManagers": [
{
"fileMatch": ["^versions\\.yml$"],
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)\n.*?: (?<currentValue>.*)"
],
"versioningTemplate": "node"
}
]
}
I got:
DEBUG: Found no results from datasource that look like a version (nginx/nginx)(dependency="nginx/nginx")
{
"result": {
"sourceUrl": "https://github.com/nginx/nginx",
"releases": []
}
}
When I add packageRules to the config:
"packageRules": [
{
"packageNames": ["nginx/nginx"],
"versioning": "regex:^release-(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)?$"
}
]
I got:
Dependency nginx/nginx has unsupported value 1.17.10
[...]
packageFiles with updates
{
"depName": "nginx/nginx",
"currentValue": "1.17.10",
"datasource": "github-tags",
"versioning": "node",
"replaceString": "# renovate: datasource=github-tags depName=nginx/nginx\nmetrics_nginx_version: 1.17.10",
"depIndex": 1,
"updates": [],
"warnings": [],
"skipReason": "unsupported-value"
},
And with:
"packageRules": [
{
"packageNames": ["nginx/nginx"],
"versioning": "regex:(release-)?(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)?"
}
]
I got:
packageFiles with updates
[...]
"depName": "nginx/nginx",
"currentValue": "1.17.10",
"datasource": "github-tags",
"versioning": "node",
"replaceString": "# renovate: datasource=github-tags depName=nginx/nginx\nmetrics_nginx_version: 1.17.10",
"depIndex": 1,
"updates": [
{
"fromVersion": "1.17.10",
"toVersion": "release-1.19.2",
"newValue": "release-1.19.2",
"newMajor": 1,
"newMinor": 19,
"updateType": "minor",
"isSingleVersion": true
}
],
"warnings": [],
"fixedVersion": "1.17.10",
"sourceUrl": "https://github.com/nginx/nginx"
},
and a PR, which updates the versions file to:
metrics_nginx_version: release-1.19.2
My original repo is https://github.com/platan/metrics-shields-io-config, but I use a fork for tests.
I would like to update my file to:
metrics_nginx_version: 1.19.2
I've transferred this into the main repo as I don't think it's possible without a feature being added.
@platan as workaround you can use nginx docker image and docker versioning.
@viceice I've had some ideas on this. Tell me what do you think?
A very simple feature like stripVersionPrefix with a string value could solve this and most other similar problems (e.g. leading v). But then what if it's a suffix?
An alternative could be to name it something like extractVersion and use a named regex group e.g. "extractVersion": "release-(?
Wondering instead about a more configurable option like transformVersion that could take a regex match as first param and a replace as second. e.g. "release-", and "".
Alternatively another approach could be to use named capture groups to match but handlebars to transform.
My best idea right now:
extractVersion for now and have it require a named capture group versiontransformVersion option that lets you use/compose any captured groups in a handlebars template, like {{version}}.0BTW I think a more flexible compatibility capability for versions could be wrapped into this functionality. e.g. instead of dockerver it could be something like "extractVersion": "^(?<version>[^-]*)(-*(?<compatibility>.*))?$": https://regex101.com/r/1WNLHr/2
Like it. Add this to package rules?
Yes, it would be configurable in packageRules although not necessarily exclusive to them, e.g. people might configure them within an object. I was also thinking whether there'd be a performance hit if we default its value to "extractVersion": "^(?<version>.*)$.
@viceice The workaround with docker datasource + docker versioning + docker image name (nginx instead of nginx/nginx) works! Thanks.
@rarkins I like your idea with extractVersion and transformVersion. We can start with extractVersion.
Can I or anyone else help with implementing this feature or would you like to do it yourself?
@platan if you can create a simple reproduction repo I can fork and test against, then I should be able to implement it pretty fast. It's a small change but you just need to know where to put it.. so best I do it
:tada: This issue has been resolved in version 23.29.0 :tada:
The release is available on:
23.29.0Your semantic-release bot :package::rocket: