0
有沒有什麼辦法可以配置master.cfg來安排構建器在其中的項目文件夾或文件被修改(或其FileVersionInfo已更改)時執行代碼?如何讓buildbot通過某些事件來運行任務?
我知道這是一個很好的解決方法,但是我需要這個在開發人員編譯產品的新版本後立即運行構建驗證測試,並且由於一些項目的開發不在CVS中,所以我需要項目文件夾的掃描儀。
下面是Master.cfg中提取物:
def create_builders_and_schedule_it(factory, build_slaves, **kwargs):
# kwargs: change_filter=None, nightly=None, trigger_name=None)
builder_names = []
if hasattr(factory, 'subcategory'):
cat = "%s_%s" % (factory.category, factory.subcategory)
else:
cat = factory.category
if 'change_filter' in kwargs:
change_filter = kwargs['change_filter']
else:
change_filter = filter.ChangeFilter(branch = factory.branch)
for i_slave in build_slaves:
builder_name = "%s_%s" % (cat, i_slave)
builder_names.append(builder_name)
c['builders'].append(
BuilderConfig(name = builder_name,
category = factory.category,
factory = factory,
slavename = i_slave
))
# every task has 'forced' scheduler at least
c['schedulers'].append(
ForceScheduler(name = cat + "_force",
builderNames = builder_names))
# every task has 'on commit' scheduler
c['schedulers'].append(
SingleBranchScheduler(name = cat + "_singlebranch",
builderNames = builder_names,
change_filter = change_filter))
# some task can be scheduled
if 'nightly' in kwargs:
c['schedulers'].append(timed.Nightly(
name = cat + '_nightly',
branch = factory.branch,
builderNames = builder_names,
hour = kwargs['nightly'][0], minute = kwargs['nightly'][1]))
if 'trigger_name' in kwargs:
c['schedulers'].append(
Triggerable(
name = kwargs['trigger_name'],
builderNames = builder_names))
有來自BuildFactory派生一個典型的類:
class Autotests(BuildFactory):
""" Build products from Autotests repository """
def __init__(self, branch):
BuildFactory.__init__(self)
self.category = "autotests"
self.branch = branch
self.addStep(
Git(repourl = AUTOTESTS_REPO, branch = branch))
def build_source_archive(self):
self.subcategory = "source"
self.addStep(
ShellCommand(
workdir = "build",
command = ["./upload_to_binary_repo.sh"]))
return self
def run_BVT_prod(self):
self.subcategory = "BVT_prod"
self.addStep(
ShellCommand(
workdir = "build/BVT_tests/prod",
env = {'PATH':"/usr/bin:/bin", 'VIRTUAL_ENV':''},
command = ["./bvt_runner.sh"]))
return self
現在我們有方法和類,我們
create_builders_and_schedule_it(
Autotests("devel").run_BVT_Prod(),
['VIX_runner'],
nightly = (2,0)
)
有沒有一種常見的方法來執行這種檢查?或者我應該朝另一個方向看?