Open rarkins opened 3 years ago
We can use https://api.adoptium.net/v3/info/available_releases to know which versions are stable (lts) https://api.adoptium.net/q/swagger-ui/#/Release%20Info/getAvailableReleases
Hi @rarkins we are attempting to configure our self-hosted renovate bot (Gitlab.com, private group) to only offer specific Java versions to teams, and only LTS versions at that. We have been experimenting with the "allowedVersions" regex and have come up a packageRules block like the below:
{ "matchDatasources":["docker"], "matchPackagePatterns": ["amazoncorretto"], "versioning": "loose", "allowedVersions": "/:(8|11|17)\.[0-9]+\.[0-9]+/" }
However, the bot still seems to decide that 19x is the version to offer..
"currentValue":"11.0.16","replaceString":"REDACTED_DOCKER_HUB_PROXY/amazoncorretto:11.0.16","autoReplaceStringTemplate":"{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}","datasource":"docker","depType":"stage","depIndex":0,"updates":[{"bucket":"major","newVersion":"19.0.0","newValue":"19.0.0","newMajor":19,"newMinor":0,"updateType":"major","branchName":"renovate/REDACTED_DOCKER_HUB_PROXY-amazoncorretto-19.x"}
Is it likely that what we are attempting is supported or will we require an enhancement such as the suggestion from @viceice ?
Thanks
Is the leading colon : in the regex pattern intentional?
If they doesn't solve it then try creating a public reproduction for us to look at
incase this is helpful, sharing the package rule we are using to limit to LTS releases.
I'm sure there are improvements that could be made to these rules, but they function
"docker": {
"packageRules": [
{
"description": "JDK runtime version - limit to preferred or acceptable versions (v11 lts or v17 lts)",
"matchPackageNames": [
"openjdk",
"amazoncorretto"
],
"allowedVersions": "/^(11|17)(\\.[0-9]+){0,2}/"
},
{
"description": "JDK runtime version - limit to preferred or acceptable versions (v11 lts or v17 lts)",
"matchPackageNames": [
"eclipse-temurin",
"adoptopenjdk"
],
"versioning": "regex:^(?<major>\\d+)(\\.(?<minor>\\d+))?(\\.(?<patch>\\d+))?(_(?<build>\\d+))?(-(?<compatibility>.*))?$",
"allowedVersions": "/^(11|17)(\\.[0-9]+){0,2}/"
}
}
@setchy would you like to contribute them to our workarounds presets in this repo? I think they'd be useful to enable by default for config:base
users
Thanks for the quick responses I will report back with how we get on
Sure thing @rarkins - will raise a PR later today
draft pr for the workaround configuration #18007 - left a few open questions on it
What would you like Renovate to be able to do?
Don't propose updating Java to "unstable" releases, e.g. from v11 to v15
Did you already have any implementation ideas?
Classify major versions like 15 as unstable? Then if someone is on an unstable version (e.g. 14 or 15) then they'd need to configure
ignoreUnstable: false
. Ideally we'd have a way to update them within a major release stream if they are already on it. Maybe we could achieve this separately by having a package rule in config:base like: