Template for a good new topic, formatted with Markdown:
- ALM used :
Azure DevOps - CI system used:
Azure DevOps - Scanner command used when applicable (private details masked)
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'Sonar Cloud'
organization: '13311015-canada-inc'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: '<our key>'
cliProjectName: '<our name - same as key>'
cliSources: 'services/service1'
- Languages of the repository
Typescript - Only if the SonarCloud project is public, the URL
- And if you need help with pull request decoration, then the URL to the PR too
- Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
No Errors. But when viewing the result, there is no code and no errors - Steps to reproduce
We have a monorepo containing client/backend code. Structure is like:
/root
- /services
- /service1
- sonar-project.properties
- tsconfig.json
- package.json
- /src
- ... folders and sources
- /service2
- sonar-project.properties
- tsconfig.json
- package.json
- /src
- ... folders and sources
- /clients/react-native
- sonar-project.properties
- package.json
- /src
....
- /libraries
- /lib1
- sonar-project.properites
- package.json
- /src
... sub folders and files
I have found with the sonar-scanner
, going to the specific project source it runs fine, finds code/issues.
% sonar-scanner \
-Dsonar.organization=my-org \
-Dsonar.projectKey=my-service \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io \
However, when triggering a build, no sources are found.
We use yarn monorepo. The build is something like:
1. download node
2. checkout depth 0
3. run - task: SonarCloudPrepare@1 (for 1 of 4 backend services)
4. yarn install
5. yarn build-libraries
6. run - task: SonarCloudAnalyze@1 (passes)
7. run - task: SonarCloudPrepare@1 (for 2 of 4 backend services)
8. run - task: SonarCloudAnalyze@1 (passes)
9. - task: SonarCloudPublish@1 (correctly links to PR, and gives a link)
10. run tests
11. run webpack
12. other steps to deploy
- Potential workaround
Can run sonar-scanner manually. But really trying to figure why the pipeline doesn’t find anything…
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!