artifacts:reports:accessibility
-
artifacts:reports:annotations
artifacts:reports:api_fuzzing
artifacts:reports:browser_performance
artifacts:reports:coverage_report
artifacts:reports:codequality
artifacts:reports:container_scanning
artifacts:reports:coverage_fuzzing
artifacts:reports:cyclonedx
artifacts:reports:dast
artifacts:reports:dependency_scanning
artifacts:reports:dotenv
artifacts:reports:junit
artifacts:reports:load_performance
artifacts:reports:metrics
artifacts:reports:requirements
artifacts:reports:repository_xray
(已弃用)artifacts:reports:sast
artifacts:reports:secret_detection
artifacts:reports:terraform
{{< details >}}
- Tier: 基础版, 专业版, 旗舰版
- Offering: JihuLab.com, 私有化部署
{{< /details >}}
使用 artifacts:reports
来:
- 收集测试报告、代码质量报告、安全报告以及在工作中包含的模板生成的其他产物。
- 这些报告中的一些被用于显示信息在:
- 合并请求。
- 流水线视图。
- 安全仪表盘。
为 artifacts: reports
创建的产物总是上传,无论工作结果是成功还是失败。您可以使用 artifacts:expire_in
来设置产物的过期时间,这将覆盖实例的默认设置。JihuLab.com 可能有不同的默认产物过期值。
一些 artifacts:reports
类型可以由同一流水线中的多个工作生成,并由合并请求或流水线功能从每个工作中使用。
要浏览报告输出文件,请确保在您的工作定义中包含 artifacts:paths
关键字。
{{< alert type=”note” >}}
使用子流水线中的产物在父流水线中合并报告是不支持的。
{{< /alert >}}
artifacts:reports:accessibility
accessibility
报告使用 pa11y 来报告在合并请求中引入的变更的可访问性影响。
极狐GitLab 可以在合并请求可访问性小部件中显示一个或多个报告的结果。
有关更多信息,请参阅可访问性测试。
artifacts:reports:annotations
{{< history >}}
- 在极狐GitLab 16.3 中引入。
{{< /history >}}
annotations
报告用于附加辅助数据到一个工作中。
一个注释报告是一个带有注释部分的 JSON 文件。每个注释部分可以有任何所需的名称,并且可以有任意数量的同类或不同类型的注释。
每个注释是一个单一键(注释类型),包含该注释的数据的子键。
注释类型
external_link
一个 external_link
注释可以附加到一个工作中,以在工作输出页面中添加一个链接。external_link
注释的值是一个具有以下键的对象:
键 | 描述 |
---|---|
label |
与链接相关的人类可读标签。 |
url |
链接指向的 URL。 |
示例报告
以下是一个工作注释报告可能的样子:
{
"my_annotation_section_1": [
{
"external_link": {
"label": "URL 1",
"url": "https://url1.example.com/"
}
},
{
"external_link": {
"label": "URL 2",
"url": "https://url2.example.com/"
}
}
]
}
artifacts:reports:api_fuzzing
{{< details >}}
- Tier: 旗舰版
{{< /details >}}
api_fuzzing
报告收集 API Fuzzing bugs 作为产物。
极狐GitLab 可以在以下位置显示一个或多个报告的结果:
artifacts:reports:browser_performance
{{< details >}}
- Tier: 专业版, 旗舰版
{{< /details >}}
browser_performance
报告收集 浏览器性能测试指标 作为产物。这个产物是由 Sitespeed 插件输出的 JSON 文件。
极狐GitLab 可以在合并请求browser performance testing widget中显示一个报告的结果。
极狐GitLab 无法显示多个 browser_performance
报告的合并结果。
artifacts:reports:coverage_report
使用 coverage_report:
来收集 覆盖率报告,格式为 Cobertura 或 JaCoCo。
coverage_format:
可以是 cobertura
或 jacoco
。
Cobertura 最初是为 Java 开发的,但有许多第三方为其他语言如 JavaScript、Python 和 Ruby 的移植。
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
收集的覆盖率报告被上传到极狐GitLab 作为产物。
您可以在一个工作中生成多个 JaCoCo 或 Cobertura 报告,并使用通配符将它们包含在最终工作产物中。报告的结果在最终覆盖率报告中进行汇总。
极狐GitLab 可以在合并请求中的差异注释中显示覆盖率报告的结果。
artifacts:reports:codequality
{{< history >}}
- 在合并请求的差异注释和完整流水线报告中引入于极狐GitLab 15.7。
{{< /history >}}
codequality
报告收集 代码质量问题。收集的代码质量报告作为产物上传到极狐GitLab。
极狐GitLab 可以在以下位置显示一个或多个报告的结果:
artifacts:expire_in
值设置为 1 周
。
artifacts:reports:container_scanning
{{< details >}}
- Tier: 旗舰版
{{< /details >}}
container_scanning
报告收集 容器扫描漏洞。收集的容器扫描报告作为产物上传到极狐GitLab。
极狐GitLab 可以在以下位置显示一个或多个报告的结果:
artifacts:reports:coverage_fuzzing
{{< details >}}
- Tier: 旗舰版
{{< /details >}}
coverage_fuzzing
报告收集 覆盖率模糊测试漏洞。收集的覆盖率模糊测试报告作为产物上传到极狐GitLab。极狐GitLab 可以在以下位置显示一个或多个报告的结果:
- 合并请求覆盖率模糊测试小部件。
- 流水线的 安全 标签。
- 项目漏洞报告。
- 安全仪表盘。
artifacts:reports:cyclonedx
{{< details >}}
- Tier: 旗舰版
{{< /details >}}
{{< history >}}
- 在极狐GitLab 15.3 中引入。
{{< /history >}}
此报告是描述项目组件的软件材料清单,遵循 CycloneDX 协议格式。
您可以为每个工作指定多个 CycloneDX 报告。这些可以作为文件名列表、文件名模式或两者:
- 文件名模式(
cyclonedx: gl-sbom-*.json
、junit: test-results/**/*.json
)。 - 文件名数组(
cyclonedx: [gl-sbom-npm-npm.cdx.json, gl-sbom-bundler-gem.cdx.json]
)。 - 两者结合(
cyclonedx: [gl-sbom-*.json, my-cyclonedx.json]
)。 - 不支持目录(
cyclonedx: test-results
、cyclonedx: test-results/**
)。
下面是一个工作暴露 CycloneDX 产物的示例:
artifacts:
reports:
cyclonedx:
- gl-sbom-npm-npm.cdx.json
- gl-sbom-bundler-gem.cdx.json
artifacts:reports:dast
{{< details >}}
- Tier: 旗舰版
{{< /details >}}
dast
报告收集 DAST 漏洞。收集的 DAST 报告作为产物上传到极狐GitLab。
极狐GitLab 可以在以下位置显示一个或多个报告的结果:
artifacts:reports:dependency_scanning
{{< details >}}
- Tier: 旗舰版
{{< /details >}}
dependency_scanning
报告收集 依赖扫描漏洞。收集的依赖扫描报告作为产物上传到极狐GitLab。
极狐GitLab 可以在以下位置显示一个或多个报告的结果:
artifacts:reports:dotenv
dotenv
报告收集一组环境变量作为产物。
收集的变量被注册为工作运行时创建的变量,您可以在后续工作脚本中使用这些变量,或者在工作完成后设置动态环境 URL。
如果 dotenv
报告中存在重复的环境变量,则使用最后一个指定的变量。
您应该避免在 dotenv 报告中存储诸如凭证之类的敏感数据,因为这些报告可以从流水线详细信息页面下载。如果需要,您可以使用 artifacts:access 来限制能够在工作中下载报告产物的用户。
对原始 dotenv 规则的例外情况如下:
- 变量键只能包含字母、数字和下划线 (
_
)。 -
.env
文件的最大大小为 5 KB。这个限制可以在极狐GitLab 私有化部署上更改。 - 在 JihuLab.com 上,继承变量的最大数量是基础版 50,专业版 100 和旗舰版 150。极狐GitLab 私有化部署的默认值为 20,可以通过更改
dotenv_variables
应用限制来进行更改。 -
.env
文件中的变量替换不支持。 - 不支持
.env
文件中的多行值。 -
.env
文件不能有空行或以#
开头的注释。 -
env
文件中的键值不能有空格或换行符 (\n
),包括使用单引号或双引号时。 - 在解析过程中不支持引号转义(
key = 'value'
->{key: "value"}
)。 - 仅支持 UTF-8 编码 supported。
artifacts:reports:junit
junit
报告收集 JUnit 报告格式 XML 文件。收集的单元测试报告作为产物上传到极狐GitLab。虽然 JUnit 最初是在 Java 中开发的,但有许多第三方为其他语言如 JavaScript、Python 和 Ruby 的移植。
有关更多详细信息和示例,请参阅单元测试报告。下面是从 Ruby 的 RSpec 测试工具收集 JUnit 报告格式 XML 文件的示例:
rspec:
stage: test
script:
- bundle install
- rspec --format RspecJunitFormatter --out rspec.xml
artifacts:
reports:
junit: rspec.xml
极狐GitLab 可以在以下位置显示一个或多个报告的结果:
一些 JUnit 工具导出到多个 XML 文件。您可以在单个工作中指定多个测试报告路径以将它们连接到一个文件中。使用以下方法之一:
- 文件名模式(
junit: rspec-*.xml
、junit: test-results/**/*.xml
)。 - 文件名数组(
junit: [rspec-1.xml, rspec-2.xml, rspec-3.xml]
)。 - 两者结合(
junit: [rspec.xml, test-results/TEST-*.xml]
)。 - 不支持目录(
junit: test-results
、junit: test-results/**
)。
artifacts:reports:load_performance
{{< details >}}
- Tier: 专业版, 旗舰版
{{< /details >}}
load_performance
报告收集 负载性能测试指标。报告作为产物上传到极狐GitLab。
极狐GitLab 只能在合并请求负载测试小部件中显示一个报告的结果。
极狐GitLab 无法显示多个 load_performance
报告的合并结果。
artifacts:reports:metrics
{{< details >}}
- Tier: 专业版, 旗舰版
{{< /details >}}
metrics
报告收集 指标。收集的指标报告作为产物上传到极狐GitLab。
极狐GitLab 可以在合并请求指标报告小部件中显示一个或多个报告的结果。
artifacts:reports:requirements
{{< details >}}
- Tier: 旗舰版
{{< /details >}}
requirements
报告收集 requirements.json
文件。收集的要求报告作为产物上传到极狐GitLab,并标记为已满足的现有要求。
极狐GitLab 可以在项目要求中显示一个或多个报告的结果。
artifacts:reports:repository_xray
(已弃用)
{{< details >}}
- Tier: 专业版, 旗舰版
{{< /details >}}
{{< history >}}
- 在极狐GitLab 16.7 中引入。
{{< /history >}}
repository_xray
报告收集有关您的存储库的信息,以供极狐GitLab Duo Code Suggestions 使用。
{{< alert type=”warning” >}}
此功能在极狐GitLab 17.6 中已弃用,计划在 18.0 中移除。请改用启用存储库 X-Ray。
{{< /alert >}}
artifacts:reports:sast
sast
报告收集 SAST 漏洞。收集的 SAST 报告作为产物上传到极狐GitLab。
有关更多信息,请参阅:
artifacts:reports:secret_detection
secret-detection
报告收集 检测到的密钥。收集的密钥检测报告上传到极狐GitLab。
极狐GitLab 可以在以下位置显示一个或多个报告的结果:
artifacts:reports:terraform
terraform
报告获得一个 OpenTofu tfplan.json
文件。需要 JQ 处理以移除凭证。收集的 OpenTofu 计划报告作为产物上传到极狐GitLab。
极狐GitLab 可以在合并请求OpenTofu 小部件中显示一个或多个报告的结果。
有关更多信息,请参阅输出 tofu plan
信息到合并请求。