OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 # FIXME: Everything in this file belongs in gatekeeper_ng_config.py | |
6 | |
7 import logging | |
8 | |
9 # Python logging is stupidly verbose to configure. | |
10 def setup_logging(): | |
11 logger = logging.getLogger(__name__) | |
12 logger.setLevel(logging.DEBUG) | |
13 handler = logging.StreamHandler() | |
14 handler.setLevel(logging.DEBUG) | |
15 formatter = logging.Formatter('%(levelname)s: %(message)s') | |
16 handler.setFormatter(formatter) | |
17 logger.addHandler(handler) | |
18 return logger, handler | |
19 | |
20 | |
21 log, logging_handler = setup_logging() | |
22 | |
23 | |
24 def excluded_builders(master_config): | |
25 return master_config[0].get('*', {}).get('excluded_builders', set()) | |
26 | |
27 | |
28 # FIXME: This is currently baked into: | |
29 # https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/slave/ gatekeeper_launch.py | |
30 # http://crbug.com/394961 | |
ojan
2014/07/22 02:01:25
We should change the flakiness dashboard concept o
| |
31 MASTER_CONFIG = { | |
32 'chromium-status': [ | |
33 'chromium', | |
34 'chromium.chrome', | |
35 'chromium.chromiumos', | |
36 'chromium.gpu', | |
37 'chromium.linux', | |
38 'chromium.mac', | |
39 'chromium.memory', | |
40 'chromium.win', | |
41 ], | |
42 'blink-status': [ | |
43 'chromium.webkit', | |
44 ], | |
45 } | |
46 | |
47 | |
48 def tree_for_master(master_name): | |
49 for tree_name, master_names in MASTER_CONFIG.items(): | |
50 if master_name in master_names: | |
51 return tree_name | |
52 | |
53 | |
54 def would_close_tree(master_config, builder_name, step_name): | |
55 # FIXME: Section support should be removed: | |
56 master_config = master_config[0] | |
57 builder_config = master_config.get(builder_name, {}) | |
58 if not builder_config: | |
59 builder_config = master_config.get('*', {}) | |
60 | |
61 # close_tree is currently unused in gatekeeper.json but planned to be. | |
62 close_tree = builder_config.get('close_tree', True) | |
63 if not close_tree: | |
64 log.debug('close_tree is false') | |
65 return False | |
66 | |
67 # Excluded steps never close. | |
68 excluded_steps = set(builder_config.get('excluded_steps', [])) | |
69 if step_name in excluded_steps: | |
70 log.debug('%s is an excluded_step' % step_name) | |
71 return False | |
72 | |
73 # See gatekeeper_ng_config.py for documentation of | |
74 # the config format. | |
75 # forgiving/closing controls if mails are sent on close. | |
76 # steps/optional controls if step-absence indicates failure. | |
77 # this function assumes the step is present and failing | |
78 # and thus doesn't care between these 4 types: | |
79 closing_steps = (builder_config.get('forgiving_steps', set()) | | |
80 builder_config.get('forgiving_optional', set()) | | |
81 builder_config.get('closing_steps', set()) | | |
82 builder_config.get('closing_optional', set())) | |
83 | |
84 # A '*' in any of the above types means it applies to all steps. | |
85 if '*' in closing_steps: | |
86 return True | |
87 | |
88 if step_name in closing_steps: | |
89 return True | |
90 | |
91 log.debug('%s not in closing_steps: %s' % (step_name, closing_steps)) | |
92 return False | |
OLD | NEW |