Changed IP addrs; Quality Gate still looking at old IP

Summary: we changed IP addresses; I updated IP addresses, but waitForQualityGate() is still looking for old IP address.

I inherited a SonarQube installation (I believe 8.1) in a Windows 10 system that has worked consistently under Jenkins, including waitForQualityGate.
The SonarQube installation is on the Jenkins master, but the builds are done on a Jenkins slave.
We have needed to change IP addresses.

I have updated IP addresses:

  • On Jenkins master, C:\sonarqube\conf\ (sonar.jdbc.url, the :1433 URL)
  • Jenkins > configuration > SonarQube servers > Server URL (:9000)
  • SonarQube server (at :9000) > Admin > Config > Webhooks: the Jenkins webhook
  • on the build agent: the line was commented out with #, but I updated the URL anyway
  • The build line: SonarScanner.MSBuild.exe begin /

But: waitForQualityGate() fails:
// waitForQualityGate
Checking status of SonarQube task on server ‘SonarQube’
// script
. . . Connection timed out: connect
. . .
Caused: java.lang.IllegalStateException: Fail to request

On the build agent, I checked the resulting .sonarqube/conf/SonarQubeAnalysisConfig.xml; it shows the new IP.

I have rebooted the Jenkins master
I have checked the Community for similar questions.

Any ideas where the old IP address is hiding, and how I can fix it?


Jenkins isn’t waiting on a specific SonarQube IP/URL. It’s waiting to hear from a SonarQube. You should check on the SonarQube side (Administration -> Webhooks, at project level or Administration -> Configuration -> Webhooks at global level) to see where your Webhooks are being sent and what response if any they’re getting.



Thanks for responding. Maybe I wasn’t clear earlier.
I’m seeing this at the end of the Jenkins console output Connection timed out: connect
. . .  
Caused: java.lang.IllegalStateException: Fail to request http://oldIPaddress:9000/api/ce/task?id=SonarQubeID
. . .

As I noted originally, I logged into SonarQube server (as administrator), and updated the IP address in Administration > Configuration > Webhooks. I even rebooted where it and the Jenkins master live.

But I just noticed something interesting: the old IP address that is being used references port 9000 (which would be the SonarQube server). The Webhook on the server uses port 8080 (which is the Jenkins server). I didn’t modify any port numbers, so I presume this is correct.

I appreciate your help so far. Any other ideas?

Hi Larry,

Thanks for clarifying. Can you provide the pipeline code for the analysis & QG steps?


Hi Ann,

Since the system is sandboxed, I am transcribing. Typos are my fault.

The build is kicked off with a PowerShell script

$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"

SonarScanner.MSBuild.exe begin /k:"buildname" /"http://newIPAddress:9000" /d:sonar.login="wholeBunchOfHexDigits"

Select-String -Path $buildPath\pathToBuildFile\buildFile.bld '(?<=%\\).*\.sln(?=")' -AllMatches … (do you need more here?)  

SonarScanner.MSBuild.exe end /d:sonar.login="sameHexDigitsAsAbove"  

This means of calling MSBuild with SonarQube has worked successfully for over a year.


timeout(time: 30, unit: 'MINUTES') {
    def qq = waitForQualityGate()
    if (qq.status != 'OK') {
        error "Pipeline aborted due to quality gate failure; ${qq.status}"


Quality Gate
[Pipeline] timeout
Timeout set to expire in 30 min
Checking status of SonarQube task 'bunchofLettersAndDigits' on server 'SonarQube'
// timeout
Post stage

Anything else that might help?

Thanks again,


I’ll be honest. I have no idea where that old I.P. is set/cached/coming from (mmm… “cached”… you might clean out any .sonar directories you see lying around). What I can say is that that waitForQualityGate step is supposed to be picking up information from the previous step you ran withSonarQubeEnv. Except that you’re not using that because you’re passing the server info on the command line instead, as described in the Scanner for MSBuild docs. The Scanner for Jenkins suggest a slightly different structure for MSBuild analysis via Jenkins:

node {
  stage('SCM') {
    git ''
  stage('Build + SonarQube analysis') {
    def sqScannerMsBuildHome = tool 'Scanner for MSBuild 4.6'
    withSonarQubeEnv('My SonarQube Server') {
      bat "${sqScannerMsBuildHome}\\SonarQube.Scanner.MSBuild.exe begin /k:myKey"
      bat 'MSBuild.exe /t:Rebuild'
      bat "${sqScannerMsBuildHome}\\SonarQube.Scanner.MSBuild.exe end"

That withSonarQubeEnv part defines which of the possibly many SonarQube instances you have defined at the global level to use, so server URL and auth are picked up from there.


Hi. Please also check the “Server base URL” on the SonarQube side:

1 Like

Ann & Felipe,

Thanks for your replies.
Felipe: I checked the Server base URL field; it has always been blank. I may to need to set it. Do I use the URL of the Jenkins master (which should be in Webhooks?) or the SonarQube server (:9000)?

Ann: More info – the build stage (which calls what I wrote above) looks thus

stage('Build + SonarScanner') {
    agent ( label 'build_agent')
    steps {
        withSonarQubeEnv('SonarQube') {
            dir( "${dir_to_run_in}" ) {
                runSonarQubeBuildTransformer( "${env.WORKSPACE}")
. . .
def runSonarQubeBuildTransformer( sourceCodePath ) {
    powershell '& "C:\\Program Files\\VisBuildPro9\\VisBuildCmd.exe" /logfile "logfile.txt"  /nologo ".\\Build_with_SQ.bld"'

Build_with_SQ.bld has:

<step action='PowerShell'>
    <CmdStr><![CDATA[& "C:Jenkins\workspace\MyBuildName\MyPowerShellScript.ps1" -buildPath "C:\Jenkins\workspace\MyBuildName"]]</CmdStr>
    . . .

The PowerShell script noted in a previous post seems to have what you have:

Select-String . . . | foreach { $filename = Split-Path "$sourcePath\$_" -Leaf; Write-Host $filename; & "$msbuild" "$sourcePath\$_" "/t:Rebuild" "/p:Configuration=$configuration" . . .

And as I noted in my first post, in Jenkins > Configure System > SonarQube servers;

  • Environment variables: checked
  • SonarQube installations: Name ‘SonarQube’ (unchanged); Server URL: updated to new IP address; Server authentication token: unchanged

Maybe I need to fill in the previously empty “Server base URL” as Felipe suggested. So which URL do I use: MyJenkinsMaster:8080 or MySonarServer:9000?

Thanks to both of you,

One additional note (get ready to cringe!): the label at the bottom of the SonarQube page reads "Version 6.7.5 (build 38563)

The description says “HTTP URL of this SonarQube server (…)” :wink:

1 Like

Also just noticed: on the Pipeline page, the left column that has all the quick links (“Back to Dashboard”, “Status”, “Build Now” (or “Build with Parameters”, “Delete Pipeline”, …), the “SonarQube” link – has the old IP address!

Somewhere, it’s being cached.

This solved my issue! Thanks a lot!!!