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

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: 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if scheduler_name: 131 if scheduler_name:
131 if scheduler_name not in builders['schedulers']: 132 if scheduler_name not in builders['schedulers']:
132 raise ValueError('unknown scheduler "%s"' % scheduler_name) 133 raise ValueError('unknown scheduler "%s"' % scheduler_name)
133 scheduler_to_builders.setdefault(scheduler_name, []).append(builder_name) 134 scheduler_to_builders.setdefault(scheduler_name, []).append(builder_name)
134 135
135 schedulers = [] 136 schedulers = []
136 for scheduler_name, scheduler_values in builders['schedulers'].items(): 137 for scheduler_name, scheduler_values in builders['schedulers'].items():
137 scheduler_type = scheduler_values['type'] 138 scheduler_type = scheduler_values['type']
138 builder_names = scheduler_to_builders[scheduler_name] 139 builder_names = scheduler_to_builders[scheduler_name]
139 140
140 if scheduler_type == 'git_poller': 141 if scheduler_type in ('git_poller', 'repo_poller'):
141 schedulers.append(SingleBranchScheduler( 142 schedulers.append(SingleBranchScheduler(
142 name=scheduler_name, 143 name=scheduler_name,
143 branch='master', 144 branch='master',
144 treeStableTimer=60, 145 treeStableTimer=60,
145 builderNames=builder_names)) 146 builderNames=builder_names))
146 147
147 elif scheduler_type == 'cron': 148 elif scheduler_type == 'cron':
148 schedulers.append(Nightly( 149 schedulers.append(Nightly(
149 name=scheduler_name, 150 name=scheduler_name,
150 branch='master', 151 branch='master',
151 minute=scheduler_values['minute'], 152 minute=scheduler_values['minute'],
152 hour=scheduler_values['hour'], 153 hour=scheduler_values['hour'],
153 builderNames=builder_names)) 154 builderNames=builder_names))
154 155
155 else: 156 else:
156 raise ValueError('unsupported scheduler type "%s"' % scheduler_type) 157 raise ValueError('unsupported scheduler type "%s"' % scheduler_type)
157 158
158 return schedulers 159 return schedulers
159 160
160 161
161 def _ComputeChangeSourceAndTagComparator(builders): 162 def _ComputeChangeSourceAndTagComparator(builders):
162 change_source = [] 163 change_source = []
163 tag_comparator = None 164 tag_comparator = None
164 165
165 for url in sorted(set(v['git_repo_url'] for 166 for url in sorted(set(v['git_repo_url'] for
166 v in builders['schedulers'].values() 167 v in builders['schedulers'].values()
167 if v['type'] == 'git_poller')): 168 if v['type'] == 'git_poller')):
168 change_source.append(gitiles_poller.GitilesPoller(url)) 169 change_source.append(gitiles_poller.GitilesPoller(url))
169 170
171 for values in builders['schedulers'].values():
ghost stip (do not use) 2015/10/12 22:37:59 this is a confusing variable name. can you make it
danalbert 2015/10/12 22:58:24 Agreed that it could be a better name. Perhaps `sc
172 if values['type'] != 'repo_poller':
173 continue
ghost stip (do not use) 2015/10/12 22:37:59 I'd prefer to unify with the if v['type'] == 'git_
danalbert 2015/10/12 22:58:24 Not sure what you mean by this either. Are you jus
174
175 change_source.append(repo_poller.RepoPoller(
176 repo_url=values['manifest_url'],
danalbert 2015/10/12 22:58:24 FYI I'm also going to change the name of this para
177 manifest='manifest',
178 repo_branches=[values.get('branch', None)],
179 pollInterval=300,
danalbert 2015/10/12 22:58:24 Should I pull out this and the `manifest` paramete
180 revlinktmpl='https://android.googlesource.com/platform/%s/+/%s'))
ghost stip (do not use) 2015/10/12 22:37:59 whoa what? we should make the revlinktmpl configur
danalbert 2015/10/12 22:58:25 Oops! Will fix.
181
170 # We have to set the tag_comparator to something, but if we have multiple 182 # We have to set the tag_comparator to something, but if we have multiple
171 # repos, the tag_comparator will not work properly (it's meaningless). 183 # repos, the tag_comparator will not work properly (it's meaningless).
172 # It's not clear if there's a good answer to this. 184 # It's not clear if there's a good answer to this.
173 if change_source: 185 if change_source:
174 tag_comparator = change_source[0].comparator 186 tag_comparator = change_source[0].comparator
175 187
176 return change_source, tag_comparator 188 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