OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 5 |
6 # pylint: disable=W0201 | 6 # pylint: disable=W0201 |
7 | 7 |
8 | 8 |
9 from recipe_engine import recipe_api | 9 from recipe_engine import recipe_api |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 self.master_name = self.m.properties['mastername'] | 28 self.master_name = self.m.properties['mastername'] |
29 self.slave_name = self.m.properties['slavename'] | 29 self.slave_name = self.m.properties['slavename'] |
30 self.build_number = self.m.properties['buildnumber'] | 30 self.build_number = self.m.properties['buildnumber'] |
31 | 31 |
32 self.slave_dir = self.m.path['slave_build'] | 32 self.slave_dir = self.m.path['slave_build'] |
33 self.checkout_root = self.slave_dir | 33 self.checkout_root = self.slave_dir |
34 self.default_env = {} | 34 self.default_env = {} |
35 self.gclient_env = {} | 35 self.gclient_env = {} |
36 self.is_compile_bot = self.builder_name.startswith('Build-') | 36 self.is_compile_bot = self.builder_name.startswith('Build-') |
37 self.no_buildbot = self.m.properties.get('nobuildbot', '') == 'True' | 37 self.no_buildbot = self.m.properties.get('nobuildbot', '') == 'True' |
| 38 self.skia_task_id = self.m.properties.get('skia_task_id', None) |
38 | 39 |
39 self.default_env['CHROME_HEADLESS'] = '1' | 40 self.default_env['CHROME_HEADLESS'] = '1' |
40 # The 'depot_tools' directory comes from recipe DEPS and isn't provided by | 41 # The 'depot_tools' directory comes from recipe DEPS and isn't provided by |
41 # default. We have to set it manually. | 42 # default. We have to set it manually. |
42 self.m.path.c.base_paths['depot_tools'] = ( | 43 self.m.path.c.base_paths['depot_tools'] = ( |
43 self.m.path.c.base_paths['slave_build'] + | 44 self.m.path.c.base_paths['slave_build'] + |
44 ('skia', 'infra', 'bots', '.recipe_deps', 'depot_tools')) | 45 ('skia', 'infra', 'bots', '.recipe_deps', 'depot_tools')) |
45 if 'Win' in self.builder_name: | 46 if 'Win' in self.builder_name: |
46 self.m.path.c.base_paths['depot_tools'] = ( | 47 self.m.path.c.base_paths['depot_tools'] = ( |
47 'c:\\', 'Users', 'chrome-bot', 'depot_tools') | 48 'c:\\', 'Users', 'chrome-bot', 'depot_tools') |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if ('Win' in self.builder_cfg.get('os', '') and arch == 'x86_64'): | 107 if ('Win' in self.builder_cfg.get('os', '') and arch == 'x86_64'): |
107 self.configuration += '_x64' | 108 self.configuration += '_x64' |
108 | 109 |
109 self.default_env.update({'SKIA_OUT': self.skia_out, | 110 self.default_env.update({'SKIA_OUT': self.skia_out, |
110 'BUILDTYPE': self.configuration}) | 111 'BUILDTYPE': self.configuration}) |
111 | 112 |
112 self.patch_storage = self.m.properties.get('patch_storage', 'rietveld') | 113 self.patch_storage = self.m.properties.get('patch_storage', 'rietveld') |
113 self.issue = None | 114 self.issue = None |
114 self.patchset = None | 115 self.patchset = None |
115 if self.no_buildbot: | 116 if self.no_buildbot: |
116 self.is_trybot = ( | 117 if (self.m.properties.get('issue', '') and |
117 self.m.properties.get('issue', '') and | 118 self.m.properties.get('patchset', '')): |
118 self.m.properties.get('patchset', '')) | 119 self.is_trybot = True |
119 if self.is_trybot: | |
120 self.issue = self.m.properties['issue'] | 120 self.issue = self.m.properties['issue'] |
121 self.patchset = self.m.properties['patchset'] | 121 self.patchset = self.m.properties['patchset'] |
| 122 elif (self.m.properties.get('event.change.number', '') and |
| 123 self.m.properties.get('event.patchSet.ref', '')): |
| 124 self.is_trybot = True |
| 125 self.issue = self.m.properties['event.change.number'] |
| 126 self.patchset = self.m.properties['event.patchSet.ref'].split('/')[-1] |
122 else: | 127 else: |
123 self.is_trybot = self.builder_cfg['is_trybot'] | 128 self.is_trybot = self.builder_cfg['is_trybot'] |
124 if self.is_trybot: | 129 if self.is_trybot: |
125 if self.patch_storage == 'gerrit': | 130 if self.patch_storage == 'gerrit': |
126 self.issue = self.m.properties['event.change.number'] | 131 self.issue = self.m.properties['event.change.number'] |
127 self.patchset = self.m.properties['event.patchSet.ref'].split('/')[-1] | 132 self.patchset = self.m.properties['event.patchSet.ref'].split('/')[-1] |
128 else: | 133 else: |
129 self.issue = self.m.properties['issue'] | 134 self.issue = self.m.properties['issue'] |
130 self.patchset = self.m.properties['patchset'] | 135 self.patchset = self.m.properties['patchset'] |
131 | 136 |
132 self.dm_dir = self.m.path.join( | 137 self.dm_dir = self.m.path.join( |
133 self.swarming_out_dir, 'dm') | 138 self.swarming_out_dir, 'dm') |
134 self.perf_data_dir = self.m.path.join(self.swarming_out_dir, | 139 self.perf_data_dir = self.m.path.join(self.swarming_out_dir, |
135 'perfdata', self.builder_name, 'data') | 140 'perfdata', self.builder_name, 'data') |
| 141 self._swarming_bot_id = None |
| 142 self._swarming_task_id = None |
136 | 143 |
137 @property | 144 @property |
138 def upload_dm_results(self): | 145 def upload_dm_results(self): |
139 # TODO(borenet): Move this into the swarm_test recipe. | 146 # TODO(borenet): Move this into the swarm_test recipe. |
140 skip_upload_bots = [ | 147 skip_upload_bots = [ |
141 'ASAN', | 148 'ASAN', |
142 'Coverage', | 149 'Coverage', |
143 'MSAN', | 150 'MSAN', |
144 'TSAN', | 151 'TSAN', |
145 'UBSAN', | 152 'UBSAN', |
(...skipping 18 matching lines...) Expand all Loading... |
164 'TSAN', | 171 'TSAN', |
165 'UBSAN', | 172 'UBSAN', |
166 'Valgrind', | 173 'Valgrind', |
167 ] | 174 ] |
168 upload_perf_results = True | 175 upload_perf_results = True |
169 for s in skip_upload_bots: | 176 for s in skip_upload_bots: |
170 if s in self.m.properties['buildername']: | 177 if s in self.m.properties['buildername']: |
171 upload_perf_results = False | 178 upload_perf_results = False |
172 break | 179 break |
173 return upload_perf_results | 180 return upload_perf_results |
| 181 |
| 182 @property |
| 183 def swarming_bot_id(self): |
| 184 if not self._swarming_bot_id: |
| 185 self._swarming_bot_id = self.m.python.inline( |
| 186 name='get swarming bot id', |
| 187 program='''import os |
| 188 print os.environ.get('SWARMING_BOT_ID', '') |
| 189 ''', |
| 190 stdout=self.m.raw_io.output()).stdout.rstrip() |
| 191 return self._swarming_bot_id |
| 192 |
| 193 @property |
| 194 def swarming_task_id(self): |
| 195 if not self._swarming_task_id: |
| 196 self._swarming_task_id = self.m.python.inline( |
| 197 name='get swarming task id', |
| 198 program='''import os |
| 199 print os.environ.get('SWARMING_TASK_ID', '') |
| 200 ''', |
| 201 stdout=self.m.raw_io.output()).stdout.rstrip() |
| 202 return self._swarming_task_id |
| 203 |
OLD | NEW |