Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71764

Changing Sonar Global configuration does not apply to existing projects actions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • sonar-plugin
    • None

      After updating the global SonarQube installations (for example change the hostname / URL, some job pages would not display and the Jenkins logs are spammed with:

      WARNING	h.p.s.client.SQProjectResolver#resolve: Error fetching project information
      java.net.SocketTimeoutException: connect timed out
      	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
      	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
      	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
      	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
      	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      	at java.base/java.net.Socket.connect(Socket.java:609)
      	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:124)
      	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:221)
      	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:147)
      	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192)
      	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
      	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
      	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
      	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
      	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
      	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
      	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
      	at okhttp3.RealCall.execute(RealCall.java:69)
      	at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:188)
      Caused: java.lang.IllegalStateException: Fail to request ${OLD_URL}/api/ce/task?id=XXXXXXXXXXXXXXX
      	at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:190)
      	at org.sonarqube.ws.client.HttpConnector.get(HttpConnector.java:124)
      	at org.sonarqube.ws.client.HttpConnector.call(HttpConnector.java:111)
      	at hudson.plugins.sonar.client.HttpClient.getHttp(HttpClient.java:37)
      	at hudson.plugins.sonar.client.WsClient.getCETask(WsClient.java:51)
      	at hudson.plugins.sonar.client.SQProjectResolver.requestCETaskDetails(SQProjectResolver.java:98)
      	at hudson.plugins.sonar.client.SQProjectResolver.resolve(SQProjectResolver.java:75)
      	at hudson.plugins.sonar.action.SonarCacheAction.get(SonarCacheAction.java:76)
      	at hudson.plugins.sonar.action.SonarCacheAction.get(SonarCacheAction.java:52)
      	at hudson.plugins.sonar.action.SonarProjectActionFactory.createProjectPage(SonarProjectActionFactory.java:117)
      	at hudson.plugins.sonar.action.SonarProjectActionFactory.createFor(SonarProjectActionFactory.java:83)
      	at hudson.plugins.sonar.action.SonarProjectActionFactory.createFor(SonarProjectActionFactory.java:42)
      	at hudson.model.Actionable.createFor(Actionable.java:115)
      	at hudson.model.Actionable.getAction(Actionable.java:330)
      	at jenkins.branch.ItemColumn.isPrimary(ItemColumn.java:67)
      

      Quickly checking into this, it looks like the transient action is created based on the last completed build information: https://github.com/jenkinsci/sonarqube-plugin/blob/sonar-2.15/src/main/java/hudson/plugins/sonar/action/SonarProjectActionFactory.java#L65-L66. And builds that have been completed before the change still have reference to the old details:

      [...]
          <hudson.plugins.sonar.action.SonarAnalysisAction plugin="sonar@2.15">
            <installationName>my-sonar-install</installationName>
            <installationUrl>https://old.url</installationUrl>
            <ceTaskId>XXXXXXXXXXXXX</ceTaskId>
            <url>https://old.url/dashboard?id=com.acme.myapp%3Amyapp</url>
            <serverUrl>https://old.url</serverUrl>
            <isNew>true</isNew>
            <isSkipped>false</isSkipped>
          </hudson.plugins.sonar.action.SonarAnalysisAction>
      [...]
      

      The action should probably not persist URLs but lookup the information using the installationName..

            sonarteam Sonar Team
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: