arsdehnel
arsdehnel

Reputation: 21

Jenkins SonarQube Scanner Behind a Proxy

We have a Jenkins server setup in our datacenter and behind our proxy.
We're trying to have that machine run SonarQube Scanner on a repo and publish the results out to a SonarQube server outside our network (in AWS).

The job starts up Sonar Scanner properly but then fails when trying to connect to our SonarQube server:

22:12:31.612 DEBUG: keyStore is : 22:12:31.613 DEBUG: keyStore type is : jks 22:12:31.613 DEBUG: keyStore provider is : 22:12:31.613 DEBUG: init keystore 22:12:31.613 DEBUG: init keymanager of type SunX509 22:12:31.682 INFO: User cache: /zdata/jenkins/.sonar/cache 22:12:31.683 DEBUG: Extract sonar-scanner-api-batch in temp... 22:12:31.687 DEBUG: Get bootstrap index... 22:12:31.687 DEBUG: Download: http://my-sq-server.com/batch/index 22:12:31.713 ERROR: SonarQube server [http://my-sq-server.com] can not be reached

I read Sonar Runner Behind a Proxy and tried putting those values in the JVM options section and the Additional Options sections but they don't seem to make any difference.

To troubleshoot this a little I added a simple curl step to the Jenkins job just through a bash script and had that hit the same server and that worked fine.

I'm sure I'm just missing a tiny little detail here but I'm new to SQ and don't quite know where else to look.

UPDATE

The current output is showing this:

/zdata/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/scanner-3.0.1.733/bin/sonar-scanner -Dhttp.proxyHost=proxy.hostname.com -Dhttp.proxyPort=8080 -e -Dsonar.host.url=http://my-sonarqube-server.com ******** -Dsonar.sourceEncoding=UTF-8 -Dsonar.sources=. -Dsonar.language=js -Dsonar.exclusions=__tests__/**,**/node_modules/**,coverage/** -Dsonar.projectVersion=1.0 -Dsonar.projectKey=repo-key -Dsonar.verbose=true -Dsonar.javascript.lcov.reportPath=coverage/lcov.info -Dsonar.tests=__tests__ "-Dsonar.projectName=Project Name" -Dsonar.projectBaseDir=/zdata/jenkins/workspace/my-project

Upvotes: 2

Views: 3786

Answers (1)

VonC
VonC

Reputation: 1325017

Check if your proxy requires authentication: you might have to add

-Dhttp.proxyUser=username -Dhttp.proxyPassword=password

Make sure your proxy is reference as the proxy server name, without http://:

-Dhttp.proxyHost=myproxy (not -Dhttp.proxyHost=http://myproxy)

Upvotes: 3

Related Questions