1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 """Define the supported projects."""
13 import find_depot_tools # pylint: disable=W0611
20 import pending_manager
21 from verification import presubmit_check
22 from verification import project_base
23 from verification import reviewer_lgtm
24 from verification import tree_status
25 from verification import try_server
26 from verification import try_job_on_rietveld
28 ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
29 sys.path.append(os.path.join(ROOT_DIR, '..', 'commit-queue-internal'))
31 # These come from commit-queue in the internal repo.
33 import chromium_committers # pylint: disable=F0401
34 import gyp_committers # pylint: disable=F0401
35 import nacl_committers # pylint: disable=F0401
36 except ImportError, e:
37 print >> sys.stderr, (
38 'Failed to find commit-queue-internal, will fail to start: %s' % e)
39 chromium_committers = None
41 nacl_committers = None
44 # It's tricky here because 'chrome' is remapped to 'svn' on src.chromium.org but
45 # the other repositories keep their repository name. So don't list it here.
47 'svn://svn.chromium.org',
49 'svn://chrome-svn.corp',
50 'svn://chrome-svn.corp.google.com'
53 CHROME_SVN_BASES = [item + '/chrome' for item in SVN_HOST_ALIASES] + [
54 'http://src.chromium.org/svn',
55 'https://src.chromium.org/svn',
56 'http://src.chromium.org/chrome',
57 'https://src.chromium.org/chrome',
60 # Steps that are never considered to determine the try job success.
62 'svnkill', 'update_scripts', 'taskkill', 'cleanup_temp', 'process_dumps')
64 # To be used in a regexp to match the branch part of an git url.
65 BRANCH_MATCH = r'\@[a-zA-Z0-9\-_]+'
68 def _read_lines(filepath, what):
70 return open(filepath).readlines()
72 raise errors.ConfigurationError('Put the %s in %s' % (what, filepath))
75 def _get_chromium_committers():
76 """Gets the list of all allowed committers."""
77 if not chromium_committers:
81 entries = chromium_committers.get_list()
82 logging.info('Found %d committers' % len(entries))
83 return ['^%s$' % re.escape(i) for i in entries]
86 def _get_nacl_committers():
87 """Gets the list of all allowed committers."""
88 if not nacl_committers:
92 entries = nacl_committers.get_list()
93 logging.info('Found %d committers' % len(entries))
94 return ['^%s$' % re.escape(i) for i in entries]
97 def _get_gyp_committers():
98 """Gets the list of all allowed committers."""
99 if not gyp_committers:
101 entries = ['georges']
103 entries = gyp_committers.get_list()
104 logging.info('Found %d committers' % len(entries))
105 return ['^%s$' % re.escape(i) for i in entries]
108 def _chromium_lkgr():
111 urllib2.urlopen('https://chromium-status.appspot.com/lkgr').read())
112 except (ValueError, IOError):
119 urllib2.urlopen('https://nativeclient-status.appspot.com/lkgr').read())
120 except (ValueError, IOError):
124 def _chromium_status_pwd(root_dir):
125 filepath = os.path.join(root_dir, '.chromium_status_pwd')
126 return _read_lines(filepath, 'chromium-status password')[0].strip()
129 def _gen_chromium(user, root_dir, rietveld_obj, no_try):
130 """Generates a PendingManager commit queue for chrome/trunk/src."""
131 svn_creds = creds.Credentials(os.path.join(root_dir, '.svn_pwd'))
132 local_checkout = checkout.SvnCheckout(
137 'svn://svn.chromium.org/chrome/trunk/src',
139 context_obj = context.Context(
142 async_push.AsyncPush(
143 'https://chromium-status.appspot.com/cq',
144 _chromium_status_pwd(root_dir)))
147 '^%s/trunk/src(|/.*)$' % re.escape(base) for base in CHROME_SVN_BASES]
151 'http://git.chromium.org/git/chromium.git',
152 'https://git.chromium.org/git/chromium.git',
154 'http://git.chromium.org/chromium/src.git',
155 'https://git.chromium.org/chromium/src.git',
156 'http://git.chromium.org/git/chromium/src',
157 'https://git.chromium.org/git/chromium/src',
158 'http://git.chromium.org/git/chromium/src.git',
159 'https://git.chromium.org/git/chromium/src.git',
160 'https://chromium.googlesource.com/chromium/src',
161 'https://chromium.googlesource.com/chromium/src.git',
163 project_bases.extend(
164 r'^%s%s$' % (re.escape(i), BRANCH_MATCH) for i in aliases)
165 verifiers_no_patch = [
166 project_base.ProjectBaseUrlVerifier(project_bases),
167 reviewer_lgtm.ReviewerLgtmVerifier(
168 _get_chromium_committers(),
172 presubmit_check.PresubmitCheckVerifier(context_obj),
175 # To add tests to this list, they MUST be in
176 # /chrome/trunk/tools/build/masters/master.chromium/master_gatekeeper_cfg.py
177 # or somehow close the tree whenever they break.
182 'cacheinvalidation_unittests',
183 'content_browsertests',
188 #'googleurl_unittests',
191 'interactive_ui_tests',
195 'printing_unittests',
197 #'pyauto_functional_tests',
201 # Tends to be broken by webkit roll and not fixed fast enough.
204 #'webkit_unit_tests',
206 builders_and_tests = {
207 # TODO(maruel): Figure out a way to run 'sizes' where people can
208 # effectively update the perf expectation correctly. This requires a
209 # clobber=True build running 'sizes'. 'sizes' is not accurate with
210 # incremental build. Reference:
211 # http://chromium.org/developers/tree-sheriffs/perf-sheriffs.
212 # TODO(maruel): An option would be to run 'sizes' but not count a failure
213 # of this step as a try job failure.
214 'linux_rel': standard_tests + [
216 'remoting_unittests',
217 'sandbox_linux_unittests',
218 'sync_integration_tests',
221 'mac_rel': standard_tests + [
223 'remoting_unittests',
224 'sync_integration_tests',
226 'win_rel': standard_tests + [
227 'chrome_frame_net_tests',
228 'chrome_frame_unittests',
229 'installer_util_unittests',
230 'mini_installer_test',
232 'remoting_unittests',
233 'sync_integration_tests',
236 'linux_clang': ['compile'],
237 'linux_chromeos': standard_tests + [
238 'sandbox_linux_unittests',
240 'android_dbg': ['build'],
241 'ios_rel_device': ['compile'],
242 'ios_dbg_simulator': [
246 'googleurl_unittests',
250 triggered_builders_and_tests = [
251 ('android_dbg_triggered_tests', 'android_dbg', ['build']),
254 verifiers.append(try_job_on_rietveld.TryRunnerRietveld(
256 'http://build.chromium.org/p/tryserver.chromium/',
259 triggered_builders_and_tests,
263 verifiers.append(tree_status.TreeStatusVerifier(
264 'http://chromium-status.appspot.com'))
265 return pending_manager.PendingManager(
271 def _gen_nacl(user, root_dir, rietveld_obj, no_try):
272 """Generates a PendingManager commit queue for Native Client."""
273 svn_creds = creds.Credentials(os.path.join(root_dir, '.svn_pwd'))
274 offset = 'trunk/src/native_client'
275 local_checkout = checkout.SvnCheckout(
280 'svn://svn.chromium.org/native_client/' + offset)
281 context_obj = context.Context(
284 async_push.AsyncPush(
285 'https://nativeclient-status.appspot.com/cq',
286 _chromium_status_pwd(root_dir)))
288 host_aliases = SVN_HOST_ALIASES + [
289 'http://src.chromium.org', 'https://src.chromium.org']
290 svn_bases = [i + '/native_client' for i in host_aliases]
292 '^%s/%s(|/.*)$' % (re.escape(base), offset) for base in svn_bases
294 git_url = 'http://git.chromium.org/native_client/src/native_client.git'
295 project_bases.append('^%s%s$' % (re.escape(git_url), BRANCH_MATCH))
296 verifiers_no_patch = [
297 project_base.ProjectBaseUrlVerifier(project_bases),
298 reviewer_lgtm.ReviewerLgtmVerifier(
299 _get_nacl_committers(),
303 presubmit_check.PresubmitCheckVerifier(context_obj),
306 # Grab the list of all the builders here. The commit queue needs to know
307 # which builders were triggered. TODO: makes this more automatic.
308 url = 'http://build.chromium.org/p/tryserver.nacl/json/builders'
309 builders_and_tests = dict(
310 (key, []) for key in json.load(urllib2.urlopen(url))
311 if (key.startswith('nacl-') and
312 'toolchain' not in key and
313 'valgrind' not in key and
314 'perf_panda' not in key and
315 'arm_hw' not in key and
316 'shared' not in key and
317 'coverage' not in key)
319 verifiers.append(try_server.TryRunnerSvn(
321 'http://build.chromium.org/p/tryserver.nacl/',
326 ['--root', 'native_client'],
329 verifiers.append(tree_status.TreeStatusVerifier(
330 'http://nativeclient-status.appspot.com'))
331 return pending_manager.PendingManager(
337 def _gen_gyp(user, root_dir, rietveld_obj, no_try):
338 """Generates a PendingManager commit queue for GYP."""
339 svn_creds = creds.Credentials(os.path.join(root_dir, '.svn_pwd'))
340 naked_url = '://gyp.googlecode.com/svn/trunk'
341 local_checkout = checkout.SvnCheckout(
347 context_obj = context.Context(
350 async_push.AsyncPush(
351 'https://chromium-status.appspot.com/cq/receiver',
352 _chromium_status_pwd(root_dir)))
355 '^%s(|/.*)$' % re.escape(base + naked_url) for base in ('http', 'https')
357 verifiers_no_patch = [
358 project_base.ProjectBaseUrlVerifier(project_bases),
359 reviewer_lgtm.ReviewerLgtmVerifier(
360 _get_gyp_committers(),
365 # Grab the list of all the builders here. The commit queue needs to know
366 # which builders were triggered. TODO: makes this more automatic.
367 # GYP is using the Nacl try server.
368 url = 'http://build.chromium.org/p/tryserver.nacl/json/builders'
369 builders_and_tests = dict(
370 (key, []) for key in json.load(urllib2.urlopen(url))
371 if key.startswith('gyp-')
373 verifiers.append(try_server.TryRunnerSvn(
375 'http://build.chromium.org/p/tryserver.nacl/',
383 verifiers.append(tree_status.TreeStatusVerifier(
384 'http://gyp-status.appspot.com/status'))
385 return pending_manager.PendingManager(
391 def _gen_tools(user, root_dir, rietveld_obj, _no_try):
392 """Generates a PendingManager commit queue for everything under
395 These don't have a try server but have presubmit checks.
400 '^%s/trunk/%s(|/.*)$' % (re.escape(base), path)
401 for base in CHROME_SVN_BASES
403 regexp = r'([a-z0-9\-_]+)'
404 githost = '://git.chromium.org/'
405 googlesource = '://chromium.googlesource.com/'
407 re.escape( 'http' + githost + 'chromium/tools/') + regexp + r'\.git',
408 re.escape('https' + githost + 'chromium/tools/') + regexp + r'\.git',
409 re.escape( 'http' + githost + 'git/chromium/tools/') + regexp,
410 re.escape('https' + githost + 'git/chromium/tools/') + regexp,
411 re.escape( 'http' + githost + 'git/chromium/tools/') + regexp + r'\.git',
412 re.escape('https' + githost + 'git/chromium/tools/') + regexp + r'\.git',
413 re.escape('https' + googlesource + 'chromium/tools/') + regexp,
414 re.escape('https' + googlesource + 'chromium/tools/') + regexp + r'\.git',
416 project_bases.extend('^%s%s$' % (i, BRANCH_MATCH) for i in aliases)
417 return _internal_simple(path, project_bases, user, root_dir, rietveld_obj)
420 def _gen_chromium_deps(user, root_dir, rietveld_obj, _no_try):
421 """Generates a PendingManager commit queue for
427 '^%s/trunk/%s(|/.*)$' % (re.escape(base), path)
428 for base in CHROME_SVN_BASES
430 return _internal_simple(path, project_bases, user, root_dir, rietveld_obj)
433 def _internal_simple(path, project_bases, user, root_dir, rietveld_obj):
434 """Generates a PendingManager commit queue for chrome/trunk/tools/build."""
435 svn_creds = creds.Credentials(os.path.join(root_dir, '.svn_pwd'))
436 local_checkout = checkout.SvnCheckout(
438 os.path.basename(path),
441 'svn://svn.chromium.org/chrome/trunk/' + path,
443 context_obj = context.Context(
446 async_push.AsyncPush(
447 'https://chromium-status.appspot.com/cq',
448 _chromium_status_pwd(root_dir)))
450 verifiers_no_patch = [
451 project_base.ProjectBaseUrlVerifier(project_bases),
452 reviewer_lgtm.ReviewerLgtmVerifier(
453 _get_chromium_committers(),
457 presubmit_check.PresubmitCheckVerifier(context_obj, timeout=900),
460 return pending_manager.PendingManager(
466 def supported_projects():
467 """List the projects that can be managed by the commit queue."""
469 x[5:] for x in dir(sys.modules[__name__]) if x.startswith('_gen_'))
472 def load_project(project, user, root_dir, rietveld_obj, no_try):
473 """Loads the specified project."""
474 assert os.path.isabs(root_dir)
475 return getattr(sys.modules[__name__], '_gen_' + project)(
476 user, root_dir, rietveld_obj, no_try)