【问题标题】:Sonar : TFS "Publish Quality Gate Result" task fail when checking node_modules声纳:检查 node_modules 时 TFS“发布质量门结果”任务失败
【发布时间】:2019-06-30 17:13:13
【问题描述】:

node_modules 是 yarn(或 npm)存储依赖的位置。

我正在使用 TFS 任务对具有此标准配置的 angular 7 项目执行 SonarQube 分析:

“发布质量门控结果”任务因此错误而失败:

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'

第一个问题:为什么 Sonar 分析 node_modules 而我将它添加到“准备分析”任务中的排除文件中:

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

第二个问题:如果我将这些选项添加到“准备分析”任务中的附加属性中,似乎忽略了该选项:

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

结果:

以及如何解决此问题以获取单元测试结果并将其发布到 sonarqube ?

EDIT:在 Sonar JIRA 上创建的票证: https://community.sonarsource.com/t/vsts-publish-quality-gate-result-with-npm-parses-node-modules-folder-and-hangs-on-symbolic-links/7058

编辑 2:声纳团队回答我说它与这个错误相似: https://jira.sonarsource.com/browse/VSTS-172

【问题讨论】:

    标签: angular tfs sonarqube


    【解决方案1】:

    Finnaly 找到了如何通过在构建工作流程中添加新的 powershell 脚本来修复它。

    在这个 powershell 脚本中,我执行 rimraf node_modues 删除所有 node_modules 文件的脚本。

    这不是修复,只是暂时有效的解决方法。

    【讨论】:

      猜你喜欢
      • 2018-11-11
      • 2016-07-21
      • 2020-07-28
      • 1970-01-01
      • 2016-12-23
      • 2019-07-05
      • 2018-10-04
      • 1970-01-01
      • 2019-01-22
      相关资源
      最近更新 更多