在对我的存储库提交更改时,实际上,我希望能够告诉Buildbot不要为更改安排时间。
我知道授权逻辑中的stopChange
特权,但是无论出于什么原因,Buildbot都不会向我显示停止更改的按钮,即使我已经给自己授予了特权。而且,即使它起作用了,在Buildbot开始构建之前,我本质上也必须在基于Web的UI中捕获更改。整rick
这是我创建调度程序的方式:
c['schedulers'].append(SingleBranchScheduler(
name="foo",
change_filter=filter.ChangeFilter(project="foo", branch="master",
repository=url),
treeStableTimer=300,
builderNames=["foo-build"]))
您可以使用该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...
使用此功能,如果提交消息中包含text [skipbuild]
,则更改不会安排构建。
我更喜欢第一种选择,因为a)它不会污染提交消息,b)我发现在文件库根目录中查找要更改的文件并进行更改比记住要在提交消息中放入哪些魔术文本来跳过要容易得多构建。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句