我们有一个基本的 GitLab CI 模板,默认情况下包含某些工件。现在我们需要将此模板包含在我们拥有的管道之一以及我们不希望传递工件的作业中。
我们尝试过这个:
artifacts: []
Run Code Online (Sandbox Code Playgroud)
编辑
这是我的例子:
基础.yaml
build:
stage: build
script:
- echo "build..."
artifacts:
expire_in: 3 weeks
reports:
dotenv: VERSION.env
paths:
- '$env:BUILD_OUTPUT_DIR\**\webconfigs'
- '$env:MSBUILD_OUTPUT_DIR\**\_PublishedWebsites\**\*.zip'
Run Code Online (Sandbox Code Playgroud)
孩子.yaml
include: 'base.yaml'
build:child:
extends: [build]
before_script: []
script:
- *run-nuget-restore
- *build-release
artifacts: [] # I don't need any of the atributes of the base template, but this does not work
Run Code Online (Sandbox Code Playgroud)
但这是无效的!如何将工件属性设置为空?
extend可以使用 排除作业的继承键null。
要从扩展内容中排除某个键,您必须将其指定为 null...
https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#exclude-a-key-from-extends
例子:
.base:
script: ...
artifacts:
paths:
- ...
test:
extends: .base
artifacts: null
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2154 次 |
| 最近记录: |