Login to SonarCloud Organization with BitBucket Authentication

Hi guys

we have setup bitbucket + sonar cloud after add we can’t see any authentication
can you guys please help us

It’s not clear to me what you’re asking here. The login page of SonarCloud offers 3 options: Azure Dev Ops, Bitbucket, or GitHub. When you click on Bitbucket, you should be redirected to Atlassian’s auth service to login, or give authorization to login. I’m not sure what you don’t see. Can you please clarify?

Hi, Janos,
we have integrated sonar cloud from bitbucket dashboard and grant the access to access Atlassian’s and setup pipeline unfortunate I haven’t any error and getting analyze my bit bucket repository. I have followed the documentation and done everything steps by step but unfortunately not analyzing code I want to understand where I missed anything or any setting wrongly configured. could you please help us to identify and fix the issue?

Did you import the repo on SonarCloud?

Is it a public project on SonarCloud? Can you please share the link?

Can you share the last couple of lines from the output of the scanner in your pipeline?

Hi Janos

this is private repo and showing on showing me on the sonar cloud dashboard

+ sonar-scanner Dsonar.projectKey=faasos_platform -Dsonar.organization=rebelfoods -Dsonar.sources=. -Dsonar.host.url=[https://sonarcloud.io](https://sonarcloud.io) -Dsonar.login=$SONAR_TOKEN
[12:25:43] Starting SonarQube analysis...
[12:25:43] Getting info from "package.json" file
[12:25:43] Checking if executable exists: /root/.sonar/native-sonar-scanner/sonar-scanner-4.0.0.1744-linux/bin/sonar-scanner
[12:25:43] Could not find executable in "/root/.sonar/native-sonar-scanner".
[12:25:43] Proceed with download of the platform binaries for SonarQube Scanner...
[12:25:43] Creating /root/.sonar/native-sonar-scanner
[12:25:43] Downloading from [https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.0.0.1744-linux.zip](https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.0.0.1744-linux.zip)
[12:25:43] (executable will be saved in cache folder: /root/.sonar/native-sonar-scanner)

INFO: Scanner configuration file: /root/.sonar/native-sonar-scanner/sonar-scanner-4.0.0.1744-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 4.0.0.1744
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Linux 4.19.50-coreos-r1 amd64
INFO: Bitbucket Cloud Pipelines detected
INFO: User cache: /root/.sonar/cache
INFO: SonarQube server 7.9.0
INFO: Load global settings
INFO: Load global settings (done) | time=589ms
INFO: Server id: BD367519-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=137ms
INFO: Load/download plugins (done) | time=31642ms
INFO: Loaded core extensions: developer-scanner
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 39.291s
INFO: Final Memory: 5M/20M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Tasks support was removed in SonarQube 7.6.
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Ok so something went wrong during analysis. To see more details, please add -X to your scanner command, and then share the more detailed output.

Hi Janos

already added

image: feeni/node-chrome:latest

clone:

depth: full # SonarCloud scanner needs the full history to assign issues properly

workingDirectory: node/

definitions:

caches:

sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build

steps:

- step: &build-test-sonarcloud

name: Build, test and analyze on SonarCloud

caches:

- node

- sonar

script:

- npm install --quiet

- npm install -g sonarqube-scanner

- sonar-scanner Dsonar.projectKey=faasos_platform -Dsonar.organization=rebelfoods -Dsonar.sources=. -Dsonar.host.url=[https://sonarcloud.io](https://sonarcloud.io) -Dsonar.login=e6f7afd42e105cf108ffcc969c46e16a80dba549

- sonar-scanner -X

#- npm run test #-- --code-coverage --no-watch --no-progress --browsers=ChromeHeadlessNoSandbox

#- pipe: sonarsource/sonarcloud-scan:1.0.0

# variables:

# SONAR_TOKEN: ${SONAR_TOKEN}

# EXTRA_ARGS: 'Dsonar.projectKey=faasos_platform -Dsonar.organization=rebelfoods -Dsonar.sources=. -Dsonar.host.url=[https://sonarcloud.io](https://sonarcloud.io) -Dsonar.login=e6f7afd42e105cf108ffcc969c46e16a80dba549'

pipelines:

default:

- step: *build-test-sonarcloud

pull-requests:

'**':

- step: *build-test-sonarcloud

output is

sonar-scanner -X
21:50:30.938 INFO: Scanner configuration file: /usr/local/Cellar/sonar-scanner/3.3.0.1492/libexec/conf/sonar-scanner.properties
21:50:30.940 INFO: Project root configuration file: NONE
21:50:30.960 INFO: SonarQube Scanner 3.3.0.1492
21:50:30.961 INFO: Java 12.0.1 Oracle Corporation (64-bit)
21:50:30.961 INFO: Mac OS X 10.13.6 x86_64
21:50:31.092 DEBUG: keyStore is :
21:50:31.092 DEBUG: keyStore type is : pkcs12
21:50:31.092 DEBUG: keyStore provider is :
21:50:31.093 DEBUG: init keystore
21:50:31.093 DEBUG: init keymanager of type SunX509
21:50:31.203 DEBUG: Create: /Users/manojmaurya/.sonar/cache
21:50:31.204 INFO: User cache: /Users/manojmaurya/.sonar/cache
21:50:31.204 DEBUG: Create: /Users/manojmaurya/.sonar/cache/_tmp
21:50:31.206 DEBUG: Extract sonar-scanner-api-batch in temp...
21:50:31.210 DEBUG: Get bootstrap index...
21:50:31.210 DEBUG: Download: [http://localhost:9000/batch/index](http://localhost:9000/batch/index)
21:50:31.251 ERROR: SonarQube server [[http://localhost:9000](http://localhost:9000)] can not be reached
21:50:31.251 INFO: ------------------------------------------------------------------------
21:50:31.251 INFO: EXECUTION FAILURE
21:50:31.252 INFO: ------------------------------------------------------------------------
21:50:31.252 INFO: Total time: 0.332s
21:50:31.262 INFO: Final Memory: 3M/20M
21:50:31.262 INFO: ------------------------------------------------------------------------
21:50:31.262 ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:310)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
	at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:181)
	at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:122)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
	at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
	at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
	... 7 more
Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connect(RealConnection.java:165)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.execute(RealCall.java:77)
	at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:113)
	at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)
	... 10 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:591)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.connectSocket(Platform.java:129)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:245)
	... 30 more

I meant to add -X in addition to the other parameters, like so:

sonar-scanner -X Dsonar.projectKey=faasos_platform -Dsonar.organization=rebelfoods -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN

Btw, when you post code or log output, you can simply copy paste, and put ``` before and after the content to format it verbatim.

Hi Jonas
now i am able analysis the code but not getting any suggestion any analysis report where is need to fix in bit bucket can you please help us

Do you confirm that you no longer get “EXECUTION FAILURE” in the output of the scanner? (You should see “EXECUTION SUCCESS” instead.) Please confirm that this issue is resolved.

Hi Janos
build was success but i am not getting syntactic error in bit bucket build is how success full even pull request has syntactical error

Can you provide an example of code and what exactly you are expecting to happen?

this pease of code there syntax error but analyse

global.test_classic_config = ;
var config=require(./config/test_config.js)
config(function(){
var cluster = require(‘cluster’);
var numCPUs = require(‘os’).cpus().length
var test_config = test_classic_config;
var env = test_config.env;
// var compass = require(‘node’);
var logger = require(’./helpers/logger’).logger