renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.15k stars 2.23k forks source link

Better Java versioning #8127

Open rarkins opened 3 years ago

rarkins commented 3 years ago

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:

{
  "matchCurrentVersion": ">11",
  "ignoreUnstable": false
}
viceice commented 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

dc2tom commented 1 year ago

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

rarkins commented 1 year ago

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

setchy commented 1 year ago

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}/"
      }
}
rarkins commented 1 year ago

@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

dc2tom commented 1 year ago

Thanks for the quick responses I will report back with how we get on

setchy commented 1 year ago

Sure thing @rarkins - will raise a PR later today

setchy commented 1 year ago

draft pr for the workaround configuration #18007 - left a few open questions on it