Hi all!
I’m faced with an issue I’m not able to solve.
So I want to move a part of a configuration in a separate file to use across the jobs.
Here is it:
.base_only:
rules:
- if: '$CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"'
when: never
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
- when: never
There I define basic rules for a job run.
Next, I want to use it within a job with its own when: manual
rule.
I can’t use it on a job level - I’m getting an error from lint saying when can’t be used there.
This does not work:
test-one:
extends:
- .base_only
stage: build
script: echo "Test one";false
when: manual
When I use rules within job too the most recent rules is used:
test-one:
extends:
- .base_only
stage: build
script: echo "Test one";false
rules:
- when: manual
So after merge, I just want to get the job with following definition:
test-one:
stage: build
script: echo "Test one";false
rules:
- if: $CI_COMMIT_REF_NAME =~ /^release.*$/i
when: manual
- if: $CI_COMMIT_REF_NAME =~ /^hotfix.*$/i
when: manual
- if: $CI_COMMIT_TAG
when: manual
- when: never
Is it possible? Or there are no possibilities to merge rules?