Title: `java-version-file` with `asdf`'s `.tool-versions` fails for Corretto, also non-strict semver versions · Issue #615 · actions/setup-java · GitHub
Open Graph Title: `java-version-file` with `asdf`'s `.tool-versions` fails for Corretto, also non-strict semver versions · Issue #615 · actions/setup-java
X Title: `java-version-file` with `asdf`'s `.tool-versions` fails for Corretto, also non-strict semver versions · Issue #615 · actions/setup-java
Description: Description: Support for asdf's .tool-versions file was added to the java-version-file parameter with PR #606 in response to issue #579 - unfortunately, there's a difference between what asdf requires for this file, vs what setup-java su...
Open Graph Description: Description: Support for asdf's .tool-versions file was added to the java-version-file parameter with PR #606 in response to issue #579 - unfortunately, there's a difference between what asdf requi...
X Description: Description: Support for asdf's .tool-versions file was added to the java-version-file parameter with PR #606 in response to issue #579 - unfortunately, there's a difference between what as...
Opengraph URL: https://github.com/actions/setup-java/issues/615
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`java-version-file` with `asdf`'s `.tool-versions` fails for Corretto, also non-strict semver versions","articleBody":"**Description:**\r\nSupport for `asdf`'s `.tool-versions` file was added to the `java-version-file` parameter with PR https://github.com/actions/setup-java/pull/606 in response to issue https://github.com/actions/setup-java/issues/579 - unfortunately, there's a difference between what `asdf` requires for this file, vs what `setup-java` supports:\r\n\r\n### `asdf` requires that the Java version in `.tool-versions` is _fully_ specified\r\n\r\nSo a file will typically look like this:\r\n\r\n```\r\njava corretto-21.0.2.13.1\r\n```\r\n\r\nIf you shorten the version, eg to `21.0.2` or `21`, and run `asdf install java`, you'll get this error from `asdf`:\r\n\r\n```\r\nUnknown release: corretto-21.0.2\r\n```\r\n\r\n### `setup-java` only supports major versions or strict 3-part semver\r\n\r\n`setup-java` supports version numbers of 1 to 3 dot-separated integers (eg `major` to `major.minor.patch`). This excludes several valid version numbers - here are some examples:\r\n\r\n- all Corretto version numbers, which are always at least 4-part (eg `21.0.2.13.1` or `8.322.06.4`)\r\n- Zulu `8.74.0.17`\r\n- sapmachine `11.0.16.1`\r\n- Oracle `18.0.2.1`\r\n- Microsoft `17.0.1.12.1`\r\n\r\n### `setup-java` _only_ supports major versions for Corretto\r\n\r\nThis is probably due to AWS Corretto only providing a simple API for looking up Java versions, that only supports getting the latest version for each major version of Java:\r\n\r\nhttps://github.com/actions/setup-java/blob/99b8673ff64fbf99d8d325f52d9a5bdedb8483e9/src/distributions/corretto/installer.ts#L100\r\n\r\nSo, Corretto with the `java-version-file` parameter is doubly unsupported:\r\n\r\n* Corretto 5-part version numbers don't match the regex's used by `setup-java` to verify version numbers\r\n* Even if Corretto version numbers were accepted, `corretto/installer.ts` wouldn't be able to locate and download the specific Corretto version, because it can only support finding by `major` version number https://github.com/actions/setup-java/blob/99b8673ff64fbf99d8d325f52d9a5bdedb8483e9/src/distributions/corretto/installer.ts#L61-L62\r\n\r\n\r\n\r\n**Task version:**\r\n\r\n[v4.2.1](https://github.com/actions/setup-java/releases/tag/v4.2.1)\r\n\r\n**Platform:**\r\n- [x] Ubuntu\r\n- [ ] macOS\r\n- [ ] Windows\r\n\r\n**Runner type:**\r\n- [x] Hosted\r\n- [ ] Self-hosted\r\n\r\n**Repro steps:** \r\nDefine an invocation of `actions/setup-java` in a workflow, and point `java-version-file` to `.tool-versions`:\r\n\r\n[**.github/workflows/ci.yml**](https://github.com/guardian/etag-caching/blob/959d4dc2ef049c72eda32126c850fbeee078b704/.github/workflows/ci.yml) :\r\n```\r\n uses: actions/setup-java@v4\r\n with:\r\n distribution: zulu\r\n java-version-file: .tool-versions\r\n```\r\n\r\nIn `.tool-versions`, define a version like `zulu-8.58.0.13` - and verify that works by executing `asdf install java`:\r\n\r\n[**.tool-versions**](https://github.com/guardian/etag-caching/blob/959d4dc2ef049c72eda32126c850fbeee078b704/.tool-versions) :\r\n```\r\njava zulu-8.58.0.13\r\n```\r\n\r\nThe let the `ci.yml` workflow run.\r\n\r\n**Expected behavior:**\r\nIdeally, if the `.tool-versions` file is valid for `asdf`, `setup-java` should install that precise version of Java. This means `setup-java` needs to accept all versions output by `asdf list-all java`.\r\n\r\nWhere a distribution has been specified that `setup-java` is unable to search for precise Java versions (ie Corretto), if the user has set a `java-version-accept-any-matching-major-version` parameter to `true` it should just install the latest version of Java for that major version.\r\n\r\n**Actual behavior:**\r\n\r\n`zulu-8.58.0.13` in `.tool-versions` (https://github.com/guardian/etag-caching/commit/959d4dc2ef049c72eda32126c850fbeee078b704) : \r\nhttps://github.com/guardian/etag-caching/actions/runs/8470107933/job/23207054598#step:3:16\r\n```\r\nNo supported version was found in file .tool-versions\r\n```\r\n\r\n\r\n\r\n\r\ncc @aparnajyothi-y @mahabaleshwars @HarithaVattikuti\r\n","author":{"url":"https://github.com/rtyley","@type":"Person","name":"rtyley"},"datePublished":"2024-03-28T17:47:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/615/setup-java/issues/615"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c8e10971-821a-ddb5-3603-040e247577b1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B41A:10CC01:3046C3:424614:6A617395 |
| html-safe-nonce | 339e645051511fabf6bd702ee8d265ec88c273ccbcbb3416d9fcd3a68329a224 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDFBOjEwQ0MwMTozMDQ2QzM6NDI0NjE0OjZBNjE3Mzk1IiwidmlzaXRvcl9pZCI6Ijc3MTM4ODk0NzAxNzQ1NTcwNzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 642d348db1ef53d512da726815f7b6a47fb737dc5da0eea48262465e0b2df45f |
| hovercard-subject-tag | issue:2213798810 |
| github-keyboard-shortcuts | repository,issues,actions,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/actions/setup-java/615/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b353c8a20c6d26ef671048fbe84d24e8a1e704a89f1b73ed0542472d1eb66558/actions/setup-java/issues/615 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b353c8a20c6d26ef671048fbe84d24e8a1e704a89f1b73ed0542472d1eb66558/actions/setup-java/issues/615 |
| og:image:alt | Description: Support for asdf's .tool-versions file was added to the java-version-file parameter with PR #606 in response to issue #579 - unfortunately, there's a difference between what asdf requi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rtyley |
| hostname | github.com |
| expected-hostname | github.com |
| None | b05bb6314e7e93021a7b7dab54a85cbe48d821938e762c1dff815efd60699622 |
| turbo-cache-control | no-preview |
| go-import | github.com/actions/setup-java git https://github.com/actions/setup-java.git |
| octolytics-dimension-user_id | 44036562 |
| octolytics-dimension-user_login | actions |
| octolytics-dimension-repository_id | 196057608 |
| octolytics-dimension-repository_nwo | actions/setup-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 196057608 |
| octolytics-dimension-repository_network_root_nwo | actions/setup-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 94389bfdcd393b0a5a274aee94e8a9739d063fe5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width