I am trying to do some SonarCloud code analyses on Jenkins with a donet docker container that is already built by my organization. However, I have to install the sonnarscanner tool on top of it, but I am getting permission denials when running the tool. This is what I've tried so far:
stage("Pull dotnet image") {
dotnetCoreImage = dockerImage("dotnet2.0")
}
dotnetCoreImage.inside() {
stage("Start sonar scanner") {
sh "dotnet tool install --tool-path /tmp/.donet/tools dotnet-sonarscanner; \
chmod 777 /tmp/.donet/tools/ -R;
export PATH=/tmp/.donet/tools; \
dotnet sonarscanner begin \
/d:sonar.host.url=https://sonarcloud.io \
/v:'1.0' \
/d:sonar.cs.opencover.reportsPaths='src/test/coverage/*.opencover.xml'\
/d:sonar.branch.name=${env.BRANCH_NAME}"
}
But I get the following errors:
16:00:46.527 16:00:46.527 WARNING: Error occurred when installing the loader targets to '/.local/share/Microsoft/MSBuild/4.0/Microsoft.Common.targets/ImportBefore/SonarQube.Integration.ImportBefore.targets'. 'Access to the path '/.local/share/Microsoft/MSBuild/4.0/Microsoft.Common.targets/ImportBefore' is denied.'
So my question is if there is a way to run inside the docker image with more permissions such as root.
(Cannot do sudo since it is not installed in the docker image)