SonarScanner issue on AWS CodeBuild with .Net Core 2.1 Project


(Rob) #1

I’m attempting to integrate SonarQube into our CI/CD pipeline. I have a SonarQube 7.4 server setup which appears to be working fine. I can run a scan or my .Net Core 2.1 application using the instructions found at the following location without a problem.

I’m using AWS CodePipeline with AWS CodeBuild for my CI build process. The problem is that the SonarScanner does appear to be working using the CodeBuild container. The error I get is on the sonarscaner end.

The error log in AWS is shown below

Calling the SonarQube Scanner…
/root/.dotnet/tools/.store/dotnet-sonarscanner/4.4.2/dotnet-sonarscanner/4.4.2/tools/netcoreapp2.1/any/sonar-scanner- 59: exec: : Permission denied
The SonarQube Scanner did not complete successfully
08:53:50.666 Creating a summary markdown file…
08:53:50.666 Post-processing failed. Exit code: 1
[Container] 2018/11/23 08:53:50 Command did not exit successfully dotnet sonarscanner end /d:sonar.login=$SONARQUBE_LOGIN_TOKEN exit status 1
[Container] 2018/11/23 08:53:50 Phase complete: POST_BUILD Success: false
[Container] 2018/11/23 08:53:50 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: dotnet sonarscanner end /d:sonar.login=$SONARQUBE_LOGIN_TOKEN. Reason: exit status 1

I built the same docker image locally and get the exact same problem as I am doing running it in AWS. This can be found in GitHub at the following location:

To reproduce the problem I start the container interactively copy my source into the container using docker cp and the run the following commands

dotnet tool install --global dotnet-sonarscanner

dotnet sonarscanner begin /k:MyProjectCode / /d:sonar.login=MyUserToken

dotnet build MyProject.sln

dotnet-sonarscanner end /d:sonar.login=MyUserToken

Everything works until I call the end command and I get the same error as above

Any help would be much appreciated




(G Ann Campbell) #2


I’m not a Windows user, but this error makes me wonder about execute permissions on the installed tool…

And/or does the process running analysis have read/write/execute in the analysis directory? Analysis needs to create a temp directory.


(Rob) #3

Thanks for the reply.

I finally figured the problem and it was nothing to do with permissions. I needed to include Java 8 in the container build. Once I did this everything work great.



(G Ann Campbell) #4

Thanks for the followup Rob!