joschi / java-metadata

Project collecting release metadata of various JDK distributions.
https://joschi.github.io/java-metadata/index.html
MIT License
32 stars 11 forks source link

Add support for Red Hat JDK #47

Open tomwhoiscontrary opened 4 months ago

tomwhoiscontrary commented 4 months ago

Red Hat are a fairly significant packager of OpenJDK, and perhaps especially relevant for anyone developing on Fedora or deploying on CentOS / Rocky / etc.

Listing and obtaining releases directly from Red Hat requires logging into their website, but they are also listed on the Adoptium Marketplace:

https://adoptium.net/en-GB/marketplace/

Which has an API:

https://marketplace-api.adoptium.net/q/swagger-ui/#/

So for example this request:

https://marketplace-api.adoptium.net/v1/assets/latest/redhat/21/hotspot

Gets a list of responses like this:

{
    "release_name": "jdk-21.0.3+9_1",
    "vendor": "redhat",
    "binary": {
      "os": "linux",
      "architecture": "x64",
      "image_type": "jdk",
      "jvm_impl": "hotspot",
      "package": {
        "name": "java-21-openjdk-21.0.3.0.9-1.portable.jdk.x86_64.tar.xz",
        "link": "https://developers.redhat.com/content-gateway/file/pub/openjdk/adoptium/April_2024/java-21-openjdk-21.0.3.0.9-1.portable.jdk.x86_64.tar.xz",
        "sha256sum_link": "https://developers.redhat.com/content-gateway/file/pub/openjdk/adoptium/April_2024/java-21-openjdk-21.0.3.0.9-1.portable.jdk.x86_64.tar.xz.sha256"
      },
      "timestamp": "2024-04-18T17:32:29Z",
      "openjdk_scm_ref": "jdk-21.0.3+9",
      "distribution": "redhat",
      "aqavit_results_link": "https://developers.redhat.com/content-gateway/file/pub/openjdk/adoptium/April_2024/java-21-openjdk-21.0.3.0.9-1.portable.jdk.x86_64.cert-merged.tar.gz"
    },
    "version": {
      "major": 21,
      "minor": 0,
      "security": 3,
      "patch": null,
      "pre": null,
      "build": 9,
      "optional": null,
      "openjdk_version": "21.0.3+9"
    }
  }

And that URL can be downloaded without authentication.

They do compress with xz rather than gzip, though.