允许基于“if”和“changes”子句手动 运行 作业
Permit job to be manually run based on `if` and `changes` clause
我的一份工作 rules
:
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"'
changes:
- upstream/**/*.*
- when: manual
- allow_failure: false
当前的行为是这样的(伪代码):
if (on master or develop) and (there are upstream changes):
run_job_automatically
else
permit_running_job_manually
我想要这个:
if (on master or develop) and (there are upstream changes):
permit_running_job_manually
else
dont_show_job
其中 dont_show_job
指的是首先不让作业成为管道的一部分。
换句话说,我希望 when: manual
与 if
和 changes
子句结合使用,而不是作为替代。该作业要么允许 运行 手动显示,要么根本不显示。它永远不应该 运行 自动。
这可能吗?
你可以在 if
块中使用手动块来做你想做的事我相信:
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"'
changes:
- upstream/**/*.*
when: manual
allow_failure: false
还有一些rule attributes。
我的一份工作 rules
:
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"'
changes:
- upstream/**/*.*
- when: manual
- allow_failure: false
当前的行为是这样的(伪代码):
if (on master or develop) and (there are upstream changes):
run_job_automatically
else
permit_running_job_manually
我想要这个:
if (on master or develop) and (there are upstream changes):
permit_running_job_manually
else
dont_show_job
其中 dont_show_job
指的是首先不让作业成为管道的一部分。
换句话说,我希望 when: manual
与 if
和 changes
子句结合使用,而不是作为替代。该作业要么允许 运行 手动显示,要么根本不显示。它永远不应该 运行 自动。
这可能吗?
你可以在 if
块中使用手动块来做你想做的事我相信:
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"'
changes:
- upstream/**/*.*
when: manual
allow_failure: false
还有一些rule attributes。