我在我的gitlab CI上使用npm审计,一切都很好,我用要更新的依赖项列表创建了一个json。
现在,我希望每当依赖项过时时,这个管道就会失败。
在其他语言上,我们有php/pip,使管道失败。
知道吗?
image: "registry.gitlab.com/gitlab-org/security-products/analyzers/npm-audit:1.4.0"
stage: security-check
variables:
TOOL: npm
script:
- /analyzer run
artifacts:
reports:
dependency_scanning: gl-dependency-scanning-report.json
paths:
- gl-dependency-scanning-report.json发布于 2022-08-18 14:17:59
可以在作业中添加允许失败或不允许使用allow_failure选项的选项。
您可以使用以下方法将其添加到安全检查作业中:
image: "registry.gitlab.com/gitlab-org/security-products/analyzers/npm-audit:1.4.0"
stage: security-check
variables:
TOOL: npm
allow_failure: false
script:
- /analyzer run
artifacts:
reports:
dependency_scanning: gl-dependency-scanning-report.json
paths:
- gl-dependency-scanning-report.json还有另一个工具这里
该工具提供环境变量,可以根据npm审计的严重程度配置这些变量。
来自上述Gitlab自述:
SCAN_EXIT_CODE --在发现中度、高度或临界漏洞时,将强制执行特定的退出代码。如果没有设置,退出代码1将在上述情况下使用,否则为0。
https://stackoverflow.com/questions/72615247
复制相似问题