Skip to content

fix(ci): read java_vendor before overwriting java_distribution - #4255

Merged
vlsi merged 1 commit into
pgjdbc:masterfrom
vlsi:fix/matrix-java-vendor
Jun 25, 2026
Merged

vlsi merged 1 commit into
pgjdbc:masterfrom
vlsi:fix/matrix-java-vendor

Conversation

@vlsi

@vlsi vlsi commented Jun 25, 2026

Copy link
Copy Markdown
Member

Why

In the matrix generator, per-row post-processing overwrote v.java_distribution with its string .value and only afterwards read .vendor from it:

v.java_distribution = v.java_distribution.value;   // now a string, e.g. ""oracle""
v.java_vendor = v.java_distribution.vendor;         // ""oracle"".vendor === undefined

So v.java_vendor was always undefined. It feeds jdkTestVendor=${{ matrix.java_vendor }} in main.yml, which sets the Gradle test toolchain vendor (JvmVendorSpec.matching(...) in build-logic/basics/src/main/kotlin/configureToolchain.kt). An empty value left the test JDK unconstrained by vendor.

What

Destructure value and vendor before the overwrite, so the read no longer depends on statement order:

const {value: javaDistribution, vendor: javaVendor} = v.java_distribution;
v.java_distribution = javaDistribution;
v.java_vendor = javaVendor;

The later v.java_distribution === ""oracle"" checks run after this block and rely on v.java_distribution already being the string value, which the fix preserves.

main.yml provisions the matching-vendor JDK via actions/setup-java with distribution: ${{ matrix.java_distribution }}, so pinning the vendor in the toolchain spec resolves against an already-installed JDK and does not need org.gradle.java.installations.auto-download.

The same bug and the same destructuring fix were applied in apache/jmeter""s .github/workflows/matrix.js.

How to verify

  1. npm ci --prefix .github/workflows
  2. MATRIX_JOBS=8 node .github/workflows/matrix.mjs
  3. Every row now has a real java_vendor — one of amazon, bellsoft, microsoft, oracle, eclipse, azul — and none is undefined.

🤖 Generated with Claude Code

The per-row post-processing overwrote `v.java_distribution` with its
string `.value` and only then read `.vendor` from it, so `v.java_vendor`
was always `undefined`. That empty value flowed into
`jdkTestVendor=${{ matrix.java_vendor }}` in main.yml, leaving the Gradle
test toolchain unconstrained by vendor.

Destructure `value` and `vendor` before the overwrite so the read no
longer depends on statement order. The later `java_distribution === 'oracle'`
checks still see the string value.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.43%. Comparing base (0a737bb) to head (fc9dbd7).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4255      +/-   ##
============================================
- Coverage     70.46%   70.43%   -0.04%     
+ Complexity     5306     5301       -5     
============================================
  Files           244      244              
  Lines         21962    21962              
  Branches       3688     3688              
============================================
- Hits          15476    15469       -7     
- Misses         4840     4843       +3     
- Partials       1646     1650       +4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vlsi
vlsi merged commit cc7947b into pgjdbc:master Jun 25, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant