5

We have a base GitLab CI template which includes by default certain artifacts. Now we need to include this template in one of the pipelines we have and in a job we want not to pass the artifacts.

We tried this:

artifacts: [] 

EDIT

Here my example:

base.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' 

child.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 

but it's not valid! How can I set the artifacts attributes to empty?

2
  • do you tried to exclude them docs.gitlab.com/ee/ci/yaml/#artifactsexclude ? Commented Jun 2, 2022 at 12:14
  • exclude is not what I need, I just want to override from the including template. I'll update my question with an example Commented Jun 2, 2022 at 12:54

1 Answer 1

4

Inherited keys of jobs with extend can be excluded with null.

To exclude a key from the extended content, you must assign it to null...

https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#exclude-a-key-from-extends

Example:

.base: script: ... artifacts: paths: - ... test: extends: .base artifacts: null 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.