maven - 为 GitLab CI 管道中的多个作业聚合 SonarQube Maven 分析
问题描述
我想知道如何为 GitLab CI 管道中的多个作业聚合 SonarQube Maven 分析。
我的 GitLab CI 管道在不同的作业(在同一阶段)中构建后端和前端组件。它们需要不同的构建环境,因此,它们使用不同的图像。骨骼:
build-backend:
image: my-backend-image
stage: build
script:
- mvn xyz verify
build-frontend:
image: my-frontend-image
stage: build
script:
- build-frontend
如果我将声纳扫描添加到两个作业中,它们将在 SonarQube 上覆盖彼此的结果。因此,我需要 AFAIU
- 一种从每个作业“聚合”结果的方法,即以某种方式告诉 Sonar 后端扫描和前端扫描属于一起。我没有看到这方面的选择。
- 构建一个可以同时构建后端和前端的超级镜像,并以某种方式将两个构建混合到同一个工作中。这将对管道产生重大影响,因为我会失去并行化。
- 将两个作业中的所有构建结果声明为 GitLab 工件(我们目前有选择地这样做)。这将包括 Java 类、覆盖率报告、测试报告等。然后在稍后阶段引入一个额外的工作,它只获取那些工件并执行例如
mvn sonar:sonar
.
我错过了更简单的解决方案吗?
解决方案
推荐阅读
- python - 两个小部件的相同颜色看起来不同
- bash - 用户创建和保存“别名”命令的最佳方法是什么?
- xml - Perl 调整 xsltMaxDepth (--maxdepth) 错误
- spring - AntMatcher 似乎与请求的路径不匹配(Spring Security)
- mysql - 对大表中的所有记录执行批量更新的最佳方法是什么
- java - 想知道一种在不使用正则表达式的情况下根据作为参数传递的分隔符来拆分字符串的方法
- angular - 如何修复 VS Code 中出现的“未定义标识符‘长度’”错误,但代码按预期工作
- android - 避免使用 Glide 和 Proguard 缩小的虚拟方法 registerAnimationCallback
- aws-lambda - serverless 如何知道在哪里可以找到 serverless.yml?
- sas - 尾随空白 SAS