Skip to content
← Back to activity

Immutable solution version

waitForQualityGate failing in Jenkins: server name mismatch or agent bug

Version 1Sign in to save

Complete solution

waitForQualityGate failing in a Jenkins declarative pipeline is usually a server-name mismatch or a known scanner-plugin bug on agents. This skill covers both.

Context: Stack Overflow #42909439 (accepted answer, 14 votes): a Jenkins declarative pipeline fails at waitForQualityGate with "SonarQube installation defined in this job does not match any configured installation". The asker renamed the server in Jenkins config to match the Jenkinsfile and got a different error; the thread found the real cause in the scanner plugin.

[accepted answer]: two things to check. First, the name passed to withSonarQubeEnv in the Jenkinsfile must exactly match a server name configured under Jenkins global SonarQube servers; a mismatch produces the "does not match any configured installation" error. Second, there was a genuine bug in the SonarQube Jenkins scanner plugin (tracked as SONARJNKNS-282): waitForQualityGate failed when the job ran on a Jenkins agent/slave instead of the master. The fix was upgrading to scanner plugin v2.61 or newer. A working stage looks like this:

stage("SonarQube analysis") { steps { withSonarQubeEnv("YourServerName") { sh "[path-to]/sonar-scanner" } def qg = waitForQualityGate() if (qg.status != "OK") { error "Pipeline aborted due to quality gate failure" } } }

If waitForQualityGate fails only on agents but works on the master, it is the plugin bug: upgrade, dont rename things.

Evidence

Stack Overflow #42909439 (accepted answer, 14 votes): a Jenkins declarative pipeline fails at waitForQualityGate with "SonarQube installation defined in this job does not match any configured installation". The asker renamed the server in Jenkins config to match the Jenkinsfile and got a different error; the thread found the real cause in the scanner plugin.

Verified resolution: [accepted answer]: two things to check. First, the name passed to withSonarQubeEnv in the Jenkinsfile must exactly match a server name configured under Jenkins global SonarQube servers; a mismatch produces the "does not match any configured installation" error. Second, there was a genuine bug in the SonarQube Jenkins scanner plugin (tracked as SONARJNKNS-282): waitForQualityGate failed when the job ran on a Jenkins agent/slave instead of the master. The fix was upgrading to scanner plugin v2.61 or newer. A working stage looks like this:

stage("SonarQube analysis") { steps { withSonarQubeEnv("YourServerName") { sh "[path-to]/sonar-scanner" } def qg = waitForQualityGate() if (qg.status != "OK") { error "Pipeline aborted due to quality gate failure" } } }

If waitForQualityGate fails only on agents but works on the master, it is the plugin bug: upgrade, dont rename things.

Source: https://stackoverflow.com/questions/42909439

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_8Vu7LJPyrPlShKx3vs3lxg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">waitForQualityGate failing in Jenkins: server name mismatch or agent bug <span>— Vectle</span></a>