From ec1af222f06b7ed5cfbc81a7ccadcf6ca27059e7 Mon Sep 17 00:00:00 2001 From: "lvfei.lv" Date: Tue, 10 Jan 2023 16:28:53 +0800 Subject: [PATCH 01/18] add support for dragonwell --- README.md | 2 + __tests__/data/dragonwell.json | 1138 +++++++++++++++++ .../distributors/dragonwell-installer.test.ts | 213 +++ dist/setup/index.js | 164 +++ docs/advanced-usage.md | 13 + src/distributions/distribution-factory.ts | 6 +- src/distributions/dragonwell/installer.ts | 163 +++ src/distributions/dragonwell/models.ts | 26 + 8 files changed, 1724 insertions(+), 1 deletion(-) create mode 100644 __tests__/data/dragonwell.json create mode 100644 __tests__/distributors/dragonwell-installer.test.ts create mode 100644 src/distributions/dragonwell/installer.ts create mode 100644 src/distributions/dragonwell/models.ts diff --git a/README.md b/README.md index c174abe36..4a728aad2 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ Currently, the following distributions are supported: | `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/) | `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) | | `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense) +| `dragonwell` | Alibaba Dragonwell JDK | [Link](https://dragonwell-jdk.io/) | [Link](https://www.aliyun.com/product/dragonwell/) **NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions. @@ -227,6 +228,7 @@ In the example above multiple JDKs are installed for the same job. The result af - [Microsoft](docs/advanced-usage.md#Microsoft) - [Amazon Corretto](docs/advanced-usage.md#Amazon-Corretto) - [Oracle](docs/advanced-usage.md#Oracle) + - [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell) - [Installing custom Java package type](docs/advanced-usage.md#Installing-custom-Java-package-type) - [Installing custom Java architecture](docs/advanced-usage.md#Installing-custom-Java-architecture) - [Installing custom Java distribution from local file](docs/advanced-usage.md#Installing-Java-from-local-file) diff --git a/__tests__/data/dragonwell.json b/__tests__/data/dragonwell.json new file mode 100644 index 000000000..58025e901 --- /dev/null +++ b/__tests__/data/dragonwell.json @@ -0,0 +1,1138 @@ +{ + "11":{ + "11.0.13.9":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"f2c68862136d12ab30358d3acfe95f925a8775f9000c54776a4439afcb02cb4a", + "name":"Alibaba_Dragonwell_11.0.13.9_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.13.9_jdk-11.0.13-ga/Alibaba_Dragonwell_11.0.13.9_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"04edcefd10f3d058b1691e73c25d91ad28870809847a5c092bc9096595f0de35", + "name":"Alibaba_Dragonwell_11.0.13.9_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.13.9_jdk-11.0.13-ga/Alibaba_Dragonwell_11.0.13.9_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"f2553f6beb567f0e5c3ed4fd22339e05e534b8b283802265cb147d883ad6ca64", + "name":"Alibaba_Dragonwell_11.0.13.9_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.13.9_jdk-11.0.13-ga/Alibaba_Dragonwell_11.0.13.9_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"2e2b7d66a02c3d9a9aff1a7b413a98e8291c08533825d407bcfc4e360b89b018", + "name":"Alibaba_Dragonwell_11.0.13.9_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.13.9_jdk-11.0.13-ga/Alibaba_Dragonwell_11.0.13.9_x64_windows.zip" + } + } + } + }, + "11.0.5.1-preview":{}, + "11.0.17.13.8":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"00d03f4959ae77f77019a400cf90359b9f6ca3f73a391c3c6872e717c34f3536", + "name":"Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_alpine-linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"12859813fe860e36995565574c1d165583cb7d34e8f917ec515cf044453d466e", + "name":"Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"d56122ebfee4ded7066955675f0ac2474ef6355547e9de838cd18bf7c7d8ac57", + "name":"Alibaba_Dragonwell_Extended_11.0.17.13.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_aarch64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"14c4a17a65bf478b25410714433f5af8df0a0ffaaedf6d94b8901f8b7ecbfa8a", + "name":"Alibaba_Dragonwell_Standard_11.0.17.13.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Standard_11.0.17.13.8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"9a01b3799883485263158241625a7abf72d4696cb2f3a7e069f1b5df8d1e30cd", + "name":"Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"089e8e10956316a91ccb00ee64642df9b9182cc3da7a6354eaf5c4f87f39afb1", + "name":"Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"198fcfde686de580dcf2607e3a97e1b241b1a3a12c07e6a2abc62f9560c31d05", + "name":"Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_windows.zip" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"fb591b3727d2232a3fb9750e846a02b3939f0beaf50f377d2c8eac50f4d317ac", + "name":"Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_windows.zip" + } + } + } + }, + "11.0.10.5":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_11.0.10.5_alpine-linux_x64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.10.5_jdk-11.0.10-ga/Alibaba_Dragonwell_11.0.10.5_alpine-linux_x64.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_11.0.10.5_linux_aarch64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.10.5_jdk-11.0.10-ga/Alibaba_Dragonwell_11.0.10.5_linux_aarch64.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_11.0.10.5_linux_x64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.10.5_jdk-11.0.10-ga/Alibaba_Dragonwell_11.0.10.5_linux_x64.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "name":"Alibaba_Dragonwell_11.0.10.5_windows_x64.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.10.5_jdk-11.0.10-ga/Alibaba_Dragonwell_11.0.10.5_windows_x64.zip" + } + } + } + }, + "11.0.7.2":{ + "linux":{ + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_11.0.7.2+9_Linux_x64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell_11.0.7.2_GA/Alibaba_Dragonwell_11.0.7.2%2B9_Linux_x64.tar.gz" + } + } + } + }, + "11.0.14.10":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"f2ce78515307f327d04ec8aa1e8646561c111ad0409097d10520868c3156bebe", + "name":"Alibaba_Dragonwell_11.0.14.10_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.14.10_jdk-11.0.14-ga/Alibaba_Dragonwell_11.0.14.10_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"4c45345734076495d5a838d67c7957c078de913a708242087130c0627716187e", + "name":"Alibaba_Dragonwell_11.0.14.10_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.14.10_jdk-11.0.14-ga/Alibaba_Dragonwell_11.0.14.10_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"f44fe94aa5ef14a67ed446698dd055ac1ab726ecb516de16b3cab24c666a71ae", + "name":"Alibaba_Dragonwell_11.0.14.10_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.14.10_jdk-11.0.14-ga/Alibaba_Dragonwell_11.0.14.10_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"55ef8cf936a901c7e333c21945b6f31edd9c9a3a5973706ab7aeea7f4fb5c436", + "name":"Alibaba_Dragonwell_11.0.14.10_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.14.10_jdk-11.0.14-ga/Alibaba_Dragonwell_11.0.14.10_x64_windows.zip" + } + } + } + }, + "11.0.11.7":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"609bf39d47f567570de8becf632e27e0fbd14ae3102fab96f347c72798c49010", + "name":"Alibaba_Dragonwell_11.0.11.7_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.11.7_jdk-11.0.11-ga/Alibaba_Dragonwell_11.0.11.7_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"44b5b977b0582ec1185fa09dfebd642ba65a87bd18988cc47b03b999b5f73551", + "name":"Alibaba_Dragonwell_11.0.11.7_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.11.7_jdk-11.0.11-ga/Alibaba_Dragonwell_11.0.11.7_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"84d62e0daa5f1609a9086cffe07b8bdad734ad3b012827bb19a99eee8bbd41f3", + "name":"Alibaba_Dragonwell_11.0.11.7_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.11.7_jdk-11.0.11-ga/Alibaba_Dragonwell_11.0.11.7_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"e97a88d72d6abd712f57f1cf8a215e064f91373389c0c072b824024d48481143", + "name":"Alibaba_Dragonwell_11.0.11.7_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.11.7_jdk-11.0.11-ga/Alibaba_Dragonwell_11.0.11.7_x64_windows.zip" + } + } + } + }, + "11.0.16.12":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"ea9de44b853172b5c6594fbe3d81723a21ad978a225ac1fa393925349c4bb7b9", + "name":"Alibaba_Dragonwell_Extended_11.0.16.12.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.16.12_jdk-11.0.16-ga/Alibaba_Dragonwell_Extended_11.0.16.12.8_x64_alpine-linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"44ca11f491873863e43bb6e476df7fd8fa453c563a932cf488b9d00ab7ef68c9", + "name":"Alibaba_Dragonwell_Standard_11.0.16.12.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.16.12_jdk-11.0.16-ga/Alibaba_Dragonwell_Standard_11.0.16.12.8_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"28ff34de82a1c020350c7b61b040a03b9e039cb5db4389e6af5711bb52abe4f3", + "name":"Alibaba_Dragonwell_Extended_11.0.16.12.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.16.12_jdk-11.0.16-ga/Alibaba_Dragonwell_Extended_11.0.16.12.8_aarch64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"bd930ac692bcd2e511cdf5c55a3adddfe18375af79a36dd843d8b52bdb574f5f", + "name":"Alibaba_Dragonwell_Standard_11.0.16.12.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.16.12_jdk-11.0.16-ga/Alibaba_Dragonwell_Standard_11.0.16.12.8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"47b904df8fa702cb7a454666cbc27dafc40d3c7c73c5178e0d9ebe2fc9b9352a", + "name":"Alibaba_Dragonwell_Extended_11.0.16.12.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.16.12_jdk-11.0.16-ga/Alibaba_Dragonwell_Extended_11.0.16.12.8_x64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"42d673d9effff252140e1402959881c3f255ee3a8b8776871fd8e775facb9584", + "name":"Alibaba_Dragonwell_Standard_11.0.16.12.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.16.12_jdk-11.0.16-ga/Alibaba_Dragonwell_Standard_11.0.16.12.8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"7d2f29c0691e1e72907b855bf5fb89bc5bf8b44a7fa632446537a71bbdf28f53", + "name":"Alibaba_Dragonwell_Extended_11.0.16.12.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.16.12_jdk-11.0.16-ga/Alibaba_Dragonwell_Extended_11.0.16.12.8_x64_windows.zip" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"977565dc6984b4dcc8a260a31cd7678638402525f07e677c37aa6ae7fe6be469", + "name":"Alibaba_Dragonwell_Standard_11.0.16.12.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.16.12_jdk-11.0.16-ga/Alibaba_Dragonwell_Standard_11.0.16.12.8_x64_windows.zip" + } + } + } + }, + "11.0.15.11":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"52ad29ef644b8c268cf2c5b3d5fc15a9b0be6f246407ddce92e547b8473b642f", + "name":"Alibaba_Dragonwell_11.0.15.11.9_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.15.11_jdk-11.0.15-ga/Alibaba_Dragonwell_11.0.15.11.9_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"459bec951d0b2d610bda8cc1fd649406abe4edc8bcda78568b2fca828993f040", + "name":"Alibaba_Dragonwell_11.0.15.11.9_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.15.11_jdk-11.0.15-ga/Alibaba_Dragonwell_11.0.15.11.9_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"2406a9b12682d443aa606213d6c00ec83d96b2d157a70728edd6b9bca80c4eab", + "name":"Alibaba_Dragonwell_11.0.15.11.9_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.15.11_jdk-11.0.15-ga/Alibaba_Dragonwell_11.0.15.11.9_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"789a3b3a9fc7ceaab9920ffc21084684b8ba5087f1c8c48dd8ff92cb3e3c2ba1", + "name":"Alibaba_Dragonwell_11.0.15.11.9_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.15.11_jdk-11.0.15-ga/Alibaba_Dragonwell_11.0.15.11.9_x64_windows.zip" + } + } + } + }, + "11.0.11.6":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"556dabaf88dac69c12b2b880acafe980d746b97b70fcf4539f49ec4da66f227f", + "name":"Alibaba_Dragonwell_11.0.11.6_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.11.6_jdk-11.0.11-ga/Alibaba_Dragonwell_11.0.11.6_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"645d7643c77c425d83617a5893f9bb11fc3972c42652b1cda23f894bf52a23c2", + "name":"Alibaba_Dragonwell_11.0.11.6_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.11.6_jdk-11.0.11-ga/Alibaba_Dragonwell_11.0.11.6_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"cf1fced88d829f9995a666cb5a032275d10e94294dc9c16a3365839153317236", + "name":"Alibaba_Dragonwell_11.0.11.6_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.11.6_jdk-11.0.11-ga/Alibaba_Dragonwell_11.0.11.6_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"3c618dc104d4c3d789aa4df5e8cfa95454293499f4f984a5b6b7fe6c672a2afb", + "name":"Alibaba_Dragonwell_11.0.11.6_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.11.6_jdk-11.0.11-ga/Alibaba_Dragonwell_11.0.11.6_x64_windows.zip" + } + } + } + }, + "11.0.12.8":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"173fef1655db84b11c3a855c950bbf76c9e8b0891a496fcda441eff68ea84f59", + "name":"Alibaba_Dragonwell_11.0.12.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.12.8_jdk-11.0.12-ga/Alibaba_Dragonwell_11.0.12.8_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"f18115624ad57d9609035fa169feef956d085cf9ad6d3caaf1bd68b87e495537", + "name":"Alibaba_Dragonwell_11.0.12.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.12.8_jdk-11.0.12-ga/Alibaba_Dragonwell_11.0.12.8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"045166d6dee2e55e2571bb9c02dcf822b538d44a9b5aaac918032e8e137ca512", + "name":"Alibaba_Dragonwell_11.0.12.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.12.8_jdk-11.0.12-ga/Alibaba_Dragonwell_11.0.12.8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"1865733f3f134c205297a32914347217bec8ed331218171600492ac0808e5789", + "name":"Alibaba_Dragonwell_11.0.12.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-11.0.12.8_jdk-11.0.12-ga/Alibaba_Dragonwell_11.0.12.8_x64_windows.zip" + } + } + } + }, + "11.0.8.3":{}, + "11.0.9.4":{}, + "latest":{ + "alpine-linux":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"00d03f4959ae77f77019a400cf90359b9f6ca3f73a391c3c6872e717c34f3536", + "name":"Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_alpine-linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"12859813fe860e36995565574c1d165583cb7d34e8f917ec515cf044453d466e", + "name":"Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"d56122ebfee4ded7066955675f0ac2474ef6355547e9de838cd18bf7c7d8ac57", + "name":"Alibaba_Dragonwell_Extended_11.0.17.13.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_aarch64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"14c4a17a65bf478b25410714433f5af8df0a0ffaaedf6d94b8901f8b7ecbfa8a", + "name":"Alibaba_Dragonwell_Standard_11.0.17.13.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Standard_11.0.17.13.8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"9a01b3799883485263158241625a7abf72d4696cb2f3a7e069f1b5df8d1e30cd", + "name":"Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"089e8e10956316a91ccb00ee64642df9b9182cc3da7a6354eaf5c4f87f39afb1", + "name":"Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"198fcfde686de580dcf2607e3a97e1b241b1a3a12c07e6a2abc62f9560c31d05", + "name":"Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_windows.zip" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"fb591b3727d2232a3fb9750e846a02b3939f0beaf50f377d2c8eac50f4d317ac", + "name":"Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell11/releases/download/dragonwell-standard-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Standard_11.0.17.13.8_x64_windows.zip" + } + } + } + } + }, + "17":{ + "17.0.5.0.5.8":{ + "alpine-linux":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"ccbfac0f24f7c4a4f35b2361ba32b37ae6d97553679ae60543b69a4ad477f95f", + "name":"Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"929be7d0d0aa7c2bd196db4b6f3ead10dbeb240afc9db6c68974e79961c59003", + "name":"Alibaba_Dragonwell_Standard_17.0.5.0.5.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"a505dea63fd58925a1512dad77d5fdc9bc6c2ebb42f065001091eb31e30ed43f", + "name":"Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"95be23b7ca73eba7d4f59a73a148475d7f05c1e36bd2c8653158c7c1584c9350", + "name":"Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_windows.zip" + } + } + } + }, + "17.0.3.0.3.7":{ + "alpine-linux":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"4620312ff9fa2772aed71315280af7c4c65cfa91e4a77bd47f6471ed279ed8a7", + "name":"Alibaba_Dragonwell_17.0.3.0.3+7_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-17.0.3.0.3%2B7_jdk-17.0.3-ga/Alibaba_Dragonwell_17.0.3.0.3%2B7_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"84c9571fccb7e028c59657712e686cd1560d760a560ee8c76d0f99e2795aafcd", + "name":"Alibaba_Dragonwell_17.0.3.0.3+7_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-17.0.3.0.3%2B7_jdk-17.0.3-ga/Alibaba_Dragonwell_17.0.3.0.3%2B7_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"8431922266c1a476e1ca2d49c68110c22ec4f989ca0438b0b089ecd9c7ade0ce", + "name":"Alibaba_Dragonwell_17.0.3.0.3+7_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-17.0.3.0.3%2B7_jdk-17.0.3-ga/Alibaba_Dragonwell_17.0.3.0.3%2B7_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"e9ddd27b24040d63c0663a11c8f7f100c8d2cca7461d4a19c36e12129f0ae8de", + "name":"Alibaba_Dragonwell_17.0.3.0.3+7_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-17.0.3.0.3%2B7_jdk-17.0.3-ga/Alibaba_Dragonwell_17.0.3.0.3%2B7_x64_windows.zip" + } + } + } + }, + "17.0.2.0.2.8":{ + "alpine-linux":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"b7a261502e8aac714defeb7fc8c48c508e63d4fc2902cbb03511a1db0291d5e9", + "name":"Alibaba_Dragonwell_17.0.2.0.2+8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-17.0.2.0.2%2B8_jdk-17.0.2-ga/Alibaba_Dragonwell_17.0.2.0.2%2B8_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"cc9f9fbd33c117f164eacfbafa2ae92270d88bc9b3d4ea4a862a20cacdcf9115", + "name":"Alibaba_Dragonwell_17.0.2.0.2+8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-17.0.2.0.2%2B8_jdk-17.0.2-ga/Alibaba_Dragonwell_17.0.2.0.2%2B8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"a345601439294b56831ecdd1366ac4006c3828e25f18a0fc59f34aa07387a97b", + "name":"Alibaba_Dragonwell_17.0.2.0.2+8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-17.0.2.0.2%2B8_jdk-17.0.2-ga/Alibaba_Dragonwell_17.0.2.0.2%2B8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"90332f5ffd03edc853cbe9d3447c4000d6406b1165e0c114fd7925ba3aea36f2", + "name":"Alibaba_Dragonwell_17.0.2.0.2+8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-17.0.2.0.2%2B8_jdk-17.0.2-ga/Alibaba_Dragonwell_17.0.2.0.2%2B8_x64_windows.zip" + } + } + } + }, + "17.0.4.0.4.8":{ + "alpine-linux":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"6e2fbad38dd6b9e0a7986f49a0885f5406518c3bbf3a7f0b4360dc36006bd34a", + "name":"Alibaba_Dragonwell_Standard_17.0.4.0.4+8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"1e7b974b860e9062c8a65dab4c71f84b20527b08866062a67c38963017a5f3fe", + "name":"Alibaba_Dragonwell_Standard_17.0.4.0.4+8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"31b3b6293b6645de7c531d16427ec38809ffaa0ef2db9a29c9c2230c5dc10eec", + "name":"Alibaba_Dragonwell_Standard_17.0.4.0.4+8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"7b23e8c2d49f2c1a067180da3abdd89ed80d5e562c80341e60b547bc1f83bbea", + "name":"Alibaba_Dragonwell_Standard_17.0.4.0.4+8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_windows.zip" + } + } + } + }, + "latest":{ + "alpine-linux":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"ccbfac0f24f7c4a4f35b2361ba32b37ae6d97553679ae60543b69a4ad477f95f", + "name":"Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_alpine-linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_alpine-linux.tar.gz" + } + } + }, + "linux":{ + "aarch64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"929be7d0d0aa7c2bd196db4b6f3ead10dbeb240afc9db6c68974e79961c59003", + "name":"Alibaba_Dragonwell_Standard_17.0.5.0.5.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"a505dea63fd58925a1512dad77d5fdc9bc6c2ebb42f065001091eb31e30ed43f", + "name":"Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Standard":{ + "content_type":"application/zip", + "sha256":"95be23b7ca73eba7d4f59a73a148475d7f05c1e36bd2c8653158c7c1584c9350", + "name":"Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_windows.zip" + } + } + } + } + }, + "8":{ + "8.7.7":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"6f18f6e2408513b2624af938f33eb11ddee91ab3ac2efd8fef5249059ca10588", + "name":"Alibaba_Dragonwell_8.7.7_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.7.7_jdk8u292-ga/Alibaba_Dragonwell_8.7.7_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"799b336da16e4b4c1e25a332e457ed396ef575579f5e9cfcf0332ad29e2ca4e8", + "name":"Alibaba_Dragonwell_8.7.7_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.7.7_jdk8u292-ga/Alibaba_Dragonwell_8.7.7_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"9d1b0c8d68e990bec8f9d094af79d3327f47797a38ecd3f71c1cb0f13a0de66d", + "name":"Alibaba_Dragonwell_8.7.7_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.7.7_jdk8u292-ga/Alibaba_Dragonwell_8.7.7_x64_windows.zip" + } + } + } + }, + "8.6.6":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"7b280e76b8d830187433fe69cb121142b8b535706cbbde70804fdeb670bb3487", + "name":"Alibaba_Dragonwell_8.6.6_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.6.6_jdk8u282-ga/Alibaba_Dragonwell_8.6.6_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"573e484ac0b64b081eaeaaeb08444e4add770b696c9a1c8bb02e98d1d58ff350", + "name":"Alibaba_Dragonwell_8.6.6_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.6.6_jdk8u282-ga/Alibaba_Dragonwell_8.6.6_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"16eefe64811b083e24ef77b28d33dccbc8f560e23ba6d36126eecee8674e2b6f", + "name":"Alibaba_Dragonwell_8.6.6_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.6.6_jdk8u282-ga/Alibaba_Dragonwell_8.6.6_x64_windows.zip" + } + } + } + }, + "8.8.8":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"60c4519b32e032f43667d397acc684cb954c591e533b70fe40c67e7977fb17d9", + "name":"Alibaba_Dragonwell_8.8.8_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.8.8_jdk8u302-ga/Alibaba_Dragonwell_8.8.8_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"98599d98cea102abb8ac3bbf30a348a58e05e81a22c62bc409b9fb07ad3b20a9", + "name":"Alibaba_Dragonwell_8.8.8_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.8.8_jdk8u302-ga/Alibaba_Dragonwell_8.8.8_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"b6d188ae4102c84bf9e071edb5f0c66e5505422e05a6c74f1a2882ed5813fc2b", + "name":"Alibaba_Dragonwell_8.8.8_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.8.8_jdk8u302-ga/Alibaba_Dragonwell_8.8.8_x64_windows.zip" + } + } + } + }, + "8.8.9":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"ff0594f36d13883972ca0b302d35cca5099f10b8be54c70c091f626e4e308774", + "name":"Alibaba_Dragonwell_8.8.9_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.8.9_jdk8u302-ga/Alibaba_Dragonwell_8.8.9_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"cd83125cde0a3a2a12d04c72abe61a522af9071a3d7ada8156c42a51e6dbcf7e", + "name":"Alibaba_Dragonwell_8.8.9_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.8.9_jdk8u302-ga/Alibaba_Dragonwell_8.8.9_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"40f66998c0d6830a45065764e5228427e3b5c71a89337352b8385f34aa845e74", + "name":"Alibaba_Dragonwell_8.8.9_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.8.9_jdk8u302-ga/Alibaba_Dragonwell_8.8.9_x64_windows.zip" + } + } + } + }, + "8.5.5":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_8.5.5-FP1_Linux_aarch64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.5.5_jdk8u275-b2/Alibaba_Dragonwell_8.5.5-FP1_Linux_aarch64.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_8.5.5-FP1_Linux_x64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.5.5_jdk8u275-b2/Alibaba_Dragonwell_8.5.5-FP1_Linux_x64.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/x-zip-compressed", + "name":"Alibaba_Dragonwell_8.5.5-Experimental_Windows_x64.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.5.5_jdk8u275-b2/Alibaba_Dragonwell_8.5.5-Experimental_Windows_x64.zip" + } + } + } + }, + "8.6.5":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_8.6.5_GA_Linux_aarch64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.6.5_jdk8u282-b1/Alibaba_Dragonwell_8.6.5_GA_Linux_aarch64.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_8.6.5_GA_Linux_x64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.6.5_jdk8u282-b1/Alibaba_Dragonwell_8.6.5_GA_Linux_x64.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "name":"Alibaba_Dragonwell_8.6.5_Experimental_Windows_x64.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.6.5_jdk8u282-b1/Alibaba_Dragonwell_8.6.5_Experimental_Windows_x64.zip" + } + } + } + }, + "8.4.4":{ + "linux":{ + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_8.4.4-GA_Linux_x64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.4.4_jdk8u262-ga/Alibaba_Dragonwell_8.4.4-GA_Linux_x64.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_8.4.4-Experimental_Windows_x64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.4.4_jdk8u262-ga/Alibaba_Dragonwell_8.4.4-Experimental_Windows_x64.tar.gz" + } + } + } + }, + "8.5.4":{ + "linux":{ + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "name":"Alibaba_Dragonwell_8.5.4-GA_Linux_x64.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.5.4_jdk8u272-ga/Alibaba_Dragonwell_8.5.4-GA_Linux_x64.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "name":"Alibaba_Dragonwell_8.5.4-GA_Experimental_Windows_x64.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.5.4_jdk8u272-ga/Alibaba_Dragonwell_8.5.4-GA_Experimental_Windows_x64.zip" + } + } + } + }, + "8.9.10":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/x-gzip", + "sha256":"8f4a5fb7d2f0e633b1280c41e89a1bef325346679feda912b21b368c1df4f5df", + "name":"Alibaba_Dragonwell_8.9.10_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.9.10_jdk8u312-ga/Alibaba_Dragonwell_8.9.10_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "sha256":"2e1dfdacfe64a6b2f797cffd7ff8ee8cf6424d29fa594376a6916b1686a38433", + "name":"Alibaba_Dragonwell_8.9.10_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.9.10_jdk8u312-ga/Alibaba_Dragonwell_8.9.10_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"bdc5aaaf8b1b8469ae1e8b5513db9d0a65a610c9d61cae389954f44100ac7272", + "name":"Alibaba_Dragonwell_8.9.10_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.9.10_jdk8u312-ga/Alibaba_Dragonwell_8.9.10_x64_windows.zip" + } + } + } + }, + "8.12.13":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/x-gzip", + "sha256":"12a8620a55dd85dc604bad71a770e235bbb773a301f5c1e12ba00c4d2bb9cea0", + "name":"Alibaba_Dragonwell_Extended_8.12.13_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.12.13_jdk8u345-ga/Alibaba_Dragonwell_Extended_8.12.13_aarch64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"b368b47f771be507b96e435b1a5fc41cb133762cdc86a7801150f25bf1e58421", + "name":"Alibaba_Dragonwell_Standard_8.12.13_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.12.13_jdk8u345-ga/Alibaba_Dragonwell_Standard_8.12.13_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/x-gzip", + "sha256":"0bb3a9b6109e29da6c7a0534cff9f34a0a16cab79ea850ebac7f7f9cfd071148", + "name":"Alibaba_Dragonwell_Extended_8.12.13_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.12.13_jdk8u345-ga/Alibaba_Dragonwell_Extended_8.12.13_x64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"64c00ba16e2eb4bf5f867f6a0604d8f82e0627c61d45d7edddc87cec641d9dd7", + "name":"Alibaba_Dragonwell_Standard_8.12.13_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.12.13_jdk8u345-ga/Alibaba_Dragonwell_Standard_8.12.13_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"3db624c7b835a7f4509e3937ea625dfdbca84aa4f84b73088a8eba5ceabe3adc", + "name":"Alibaba_Dragonwell_Extended_8.12.13_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.12.13_jdk8u345-ga/Alibaba_Dragonwell_Extended_8.12.13_x64_windows.zip" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"22e523e1be2dafc6e1dc47835800a629991beed45805c1b82fb37524fc6069d1", + "name":"Alibaba_Dragonwell_Standard_8.12.13_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.12.13_jdk8u345-ga/Alibaba_Dragonwell_Standard_8.12.13_x64_windows.zip" + } + } + } + }, + "8.11.12":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"544a2b75c1b5963664395fba4b58bc6012cd1db36b68c0f1886d81d657a0b24b", + "name":"Alibaba_Dragonwell_8.11.12_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.11.12_jdk8u332-ga/Alibaba_Dragonwell_8.11.12_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"03923f200dffddf9eee2aadc0c495674fe0b87cc2eece94a9a8dec84812d12bd", + "name":"Alibaba_Dragonwell_8.11.12_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.11.12_jdk8u332-ga/Alibaba_Dragonwell_8.11.12_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"9bbd1dc3a19a1309468e5ef8487467f10ba785cf625476588bccfee0d3164c75", + "name":"Alibaba_Dragonwell_8.11.12_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.11.12_jdk8u332-ga/Alibaba_Dragonwell_8.11.12_x64_windows.zip" + } + } + } + }, + "8.10.11":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"0cef113ff67338881a77f663b6562b96d181b4ac49cf4a27f65d3f615f6d04e8", + "name":"Alibaba_Dragonwell_8.10.11_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.10.11_jdk8u322-ga/Alibaba_Dragonwell_8.10.11_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"f81a565570ab799c0cb6079b7b9e9011bd3981a94f5db61039daae305cda1609", + "name":"Alibaba_Dragonwell_8.10.11_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.10.11_jdk8u322-ga/Alibaba_Dragonwell_8.10.11_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"c0349cdd651173e83e6ea6eec0eef5b894d54004a71d70126b7f3bcc9038da16", + "name":"Alibaba_Dragonwell_8.10.11_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-8.10.11_jdk8u322-ga/Alibaba_Dragonwell_8.10.11_x64_windows.zip" + } + } + } + }, + "8.13.14":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"87546423fa952bfbf52a4f8aafa89ae579bc498c5d139d8e30063da625aa5a88", + "name":"Alibaba_Dragonwell_Extended_8.13.14_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_aarch64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"1cc019db94abf0b828620565c1118f96ef6884ad394bf96b77786c26771be61c", + "name":"Alibaba_Dragonwell_Standard_8.13.14_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Standard_8.13.14_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"b9219b1b9d97069591b240a78003d0a8e782e84a8b7b1d08749afe7565d4e409", + "name":"Alibaba_Dragonwell_Extended_8.13.14_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"45b20c04ba93f8c25f1dcc75966bec461224ee9f875fdf3f49a09eb4606f3149", + "name":"Alibaba_Dragonwell_Standard_8.13.14_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Standard_8.13.14_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"6b1c6165d5cb807579af7f90f05669edff34499c91d624941921a83f3f52ec62", + "name":"Alibaba_Dragonwell_Extended_8.13.14_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_windows.zip" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"41207bb05da8fa447e7b0d669b0918f3b9d702a8ef84f01cca256e58cef8a44c", + "name":"Alibaba_Dragonwell_Standard_8.13.14_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Standard_8.13.14_x64_windows.zip" + } + } + } + }, + "latest":{ + "linux":{ + "aarch64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"87546423fa952bfbf52a4f8aafa89ae579bc498c5d139d8e30063da625aa5a88", + "name":"Alibaba_Dragonwell_Extended_8.13.14_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_aarch64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"1cc019db94abf0b828620565c1118f96ef6884ad394bf96b77786c26771be61c", + "name":"Alibaba_Dragonwell_Standard_8.13.14_aarch64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Standard_8.13.14_aarch64_linux.tar.gz" + } + }, + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"b9219b1b9d97069591b240a78003d0a8e782e84a8b7b1d08749afe7565d4e409", + "name":"Alibaba_Dragonwell_Extended_8.13.14_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_linux.tar.gz" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"45b20c04ba93f8c25f1dcc75966bec461224ee9f875fdf3f49a09eb4606f3149", + "name":"Alibaba_Dragonwell_Standard_8.13.14_x64_linux.tar.gz", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Standard_8.13.14_x64_linux.tar.gz" + } + } + }, + "windows":{ + "x64":{ + "Extended":{ + "content_type":"application/zip", + "sha256":"6b1c6165d5cb807579af7f90f05669edff34499c91d624941921a83f3f52ec62", + "name":"Alibaba_Dragonwell_Extended_8.13.14_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_windows.zip" + }, + "Standard":{ + "content_type":"application/zip", + "sha256":"41207bb05da8fa447e7b0d669b0918f3b9d702a8ef84f01cca256e58cef8a44c", + "name":"Alibaba_Dragonwell_Standard_8.13.14_x64_windows.zip", + "download_url":"https://github.com/alibaba/dragonwell8/releases/download/dragonwell-standard-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Standard_8.13.14_x64_windows.zip" + } + } + } + } + } +} diff --git a/__tests__/distributors/dragonwell-installer.test.ts b/__tests__/distributors/dragonwell-installer.test.ts new file mode 100644 index 000000000..9af4f60f4 --- /dev/null +++ b/__tests__/distributors/dragonwell-installer.test.ts @@ -0,0 +1,213 @@ +import {HttpClient} from '@actions/http-client'; +import * as semver from 'semver'; +import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer'; +import {IDragonwellAllVersions} from '../../src/distributions/dragonwell/models'; +import * as utils from '../../src/util'; +import os from 'os'; + +import manifestData from '../data/dragonwell.json'; + +describe('getAvailableVersions', () => { + let spyHttpClient: jest.SpyInstance; + let spyUtilGetDownloadArchiveExtension: jest.SpyInstance; + + beforeEach(() => { + spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson'); + spyHttpClient.mockReturnValue({ + statusCode: 200, + headers: {}, + result: manifestData + }); + + spyUtilGetDownloadArchiveExtension = jest.spyOn( + utils, + 'getDownloadArchiveExtension' + ); + spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz'); + }); + + afterEach(() => { + jest.resetAllMocks(); + jest.clearAllMocks(); + jest.restoreAllMocks(); + }); + + const mockPlatform = ( + distribution: DragonwellDistribution, + platform: string + ) => { + distribution['getPlatformOption'] = () => platform; + const mockedExtension = platform == 'windows' ? 'zip' : 'tar.gz'; + spyUtilGetDownloadArchiveExtension.mockReturnValue(mockedExtension); + }; + + describe('getAvailableVersions', () => { + it.each([ + ['8', 'x86', 'linux', 0], + ['8', 'aarch64', 'linux', 33], + ['8.6.6', 'x64', 'linux', 36], + ['8', 'x86', 'anolis', 0], + ['8', 'x86', 'windows', 0], + ['8', 'x86', 'mac', 0], + ['11', 'x64', 'linux', 36], + ['11', 'aarch64', 'linux', 33], + ['17', 'riscv', 'linux', 0], + ['16.0.1', 'x64', 'linux', 36] + ])( + 'load available versions', + async ( + jdkVersion: string, + arch: string, + platform: string, + len: number + ) => { + const distribution = new DragonwellDistribution({ + version: jdkVersion, + architecture: arch, + packageType: 'jdk', + checkLatest: false + }); + mockPlatform(distribution, platform); + + const availableVersions = await distribution['getAvailableVersions'](); + expect(availableVersions).not.toBeNull(); + expect(availableVersions.length).toBe(len); + } + ); + }); + + describe('findPackageForDownload', () => { + it.each([ + [ + '8', + 'linux', + 'x64', + 'https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_linux.tar.gz' + ], + [ + '8', + 'linux', + 'aarch64', + 'https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_aarch64_linux.tar.gz' + ], + [ + '8', + 'windows', + 'x64', + 'https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_windows.zip' + ], + [ + '8.13.14', + 'linux', + 'x64', + 'https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_linux.tar.gz' + ], + [ + '11', + 'linux', + 'x64', + 'https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_linux.tar.gz' + ], + [ + '11', + 'linux', + 'aarch64', + 'https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_aarch64_linux.tar.gz' + ], + [ + '11', + 'windows', + 'x64', + 'https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_windows.zip' + ], + [ + '11', + 'alpine-linux', + 'x64', + 'https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_alpine-linux.tar.gz' + ], + [ + '11.0.17', + 'linux', + 'x64', + 'https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_linux.tar.gz' + ], + [ + '17', + 'linux', + 'x64', + 'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_linux.tar.gz' + ], + [ + '17', + 'linux', + 'aarch64', + 'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_aarch64_linux.tar.gz' + ], + [ + '17', + 'windows', + 'x64', + 'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_windows.zip' + ], + [ + '17', + 'alpine-linux', + 'x64', + 'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_alpine-linux.tar.gz' + ], + [ + '17.0.4', + 'linux', + 'x64', + 'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_linux.tar.gz' + ] + ])( + 'test for download link', + async ( + jdkVersion: string, + platform: string, + arch: string, + expectedLink: string + ) => { + const distribution = new DragonwellDistribution({ + version: jdkVersion, + architecture: arch, + packageType: 'jdk', + checkLatest: false + }); + mockPlatform(distribution, platform); + + const availableVersion = await distribution['findPackageForDownload']( + jdkVersion + ); + expect(availableVersion).not.toBeNull(); + expect(availableVersion.url).toBe(expectedLink); + } + ); + + it.each([ + ['8', 'alpine-linux', 'x64'], + ['8', 'macos', 'aarch64'], + ['11', 'macos', 'aarch64'], + ['17', 'linux', 'riscv'] + ])( + 'test for unsupported version', + async (jdkVersion: string, platform: string, arch: string) => { + const distribution = new DragonwellDistribution({ + version: jdkVersion, + architecture: arch, + packageType: 'jdk', + checkLatest: false + }); + mockPlatform(distribution, platform); + + await expect( + distribution['findPackageForDownload'](jdkVersion) + ).rejects.toThrow( + `Couldn't find any satisfied version for the specified: "${jdkVersion}".` + ); + } + ); + }); +}); diff --git a/dist/setup/index.js b/dist/setup/index.js index 2d095d423..17b44c04a 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -104319,6 +104319,7 @@ const installer_6 = __nccwpck_require__(3613); const installer_7 = __nccwpck_require__(1121); const installer_8 = __nccwpck_require__(4750); const installer_9 = __nccwpck_require__(4298); +const installer_10 = __nccwpck_require__(6132); var JavaDistribution; (function (JavaDistribution) { JavaDistribution["Adopt"] = "adopt"; @@ -104332,6 +104333,7 @@ var JavaDistribution; JavaDistribution["Semeru"] = "semeru"; JavaDistribution["Corretto"] = "corretto"; JavaDistribution["Oracle"] = "oracle"; + JavaDistribution["Dragonwell"] = "dragonwell"; })(JavaDistribution || (JavaDistribution = {})); function getJavaDistribution(distributionName, installerOptions, jdkFile) { switch (distributionName) { @@ -104356,6 +104358,8 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) { return new installer_8.CorrettoDistribution(installerOptions); case JavaDistribution.Oracle: return new installer_9.OracleDistribution(installerOptions); + case JavaDistribution.Dragonwell: + return new installer_10.DragonwellDistribution(installerOptions); default: return null; } @@ -104363,6 +104367,166 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) { exports.getJavaDistribution = getJavaDistribution; +/***/ }), + +/***/ 6132: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DragonwellDistribution = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const tc = __importStar(__nccwpck_require__(7784)); +const fs_1 = __importDefault(__nccwpck_require__(7147)); +const path_1 = __importDefault(__nccwpck_require__(1017)); +const base_installer_1 = __nccwpck_require__(9741); +const util_1 = __nccwpck_require__(2629); +class DragonwellDistribution extends base_installer_1.JavaBase { + constructor(installerOptions) { + super('Dragonwell', installerOptions); + } + findPackageForDownload(version) { + return __awaiter(this, void 0, void 0, function* () { + if (!this.stable) { + throw new Error('Early access versions are not supported'); + } + let majorVersion = version; + if (version.includes('.')) { + const splits = version.split('.'); + majorVersion = splits[0]; + version = splits.length >= 3 ? splits.slice(0, 3).join('.') : version; + } + const edition = majorVersion == '17' ? 'Standard' : 'Extended'; + const availableVersions = yield this.getAvailableVersions(); + const matchedVersions = availableVersions + .filter(item => item.jdk_version == version && item.edition == edition) + .map(item => { + return { + version: item.jdk_version, + url: item.download_link + }; + }); + if (!matchedVersions.length) { + throw new Error(`Couldn't find any satisfied version for the specified: "${version}".`); + } + const resolvedVersion = matchedVersions[0]; + return resolvedVersion; + }); + } + getAvailableVersions() { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const platform = this.getPlatformOption(); + const arch = this.distributionArchitecture(); + const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; + const fetchedDragonwellVersions = (_a = (yield this.http.getJson(availableVersionsUrl)) + .result) !== null && _a !== void 0 ? _a : {}; + if (Object.keys(fetchedDragonwellVersions).length == 0) { + throw Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`); + } + const availableVersions = this.getEligibleAvailableVersions(platform, arch, fetchedDragonwellVersions); + if (core.isDebug()) { + core.startGroup('Print information about available versions'); + core.debug(availableVersions.map(item => item.jdk_version).join(', ')); + core.endGroup(); + } + return availableVersions; + }); + } + downloadTool(javaRelease) { + return __awaiter(this, void 0, void 0, function* () { + core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`); + const javaArchivePath = yield tc.downloadTool(javaRelease.url); + core.info(`Extracting Java archive...`); + const extractedJavaPath = yield util_1.extractJdkFile(javaArchivePath, util_1.getDownloadArchiveExtension()); + const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0]; + const archivePath = path_1.default.join(extractedJavaPath, archiveName); + const version = this.getToolcacheVersionName(javaRelease.version); + const javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture); + return { version: javaRelease.version, path: javaPath }; + }); + } + getEligibleAvailableVersions(platform, arch, dragonwellVersions) { + const eligibleVersions = []; + for (const majorVersion in dragonwellVersions) { + const majorVersionMap = dragonwellVersions[majorVersion]; + for (let jdkVersion in majorVersionMap) { + const jdkVersionMap = majorVersionMap[jdkVersion]; + if (!(platform in jdkVersionMap)) { + continue; + } + const platformMap = jdkVersionMap[platform]; + if (!(arch in platformMap)) { + continue; + } + const archMap = platformMap[arch]; + if (jdkVersion === 'latest') { + jdkVersion = majorVersion; + } + if (jdkVersion.includes('.')) { + const splits = jdkVersion.split('.'); + jdkVersion = + splits.length >= 3 ? splits.slice(0, 3).join('.') : jdkVersion; + } + for (const edition in archMap) { + eligibleVersions.push({ + os: platform, + architecture: arch, + jdk_version: jdkVersion, + checksum: archMap[edition].sha256, + download_link: archMap[edition].download_url, + edition: edition, + image_type: 'jdk' + }); + } + } + } + return eligibleVersions; + } + getPlatformOption() { + switch (process.platform) { + case 'win32': + return 'windows'; + default: + return process.platform; + } + } +} +exports.DragonwellDistribution = DragonwellDistribution; + + /***/ }), /***/ 883: diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 7fbcc3a26..3a5482235 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -7,6 +7,7 @@ - [Microsoft](#Microsoft) - [Amazon Corretto](#Amazon-Corretto) - [Oracle](#Oracle) + - [Alibaba Dragonwell](#Alibaba-Dragonwell) - [Installing custom Java package type](#Installing-custom-Java-package-type) - [Installing custom Java architecture](#Installing-custom-Java-architecture) - [Installing custom Java distribution from local file](#Installing-Java-from-local-file) @@ -124,6 +125,18 @@ steps: - run: java -cp java HelloWorldApp ``` +### Alibaba Dragonwell +**NOTE:** Alibaba Dragonwell only provides jdk. +```yaml +steps: +- uses: actions/checkout@v3 +- uses: actions/setup-java@v3 + with: + distribution: 'dragonwell' + java-version: '8' +- run: java -cp java HelloWorldApp +``` + ## Installing custom Java package type ```yaml steps: diff --git a/src/distributions/distribution-factory.ts b/src/distributions/distribution-factory.ts index 1dd5131af..52a41b5b4 100644 --- a/src/distributions/distribution-factory.ts +++ b/src/distributions/distribution-factory.ts @@ -9,6 +9,7 @@ import {MicrosoftDistributions} from './microsoft/installer'; import {SemeruDistribution} from './semeru/installer'; import {CorrettoDistribution} from './corretto/installer'; import {OracleDistribution} from './oracle/installer'; +import {DragonwellDistribution} from './dragonwell/installer'; enum JavaDistribution { Adopt = 'adopt', @@ -21,7 +22,8 @@ enum JavaDistribution { Microsoft = 'microsoft', Semeru = 'semeru', Corretto = 'corretto', - Oracle = 'oracle' + Oracle = 'oracle', + Dragonwell = 'dragonwell' } export function getJavaDistribution( @@ -60,6 +62,8 @@ export function getJavaDistribution( return new CorrettoDistribution(installerOptions); case JavaDistribution.Oracle: return new OracleDistribution(installerOptions); + case JavaDistribution.Dragonwell: + return new DragonwellDistribution(installerOptions); default: return null; } diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts new file mode 100644 index 000000000..d39b09a75 --- /dev/null +++ b/src/distributions/dragonwell/installer.ts @@ -0,0 +1,163 @@ +import * as core from '@actions/core'; +import * as tc from '@actions/tool-cache'; + +import fs from 'fs'; +import path from 'path'; + +import {JavaBase} from '../base-installer'; +import {extractJdkFile, getDownloadArchiveExtension} from '../../util'; +import {IDragonwellVersions, IDragonwellAllVersions} from './models'; +import { + JavaDownloadRelease, + JavaInstallerOptions, + JavaInstallerResults +} from '../base-models'; + +export class DragonwellDistribution extends JavaBase { + constructor(installerOptions: JavaInstallerOptions) { + super('Dragonwell', installerOptions); + } + + protected async findPackageForDownload( + version: string + ): Promise { + if (!this.stable) { + throw new Error('Early access versions are not supported'); + } + let majorVersion = version; + if (version.includes('.')) { + const splits = version.split('.'); + majorVersion = splits[0]; + version = splits.length >= 3 ? splits.slice(0, 3).join('.') : version; + } + const edition = majorVersion == '17' ? 'Standard' : 'Extended'; + const availableVersions = await this.getAvailableVersions(); + const matchedVersions = availableVersions + .filter(item => item.jdk_version == version && item.edition == edition) + .map(item => { + return { + version: item.jdk_version, + url: item.download_link + } as JavaDownloadRelease; + }); + if (!matchedVersions.length) { + throw new Error( + `Couldn't find any satisfied version for the specified: "${version}".` + ); + } + + const resolvedVersion = matchedVersions[0]; + return resolvedVersion; + } + + private async getAvailableVersions(): Promise { + const platform = this.getPlatformOption(); + const arch = this.distributionArchitecture(); + + const availableVersionsUrl = + 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; + + const fetchedDragonwellVersions = + (await this.http.getJson(availableVersionsUrl)) + .result ?? {}; + if (Object.keys(fetchedDragonwellVersions).length == 0) { + throw Error( + `Couldn't fetch any dragonwell versions from ${availableVersionsUrl}` + ); + } + const availableVersions = this.getEligibleAvailableVersions( + platform, + arch, + fetchedDragonwellVersions + ); + + if (core.isDebug()) { + core.startGroup('Print information about available versions'); + core.debug(availableVersions.map(item => item.jdk_version).join(', ')); + core.endGroup(); + } + + return availableVersions; + } + + protected async downloadTool( + javaRelease: JavaDownloadRelease + ): Promise { + core.info( + `Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...` + ); + const javaArchivePath = await tc.downloadTool(javaRelease.url); + + core.info(`Extracting Java archive...`); + + const extractedJavaPath = await extractJdkFile( + javaArchivePath, + getDownloadArchiveExtension() + ); + + const archiveName = fs.readdirSync(extractedJavaPath)[0]; + const archivePath = path.join(extractedJavaPath, archiveName); + const version = this.getToolcacheVersionName(javaRelease.version); + + const javaPath = await tc.cacheDir( + archivePath, + this.toolcacheFolderName, + version, + this.architecture + ); + + return {version: javaRelease.version, path: javaPath}; + } + + private getEligibleAvailableVersions( + platform: string, + arch: string, + dragonwellVersions: IDragonwellAllVersions + ): IDragonwellVersions[] { + const eligibleVersions: IDragonwellVersions[] = []; + + for (const majorVersion in dragonwellVersions) { + const majorVersionMap = dragonwellVersions[majorVersion]; + for (let jdkVersion in majorVersionMap) { + const jdkVersionMap = majorVersionMap[jdkVersion]; + if (!(platform in jdkVersionMap)) { + continue; + } + const platformMap = jdkVersionMap[platform]; + if (!(arch in platformMap)) { + continue; + } + const archMap = platformMap[arch]; + if (jdkVersion === 'latest') { + jdkVersion = majorVersion; + } + if (jdkVersion.includes('.')) { + const splits = jdkVersion.split('.'); + jdkVersion = + splits.length >= 3 ? splits.slice(0, 3).join('.') : jdkVersion; + } + for (const edition in archMap) { + eligibleVersions.push({ + os: platform, + architecture: arch, + jdk_version: jdkVersion, + checksum: archMap[edition].sha256, + download_link: archMap[edition].download_url, + edition: edition, + image_type: 'jdk' + }); + } + } + } + return eligibleVersions; + } + + private getPlatformOption(): string { + switch (process.platform) { + case 'win32': + return 'windows'; + default: + return process.platform; + } + } +} diff --git a/src/distributions/dragonwell/models.ts b/src/distributions/dragonwell/models.ts new file mode 100644 index 000000000..3d29c8864 --- /dev/null +++ b/src/distributions/dragonwell/models.ts @@ -0,0 +1,26 @@ +export interface IDragonwellAllVersions { + [major: string]: { + [jdk_version: string]: { + [os: string]: { + [arch: string]: { + [edition: string]: { + content_type: string; + sha256: string; + name: string; + download_url: string; + }; + }; + }; + }; + }; +} + +export interface IDragonwellVersions { + os: string; + architecture: string; + jdk_version: string; + checksum: string; + download_link: string; + edition: string; + image_type: string; +} From ef8523a614279f2bd43532b640690a0f241d874c Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 12 Sep 2023 14:41:42 +0200 Subject: [PATCH 02/18] fix: update logic of parsing json file, refactor code --- src/distributions/dragonwell/installer.ts | 70 ++++++++++++++++------- 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index d39b09a75..b815a53f2 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -1,11 +1,12 @@ import * as core from '@actions/core'; import * as tc from '@actions/tool-cache'; +import semver from 'semver'; import fs from 'fs'; import path from 'path'; import {JavaBase} from '../base-installer'; -import {extractJdkFile, getDownloadArchiveExtension} from '../../util'; +import {extractJdkFile, getDownloadArchiveExtension, isVersionSatisfies} from '../../util'; import {IDragonwellVersions, IDragonwellAllVersions} from './models'; import { JavaDownloadRelease, @@ -24,22 +25,20 @@ export class DragonwellDistribution extends JavaBase { if (!this.stable) { throw new Error('Early access versions are not supported'); } - let majorVersion = version; - if (version.includes('.')) { - const splits = version.split('.'); - majorVersion = splits[0]; - version = splits.length >= 3 ? splits.slice(0, 3).join('.') : version; - } - const edition = majorVersion == '17' ? 'Standard' : 'Extended'; + const availableVersions = await this.getAvailableVersions(); + const matchedVersions = availableVersions - .filter(item => item.jdk_version == version && item.edition == edition) + .filter(item => { + return isVersionSatisfies(version, item.jdk_version); + }) .map(item => { return { version: item.jdk_version, url: item.download_link } as JavaDownloadRelease; }); + if (!matchedVersions.length) { throw new Error( `Couldn't find any satisfied version for the specified: "${version}".` @@ -59,17 +58,19 @@ export class DragonwellDistribution extends JavaBase { const fetchedDragonwellVersions = (await this.http.getJson(availableVersionsUrl)) - .result ?? {}; - if (Object.keys(fetchedDragonwellVersions).length == 0) { - throw Error( + .result; + + if (!fetchedDragonwellVersions) { + throw new Error( `Couldn't fetch any dragonwell versions from ${availableVersionsUrl}` ); } - const availableVersions = this.getEligibleAvailableVersions( + + const availableVersions = this.parseVersions( platform, arch, fetchedDragonwellVersions - ); + ); if (core.isDebug()) { core.startGroup('Print information about available versions'); @@ -109,7 +110,7 @@ export class DragonwellDistribution extends JavaBase { return {version: javaRelease.version, path: javaPath}; } - private getEligibleAvailableVersions( + private parseVersions( platform: string, arch: string, dragonwellVersions: IDragonwellAllVersions @@ -119,6 +120,7 @@ export class DragonwellDistribution extends JavaBase { for (const majorVersion in dragonwellVersions) { const majorVersionMap = dragonwellVersions[majorVersion]; for (let jdkVersion in majorVersionMap) { + const jdkVersionMap = majorVersionMap[jdkVersion]; if (!(platform in jdkVersionMap)) { continue; @@ -128,28 +130,52 @@ export class DragonwellDistribution extends JavaBase { continue; } const archMap = platformMap[arch]; + if (jdkVersion === 'latest') { - jdkVersion = majorVersion; + continue; } - if (jdkVersion.includes('.')) { - const splits = jdkVersion.split('.'); - jdkVersion = - splits.length >= 3 ? splits.slice(0, 3).join('.') : jdkVersion; + + if (jdkVersion.split(".").length > 3) { + jdkVersion = this.transformToSemver(jdkVersion); } + for (const edition in archMap) { eligibleVersions.push({ os: platform, architecture: arch, jdk_version: jdkVersion, - checksum: archMap[edition].sha256, + checksum: archMap[edition].sha256 ?? "", download_link: archMap[edition].download_url, edition: edition, image_type: 'jdk' }); + break; // Get the first available link to the JDK. In most cases it should point to the Extended version of JDK, in rare cases like with v17 it points to the Standard version (the only available). } } } - return eligibleVersions; + + const sortedEligibleVersions = this.sortParsedVersions(eligibleVersions); // сортирует версии в порядке убивания + + return sortedEligibleVersions; + } + + // Sorts versions in descending order as by default data in JSON isn't sorted + private sortParsedVersions(eligibleVersions: IDragonwellVersions[]): IDragonwellVersions[] { + const sortedVersions = eligibleVersions.sort((versionObj1, versionObj2) => { + const version1 = versionObj1.jdk_version; + const version2 = versionObj2.jdk_version; + return semver.compareBuild(version1, version2); + }); + return sortedVersions.reverse(); + } + + // Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits). + // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. + private transformToSemver(version: string) { + const splits = version.split('.'); + const versionMainPart = splits.slice(0,3).join("."); + const versionBuildPart = splits.slice(3).join("."); + return `${versionMainPart}+${versionBuildPart}`; } private getPlatformOption(): string { From f3b981e1234dc25604c785dae51062c769618e7c Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 12 Sep 2023 14:44:28 +0200 Subject: [PATCH 03/18] build: rebuild action --- dist/setup/index.js | 57 ++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 17b44c04a..d6ebb511a 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -104409,6 +104409,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DragonwellDistribution = void 0; const core = __importStar(__nccwpck_require__(2186)); const tc = __importStar(__nccwpck_require__(7784)); +const semver_1 = __importDefault(__nccwpck_require__(1383)); const fs_1 = __importDefault(__nccwpck_require__(7147)); const path_1 = __importDefault(__nccwpck_require__(1017)); const base_installer_1 = __nccwpck_require__(9741); @@ -104422,16 +104423,11 @@ class DragonwellDistribution extends base_installer_1.JavaBase { if (!this.stable) { throw new Error('Early access versions are not supported'); } - let majorVersion = version; - if (version.includes('.')) { - const splits = version.split('.'); - majorVersion = splits[0]; - version = splits.length >= 3 ? splits.slice(0, 3).join('.') : version; - } - const edition = majorVersion == '17' ? 'Standard' : 'Extended'; const availableVersions = yield this.getAvailableVersions(); const matchedVersions = availableVersions - .filter(item => item.jdk_version == version && item.edition == edition) + .filter(item => { + return util_1.isVersionSatisfies(version, item.jdk_version); + }) .map(item => { return { version: item.jdk_version, @@ -104446,17 +104442,16 @@ class DragonwellDistribution extends base_installer_1.JavaBase { }); } getAvailableVersions() { - var _a; return __awaiter(this, void 0, void 0, function* () { const platform = this.getPlatformOption(); const arch = this.distributionArchitecture(); const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; - const fetchedDragonwellVersions = (_a = (yield this.http.getJson(availableVersionsUrl)) - .result) !== null && _a !== void 0 ? _a : {}; - if (Object.keys(fetchedDragonwellVersions).length == 0) { - throw Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`); + const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl)) + .result; + if (!fetchedDragonwellVersions) { + throw new Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`); } - const availableVersions = this.getEligibleAvailableVersions(platform, arch, fetchedDragonwellVersions); + const availableVersions = this.parseVersions(platform, arch, fetchedDragonwellVersions); if (core.isDebug()) { core.startGroup('Print information about available versions'); core.debug(availableVersions.map(item => item.jdk_version).join(', ')); @@ -104478,7 +104473,8 @@ class DragonwellDistribution extends base_installer_1.JavaBase { return { version: javaRelease.version, path: javaPath }; }); } - getEligibleAvailableVersions(platform, arch, dragonwellVersions) { + parseVersions(platform, arch, dragonwellVersions) { + var _a; const eligibleVersions = []; for (const majorVersion in dragonwellVersions) { const majorVersionMap = dragonwellVersions[majorVersion]; @@ -104493,27 +104489,44 @@ class DragonwellDistribution extends base_installer_1.JavaBase { } const archMap = platformMap[arch]; if (jdkVersion === 'latest') { - jdkVersion = majorVersion; + continue; } - if (jdkVersion.includes('.')) { - const splits = jdkVersion.split('.'); - jdkVersion = - splits.length >= 3 ? splits.slice(0, 3).join('.') : jdkVersion; + if (jdkVersion.split(".").length > 3) { + jdkVersion = this.transformToSemver(jdkVersion); } for (const edition in archMap) { eligibleVersions.push({ os: platform, architecture: arch, jdk_version: jdkVersion, - checksum: archMap[edition].sha256, + checksum: (_a = archMap[edition].sha256) !== null && _a !== void 0 ? _a : "", download_link: archMap[edition].download_url, edition: edition, image_type: 'jdk' }); + break; // Get the first available link to the JDK. In most cases it should point to the Extended version of JDK, in rare cases like with v17 it points to the Standard version (the only available). } } } - return eligibleVersions; + const sortedEligibleVersions = this.sortParsedVersions(eligibleVersions); // сортирует версии в порядке убивания + return sortedEligibleVersions; + } + // Sorts versions in descending order as by default data in JSON isn't sorted + sortParsedVersions(eligibleVersions) { + const sortedVersions = eligibleVersions.sort((versionObj1, versionObj2) => { + const version1 = versionObj1.jdk_version; + const version2 = versionObj2.jdk_version; + return semver_1.default.compareBuild(version1, version2); + }); + return sortedVersions.reverse(); + } + // Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits). + // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. + transformToSemver(version) { + const splits = version.split('.'); + const versionMainPart = splits.slice(0, 3).join("."); + const versionBuildPart = splits.slice(3).join("."); + return `${versionMainPart}+${versionBuildPart}`; } getPlatformOption() { switch (process.platform) { From e51fc6409d60cc36ce9f6791cbea1f26be27e141 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 12 Sep 2023 14:52:01 +0200 Subject: [PATCH 04/18] chore: update error message --- src/distributions/dragonwell/installer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index b815a53f2..f899d71bd 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -41,7 +41,7 @@ export class DragonwellDistribution extends JavaBase { if (!matchedVersions.length) { throw new Error( - `Couldn't find any satisfied version for the specified: "${version}".` + `Couldn't find any satisfied version for the specified java-version: "${version}".` ); } From 253a04374f7700e31f83ff828879ee1dd63202f5 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 12 Sep 2023 14:58:04 +0200 Subject: [PATCH 05/18] build: rebuild action --- dist/setup/index.js | 6 +++--- src/distributions/dragonwell/installer.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index d6ebb511a..d87effa92 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -104435,7 +104435,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase { }; }); if (!matchedVersions.length) { - throw new Error(`Couldn't find any satisfied version for the specified: "${version}".`); + throw new Error(`Couldn't find any satisfied version for the specified java-version: "${version}".`); } const resolvedVersion = matchedVersions[0]; return resolvedVersion; @@ -104508,8 +104508,8 @@ class DragonwellDistribution extends base_installer_1.JavaBase { } } } - const sortedEligibleVersions = this.sortParsedVersions(eligibleVersions); // сортирует версии в порядке убивания - return sortedEligibleVersions; + const sortedVersions = this.sortParsedVersions(eligibleVersions); + return sortedVersions; } // Sorts versions in descending order as by default data in JSON isn't sorted sortParsedVersions(eligibleVersions) { diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index f899d71bd..af7cfc894 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -154,9 +154,9 @@ export class DragonwellDistribution extends JavaBase { } } - const sortedEligibleVersions = this.sortParsedVersions(eligibleVersions); // сортирует версии в порядке убивания + const sortedVersions = this.sortParsedVersions(eligibleVersions); - return sortedEligibleVersions; + return sortedVersions; } // Sorts versions in descending order as by default data in JSON isn't sorted From 9799c80ea4c231dad0b1a821ebb6eb3a7d16fdd6 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Wed, 13 Sep 2023 11:39:20 +0200 Subject: [PATCH 06/18] tests: fix unit tests, add e2e tests --- .github/workflows/e2e-versions.yml | 32 +++++++++++++++++-- .../distributors/dragonwell-installer.test.ts | 21 ++++++------ 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/.github/workflows/e2e-versions.yml b/.github/workflows/e2e-versions.yml index 7af524ef8..a1166e31a 100644 --- a/.github/workflows/e2e-versions.yml +++ b/.github/workflows/e2e-versions.yml @@ -29,12 +29,17 @@ jobs: 'liberica', 'microsoft', 'semeru', - 'corretto' + 'corretto', + 'dragonwell' ] # internally 'adopt-hotspot' is the same as 'adopt' version: ['8', '11', '16'] exclude: - distribution: microsoft version: 8 + - distribution: dragonwell + os: macos-latest + - distribution: dragonwell + version: 16 include: - distribution: oracle os: macos-latest @@ -45,6 +50,12 @@ jobs: - distribution: oracle os: ubuntu-latest version: 19 + - distribution: dragonwell + os: windows-latest + version: 17 + - distribution: dragonwell + os: ubuntu-latest + version: 17 steps: - name: Checkout uses: actions/checkout@v3 @@ -75,6 +86,15 @@ jobs: - distribution: oracle os: ubuntu-latest version: '19.0.1' + - distribution: dragonwell + os: ubuntu-latest + version: '11.0' + - distribution: dragonwell + os: ubuntu-latest + version: '8.13.14' + - distribution: dragonwell + os: ubuntu-latest + version: '11.0.13+9' steps: - name: Checkout uses: actions/checkout@v3 @@ -96,7 +116,10 @@ jobs: fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] - distribution: ['temurin', 'zulu', 'liberica'] + distribution: ['temurin', 'zulu', 'liberica', 'dragonwell'] + exclude: + - distribution: dragonwell + os: macos-latest steps: - name: Checkout uses: actions/checkout@v3 @@ -119,7 +142,10 @@ jobs: fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] - distribution: ['temurin', 'zulu', 'liberica'] + distribution: ['temurin', 'zulu', 'liberica', 'dragonwell'] + exclude: + - distribution: dragonwell + os: macos-latest steps: - name: Checkout uses: actions/checkout@v3 diff --git a/__tests__/distributors/dragonwell-installer.test.ts b/__tests__/distributors/dragonwell-installer.test.ts index 9af4f60f4..3e5b98b05 100644 --- a/__tests__/distributors/dragonwell-installer.test.ts +++ b/__tests__/distributors/dragonwell-installer.test.ts @@ -1,9 +1,6 @@ import {HttpClient} from '@actions/http-client'; -import * as semver from 'semver'; import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer'; -import {IDragonwellAllVersions} from '../../src/distributions/dragonwell/models'; import * as utils from '../../src/util'; -import os from 'os'; import manifestData from '../data/dragonwell.json'; @@ -44,17 +41,17 @@ describe('getAvailableVersions', () => { describe('getAvailableVersions', () => { it.each([ ['8', 'x86', 'linux', 0], - ['8', 'aarch64', 'linux', 33], - ['8.6.6', 'x64', 'linux', 36], + ['8', 'aarch64', 'linux', 24], + ['8.6.6', 'x64', 'linux', 27], ['8', 'x86', 'anolis', 0], ['8', 'x86', 'windows', 0], ['8', 'x86', 'mac', 0], - ['11', 'x64', 'linux', 36], - ['11', 'aarch64', 'linux', 33], + ['11', 'x64', 'linux', 27], + ['11', 'aarch64', 'linux', 24], ['17', 'riscv', 'linux', 0], - ['16.0.1', 'x64', 'linux', 36] + ['16.0.1', 'x64', 'linux', 27] ])( - 'load available versions', + 'should get right number of available versions from JSON', async ( jdkVersion: string, arch: string, @@ -163,7 +160,7 @@ describe('getAvailableVersions', () => { 'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_linux.tar.gz' ] ])( - 'test for download link', + 'should return proper link according to the specified java-version, platform and arch', async ( jdkVersion: string, platform: string, @@ -192,7 +189,7 @@ describe('getAvailableVersions', () => { ['11', 'macos', 'aarch64'], ['17', 'linux', 'riscv'] ])( - 'test for unsupported version', + 'should throw when required version of JDK can not be found in the JSON', async (jdkVersion: string, platform: string, arch: string) => { const distribution = new DragonwellDistribution({ version: jdkVersion, @@ -205,7 +202,7 @@ describe('getAvailableVersions', () => { await expect( distribution['findPackageForDownload'](jdkVersion) ).rejects.toThrow( - `Couldn't find any satisfied version for the specified: "${jdkVersion}".` + `Couldn't find any satisfied version for the specified java-version: "${jdkVersion}".` ); } ); From 8036ba56572997901a63cca10d7f8e56101b042c Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Wed, 13 Sep 2023 14:13:13 +0200 Subject: [PATCH 07/18] chore: prettier, lint and rebuild solution --- dist/setup/index.js | 11 +++---- src/distributions/dragonwell/installer.ts | 37 +++++++++++++---------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 042f980a9..57e8e2790 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102681,8 +102681,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase { const platform = this.getPlatformOption(); const arch = this.distributionArchitecture(); const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; - const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl)) - .result; + const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl)).result; if (!fetchedDragonwellVersions) { throw new Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`); } @@ -102726,7 +102725,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase { if (jdkVersion === 'latest') { continue; } - if (jdkVersion.split(".").length > 3) { + if (jdkVersion.split('.').length > 3) { jdkVersion = this.transformToSemver(jdkVersion); } for (const edition in archMap) { @@ -102734,7 +102733,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase { os: platform, architecture: arch, jdk_version: jdkVersion, - checksum: (_a = archMap[edition].sha256) !== null && _a !== void 0 ? _a : "", + checksum: (_a = archMap[edition].sha256) !== null && _a !== void 0 ? _a : '', download_link: archMap[edition].download_url, edition: edition, image_type: 'jdk' @@ -102759,8 +102758,8 @@ class DragonwellDistribution extends base_installer_1.JavaBase { // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. transformToSemver(version) { const splits = version.split('.'); - const versionMainPart = splits.slice(0, 3).join("."); - const versionBuildPart = splits.slice(3).join("."); + const versionMainPart = splits.slice(0, 3).join('.'); + const versionBuildPart = splits.slice(3).join('.'); return `${versionMainPart}+${versionBuildPart}`; } getPlatformOption() { diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index af7cfc894..35a71c914 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -6,7 +6,11 @@ import fs from 'fs'; import path from 'path'; import {JavaBase} from '../base-installer'; -import {extractJdkFile, getDownloadArchiveExtension, isVersionSatisfies} from '../../util'; +import { + extractJdkFile, + getDownloadArchiveExtension, + isVersionSatisfies +} from '../../util'; import {IDragonwellVersions, IDragonwellAllVersions} from './models'; import { JavaDownloadRelease, @@ -25,13 +29,13 @@ export class DragonwellDistribution extends JavaBase { if (!this.stable) { throw new Error('Early access versions are not supported'); } - + const availableVersions = await this.getAvailableVersions(); const matchedVersions = availableVersions .filter(item => { return isVersionSatisfies(version, item.jdk_version); - }) + }) .map(item => { return { version: item.jdk_version, @@ -56,21 +60,21 @@ export class DragonwellDistribution extends JavaBase { const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; - const fetchedDragonwellVersions = - (await this.http.getJson(availableVersionsUrl)) - .result; + const fetchedDragonwellVersions = ( + await this.http.getJson(availableVersionsUrl) + ).result; - if (!fetchedDragonwellVersions) { + if (!fetchedDragonwellVersions) { throw new Error( `Couldn't fetch any dragonwell versions from ${availableVersionsUrl}` ); } - + const availableVersions = this.parseVersions( platform, arch, fetchedDragonwellVersions - ); + ); if (core.isDebug()) { core.startGroup('Print information about available versions'); @@ -120,7 +124,6 @@ export class DragonwellDistribution extends JavaBase { for (const majorVersion in dragonwellVersions) { const majorVersionMap = dragonwellVersions[majorVersion]; for (let jdkVersion in majorVersionMap) { - const jdkVersionMap = majorVersionMap[jdkVersion]; if (!(platform in jdkVersionMap)) { continue; @@ -135,7 +138,7 @@ export class DragonwellDistribution extends JavaBase { continue; } - if (jdkVersion.split(".").length > 3) { + if (jdkVersion.split('.').length > 3) { jdkVersion = this.transformToSemver(jdkVersion); } @@ -144,7 +147,7 @@ export class DragonwellDistribution extends JavaBase { os: platform, architecture: arch, jdk_version: jdkVersion, - checksum: archMap[edition].sha256 ?? "", + checksum: archMap[edition].sha256 ?? '', download_link: archMap[edition].download_url, edition: edition, image_type: 'jdk' @@ -155,12 +158,14 @@ export class DragonwellDistribution extends JavaBase { } const sortedVersions = this.sortParsedVersions(eligibleVersions); - + return sortedVersions; } // Sorts versions in descending order as by default data in JSON isn't sorted - private sortParsedVersions(eligibleVersions: IDragonwellVersions[]): IDragonwellVersions[] { + private sortParsedVersions( + eligibleVersions: IDragonwellVersions[] + ): IDragonwellVersions[] { const sortedVersions = eligibleVersions.sort((versionObj1, versionObj2) => { const version1 = versionObj1.jdk_version; const version2 = versionObj2.jdk_version; @@ -173,8 +178,8 @@ export class DragonwellDistribution extends JavaBase { // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. private transformToSemver(version: string) { const splits = version.split('.'); - const versionMainPart = splits.slice(0,3).join("."); - const versionBuildPart = splits.slice(3).join("."); + const versionMainPart = splits.slice(0, 3).join('.'); + const versionBuildPart = splits.slice(3).join('.'); return `${versionMainPart}+${versionBuildPart}`; } From 2c43893557f3b5281f5c11d9a369bbd656dabd61 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Wed, 13 Sep 2023 15:54:22 +0200 Subject: [PATCH 08/18] feat: add check for the package type, update unit tests --- .../distributors/dragonwell-installer.test.ts | 17 +++++++++++++++++ dist/setup/index.js | 3 +++ src/distributions/dragonwell/installer.ts | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/__tests__/distributors/dragonwell-installer.test.ts b/__tests__/distributors/dragonwell-installer.test.ts index 3e5b98b05..95518b000 100644 --- a/__tests__/distributors/dragonwell-installer.test.ts +++ b/__tests__/distributors/dragonwell-installer.test.ts @@ -206,5 +206,22 @@ describe('getAvailableVersions', () => { ); } ); + + it('should throw when required package type is not jdk', async () => { + const jdkVersion = '17'; + const arch = 'x64'; + const platform = 'linux'; + const distribution = new DragonwellDistribution({ + version: jdkVersion, + architecture: arch, + packageType: 'jre', + checkLatest: false + }); + mockPlatform(distribution, platform); + + await expect( + distribution['findPackageForDownload'](jdkVersion) + ).rejects.toThrow('Dragonwell provides only the `jdk` package type'); + }); }); }); diff --git a/dist/setup/index.js b/dist/setup/index.js index 57e8e2790..bf0674d8d 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102658,6 +102658,9 @@ class DragonwellDistribution extends base_installer_1.JavaBase { if (!this.stable) { throw new Error('Early access versions are not supported'); } + if (this.packageType !== 'jdk') { + throw new Error('Dragonwell provides only the `jdk` package type'); + } const availableVersions = yield this.getAvailableVersions(); const matchedVersions = availableVersions .filter(item => { diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 35a71c914..5a2f834cf 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -30,6 +30,10 @@ export class DragonwellDistribution extends JavaBase { throw new Error('Early access versions are not supported'); } + if (this.packageType !== 'jdk') { + throw new Error('Dragonwell provides only the `jdk` package type'); + } + const availableVersions = await this.getAvailableVersions(); const matchedVersions = availableVersions From 5f1dbfa8afc8029be251a652241f12a76e1f8c11 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Wed, 13 Sep 2023 16:21:23 +0200 Subject: [PATCH 09/18] tests: update e2e tests --- .github/workflows/e2e-versions.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/e2e-versions.yml b/.github/workflows/e2e-versions.yml index f6f7c6899..c83e30b88 100644 --- a/.github/workflows/e2e-versions.yml +++ b/.github/workflows/e2e-versions.yml @@ -90,9 +90,6 @@ jobs: - distribution: dragonwell os: ubuntu-latest version: '11.0' - - distribution: dragonwell - os: ubuntu-latest - version: '8.13.14' - distribution: dragonwell os: ubuntu-latest version: '11.0.13+9' From 3888c0a066ce1433cd7306899f136c271b98de1b Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Fri, 15 Sep 2023 10:10:53 +0200 Subject: [PATCH 10/18] tests: remove excess entries from e2e tests --- .github/workflows/e2e-versions.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/e2e-versions.yml b/.github/workflows/e2e-versions.yml index c83e30b88..87808e4f2 100644 --- a/.github/workflows/e2e-versions.yml +++ b/.github/workflows/e2e-versions.yml @@ -38,8 +38,6 @@ jobs: version: 8 - distribution: dragonwell os: macos-latest - - distribution: dragonwell - version: 16 include: - distribution: oracle os: macos-latest @@ -50,12 +48,6 @@ jobs: - distribution: oracle os: ubuntu-latest version: 20 - - distribution: dragonwell - os: windows-latest - version: 17 - - distribution: dragonwell - os: ubuntu-latest - version: 17 steps: - name: Checkout From cf4e1422a00f261bdaf87904e8ae63ed1d2ad2dd Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Mon, 18 Sep 2023 15:53:34 +0200 Subject: [PATCH 11/18] feat: update logic of getting json file --- dist/setup/index.js | 14 ++++++++++++-- src/distributions/dragonwell/installer.ts | 21 ++++++++++++++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index bf0674d8d..ca30589bf 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102683,8 +102683,18 @@ class DragonwellDistribution extends base_installer_1.JavaBase { return __awaiter(this, void 0, void 0, function* () { const platform = this.getPlatformOption(); const arch = this.distributionArchitecture(); - const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; - const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl)).result; + const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; + const owner = 'dragonwell-releng'; + const repository = 'dragonwell-setup-java'; + const branch = 'main'; + const filePath = 'releases.json'; + const availableVersionsUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; + const headers = { + authorization: auth, + accept: 'application/vnd.github.VERSION.raw' + }; + const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl, headers)).result; if (!fetchedDragonwellVersions) { throw new Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`); } diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 5a2f834cf..34e47bc74 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -4,6 +4,7 @@ import semver from 'semver'; import fs from 'fs'; import path from 'path'; +import {OutgoingHttpHeaders} from 'http'; import {JavaBase} from '../base-installer'; import { @@ -61,11 +62,25 @@ export class DragonwellDistribution extends JavaBase { const platform = this.getPlatformOption(); const arch = this.distributionArchitecture(); - const availableVersionsUrl = - 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; + const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; + const owner = 'dragonwell-releng'; + const repository = 'dragonwell-setup-java'; + const branch = 'main'; + const filePath = 'releases.json'; + + const availableVersionsUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; + + const headers: OutgoingHttpHeaders = { + authorization: auth, + accept: 'application/vnd.github.VERSION.raw' + }; const fetchedDragonwellVersions = ( - await this.http.getJson(availableVersionsUrl) + await this.http.getJson( + availableVersionsUrl, + headers + ) ).result; if (!fetchedDragonwellVersions) { From 6ba9d9dd2cf69598a2e222bce45ad12fb62ccae0 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 19 Sep 2023 11:44:45 +0200 Subject: [PATCH 12/18] feat: add logic for backuping getting json --- dist/setup/index.js | 60 ++++++++++++----- src/distributions/dragonwell/installer.ts | 78 ++++++++++++++++------- 2 files changed, 101 insertions(+), 37 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index ca30589bf..959b4a044 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102683,22 +102683,14 @@ class DragonwellDistribution extends base_installer_1.JavaBase { return __awaiter(this, void 0, void 0, function* () { const platform = this.getPlatformOption(); const arch = this.distributionArchitecture(); - const token = core.getInput('token'); - const auth = !token ? undefined : `token ${token}`; - const owner = 'dragonwell-releng'; - const repository = 'dragonwell-setup-java'; - const branch = 'main'; - const filePath = 'releases.json'; - const availableVersionsUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; - const headers = { - authorization: auth, - accept: 'application/vnd.github.VERSION.raw' - }; - const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl, headers)).result; - if (!fetchedDragonwellVersions) { - throw new Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`); + let fetchedDragonwellJson = yield this.fetchJsonFromPrimaryUrl(); + if (!fetchedDragonwellJson) { + fetchedDragonwellJson = yield this.fetchJsonFromBackupUrl(); } - const availableVersions = this.parseVersions(platform, arch, fetchedDragonwellVersions); + if (!fetchedDragonwellJson) { + throw new Error(`Couldn't fetch any dragonwell versions from both primary and backup urls`); + } + const availableVersions = this.parseVersions(platform, arch, fetchedDragonwellJson); if (core.isDebug()) { core.startGroup('Print information about available versions'); core.debug(availableVersions.map(item => item.jdk_version).join(', ')); @@ -102783,6 +102775,44 @@ class DragonwellDistribution extends base_installer_1.JavaBase { return process.platform; } } + fetchJsonFromPrimaryUrl() { + return __awaiter(this, void 0, void 0, function* () { + const primaryUrl = 'https://dragonwell-jjk.io/map_with_checksum.json'; + try { + core.debug(`Trying to fetch available versions info from the primary url: ${primaryUrl}`); + const fetchedDragonwellJson = (yield this.http.getJson(primaryUrl)).result; + return fetchedDragonwellJson; + } + catch (err) { + core.debug(`Fetching from the primary link: ${primaryUrl} ended with the error: ${err.message}`); + return null; + } + }); + } + fetchJsonFromBackupUrl() { + return __awaiter(this, void 0, void 0, function* () { + const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; + const owner = 'dragonwell-releng'; + const repository = 'dragonwell-setup-java'; + const branch = 'main'; + const filePath = 'releases.json'; + const backupUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; + const headers = { + authorization: auth, + accept: 'application/vnd.github.VERSION.raw' + }; + try { + core.debug(`Trying to fetch available versions from the backup url: ${backupUrl}`); + const fetchedDragonwellVersions = (yield this.http.getJson(backupUrl, headers)).result; + return fetchedDragonwellVersions; + } + catch (err) { + core.debug(`Fetching from the backup url: ${backupUrl} ended with the error: ${err.message}`); + return null; + } + }); + } } exports.DragonwellDistribution = DragonwellDistribution; diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 34e47bc74..79914c4b5 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -62,37 +62,22 @@ export class DragonwellDistribution extends JavaBase { const platform = this.getPlatformOption(); const arch = this.distributionArchitecture(); - const token = core.getInput('token'); - const auth = !token ? undefined : `token ${token}`; - const owner = 'dragonwell-releng'; - const repository = 'dragonwell-setup-java'; - const branch = 'main'; - const filePath = 'releases.json'; - - const availableVersionsUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; - - const headers: OutgoingHttpHeaders = { - authorization: auth, - accept: 'application/vnd.github.VERSION.raw' - }; + let fetchedDragonwellJson = await this.fetchJsonFromPrimaryUrl(); - const fetchedDragonwellVersions = ( - await this.http.getJson( - availableVersionsUrl, - headers - ) - ).result; + if (!fetchedDragonwellJson) { + fetchedDragonwellJson = await this.fetchJsonFromBackupUrl(); + } - if (!fetchedDragonwellVersions) { + if (!fetchedDragonwellJson) { throw new Error( - `Couldn't fetch any dragonwell versions from ${availableVersionsUrl}` + `Couldn't fetch any dragonwell versions from both primary and backup urls` ); } const availableVersions = this.parseVersions( platform, arch, - fetchedDragonwellVersions + fetchedDragonwellJson ); if (core.isDebug()) { @@ -210,4 +195,53 @@ export class DragonwellDistribution extends JavaBase { return process.platform; } } + + private async fetchJsonFromPrimaryUrl(): Promise { + const primaryUrl = 'https://dragonwell-jjk.io/map_with_checksum.json'; + try { + core.debug( + `Trying to fetch available versions info from the primary url: ${primaryUrl}` + ); + const fetchedDragonwellJson = ( + await this.http.getJson(primaryUrl) + ).result; + return fetchedDragonwellJson; + } catch (err) { + core.debug( + `Fetching from the primary link: ${primaryUrl} ended with the error: ${err.message}` + ); + return null; + } + } + + private async fetchJsonFromBackupUrl(): Promise { + const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; + const owner = 'dragonwell-releng'; + const repository = 'dragonwell-setup-java'; + const branch = 'main'; + const filePath = 'releases.json'; + + const backupUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; + + const headers: OutgoingHttpHeaders = { + authorization: auth, + accept: 'application/vnd.github.VERSION.raw' + }; + + try { + core.debug( + `Trying to fetch available versions from the backup url: ${backupUrl}` + ); + const fetchedDragonwellVersions = ( + await this.http.getJson(backupUrl, headers) + ).result; + return fetchedDragonwellVersions; + } catch (err) { + core.debug( + `Fetching from the backup url: ${backupUrl} ended with the error: ${err.message}` + ); + return null; + } + } } From b93179bb9101acf82cc9d42b8af320da3395c0bf Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 19 Sep 2023 11:47:19 +0200 Subject: [PATCH 13/18] chore: update wordings --- dist/setup/index.js | 6 +++--- src/distributions/dragonwell/installer.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 959b4a044..a0dba7f90 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102784,7 +102784,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase { return fetchedDragonwellJson; } catch (err) { - core.debug(`Fetching from the primary link: ${primaryUrl} ended with the error: ${err.message}`); + core.debug(`Fetching from the primary link: ${primaryUrl} ended up with the error: ${err.message}`); return null; } }); @@ -102803,12 +102803,12 @@ class DragonwellDistribution extends base_installer_1.JavaBase { accept: 'application/vnd.github.VERSION.raw' }; try { - core.debug(`Trying to fetch available versions from the backup url: ${backupUrl}`); + core.debug(`Trying to fetch available versions info from the backup url: ${backupUrl}`); const fetchedDragonwellVersions = (yield this.http.getJson(backupUrl, headers)).result; return fetchedDragonwellVersions; } catch (err) { - core.debug(`Fetching from the backup url: ${backupUrl} ended with the error: ${err.message}`); + core.debug(`Fetching from the backup url: ${backupUrl} ended up with the error: ${err.message}`); return null; } }); diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 79914c4b5..5bb99bf13 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -208,7 +208,7 @@ export class DragonwellDistribution extends JavaBase { return fetchedDragonwellJson; } catch (err) { core.debug( - `Fetching from the primary link: ${primaryUrl} ended with the error: ${err.message}` + `Fetching from the primary link: ${primaryUrl} ended up with the error: ${err.message}` ); return null; } @@ -231,7 +231,7 @@ export class DragonwellDistribution extends JavaBase { try { core.debug( - `Trying to fetch available versions from the backup url: ${backupUrl}` + `Trying to fetch available versions info from the backup url: ${backupUrl}` ); const fetchedDragonwellVersions = ( await this.http.getJson(backupUrl, headers) @@ -239,7 +239,7 @@ export class DragonwellDistribution extends JavaBase { return fetchedDragonwellVersions; } catch (err) { core.debug( - `Fetching from the backup url: ${backupUrl} ended with the error: ${err.message}` + `Fetching from the backup url: ${backupUrl} ended up with the error: ${err.message}` ); return null; } From 4f1c6f6018f2d43ec035151e6844b74ad31a915c Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 19 Sep 2023 11:53:33 +0200 Subject: [PATCH 14/18] chore: fix typos, add additional logs --- dist/setup/index.js | 5 +++-- src/distributions/dragonwell/installer.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index a0dba7f90..f2f3822c3 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102688,8 +102688,9 @@ class DragonwellDistribution extends base_installer_1.JavaBase { fetchedDragonwellJson = yield this.fetchJsonFromBackupUrl(); } if (!fetchedDragonwellJson) { - throw new Error(`Couldn't fetch any dragonwell versions from both primary and backup urls`); + throw new Error(`Couldn't fetch dragonwell versions information from both primary and backup urls`); } + core.debug('Successfully fetched information about available dragonwell versions'); const availableVersions = this.parseVersions(platform, arch, fetchedDragonwellJson); if (core.isDebug()) { core.startGroup('Print information about available versions'); @@ -102777,7 +102778,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase { } fetchJsonFromPrimaryUrl() { return __awaiter(this, void 0, void 0, function* () { - const primaryUrl = 'https://dragonwell-jjk.io/map_with_checksum.json'; + const primaryUrl = 'https://dragonwell-jdk.io/map_with_checksum.json'; try { core.debug(`Trying to fetch available versions info from the primary url: ${primaryUrl}`); const fetchedDragonwellJson = (yield this.http.getJson(primaryUrl)).result; diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 5bb99bf13..184bc2879 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -70,10 +70,14 @@ export class DragonwellDistribution extends JavaBase { if (!fetchedDragonwellJson) { throw new Error( - `Couldn't fetch any dragonwell versions from both primary and backup urls` + `Couldn't fetch dragonwell versions information from both primary and backup urls` ); } + core.debug( + 'Successfully fetched information about available dragonwell versions' + ); + const availableVersions = this.parseVersions( platform, arch, @@ -197,7 +201,7 @@ export class DragonwellDistribution extends JavaBase { } private async fetchJsonFromPrimaryUrl(): Promise { - const primaryUrl = 'https://dragonwell-jjk.io/map_with_checksum.json'; + const primaryUrl = 'https://dragonwell-jdk.io/map_with_checksum.json'; try { core.debug( `Trying to fetch available versions info from the primary url: ${primaryUrl}` From 8afb584024d492c5075267d9963547a0e2ab052c Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 19 Sep 2023 14:31:18 +0200 Subject: [PATCH 15/18] fix: fix review points --- src/distributions/dragonwell/installer.ts | 9 ++------- src/distributions/microsoft/installer.ts | 14 ++++++-------- src/util.ts | 11 +++++++++++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 184bc2879..8fb188e0f 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -4,12 +4,12 @@ import semver from 'semver'; import fs from 'fs'; import path from 'path'; -import {OutgoingHttpHeaders} from 'http'; import {JavaBase} from '../base-installer'; import { extractJdkFile, getDownloadArchiveExtension, + getGitHubHttpHeaders, isVersionSatisfies } from '../../util'; import {IDragonwellVersions, IDragonwellAllVersions} from './models'; @@ -219,8 +219,6 @@ export class DragonwellDistribution extends JavaBase { } private async fetchJsonFromBackupUrl(): Promise { - const token = core.getInput('token'); - const auth = !token ? undefined : `token ${token}`; const owner = 'dragonwell-releng'; const repository = 'dragonwell-setup-java'; const branch = 'main'; @@ -228,10 +226,7 @@ export class DragonwellDistribution extends JavaBase { const backupUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; - const headers: OutgoingHttpHeaders = { - authorization: auth, - accept: 'application/vnd.github.VERSION.raw' - }; + const headers = getGitHubHttpHeaders(); try { core.debug( diff --git a/src/distributions/microsoft/installer.ts b/src/distributions/microsoft/installer.ts index 8b6a7a38e..c56fa9325 100644 --- a/src/distributions/microsoft/installer.ts +++ b/src/distributions/microsoft/installer.ts @@ -4,10 +4,13 @@ import { JavaInstallerOptions, JavaInstallerResults } from '../base-models'; -import {extractJdkFile, getDownloadArchiveExtension} from '../../util'; +import { + extractJdkFile, + getDownloadArchiveExtension, + getGitHubHttpHeaders +} from '../../util'; import * as core from '@actions/core'; import * as tc from '@actions/tool-cache'; -import {OutgoingHttpHeaders} from 'http'; import fs from 'fs'; import path from 'path'; import {ITypedResponse} from '@actions/http-client/interfaces'; @@ -85,8 +88,6 @@ export class MicrosoftDistributions extends JavaBase { private async getAvailableVersions(): Promise { // TODO get these dynamically! // We will need Microsoft to add an endpoint where we can query for versions. - const token = core.getInput('token'); - const auth = !token ? undefined : `token ${token}`; const owner = 'actions'; const repository = 'setup-java'; const branch = 'main'; @@ -96,10 +97,7 @@ export class MicrosoftDistributions extends JavaBase { let releases: tc.IToolRelease[] | null = null; const fileUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; - const headers: OutgoingHttpHeaders = { - authorization: auth, - accept: 'application/vnd.github.VERSION.raw' - }; + const headers = getGitHubHttpHeaders(); let response: ITypedResponse | null = null; diff --git a/src/util.ts b/src/util.ts index fe1078d92..8fac69316 100644 --- a/src/util.ts +++ b/src/util.ts @@ -7,6 +7,7 @@ import * as core from '@actions/core'; import * as tc from '@actions/tool-cache'; import {INPUT_JOB_STATUS, DISTRIBUTIONS_ONLY_MAJOR_VERSION} from './constants'; +import {OutgoingHttpHeaders} from 'http'; export function getTempDir() { const tempDirectory = process.env['RUNNER_TEMP'] || os.tmpdir(); @@ -161,3 +162,13 @@ export function convertVersionToSemver(version: number[] | string) { } return mainVersion; } + +export function getGitHubHttpHeaders(): OutgoingHttpHeaders { + const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; + const headers: OutgoingHttpHeaders = { + authorization: auth, + accept: 'application/vnd.github.VERSION.raw' + }; + return headers; +} From 2e4e4de3b40545707193845e18b18d0fb7cfb4e5 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Tue, 19 Sep 2023 14:35:59 +0200 Subject: [PATCH 16/18] chore: rebuild solution --- dist/cleanup/index.js | 12 +++++++++++- dist/setup/index.js | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 56df7de43..34e109d6a 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -67020,7 +67020,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.convertVersionToSemver = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0; +exports.getGitHubHttpHeaders = exports.convertVersionToSemver = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0; const os_1 = __importDefault(__nccwpck_require__(2037)); const path_1 = __importDefault(__nccwpck_require__(1017)); const fs = __importStar(__nccwpck_require__(7147)); @@ -67157,6 +67157,16 @@ function convertVersionToSemver(version) { return mainVersion; } exports.convertVersionToSemver = convertVersionToSemver; +function getGitHubHttpHeaders() { + const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; + const headers = { + authorization: auth, + accept: 'application/vnd.github.VERSION.raw' + }; + return headers; +} +exports.getGitHubHttpHeaders = getGitHubHttpHeaders; /***/ }), diff --git a/dist/setup/index.js b/dist/setup/index.js index f2f3822c3..ff7159bbd 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102792,17 +102792,12 @@ class DragonwellDistribution extends base_installer_1.JavaBase { } fetchJsonFromBackupUrl() { return __awaiter(this, void 0, void 0, function* () { - const token = core.getInput('token'); - const auth = !token ? undefined : `token ${token}`; const owner = 'dragonwell-releng'; const repository = 'dragonwell-setup-java'; const branch = 'main'; const filePath = 'releases.json'; const backupUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; - const headers = { - authorization: auth, - accept: 'application/vnd.github.VERSION.raw' - }; + const headers = util_1.getGitHubHttpHeaders(); try { core.debug(`Trying to fetch available versions info from the backup url: ${backupUrl}`); const fetchedDragonwellVersions = (yield this.http.getJson(backupUrl, headers)).result; @@ -103190,18 +103185,13 @@ class MicrosoftDistributions extends base_installer_1.JavaBase { return __awaiter(this, void 0, void 0, function* () { // TODO get these dynamically! // We will need Microsoft to add an endpoint where we can query for versions. - const token = core.getInput('token'); - const auth = !token ? undefined : `token ${token}`; const owner = 'actions'; const repository = 'setup-java'; const branch = 'main'; const filePath = 'src/distributions/microsoft/microsoft-openjdk-versions.json'; let releases = null; const fileUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; - const headers = { - authorization: auth, - accept: 'application/vnd.github.VERSION.raw' - }; + const headers = util_1.getGitHubHttpHeaders(); let response = null; if (core.isDebug()) { console.time('Retrieving available versions for Microsoft took'); // eslint-disable-line no-console @@ -104294,7 +104284,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.convertVersionToSemver = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0; +exports.getGitHubHttpHeaders = exports.convertVersionToSemver = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0; const os_1 = __importDefault(__nccwpck_require__(2037)); const path_1 = __importDefault(__nccwpck_require__(1017)); const fs = __importStar(__nccwpck_require__(7147)); @@ -104431,6 +104421,16 @@ function convertVersionToSemver(version) { return mainVersion; } exports.convertVersionToSemver = convertVersionToSemver; +function getGitHubHttpHeaders() { + const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; + const headers = { + authorization: auth, + accept: 'application/vnd.github.VERSION.raw' + }; + return headers; +} +exports.getGitHubHttpHeaders = getGitHubHttpHeaders; /***/ }), From 3fd8616c89efe671a98e9956988bf86d242f5b81 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Wed, 20 Sep 2023 11:15:37 +0200 Subject: [PATCH 17/18] chore: update wordings --- .../distributors/dragonwell-installer.test.ts | 3 +-- dist/setup/index.js | 20 +++++++++---------- src/distributions/dragonwell/installer.ts | 20 +++++++++---------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/__tests__/distributors/dragonwell-installer.test.ts b/__tests__/distributors/dragonwell-installer.test.ts index 95518b000..44cc39640 100644 --- a/__tests__/distributors/dragonwell-installer.test.ts +++ b/__tests__/distributors/dragonwell-installer.test.ts @@ -202,7 +202,7 @@ describe('getAvailableVersions', () => { await expect( distribution['findPackageForDownload'](jdkVersion) ).rejects.toThrow( - `Couldn't find any satisfied version for the specified java-version: "${jdkVersion}".` + `Couldn't find any satisfied version for the specified java-version: "${jdkVersion}" and architecture: "${arch}".` ); } ); @@ -218,7 +218,6 @@ describe('getAvailableVersions', () => { checkLatest: false }); mockPlatform(distribution, platform); - await expect( distribution['findPackageForDownload'](jdkVersion) ).rejects.toThrow('Dragonwell provides only the `jdk` package type'); diff --git a/dist/setup/index.js b/dist/setup/index.js index ff7159bbd..8f995588d 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102656,7 +102656,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase { findPackageForDownload(version) { return __awaiter(this, void 0, void 0, function* () { if (!this.stable) { - throw new Error('Early access versions are not supported'); + throw new Error('Early access versions are not supported by Dragonwell'); } if (this.packageType !== 'jdk') { throw new Error('Dragonwell provides only the `jdk` package type'); @@ -102673,7 +102673,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase { }; }); if (!matchedVersions.length) { - throw new Error(`Couldn't find any satisfied version for the specified java-version: "${version}".`); + throw new Error(`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`); } const resolvedVersion = matchedVersions[0]; return resolvedVersion; @@ -102688,9 +102688,9 @@ class DragonwellDistribution extends base_installer_1.JavaBase { fetchedDragonwellJson = yield this.fetchJsonFromBackupUrl(); } if (!fetchedDragonwellJson) { - throw new Error(`Couldn't fetch dragonwell versions information from both primary and backup urls`); + throw new Error(`Couldn't fetch Dragonwell versions information from both primary and backup urls`); } - core.debug('Successfully fetched information about available dragonwell versions'); + core.debug('Successfully fetched information about available Dragonwell versions'); const availableVersions = this.parseVersions(platform, arch, fetchedDragonwellJson); if (core.isDebug()) { core.startGroup('Print information about available versions'); @@ -102780,12 +102780,12 @@ class DragonwellDistribution extends base_installer_1.JavaBase { return __awaiter(this, void 0, void 0, function* () { const primaryUrl = 'https://dragonwell-jdk.io/map_with_checksum.json'; try { - core.debug(`Trying to fetch available versions info from the primary url: ${primaryUrl}`); + core.debug(`Trying to fetch available Dragonwell versions info from the primary url: ${primaryUrl}`); const fetchedDragonwellJson = (yield this.http.getJson(primaryUrl)).result; return fetchedDragonwellJson; } catch (err) { - core.debug(`Fetching from the primary link: ${primaryUrl} ended up with the error: ${err.message}`); + core.debug(`Fetching Dragonwell versions info from the primary link: ${primaryUrl} ended up with the error: ${err.message}`); return null; } }); @@ -102799,12 +102799,12 @@ class DragonwellDistribution extends base_installer_1.JavaBase { const backupUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; const headers = util_1.getGitHubHttpHeaders(); try { - core.debug(`Trying to fetch available versions info from the backup url: ${backupUrl}`); - const fetchedDragonwellVersions = (yield this.http.getJson(backupUrl, headers)).result; - return fetchedDragonwellVersions; + core.debug(`Trying to fetch available Dragonwell versions info from the backup url: ${backupUrl}`); + const fetchedDragonwellJson = (yield this.http.getJson(backupUrl, headers)).result; + return fetchedDragonwellJson; } catch (err) { - core.debug(`Fetching from the backup url: ${backupUrl} ended up with the error: ${err.message}`); + core.debug(`Fetching Dragonwell versions info from the backup url: ${backupUrl} ended up with the error: ${err.message}`); return null; } }); diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 8fb188e0f..57b102d6d 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -28,7 +28,7 @@ export class DragonwellDistribution extends JavaBase { version: string ): Promise { if (!this.stable) { - throw new Error('Early access versions are not supported'); + throw new Error('Early access versions are not supported by Dragonwell'); } if (this.packageType !== 'jdk') { @@ -50,7 +50,7 @@ export class DragonwellDistribution extends JavaBase { if (!matchedVersions.length) { throw new Error( - `Couldn't find any satisfied version for the specified java-version: "${version}".` + `Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".` ); } @@ -70,12 +70,12 @@ export class DragonwellDistribution extends JavaBase { if (!fetchedDragonwellJson) { throw new Error( - `Couldn't fetch dragonwell versions information from both primary and backup urls` + `Couldn't fetch Dragonwell versions information from both primary and backup urls` ); } core.debug( - 'Successfully fetched information about available dragonwell versions' + 'Successfully fetched information about available Dragonwell versions' ); const availableVersions = this.parseVersions( @@ -204,7 +204,7 @@ export class DragonwellDistribution extends JavaBase { const primaryUrl = 'https://dragonwell-jdk.io/map_with_checksum.json'; try { core.debug( - `Trying to fetch available versions info from the primary url: ${primaryUrl}` + `Trying to fetch available Dragonwell versions info from the primary url: ${primaryUrl}` ); const fetchedDragonwellJson = ( await this.http.getJson(primaryUrl) @@ -212,7 +212,7 @@ export class DragonwellDistribution extends JavaBase { return fetchedDragonwellJson; } catch (err) { core.debug( - `Fetching from the primary link: ${primaryUrl} ended up with the error: ${err.message}` + `Fetching Dragonwell versions info from the primary link: ${primaryUrl} ended up with the error: ${err.message}` ); return null; } @@ -230,15 +230,15 @@ export class DragonwellDistribution extends JavaBase { try { core.debug( - `Trying to fetch available versions info from the backup url: ${backupUrl}` + `Trying to fetch available Dragonwell versions info from the backup url: ${backupUrl}` ); - const fetchedDragonwellVersions = ( + const fetchedDragonwellJson = ( await this.http.getJson(backupUrl, headers) ).result; - return fetchedDragonwellVersions; + return fetchedDragonwellJson; } catch (err) { core.debug( - `Fetching from the backup url: ${backupUrl} ended up with the error: ${err.message}` + `Fetching Dragonwell versions info from the backup url: ${backupUrl} ended up with the error: ${err.message}` ); return null; } From 4259d72e25d0d91502d7b39dbc6253a8e2c13bc7 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Wed, 20 Sep 2023 11:48:35 +0200 Subject: [PATCH 18/18] chore: refactor code --- dist/setup/index.js | 12 +++--------- src/distributions/dragonwell/installer.ts | 14 ++++---------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 8f995588d..4e99c8ed4 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102731,8 +102731,10 @@ class DragonwellDistribution extends base_installer_1.JavaBase { if (jdkVersion === 'latest') { continue; } + // Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits). + // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. if (jdkVersion.split('.').length > 3) { - jdkVersion = this.transformToSemver(jdkVersion); + jdkVersion = util_1.convertVersionToSemver(jdkVersion); } for (const edition in archMap) { eligibleVersions.push({ @@ -102760,14 +102762,6 @@ class DragonwellDistribution extends base_installer_1.JavaBase { }); return sortedVersions.reverse(); } - // Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits). - // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. - transformToSemver(version) { - const splits = version.split('.'); - const versionMainPart = splits.slice(0, 3).join('.'); - const versionBuildPart = splits.slice(3).join('.'); - return `${versionMainPart}+${versionBuildPart}`; - } getPlatformOption() { switch (process.platform) { case 'win32': diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 57b102d6d..11ed4c25e 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -7,6 +7,7 @@ import path from 'path'; import {JavaBase} from '../base-installer'; import { + convertVersionToSemver, extractJdkFile, getDownloadArchiveExtension, getGitHubHttpHeaders, @@ -146,8 +147,10 @@ export class DragonwellDistribution extends JavaBase { continue; } + // Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits). + // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. if (jdkVersion.split('.').length > 3) { - jdkVersion = this.transformToSemver(jdkVersion); + jdkVersion = convertVersionToSemver(jdkVersion); } for (const edition in archMap) { @@ -182,15 +185,6 @@ export class DragonwellDistribution extends JavaBase { return sortedVersions.reverse(); } - // Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits). - // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. - private transformToSemver(version: string) { - const splits = version.split('.'); - const versionMainPart = splits.slice(0, 3).join('.'); - const versionBuildPart = splits.slice(3).join('.'); - return `${versionMainPart}+${versionBuildPart}`; - } - private getPlatformOption(): string { switch (process.platform) { case 'win32':