SAP / jenkins-library

Jenkins shared library for Continuous Delivery pipelines.
https://www.project-piper.io
Apache License 2.0
781 stars 594 forks source link

SonarQube server can not be reached #2664

Closed kevinzwithu closed 3 years ago

kevinzwithu commented 3 years ago

Hi colleagues,

Currently our pipeline crushed continuouslly. After checking, we find that the step sonarExecuteScan in PR-Voting stage failed. Here's related information:

11:37:44  + ./piper sonarExecuteScan --defaultConfig .pipeline/piper-defaults.yml --ignoreCustomDefaults
11:37:44  info  sonarExecuteScan - Using stageName 'Pull-Request Voting' from env variable 'STAGE_NAME'
11:37:44  info  sonarExecuteScan - Project config: '.pipeline/config.yaml'
11:37:44  info  sonarExecuteScan - Project defaults: '.pipeline/piper-defaults.yml'
11:37:44  info  sonarExecuteScan - Ignoring custom defaults from pipeline config
11:37:44  info  sonarExecuteScan - Retrieving hook configuration
11:37:44  warn  sonarExecuteScan - sonar token not set
11:37:44  info  sonarExecuteScan - Using local trust store
11:37:44  info  sonarExecuteScan - running command: sonar-scanner -Dsonar.pullrequest.github.repository=grchcpcf/manual-procedure -Dsonar.pullrequest.key=848 -Dsonar.pullrequest.base=master -Dsonar.pullrequest.branch=fix -Dsonar.pullrequest.provider=github -Dsonar.projectVersion='${projectVersion}'
11:37:45  info  sonarExecuteScan - INFO: Scanner configuration file: /home/piper/sonar-scanner/conf/sonar-scanner.properties
11:37:45  info  sonarExecuteScan - INFO: Project root configuration file: /home/jenkins/agent/workspace/Pipeline_manual-procedure_PR-848/sonar-project.properties
11:37:45  info  sonarExecuteScan - INFO: SonarQube Scanner 3.0.3.778
11:37:45  info  sonarExecuteScan - INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
11:37:45  info  sonarExecuteScan - INFO: Linux 4.19.112+ amd64
11:37:45  info  sonarExecuteScan - INFO: SONAR_SCANNER_OPTS=-Djavax.net.ssl.trustStore=/home/jenkins/agent/workspace/Pipeline_manual-procedure_PR-848/.certificates/cacerts -Djavax.net.ssl.trustStorePassword=changeit
11:37:45  info  sonarExecuteScan - INFO: User cache: /home/piper/.sonar/cache
11:37:50  error sonarExecuteScan - ERROR: SonarQube server [https://sonarci.wdf.sap.corp:8443/sonar] can not be reached
11:37:50  info  sonarExecuteScan - INFO: ------------------------------------------------------------------------
11:37:50  info  sonarExecuteScan - INFO: EXECUTION FAILURE
11:37:50  info  sonarExecuteScan - INFO: ------------------------------------------------------------------------
11:37:50  info  sonarExecuteScan - INFO: Total time: 5.416s
11:37:50  error sonarExecuteScan - ERROR: Error during SonarQube Scanner execution
11:37:50  info  sonarExecuteScan - INFO: Final Memory: 12M/1963M
11:37:50  info  sonarExecuteScan - INFO: ------------------------------------------------------------------------
11:37:50  info  sonarExecuteScan - org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
11:37:50  info  sonarExecuteScan -  at java.security.AccessController.doPrivileged(Native Method)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.cli.Main.main(Main.java:61)
11:37:50  info  sonarExecuteScan - Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:100)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.Jars.getScannerEngineFiles(Jars.java:76)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
11:37:50  info  sonarExecuteScan -  ... 8 more
11:37:50  info  sonarExecuteScan - Caused by: java.net.SocketTimeoutException: connect timed out
11:37:50  info  sonarExecuteScan -  at java.net.PlainSocketImpl.socketConnect(Native Method)
11:37:50  info  sonarExecuteScan -  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
11:37:50  info  sonarExecuteScan -  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
11:37:50  info  sonarExecuteScan -  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
11:37:50  info  sonarExecuteScan -  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
11:37:50  info  sonarExecuteScan -  at java.net.Socket.connect(Socket.java:589)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.connectSocket(Platform.java:124)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:220)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connect(RealConnection.java:146)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:186)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.execute(RealCall.java:63)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:113)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
11:37:50  info  sonarExecuteScan -  at org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:96)
11:37:50  info  sonarExecuteScan -  ... 12 more
11:37:50  error sonarExecuteScan - ERROR: 
11:37:50  error sonarExecuteScan - ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
11:37:50  fatal sonarExecuteScan - Execution failed - running command 'sonar-scanner' failed: cmd.Run() failed: exit status 1

Here's our settings:

sonarExecuteScan:
    dockerEnvVars: {}
    dockerImage: 'docker.wdf.sap.corp:50000/piper/sonar'
    dockerWorkspace: '/home/piper'
    # already set globally in https://sonarci.wdf.sap.corp:8443/sonar
    # githubApiUrl: 'https://github.wdf.sap.corp/api/v3'
    instance: 'SAP SonarQube'
    options:
      - "-Dsonar.projectVersion='${projectVersion}'"
    stashContent:
      - 'buildDescriptor'
      - 'git'
      - 'sonar'

We notice that some other teams also meet this issue. Could you please help check?

Thanks and Best Regards, Kevinz

Exotrom commented 3 years ago

@kevinzwithu I am facing the same issue. I guess the issue is more related to the internal SAP piper repository than to this one, as it seems to be a problem with the default piper config and not with the step itself.

However, until fixed you can try the following workaroud:

steps:
  sonarExecuteScan:
    options:
      - '-Dsonar.host.url=<desired sonar url>'

In case you want to use the "SAP SonarQube", simply set the sonar.host.url to the SAP Sonar CE url

Best regards Leonard

github-actions[bot] commented 3 years ago

Thank you for your contribution! This issue is stale because it has been open 60 days with no activity. In order to keep it open, please remove stale label or add a comment within the next 10 days. If you need a Piper team member to remove the stale label make sure to add @SAP/jenkins-library-team to your comment.

github-actions[bot] commented 3 years ago

Issue got stale and no further activity happened. It has automatically been closed. Please re-open in case you still consider it relevant.