您可以使用fileIsImportant
选项来检查文件的变化中存在,如果这个文件被改变了,那么认为的变化不重要,这会导致Buildbot不安排构建。所以:
def fileIsImportant(change):
if ".skipbuild" in change.files:
return False
# There could be more logic here to test other things...
然后您注册调度程序是这样的:
c['schedulers'].append(SingleBranchScheduler(
name="foo",
change_filter=filter.ChangeFilter(project="foo", branch="master",
repository=url),
treeStableTimer=300,
fileIsImportant=fileIsImportant,
builderNames=["foo-build"]))
通过上面的代码,任何承诺,其中有一个名为.skipbuild
文件的变化(出现在根目录的文件您的存储库)不会导致构建进度计划。我使用与上述代码类似的东西来进行自己的Buildbot配置。
另一种选择是检查提交消息。与顾名思义相反fileIsImportant
确实是否确定更改是否重要,而不仅仅是一个文件。所以:
def fileIsImportant(change):
if "[skipbuild]" in change.comments:
return False
# There could be more logic here to test other things...
有了这个功能,如果提交信息有文本[skipbuild]
,更改将不会安排构建。
我更喜欢第一个选项,因为a)它不会污染提交消息,b)我发现在文件库根目录中更改文件更容易,并且更改它比记住我需要放入什么魔法文本提交消息以跳过构建。