fix: select musl JDK artifacts on Alpine for Dragonwell, Corretto, Zulu and Liberica - #1220
Merged
brunoborges merged 2 commits intoAug 5, 2026
Conversation
On Alpine, `getPlatformOption()` returned the glibc platform key for Dragonwell, Corretto, Zulu, Liberica and Liberica NIK, so the action resolved and installed a glibc JDK that cannot run under musl. Add a shared `isAlpineLinux()` helper and use it to select each vendor's musl artifacts: | distribution | glibc | musl | | ------------ | ------------- | -------------- | | Dragonwell | `linux` | `alpine-linux` | | Corretto | `linux` | `alpine` | | Zulu | `linux_glibc` | `linux_musl` | | Liberica | `linux` | `linux-musl` | | Liberica NIK | `linux` | `linux-musl` | Each key was verified against the vendor's live metadata API or manifest. There is deliberately no silent fallback to glibc when a vendor has no musl build for the requested version or architecture: the existing "could not find a version that satisfies" error fires instead. This matches the behaviour Temurin and SapMachine already have, and a glibc JDK would not run on musl anyway. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 74248bb0-72af-41d8-b85d-b0f5836e68db
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect JDK artifact selection on Alpine Linux by ensuring affected distributions choose musl-compatible vendor platform keys instead of defaulting to glibc artifacts.
Changes:
- Added shared
isAlpineLinux()helper insrc/distributions/platform-types.ts(short-circuits off Linux and probes/etc/alpine-releaseonly on Linux). - Updated
getPlatformOption()for Dragonwell, Corretto, Zulu, Liberica, and Liberica NIK to select the vendor’s musl platform key on Alpine. - Added targeted unit tests covering musl vs glibc selection per distribution and direct coverage for
isAlpineLinux()behavior (including “no filesystem probe off Linux”).
Show a summary per file
| File | Description |
|---|---|
| src/distributions/zulu/installer.ts | Selects linux_musl on Alpine, otherwise linux_glibc. |
| src/distributions/platform-types.ts | Adds isAlpineLinux() helper (Linux-gated /etc/alpine-release probe). |
| src/distributions/liberica/installer.ts | Selects linux-musl on Alpine for Liberica artifacts. |
| src/distributions/liberica-nik/installer.ts | Selects linux-musl on Alpine for Liberica NIK artifacts. |
| src/distributions/dragonwell/installer.ts | Selects alpine-linux on Alpine for Dragonwell artifacts. |
| src/distributions/corretto/installer.ts | Selects alpine on Alpine for Corretto artifacts. |
| dist/setup/index.js | Regenerated bundle reflecting new helper export and logic changes. |
| dist/setup/978.index.js | Regenerated bundle reflecting Zulu platform selection change. |
| dist/setup/675.index.js | Regenerated bundle reflecting Dragonwell platform selection change. |
| dist/setup/63.index.js | Regenerated bundle reflecting Liberica platform selection change. |
| dist/setup/524.index.js | Regenerated bundle reflecting Liberica NIK platform selection change. |
| dist/setup/126.index.js | Regenerated bundle reflecting Corretto platform selection change. |
| tests/java-platform-contract.test.ts | Adds direct unit coverage for isAlpineLinux() semantics. |
| tests/distributors/zulu-installer.test.ts | Adds tests for musl/glibc selection and “no probe off Linux”. |
| tests/distributors/liberica-nik-installer.test.ts | Pins Alpine probe for existing cases and adds musl/glibc selection tests. |
| tests/distributors/liberica-installer.test.ts | Pins Alpine probe for existing cases and adds musl/glibc selection tests. |
| tests/distributors/dragonwell-installer.test.ts | Adds tests for musl/glibc selection and “no probe off Linux”. |
| tests/distributors/corretto-installer.test.ts | Adds tests for musl/glibc selection and “no probe off Linux”. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 12/18 changed files
- Comments generated: 0
- Review effort level: Lite
PR actions#1210 landed the shared `isAlpineLinux()` helper, so this branch drops its own identical copy and imports main's. `platform-types.ts` and `java-platform-contract.test.ts` are now untouched by this branch; the duplicated `isAlpineLinux` test block was byte-identical to main's and was removed. Rebuilt dist/ to resolve the bundle conflict. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 74248bb0-72af-41d8-b85d-b0f5836e68db
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Alpine Linux, five distributions resolve the glibc artifact and install a JDK that cannot run under musl.
getPlatformOption()mapsprocess.platform === 'linux'to the vendor's glibc platform key with no libc check.Temurin and SapMachine already probe
/etc/alpine-releaseand select their musl artifacts. The remaining distributions do not.This was found while reviewing #1209 / #1210. It is a separate, pre-existing bug: #1210 makes the resolution cache distinguish glibc from musl, which is necessary but not sufficient — these five distributions resolve the wrong artifact whether or not the cache is involved.
Change
Adds a shared
isAlpineLinux()helper insrc/distributions/platform-types.tsand uses it in each affectedgetPlatformOption().linuxalpine-linuxlinuxalpinelinux_glibclinux_musllinuxlinux-musllinuxlinux-muslEvery key verified against live vendor metadata
Not inferred from naming conventions — each was confirmed to return real artifacts:
dragonwell-jdk.io/map_with_checksum.jsonplatform keys arealpine-linux,linux,windows.alpine-linuxcovers majors 11/17/21/25, x64 only.corretto-downloads/latest_links/indexmap_with_checksum.jsontop-level keys includealpine, with x64 and aarch64, image typesjdkanddebugsymbols. There is nojreunderalpine, but there is none underlinuxeither, so no regression.api.azul.com/metadata/v1/zulu/packages/?os=linux_muslreturns e.g.zulu21.52.15-ca-jdk21.0.12-linux_musl_x64.tar.gz.api.bell-sw.comwithos=linux-muslreturns e.g.bellsoft-jdk21+37-linux-x64-musl.tar.gz.Scope note
The gap was originally reported to me as Dragonwell + Corretto. Verifying it showed the same root cause in five distributions, with the same one-line shape in each. Shipping a partial fix for a systemic bug would leave three distributions silently broken, so all five are fixed together.
No silent glibc fallback — deliberate
Where a vendor has no musl build for the requested version/architecture (for example Dragonwell on aarch64, or Corretto's
arm-muslvariant which this platform-key mapping does not reach), the existing "could not find a version that satisfies" error fires instead of quietly installing a glibc JDK.This matches what Temurin and SapMachine already do, and a glibc JDK generally will not run on musl regardless. Users on Alpine images with
gcompat/libc6-compatwho were relying on the glibc build will now get an explicit error rather than a working-by-accident install; an explicit error is the better failure mode and is consistent with the rest of the action.Tests
19 new tests. For each distribution: musl on Alpine, glibc on other Linux runners, and an assertion that the filesystem is not probed off Linux. Plus direct
isAlpineLinux()coverage.The existing Liberica/NIK
getPlatformOptiontables had alinux → linuxrow that would have become machine-dependent oncelinuxbranches on libc; they now pin the Alpine probe explicitly.All assertions were mutation-verified: forcing
isAlpineLinux()to always returnfalsefails 6 tests, alwaystruefails 10. Full suite: 41 suites / 1373 tests green.Relationship to #1210
#1210 has landed. It added the shared
isAlpineLinux()helper, and because this branch used an identical name, signature and semantics, the merge resolved by simply deleting this branch's copy — no behavioural reconciliation was needed.As a result
src/distributions/platform-types.tsand__tests__/java-platform-contract.test.tsare now untouched by this PR. The diff is exactly the fivegetPlatformOption()implementations plus their tests.#1210 was necessary but not sufficient: it makes the resolution cache distinguish glibc from musl, while this PR fixes the five distributions that resolve the wrong artifact in the first place, cache or no cache.
Related: #1209, #1210