Include/exclude CI template with `rules` keyword
Problem to Solve
In .gitlab-ci.yml keywords, there are two useful ones, one is rules that is used for including/excluding a job when a condition met, another one is include that is used for importing/merging the other .gitlab-ci.yml into the current one.
However, you cannot use these keywords in the same ground. So for example, if you want to include/exclude a certain template in a specific condition, you likely need to define rules to all of the jobs in all templates.
Ideally, this should be simplified like this.
include:
- template: Jobs/kubernetes-Deploy.gitlab-ci.yml
rules:
- if: $AUTO_DEPLOY_PLATFORM == 'kubernetes'
- template: Jobs/ecs-Deploy.gitlab-ci.yml
rules:
- if: $AUTO_DEPLOY_PLATFORM == 'ecs'
Proposal
Support rules (or workflow:rules:) for include usage
Edited by Jason Yavorsky