CI Issue in Docker Image

Invoke-Expression "docker run (env:DOCKER_FLAGS) -v (env:CI_PROJECT_DIR):(env:CI_PROJECT_DIR) -w (env:CI_PROJECT_DIR) ($env:DOCKER_IMAGE) dotnet sonarscanner end /d:sonar.login=admin /d:sonar.password=admin "
SonarScanner for MSBuild 4.10
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:

  1. The project has not been built - the project must be built in between the begin and end steps
  2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
  3. The begin, build and end steps have not all been launched from the same folder
  4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
    09:34:32.775 Post-processing failed. Exit code: 1

Please help, this is working on local system

Hi,

The error seems pretty clear to me: “SonarQube was unable to collect the required information about your projects.” followed by a list of possible causes.

Did you build your project? Are you using a supported version of MSBuild? … &etc.

 
Ann

Hey Ann,

Yeah about that the project was build successfully in Docker Container.
But I have a question with respect to screen shot.

It is saying “Using the .NET Core version of the Scanner for MSBuild”
I am trying these commands on .NET Framework project
When I tried on local these seems to be working but not on docker container.

MSBuild version 16 is installed.

Thanks
Anuj

I would also like to know is there a easier way to Integrate to CI.
.NET Framework and .NET Core Project.
Steps as I am going by my guts to include the commands in yaml file before and after build of artifacts.

Is there a better way to implement all this ?

Thanks
Anuj

hi @anuj - what CI/CD service are you using?

Hey Andrei,
I am using Gitlab CI/CD.

You can read about the integration here https://www.sonarqube.org/gitlab-integration/

Yes, I did came across that but I was hoping in coding term when I am pulling docker image in my container before building of my code I put the sonarscanner start and after build put in the sonarscanner end. Since all executed on 3 different invoke expression for some reason the output folder turns up empty without any analysis .dll. So when sonarscanner end is trigger after building it throw and error message of not able to find anything to push.

I was looking for something helping on those terms and if I doing something wrong in yaml file by doing start build end all on three different line of invoke expression doctor run is causing this so that I can be certain I am building this integration with industry standard practises

Hi @anuj

The sonar-scanner end should be invoked from the folder where your source code is, and most importantly, from where the .sonarqube folder is (which normally is the same as your source code).

As we install targets and hook up into the dotnet build task, do you see any Sonar related logs if you execute the dotnet build command with a verbose option ? That may help at first to see if those target are well considered during the build.

Thanks.

Hey Mickael,

Thanks for the input it helped to channel my integration.
Few follow up questions :-

Q1:- .sonarcube folder is to be committed inside the project repository ?
Q2: Is project needs to be in debug configuration ?
Q3: No Sonar related logs on executing with verbose option.
Q4. My local project repository when executing command from developer command prompt,
looks up to the logged in user and there .sonar folder for help. So Can that be the reason why it is not working docker container doesn’t require a local user and we might need to configure path in some config file ?

Thanks
Anuj

Hi @anuj ,

No, this folder is automatically created upon the first analysis inside the folder where you are executing the commandline from

No, that’s not needed.

That’s weird. Can you send us the 3 followings logs, all in debug mode if possible : sonar-scanner begin, your build (at least the first 100 lines should be enough), and sonar-scanner end ?

I’m not sure about this one, let’s have a look first at the logs and see what we can assume with them.

Thank you.