CI: Hide or temporarily “disable“ a job from a included template file
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Release notes
Allow to hide or temporarily “disable” a job from a included template file.
t.b.d.
Problem to solve
As a DevOps Engineer I want to deactivate a CI job inherited from a included template file to remove jobs not yet supported/allowed/wanted in a project setup.
When a DevOps Engineer includes one or many templates in a CI configuration, then it may be necessary to deactivate a job originating in another template. For example the template includes many jobs of which one single job is not supported or allowed in the current project.
Content of template project https://example.com/autodevops-template.yml
job1:
script: echo Apple
job2:
script: echo Banana
job3:
script: echo Pepper
Content of current project .gitlab-ci.yml:
include: 'https://example.com/autodevops-template.yml'
job4:
script: echo Melon
The current project wants all jobs except for job3 (Pepper).
Current workarounds:
- Go without the include feature and copy and paste all jobs from the template repository file except for
job3 - Hide the job in the template repository by starting its name with a dot (
.) → this however would deactivate the job in all other projects which include the template file as well - Overwrite the
ruleslist with a rule which will never succeed → This will still display the job as available in Linter of the »Pipeline Editor«, it will not be executed though
job3:
rules:
- when: never
Intended users
DevOps Engineer, Software development
User experience goal
The user should be able to deactivate an inherited job in the current project using a defined path (and no workarounds instead).
Proposal
Idea 1:
- Allow the value
neverinwhenkeyword, outside of rules/workflow statements
job3:
- when: never
Idea 2:
- Allow a YAML parser syntax to remove keys, like
>>odernull
job3: >>
Links / references
https://docs.gitlab.com/ee/ci/yaml/README.html#includefile https://docs.gitlab.com/ee/ci/yaml/includes.html#overriding-external-template-values https://docs.gitlab.com/ee/ci/yaml/README.html#hide-jobs https://docs.gitlab.com/ee/ci/yaml/README.html#when