2016-12-13 49 views
0

說你有這個結構的回購:如何在buildbot在一個Git回購的子目錄變化觸發構建

myrepo/project1 
myrepo/project2 

如何配置buildbot所以只觸發建立時,有在myrepo的更新/ PROJECT1?

下面是示例配置我有觸發對整個回購:

step_build = steps.ShellCommand(name='somebuildcommand', 
     command=['some', 'build', 'command'], 
     workdir="build/", 
     description='some build command') 

factory = util.BuildFactory() 
# check out the source 
factory.addStep(steps.Git(repourl='https://github.com/some/myrepo.git', mode='incremental')) 
factory.addStep(step_build) 

c['builders'] = [] 
c['builders'].append(
    util.BuilderConfig(name="runtests", 
     workernames=["example-worker"], 
     factory=factory)) 

回答

0

好了,想通了這一點嘍,基本上需要配置調度程序和「重要」的文件,下面的例子只是觸發:

def file_is_important(change): 
    if not change.files: 
     return False 
    for file in change.files: 
     if file.startswith('important-dir/'): 
      print 'detected important changes:', change.files 
      return True 
    return False 

c['schedulers'] = [] 
c['schedulers'].append(schedulers.SingleBranchScheduler(
          name="all", 
          fileIsImportant=file_is_important, 
          change_filter=util.ChangeFilter(branch='master'), 
          treeStableTimer=None, 
          builderNames=["builder"])) 
相關問題