Skip to content

Prefer Zulu 4-segment hotfix builds when resolving version ranges - #1278

Merged
brunoborges merged 1 commit into
mainfrom
brunoborges-zulu-sdkmanrc-hotfix-builds
Oct 2, 2026
Merged

brunoborges merged 1 commit into
mainfrom
brunoborges-zulu-sdkmanrc-hotfix-builds

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:
Azul publishes out-of-band hotfix builds with a 4-segment java_version. For example, zulu25.36.205-ca-jdk25.0.4.1 has java_version=[25,0,4,1] and openjdk_build_number=1. SDKMAN calls this build 25.0.4+1.1.

Since the v6 Azul Metadata API migration, an exact 25.0.4+1.1 request (for example from .sdkmanrc java=25.0.4+1.1-zulu) already resolves. The failure in the issue came from a pinned pre-v6 commit that dropped the build number.

There was still a bug with version ranges. Candidates were sorted with semver.compareBuild, which compares the text after + and ranks 25.0.4+7 above 25.0.4+1.1. As a result, 25 or 25.0.4 resolved to the older GA build instead of the newer 25.0.4.1 hotfix.

This PR sorts Zulu candidates numerically by:

  1. java_version (a missing segment counts as 0)
  2. openjdk_build_number
  3. distro_version, which stays the tie-breaker

The version strings themselves are unchanged, so exact matching and toolcache folder names behave the same.

Toolcache lookup of already-cached versions may have a similar ordering issue. It is not addressed here.

Related issue:
Fixes: #1275

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
    • Not run in full. Targeted jest runs of __tests__/distributors/zulu-installer.test.ts and __tests__/util.test.ts passed (284 tests).
    • npm run build passed. ESLint on the changed source and Zulu test file was clean.
    • The pre-commit hook ran prettier and eslint on the staged files.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes. Two of the new Zulu tests fail without the fix.
Azul reports hotfix releases like 25.0.4.1 as java_version=[25,0,4,1]
with openjdk_build_number=1 (SDKMAN '25.0.4+1.1'). Sorting candidates via
semver.compareBuild ranked 25.0.4+7 above 25.0.4+1.1, so ranges such as
'25' resolved to the older build. Compare java_version, build number and
distro_version numerically instead.

Fixes: #1275

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@brunoborges
brunoborges requested a review from a team as a code owner October 2, 2026 03:49
Copilot AI balanced review requested due to automatic review settings October 2, 2026 03:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused implementation matches the documented ordering requirements and includes regression coverage for exact and ranged versions.

Review effort: Balanced
Findings: None

What changed in this PR

Updates Zulu version resolution so range requests prefer newer four-segment hotfix builds.

Changes:

  • Sorts candidates numerically by Java version, build number, then distro version.
  • Adds coverage for exact and ranged hotfix resolution.
  • Rebuilds the runtime bundle.
File Description
src/​distributions/​zulu/​installer.ts Implements numeric candidate ordering.
dist/​setup/​978.index.js Updates the generated runtime bundle.
__tests__/​util.test.ts Covers SDKMAN Zulu version parsing.
__tests__/​distributors/​zulu-installer.test.ts Tests hotfix selection behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@brunoborges
brunoborges merged commit 74920aa into main Oct 2, 2026
83 of 86 checks passed
@brunoborges
brunoborges deleted the brunoborges-zulu-sdkmanrc-hotfix-builds branch October 2, 2026 04:07
gregor-dietrich pushed a commit to gregor-dietrich/Midas that referenced this pull request Oct 24, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/setup-java](https://github.com/actions/setup-java) | action | minor | `v6.0.1` → `v6.1.0` |

---

### Release Notes

<details>
<summary>actions/setup-java</summary>

### [`v6.1.0`](https://github.com/actions/setup-java/releases/tag/v6.1.0)

[Compare Source](actions/setup-java@v6.0.1...v6.1.0)

##### What's Changed

- Preserve compound Liberica build versions from .sdkmanrc by [@&#8203;brunoborges](https://github.com/brunoborges) with [@&#8203;Copilot](https://github.com/Copilot) in [#&#8203;1268](actions/setup-java#1268)
- Support Temurin on Linux RISC-V by [@&#8203;yawkat](https://github.com/yawkat) in [#&#8203;1269](actions/setup-java#1269)
- Stop GPG agent before removing signature-verification home by [@&#8203;brunoborges](https://github.com/brunoborges) with [@&#8203;Copilot](https://github.com/Copilot) in [#&#8203;1273](actions/setup-java#1273)
- Prefer Zulu 4-segment hotfix builds when resolving version ranges by [@&#8203;brunoborges](https://github.com/brunoborges) in [#&#8203;1278](actions/setup-java#1278)
- Support Temurin JEP 322 patch versions like 26.0.2.1+1 by [@&#8203;brunoborges](https://github.com/brunoborges) in [#&#8203;1279](actions/setup-java#1279)
- chore(deps): bump undici from 6.28.0 to 6.29.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;1274](actions/setup-java#1274)
- chore(deps): bump the monthly-npm-updates group with 13 updates by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;1276](actions/setup-java#1276)
- feat: support Maven server credential origins by [@&#8203;YunaBraska](https://github.com/YunaBraska) in [#&#8203;1282](actions/setup-java#1282)
- Support Maven plugin repositories in generated settings.xml by [@&#8203;brunoborges](https://github.com/brunoborges) in [#&#8203;1286](actions/setup-java#1286)

##### New Contributors

- [@&#8203;yawkat](https://github.com/yawkat) made their first contribution in [#&#8203;1269](actions/setup-java#1269)
- [@&#8203;YunaBraska](https://github.com/YunaBraska) made their first contribution in [#&#8203;1282](actions/setup-java#1282)

**Full Changelog**: <actions/setup-java@v6.0.1...v6.1.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNjUuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjE2NS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.vptr.de/gregor/midas2/pulls/113
Reviewed-by: gregor <1+gregor@noreply.localhost>
Co-authored-by: Renovate Bot <renovate@vptr.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants