Nodejs project running on Kubernetes using helm

Hello there,

I’m using Azure Devops for CI/CD, and I start using Pipeline Decorator to enforce Sonarqubes on all projects, this approach I’ve learned here on community, thanks for that. Now, after running some projects, I’m facing a problem with one NodeJs project, I think this problem occurs because it was containered at the end.

I’m using the Sonarqube steps, so first, we ran a Prepare Analysis, and this step is finished successful. After that, some steps for Helm, as follows:

On step named “SI: Run Code Analysis”, I’ve got this error:

2020-02-28T14:48:52.8046450Z ##[section]Starting: SI: Run Code Analysis
2020-02-28T14:48:52.8052307Z ==============================================================================
2020-02-28T14:48:52.8052731Z Task : Run Code Analysis
2020-02-28T14:48:52.8053107Z Description : Run scanner and upload the results to the SonarQube server.
2020-02-28T14:48:52.8053459Z Version : 4.9.0
2020-02-28T14:48:52.8053739Z Author : sonarsource
2020-02-28T14:48:52.8054464Z Help : Version: 4.9.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

More Information
2020-02-28T14:48:52.8055261Z ==============================================================================
2020-02-28T14:48:52.9639047Z [command]/usr/bin/dotnet /home/vsts/work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/4.9.0/dotnet-sonar-scanner-msbuild/SonarScanner.MSBuild.dll end
2020-02-28T14:48:53.0452055Z SonarScanner for MSBuild 4.8
2020-02-28T14:48:53.0452695Z Using the .NET Core version of the Scanner for MSBuild
2020-02-28T14:48:53.1128263Z Post-processing started.
2020-02-28T14:48:53.2380142Z ##[error]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)
    2020-02-28T14:48:53.2391708Z The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
    2020-02-28T14:48:53.2392231Z Possible causes:
    2020-02-28T14:48:53.2393199Z 1. The project has not been built - the project must be built in between the begin and end steps
    2020-02-28T14:48:53.2393853Z 2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
    2020-02-28T14:48:53.2394726Z 3. The begin, build and end steps have not all been launched from the same folder
    2020-02-28T14:48:53.2395255Z 4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    2020-02-28T14:48:53.2405550Z Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
    2020-02-28T14:48:53.2450660Z ##[error]14:48:53.244 Post-processing failed. Exit code: 1
    2020-02-28T14:48:53.2452106Z 14:48:53.244 Post-processing failed. Exit code: 1
    2020-02-28T14:48:53.2573435Z ##[error]The process ‘/usr/bin/dotnet’ failed with exit code 1
    2020-02-28T14:48:53.2595594Z ##[section]Finishing: SI: Run Code Analysis

I think it was confused, trying to do a Analysis as .Net Code, and it is Node.js. But I don’t know why to tell to sonarqube what is the correct language, or even use npm instead msbuild.

Hello,

After some more research, I figure it out: I’m really using msbuild. I ajust my yaml as follows, and it works with .Net Core and NodeJs with no problems ou Azure Devops:

inputs:

    SonarQube: <sonarname>
    scannerMode: CLI
    configMode: manual
    cliProjectKey: 'sonarQubeKey'
    cliProjectName: 'sonarQubeName'

Thanks!!!