updatecli / updatecli

A Declarative Dependency Management tool
https://www.updatecli.io
Apache License 2.0
538 stars 62 forks source link

Feature Request: Support for version pattern in autodiscovery for docker image eclipse-temurin #1733

Closed JohnniDi closed 1 week ago

JohnniDi commented 10 months ago

Is your feature request related to a problem?

The eclispe temurin version pattern (eg eclipse-temurin:17.0.6_10-jdk) is not understood by updatecli's version parser

Solution you'd like

Support for patterns like eclipse-temurin:17.0.6_10-jdk

Alternatives you've considered

Implemented manually writing source and target rules. This bloats our ci pipeline enormously, though.

Anything else?

No response

dduportal commented 10 months ago

Hi @JohnniDi could you provide a reproduction case please (so it will help us to understand the best way to solve this)?

olblak commented 10 months ago

The problem in this case, is that Temurin doesn't use a semver version. The underscore in 17.0.6_10-jdk is the issue.

Considering how big the Temurin project is, I think it would make sense to add a new versionfilter kind That would be specific to Java Temurin

This should be added in https://github.com/updatecli/updatecli/tree/main/pkg/plugins/utils/version

dduportal commented 10 months ago

I've started playing around with shell script with the adoptium API (https://api.adoptium.net/q/swagger-ui/#/Assets/searchReleases and https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc) and it looks a really good support.

I'll come with a proposal in this issue soon, with a new resource adoptium a bit like the current jenkins resource

dduportal commented 10 months ago

Here is a first "usage" for a potential temurin new resource. I've only treated the source fo now. Condition should come later.

WDYT @JohnniDi @olblak @gounthar @hervelemeur @smerle33 ?

sources:
  ## Returns last LTS (implicit default)
  # Result: 21.0.1+12
  getLastDefaultVersion:
    kind: temurin

  ## Returns last feature release (explicit)
  # Result: 21.0.1+12
  getLastFeatureVersion:
    kind: temurin
    spec:
      release: feature # Can be 'lts' (default), 'feature', 'tip'

  ## Returns last LTS Nightly
  # Result: 21.0.1+12-ea-beta
  getLastLTSNightlyVersion:
    kind: temurin
    spec:
      release: lts
      type: ea # Can be 'ga' (default), 'ea'

  ## Fails (no GA release type for JDK22 ... yet)
  # getLastTipVersion:
  #   kind: temurin
  #   spec:
  #     release: tip

  ## Fails (no GA release type for JDK22 ... yet)
  # getLastLTSNightlyVersion:
  #   kind: temurin
  #   spec:
  #     release: tip
  #     type: ga

  ## Returns last tip nightly release (EA)
  # Result: 22+21-ea-beta
  getLastTipNightlyVersion:
    kind: temurin
    spec:
      release: tip
      type: ea

  ## Returns Last GA of the 17 version line
  # Result: 17.0.9+9
  getLastGA17Version:
    kind: temurin
    spec:
      release: tip
      type: ga
      majorversion: 17 # Validated against the list of available releases

  ## Fails as no JDK10 exists for Temurin
  # getLast10Version:
  #   kind: temurin
  #   spec:
  #     release: tip
  #     majorversion: 10

  ## Returns the binary download URL for the latest x64 Windows JDK in the LTS version line
  # Result: https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.1%2B12/OpenJDK21U-jdk_x64_linux_hotspot_21.0.1_12.tar.gz
  getLastBinary17LinuxAMD64:
    kind: temurin
    spec:
      result: binary_url # Can be 'version' (default), 'name', 'binary_url', 'installer_url' (windows only), 'checksum', 'checksum_url'

  ## Returns the installer download URL for the latest x64 Windows JDK in the LTS version line
  # Result: https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.1%2B12/OpenJDK21U-jdk_x64_windows_hotspot_21.0.1_12.msi
  getLastInstaller17WindowsAMD64:
    kind: temurin
    spec:
      result: installer_url
      os: windows           # Follows Temurin conventions: can be 'linux' (default), 'alpine-linux', 'windows', 'mac', 'solaris', 'aix'

  ## Returns Checksum for latest JRE on the s390x Linux 17 line
  # Result: c4f2249bee785aa8c754741aa24d035e02b4e6d844e35b2b20030374d8fbab75  OpenJDK17U-jre_s390x_linux_hotspot_17.0.9_9.tar.gz
  getLastJdkLTSVersionBinaryWindowsAMD64:
    kind: temurin
    spec:
      majorversion: 17
      os: linux
      architecture: s390x # Follows Temurin conventions: can be 'x64' (default), 'x86', 'x32', 'ppc64', 'ppc64le', 's390x', 'aarch64', 'arm', 'sparcv9', 'riscv64'
      image_type: jre     # Follows Temurin conventions: can be 'jdk' (default), 'jre', 'testimage', 'debugimage', 'staticlibs', 'sources', 'sbom'
      result: checksum
gounthar commented 10 months ago

Looks promising, thanks! 👍