1
votes

node_modules is the location where yarn (or npm) stores dependencies.

I'm using TFS task to execute SonarQube analysis on a angular 7 project with this standard configuration :

enter image description here

"Publish Quality Gate Result" task failed with this error :

2019-02-06T16:15:40.1474327Z ##[debug]findPath: 'C:\Agt2\_work\14'
2019-02-06T16:15:40.1474945Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2019-02-06T16:15:40.1475394Z ##[debug]findOptions.followSymbolicLinks: 'true'
2019-02-06T16:15:40.1480701Z ##[debug]  C:\Agt2\_work\14 (directory)
[...]
2019-02-06T16:15:41.2684833Z ##[debug]  C:\Agt2\_work\14\s\node_modules\@angular\cli (directory)
2019-02-06T16:15:41.2692225Z ##[debug]  C:\Agt2\_work\14\s\node_modules\@angular\cli\.bin (directory)
2019-02-06T16:15:41.2779828Z ##[debug][SQ] Publish task error: Failed find: ENOENT: no such file or directory, stat 'C:\Agt2\_work\14\s\node_modules\@angular\cli\.bin\ng'
2019-02-06T16:15:41.2781059Z ##[debug]task result: Failed
2019-02-06T16:15:41.2782877Z ##[error]Failed find: ENOENT: no such file or directory, stat 'C:\Agt2\_work\14\s\node_modules\@angular\cli\.bin\ng'

First problem : why Sonar analyze node_modules while I added it to excluded files in the "prepare analysis" task:

sonar.exclusions=**/node_modules/**,**/*.spec.ts

Second problem : if I add these options to the additional properties in the "prepare analysis" task, it seems to be ignoring the option :

findOptions.followSpecifiedSymbolicLink='false'
findOptions.followSymbolicLinks:'false'

Result : enter image description here

And how to fix this problem to get unit test result and publish it to sonarqube ?

EDIT : ticket created on Sonar JIRA : https://community.sonarsource.com/t/vsts-publish-quality-gate-result-with-npm-parses-node-modules-folder-and-hangs-on-symbolic-links/7058

EDIT 2 : Sonar team answered me that it's similar with this bug : https://jira.sonarsource.com/browse/VSTS-172

1

1 Answers

0
votes

Finnaly found how to fix it by adding a new powershell script on build workflow.

In this powershell script, i execute rimraf node_modues script that delete all node_modules files.

That's not a fix but only Workaround working for the moment.

enter image description here