Itiviti / gradle-dotnet-plugin

Gradle plugin for interacting with dotnet cli
Apache License 2.0
19 stars 8 forks source link

Dotnet-sonar not working when sonar.login is used #2

Closed nikolauskrismer closed 4 years ago

nikolauskrismer commented 4 years ago

Hi,

it seems that when using the dotnet-sonar plugin credentials can not be used. I am passing my credentials like this (in build.gradle):

plugins {
    id 'com.itiviti.dotnet' version '1.3.6'
    id 'com.itiviti.dotnet-sonar' version '1.3.6'
}

dotnet {
    solution = '<myProject>.sln'
    configuration = 'Release'
}

sonarqube {
    properties {
        property 'sonar.host.url', <mySonarServerUrl>
        property 'sonar.login', <mySonarLogin>
        property 'sonar.projectKey', <projectKeyName>
        property 'sonar.branch', 'develop'
    }
}

However, when I call gradle with something like ./gradlew clean build sonarqube -x dotnetTest -Pversion=1.0.0-SNAPSHOT I get this error:

> Task :sonarqube FAILED
Caching disabled for task ':sonarqube' because:
  Build cache is disabled
Task ':sonarqube' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Starting process 'command 'C:\workspace\<myProject>\build\dotnet\tools\dotnet-sonarscanner''. Working directory: C:\workspace\<myProject> Command: C:\workspace\<myProject>\build\dotnet\tools\dotnet-sonarscanner end
Successfully started process 'command 'C:\workspace\<myProject>\build\dotnet\tools\dotnet-sonarscanner''
SonarScanner for MSBuild 4.10
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
23:14:14.976  Credentials must be passed in both begin and end steps or not at all
23:14:14.976  Post-processing failed. Exit code: 1

Is there anything I can do about this? I did not find anything about the end call in the code (I did not look very closely though)

Greetings, Niko

ngyukman commented 4 years ago

Hi, thanks for your report Sonar is running by a begin and an end execution before and after the build

And here is the end execution https://github.com/Itiviti/gradle-dotnet-plugin/blob/master/src/main/kotlin/com/itiviti/tasks/DotnetSonarTask.kt

Indeed login is the special parameter that is required to pass to sonnar runner at the end