我正在尝试在 Gitlab 中为我们的 monorepo 显示测试覆盖率可视化,如此处所述测试覆盖率可视化
我们正在使用自我管理的 gitlab 运行器以及托管在 AWS EC2 实例上的 docker+machine 执行器。我们正在使用 Gitlab SaaS。gitlab-ci.yml 的工作如下
sdk:
stage: test
needs: []
artifacts:
when: always
reports:
cobertura: /builds/path/to/cobertura/coverage/cobertura-coverage.xml
<<: *main
<<: *tests
<<: *rules
<<: *tags
Run Code Online (Sandbox Code Playgroud)
脚本中运行测试并输出代码覆盖率的行...
- npm run test -- --watchAll=false --coverage --coverageReporters=cobertura
该工件保存得很好,当我下载它时看起来很正常,但我没有得到上面链接的文档中所述的任何可视化效果。我刚刚将 gitlab runner 更新到 V14.0.0,认为这可能是问题所在,但事实并非如此。
我没有任何类型的正则表达式模式设置,因为根据我的理解,这仅用于将覆盖范围打印到标准输出。
我确信我忽略了一些微不足道的事情,我真的需要在这里进行一次健全性检查,因为我已经在这方面花费了比我能承受的更多的时间。
我正在编写一个用于构建 ECR 存储库的 cloudformation 模板。我使用事件模式构建了它,仅当图像扫描具有高漏洞或严重漏洞时,才会在将图像推送到存储库时通知我。为了简单起见,我首先构建了它,以便它不向 SNS 发送通知,而是在 Cloudwatch 日志中创建一个日志条目。这一切都很顺利,但现在我试图让它通过 SNS 发送电子邮件,但我遇到了问题。我在主题策略中尝试了几种不同的方法,例如 !GetAtt ScanReportTopic.arn 作为资源的值,我还尝试了资源:“*”以及其他一些方法。
我不知道还能尝试什么。这是我正在使用的模板(电子邮件已混淆)
Resources:
EventBusTestRuleCritical:
Type: AWS::Events::Rule
Properties:
EventBusName: default
EventPattern:
source:
- aws.ecr
detail-type:
- ECR Image Scan
detail:
finding-severity-counts:
CRITICAL:
- exists: true
Targets:
- Arn: !Ref ScanReportTopic
Id: ScanReporting
EventBusTestRuleHigh:
Type: AWS::Events::Rule
Properties:
EventBusName: default
EventPattern:
source:
- aws.ecr
detail-type:
- ECR Image Scan
detail:
finding-severity-counts:
HIGH:
- exists: true
Targets:
- Arn: !Ref ScanReportTopic
Id: ScanReporting
ECRTestRepo:
Type: AWS::ECR::Repository
Properties:
RepositoryName: TestScanRepo #Optional
ImageScanningConfiguration: …Run Code Online (Sandbox Code Playgroud) amazon-web-services amazon-sns aws-cloudformation amazon-iam