sonarscan-dotnet: let SonarScanner provision its own JRE - #245
Draft
gunndabad wants to merge 1 commit into
Draft
Conversation
The action hardcoded sonar.scanner.skipJreProvisioning=true and installed Java 17, so the scanner engine was pinned to whatever JDK the action chose. SonarQube Cloud has since raised its minimum to Java 21, and the engine now dies on startup. The scanner reports this as a broken stdin pipe and aborts with exit code 134, which gives no hint that Java is the cause. Make the flag configurable via a new skip-jre-provisioning input, defaulting to false so the scanner downloads the JRE the server asks for and tracks future bumps on its own. Raise the java-version default to 21 for consumers that opt back into skipping. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
gunndabad
marked this pull request as draft
August 13, 2026 08:31
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
The action hardcodes
sonar.scanner.skipJreProvisioning=trueand installs Java 17, so the SonarScanner engine is pinned to whatever JDK the action picks. SonarQube Cloud has since raised its minimum to Java 21, so the engine now fails to start during theendstep.The failure gives no indication that Java is involved — the scanner is writing its analysis payload to the engine over stdin, so a dead engine surfaces as a broken pipe and a SIGABRT:
This was pre-announced. Scans on Java 17 were already printing the warning below before they started failing outright:
Every consumer of this action is affected as soon as its scan next runs. It surfaced in
get-information-about-pupils, where the scan job had been dormant for two months and failed on all three runs since it was re-enabled.Change
skip-jre-provisioninginput, defaulting tofalse— the scanner downloads the JRE the server asks for, so the Java version tracks SonarQube Cloud and future bumps don't break anyone.java-versiondefault raised17→21, so consumers that opt back into skipping still get a working engine today.Review note: this changes default behaviour
Consumers currently skipping provisioning implicitly will now download a JRE at scan time. That is the point — it is what makes the fix durable rather than moving the pin from 17 to 21 and waiting for the next bump. But it does mean runners that cannot reach the Sonar JRE download will need
skip-jre-provisioning: true, and I don't know whether any DfE self-hosted or network-restricted runners fall into that category. If that's a real concern, the alternative is defaulting the input totrueand having each repo opt in — say the word and I'll flip it.Testing
I have not run this against a live pipeline — it needs a
SONAR_TOKENand a consumer repo. What I did verify: the YAML parses, and the generatedbegincommand is well-formed in both modes, with the flag dropping out cleanly when disabled (same conditional-arg pattern already used forCOVERAGE_ARG).Worth a check on a real scan before merge.
Conflict with #242
#242 is open against the same file and edits the adjacent line, replacing the hardcoded
sonar.coverage.exclusionswith a conditional. Whichever merges second will need a trivial resolution — both changes are independent and use the same pattern.🤖 Generated with Claude Code