phase2: adjust change filter
authorJo-Philipp Wich <jo@mein.io>
Fri, 2 Dec 2016 21:44:18 +0000 (22:44 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 2 Dec 2016 22:08:12 +0000 (23:08 +0100)
Instead of hardcoding the master branch, filter incoming changes by the branch
used for the corresponding feed.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase2/master.cfg

index ddcca29b123b6fab28a205edfa85e2b6b5b835f2..06e1b597bfe04521a5cb677d4caba4f7dcf347c6 100644 (file)
@@ -119,6 +119,7 @@ while True:
 
 # find feeds
 feeds = []
+feedbranches = dict()
 
 from buildbot.changes.gitpoller import GitPoller
 c['change_source'] = []
@@ -130,6 +131,7 @@ with open(home_dir+'/source.git/feeds.conf.default', 'r') as f:
                        feeds.append(parts)
                        url = parts[2].strip().split(';')
                        branch = url[1] if len(url) > 1 else 'master'
+                       feedbranches[url[0]] = branch
                        c['change_source'].append(GitPoller(url[0], branch=branch, workdir='%s/%s.git' %(os.getcwd(), parts[1]), pollinterval=300))
 
 
@@ -138,13 +140,16 @@ with open(home_dir+'/source.git/feeds.conf.default', 'r') as f:
 # Configure the Schedulers, which decide how to react to incoming changes.  In this
 # case, just kick off a 'basebuild' build
 
+def branch_change_filter(change):
+       return change.branch == feedbranches[change.repository]
+
 from buildbot.schedulers.basic import SingleBranchScheduler
 from buildbot.schedulers.forcesched import ForceScheduler
 from buildbot.changes import filter
 c['schedulers'] = []
 c['schedulers'].append(SingleBranchScheduler(
        name="all",
-       change_filter=filter.ChangeFilter(branch='master'),
+       change_filter=filter.ChangeFilter(filter_fn=branch_change_filter),
        treeStableTimer=60,
        builderNames=archnames))