SonarScanner.MSBuild SSL/TLS

build-wrapper
msbuild

(Greg Bishop) #1

Recently the c build-wrapper bypass was removed causing us to have to use the build-wrapper for our builds. Prior to removal I used the sonar-scanner.bat, but when I put the path for the output directory I get the following error:

INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 24.394s
INFO: Final Memory: 42M/457M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Illegal char <:> at index 8: output=C:\Jenkins\workspace\NCITE.Test.174\output\/build-wrapper-dump.json
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

For some reason it does not like the colon and adds a forward slash before the json file.

So, I switched to attempting to use the SonarScanner.MSBuild. However, the problem is that we have to pass a punch of pki/truststore information in order for the build server to connect with the SonarQube server. My SONAR_SCANNER_OPTS looks like this:

-Xmx4096m -Djavax.net.ssl.keyStoreType=jks -Djavax.net.ssl.keyStore=C:\path\to\local.jks -Djavax.net.ssl.keyStorePassword=somepassword -Djavax.net.ssl.trustStore=C:\path\to\certs.jks -Dhttp.proxyHost=ip -Dhttp.proxyPort=port -Dhttps.proxyHost=ip -Dhttps.proxyPort=port

I’m getting the following error:

SonarScanner for MSBuild 4.5
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\sonar-scanner-msbuild\SonarQube.Analysis.xml
Loading analysis properties from C:\sonar-scanner-msbuild\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
17:42:21.003  Updating build integration targets...
17:42:21.037  Fetching analysis configuration settings...
17:42:21.324  Failed to request and parse 'https://sonar.server/api/server/version': The request was aborted: Could not create SSL/TLS secure channel.

Unhandled Exception: System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass15_0.<DownloadServerVersion>b__0()
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func`1 op, String url, Action`1 onError)
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.DownloadServerVersion()
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetServerVersion()
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetProperties(String projectKey, String projectBranch)
   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
   at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
   at SonarScanner.MSBuild.BootstrapperClass.Execute()
   at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
   at SonarScanner.MSBuild.Program.Main(String[] args)

We are at a loss as to what to do at this point.

SonarQube version: 7.5.0.20543
SonarScanner.MSBuild version: 4.5.0.1761
SonarScanner version: 3.2.0.1227


(Greg Bishop) #2

I am bumping this because I see no way around the issues that I am having. I could really use help here. Thanks