SONAR_HOST_URL can't be reached in bitBucket pipeline

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQUbe version 9.5
  • how is SonarQube deployed: zip
  • what are you trying to achieve
    I am trying to Integrate BitBucket to SonarQube. Everything is setup as per the documentation. But getting errors while running the BitBucket Pipeline.
  • what have you tried so far to achieve this
    Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

INFO: ------------------------------------------------------------------------
77 INFO: EXECUTION FAILURE
78 INFO: ------------------------------------------------------------------------
79 ERROR: SonarQube server [$SONAR_HOST_URL] can not be reached
80 INFO: Total time: 5.389s
81 ERROR: Error during SonarScanner execution
82 INFO: Final Memory: 3M/15M
83 INFO: ------------------------------------------------------------------------
84 org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
85 	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
86 	at java.base/java.security.AccessController.doPrivileged(Native Method)
87 	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
88 	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
89 	at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)
90 	at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)
91 	at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
92 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
93 Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
94 	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
95 	at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
96 	at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
97 	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
98 	... 7 more
99 Caused by: java.net.SocketTimeoutException: connect timed out
100 	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
101 	at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
102 	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
103 	at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
104 	at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
105 	at java.base/java.net.Socket.connect(Unknown Source)
106 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.connectSocket(Platform.java:130)
107 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:263)
108 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connect(RealConnection.java:183)
109 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
110 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
111 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
112 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.Transmitter.newExchange(Transmitter.java:169)
113 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
114 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
115 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
116 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
117 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
118 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
119 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
120 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
121 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
122 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
123 	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
124 	at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
125 	at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.execute(RealCall.java:81)
126 	at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:115)
127 	at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99)
128 	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)
129 	... 10 more
130 ERROR: 
131 ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

I already spoke to my IT team. They have also whitelisted IPs given by BitBucket.

Let me know what am I missing?

Thanks
Shiva

Hi Shiva,

The error is pretty clear:

If your SonarQube server URL is correctly configured (worth double-checking) then you should talk to your network folks again.

:warning: Also, make sure you upgrade to SonarQube v9.9 LTS soon, not only to benefit from our Best LTS Ever™, but because soon we will systematically ask users to upgrade when they ask questions about earlier versions of SonarQube, which are now considered unsupported. :smiley:

 
HTH,
Ann