continuous-integration - 允许基于 `if` 和 `changes` 子句手动运行作业
问题描述
我的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
wheredont_show_job
指的是首先不使工作成为管道的一部分。
换句话说,我希望将the与 and子句when: manual
结合起来,而不是作为替代。该作业要么允许手动运行,要么根本不显示。它永远不应该自动运行。if
changes
那可能吗?
解决方案
您可以在块中使用手动块if
来做您想做的事情,我相信:
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"'
changes:
- upstream/**/*.*
when: manual
allow_failure: false
更多规则属性。
推荐阅读
- asp.net-core - 如何使用 NSubstitute 和 XUnit 模拟返回 bool 的 UpdateOneAsync 方法?
- django - 为什么我的表值没有显示在 django 模板中?
- python - 如何从句子中只提取单词?
- angular - Ionic 5/angular 不能再访问页面了?
- python - 正则表达式不允许特殊字符在 python 中失败
- discord.py - 您如何制作特定于角色的命令以及特定于权限的命令
- flutter - Flutter 无状态小部件调用的问题
- python - 为什么 Pandas 转置失败且没有错误?
- elasticsearch - 为桶弹性搜索聚合中的每个键设置阈值
- python - 在django admin中已经创建了models对象,但是我添加了三条信息后,在127.0.0.1/admin/中没有显示出来