如果我直接提交到分支,Buildbot会选择它并运行我的构建,但是如果将合并请求合并到分支中,Buildbot将忽略它,甚至日志中也不会显示任何内容。如何让Buildbot生成合并产生的代码?
当有人将更改合并到我的“ staging”分支中时,我希望Buildbot运行运行unittests的特殊构建,然后如果测试通过,则将代码部署到staging服务器。对于对所有其他分支的提交,我有单独的工作人员运行一个单独的构建来运行测试,但不进行部署。
这些是我的Buildbot cfg的相关部分:
c['change_source'] = [
changes.GitPoller(
'git@bitbucket.org:myaccount/myproject.git',
workdir='gitpoller-workdir',
#TODO:fix, this is cached at initial load and not updated, use a cache-breaking proxy to resolve
#branches=['master', 'staging'] + get_pull_request_branch_names(open=True),
#branches=True,
project='myproject',
pollinterval=60, # interval in seconds between polls
buildPushesWithNoCommits=True, # build merge commits
),
]
def fileIsImportant(change):
"""
Return true if meaningful code has changed. Returns false otherwise.
"""
print('Running fileIsImportant:', change)
important_extensions = set(['.py', '.js', '.css', '.html'])
print('%i files changed.' % len(change.files))
for f in change.files:
print('Checking file:', f)
ext = os.path.splitext(f)[-1].lower()
if ext in important_extensions:
print('Important extension found.')
return True
print('No important extensions found.')
return False
c['schedulers'] = [
schedulers.SingleBranchScheduler(
name="master",
change_filter=util.ChangeFilter(branch='master'),
treeStableTimer=30,
fileIsImportant=fileIsImportant,
builderNames=["myproject_runtests"],
),
schedulers.SingleBranchScheduler(
name="staging",
change_filter=util.ChangeFilter(branch='staging'),
treeStableTimer=30,
fileIsImportant=fileIsImportant,
builderNames=["myproject_runtests_staging"],
),
schedulers.AnyBranchScheduler(
name="open",
change_filter=util.ChangeFilter(branch_fn=lambda b: b not in ['master', 'staging']), # Exclude master and staging
treeStableTimer=30,
fileIsImportant=fileIsImportant,
builderNames=["myproject_runtests"],
),
schedulers.ForceScheduler(
name="force",
buttonName="Use the Force",
builderNames=["myproject_runtests"],
)
]
c['builders'] = [
# The first worker will build all branches, including staging, which it will also deploy.
util.BuilderConfig(
name="myproject_runtests_staging",
workernames=[
"worker1",
],
collapseRequests=True,
factory=factory),
# All workers but the first will run builds for everything except staging.
util.BuilderConfig(
name="myproject_runtests",
workernames=[
"worker2",
"worker3",
],
collapseRequests=True,
factory=factory),
]
我认为这应该做我想要的,但是没有用。我所有的员工都在进行更改,但是只有在更改直接提交给他们的情况下才能进行。合并的更改不会触发构建。我在做什么错了?