Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: scripts/master/master_gen.py

Issue 1400073002: Teach builders.pyl about RepoPoller. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Follow convention for {}.get() Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import ast 5 import ast
6 import os 6 import os
7 7
8 from buildbot.schedulers.basic import SingleBranchScheduler 8 from buildbot.schedulers.basic import SingleBranchScheduler
9 from buildbot.schedulers.timed import Nightly 9 from buildbot.schedulers.timed import Nightly
10 from buildbot.status.mail import MailNotifier 10 from buildbot.status.mail import MailNotifier
11 from buildbot import util 11 from buildbot import util
12 12
13 from config_bootstrap import Master 13 from config_bootstrap import Master
14 14
15 from common import chromium_utils 15 from common import chromium_utils
16 16
17 from master import gitiles_poller 17 from master import gitiles_poller
18 from master import master_utils 18 from master import master_utils
19 from master import repo_poller
19 from master import slaves_list 20 from master import slaves_list
20 from master.factory import annotator_factory 21 from master.factory import annotator_factory
21 22
22 23
23 def PopulateBuildmasterConfig(BuildmasterConfig, builders_path, 24 def PopulateBuildmasterConfig(BuildmasterConfig, builders_path,
24 active_master_cls): 25 active_master_cls):
25 """Read builders_path and populate a build master config dict.""" 26 """Read builders_path and populate a build master config dict."""
26 builders = chromium_utils.ReadBuildersFile(builders_path) 27 builders = chromium_utils.ReadBuildersFile(builders_path)
27 _Populate(BuildmasterConfig, builders, active_master_cls) 28 _Populate(BuildmasterConfig, builders, active_master_cls)
28 29
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if scheduler_name: 132 if scheduler_name:
132 if scheduler_name not in builders['schedulers']: 133 if scheduler_name not in builders['schedulers']:
133 raise ValueError('unknown scheduler "%s"' % scheduler_name) 134 raise ValueError('unknown scheduler "%s"' % scheduler_name)
134 scheduler_to_builders.setdefault(scheduler_name, []).append(builder_name) 135 scheduler_to_builders.setdefault(scheduler_name, []).append(builder_name)
135 136
136 schedulers = [] 137 schedulers = []
137 for scheduler_name, scheduler_values in builders['schedulers'].items(): 138 for scheduler_name, scheduler_values in builders['schedulers'].items():
138 scheduler_type = scheduler_values['type'] 139 scheduler_type = scheduler_values['type']
139 builder_names = scheduler_to_builders[scheduler_name] 140 builder_names = scheduler_to_builders[scheduler_name]
140 141
141 if scheduler_type == 'git_poller': 142 if scheduler_type in ('git_poller', 'repo_poller'):
142 schedulers.append(SingleBranchScheduler( 143 schedulers.append(SingleBranchScheduler(
143 name=scheduler_name, 144 name=scheduler_name,
144 branch='master', 145 branch='master',
145 treeStableTimer=60, 146 treeStableTimer=60,
146 builderNames=builder_names)) 147 builderNames=builder_names))
147 148
148 elif scheduler_type == 'cron': 149 elif scheduler_type == 'cron':
149 schedulers.append(Nightly( 150 schedulers.append(Nightly(
150 name=scheduler_name, 151 name=scheduler_name,
151 branch='master', 152 branch='master',
152 minute=scheduler_values['minute'], 153 minute=scheduler_values['minute'],
153 hour=scheduler_values['hour'], 154 hour=scheduler_values['hour'],
154 builderNames=builder_names)) 155 builderNames=builder_names))
155 156
156 else: 157 else:
157 raise ValueError('unsupported scheduler type "%s"' % scheduler_type) 158 raise ValueError('unsupported scheduler type "%s"' % scheduler_type)
158 159
159 return schedulers 160 return schedulers
160 161
161 162
162 def _ComputeChangeSourceAndTagComparator(builders): 163 def _ComputeChangeSourceAndTagComparator(builders):
163 change_source = [] 164 change_source = []
164 tag_comparator = None 165 tag_comparator = None
165 166
166 for url in sorted(set(v['git_repo_url'] for 167 for url in sorted(set(v['git_repo_url'] for
167 v in builders['schedulers'].values() 168 v in builders['schedulers'].values()
168 if v['type'] == 'git_poller')): 169 if v['type'] == 'git_poller')):
169 change_source.append(gitiles_poller.GitilesPoller(url)) 170 change_source.append(gitiles_poller.GitilesPoller(url))
170 171
172 for scheduler_config in builders['schedulers'].values():
173 if scheduler_config['type'] != 'repo_poller':
174 continue
175
176 rev_link_template = scheduler_config.get('rev_link_template')
177 branch = scheduler_config.get('branch')
178 branches = [branch] if branch is not None else None
179 change_source.append(repo_poller.RepoPoller(
180 repo_url=scheduler_config['repo_url'],
181 manifest='manifest',
182 repo_branches=branches,
183 pollInterval=300,
184 revlinktmpl=rev_link_template))
185
171 # We have to set the tag_comparator to something, but if we have multiple 186 # We have to set the tag_comparator to something, but if we have multiple
172 # repos, the tag_comparator will not work properly (it's meaningless). 187 # repos, the tag_comparator will not work properly (it's meaningless).
173 # It's not clear if there's a good answer to this. 188 # It's not clear if there's a good answer to this.
174 if change_source: 189 if change_source:
175 tag_comparator = change_source[0].comparator 190 tag_comparator = change_source[0].comparator
176 191
177 return change_source, tag_comparator 192 return change_source, tag_comparator
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698