Reputation: 5877
I have the following rules
for one of my jobs:
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"'
changes:
- upstream/**/*.*
- when: manual
- allow_failure: false
The current behavior is like this (pseudo-code):
if (on master or develop) and (there are upstream changes):
run_job_automatically
else
permit_running_job_manually
I instead want this:
if (on master or develop) and (there are upstream changes):
permit_running_job_manually
else
dont_show_job
where dont_show_job
refers to not making the job a part of the pipeline in the first place.
In other words, I want the when: manual
to be combined with the if
and changes
clauses instead of serving as an alternative. The job is either allowed to be run manually, or won't show up at all. It should never be run automatically.
Is that possible?
Upvotes: 1
Views: 126
Reputation: 7344
You can have the manual block within the if
block to do what you desire I believe:
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"'
changes:
- upstream/**/*.*
when: manual
allow_failure: false
Some more rule attributes.
Upvotes: 1