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

Side by Side Diff: scripts/slave/recipes/run_presubmit.py

Issue 2442203002: Update recipes to understand new Gerrit patch properties. (Closed)
Patch Set: Fix bugs. Created 4 years, 1 month 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
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 DEPS = [ 5 DEPS = [
6 'depot_tools/bot_update', 6 'depot_tools/bot_update',
7 'depot_tools/gclient', 7 'depot_tools/gclient',
8 'depot_tools/git', 8 'depot_tools/git',
9 'depot_tools/presubmit', 9 'depot_tools/presubmit',
10 'recipe_engine/json', 10 'recipe_engine/json',
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if codereview_auth: 56 if codereview_auth:
57 presubmit_args.extend([ 57 presubmit_args.extend([
58 '--rietveld_email_file', 58 '--rietveld_email_file',
59 api.path['build'].join('site_config', '.rietveld_client_email')]) 59 api.path['build'].join('site_config', '.rietveld_client_email')])
60 presubmit_args.extend([ 60 presubmit_args.extend([
61 '--rietveld_private_key_file', 61 '--rietveld_private_key_file',
62 api.path['build'].join('site_config', '.rietveld_secret_key')]) 62 api.path['build'].join('site_config', '.rietveld_secret_key')])
63 else: 63 else:
64 presubmit_args.extend(['--rietveld_email', '']) # activate anonymous mode 64 presubmit_args.extend(['--rietveld_email', '']) # activate anonymous mode
65 elif patch_storage == 'gerrit': 65 elif patch_storage == 'gerrit':
66 # Field event.patchSet.ref looks like 'refs/changes/11/338811/4' 66 gerrit_url = api.properties.get('patch_gerrit_url')
67 issue, patchset = api.properties['event.patchSet.ref'].split('/')[-2:] 67 if not gerrit_url:
68 # TODO(tandrii): clean up old Gerrit patch properties.
69 # Field event.patchSet.ref looks like 'refs/changes/11/338811/4'
70 issue, patchset = api.properties['event.patchSet.ref'].split('/')[-2:]
71 gerrit_url = api.properties['gerrit']
72 else:
73 issue = api.properties.get('patch_issue')
74 patchset = api.properties.get('patch_set')
68 presubmit_args = [ 75 presubmit_args = [
69 '--issue', issue, 76 '--issue', issue,
70 '--patchset', patchset, 77 '--patchset', patchset,
71 '--gerrit_url', api.properties['gerrit'], 78 '--gerrit_url', gerrit_url,
72 '--gerrit_fetch', 79 '--gerrit_fetch',
73 ] 80 ]
74 else: # pragma: no cover 81 else: # pragma: no cover
75 assert False, 'patch_storage %s is not supported' % patch_storage 82 assert False, 'patch_storage %s is not supported' % patch_storage
76 if api.properties.get('dry_run'): 83 if api.properties.get('dry_run'):
77 presubmit_args.append('--dry_run') 84 presubmit_args.append('--dry_run')
78 85
79 presubmit_args.extend([ 86 presubmit_args.extend([
80 '--root', abs_root, 87 '--root', abs_root,
81 '--commit', 88 '--commit',
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 mastername='tryserver.chromium.linux', 166 mastername='tryserver.chromium.linux',
160 buildername='infra_presubmit', 167 buildername='infra_presubmit',
161 repo_name='infra', 168 repo_name='infra',
162 patch_project='infra', 169 patch_project='infra',
163 runhooks=True) + 170 runhooks=True) +
164 api.step_data('presubmit', api.json.output([['infra_presubmit', 171 api.step_data('presubmit', api.json.output([['infra_presubmit',
165 ['compile']]])) 172 ['compile']]]))
166 ) 173 )
167 174
168 yield ( 175 yield (
169 api.test('infra_with_runhooks_and_gerrit') + 176 api.test('infra_with_runhooks_and_gerrit_deprecated') +
170 api.properties.tryserver_gerrit( 177 api.properties.tryserver_gerrit(
171 full_project_name='infra/infra', 178 full_project_name='infra/infra',
172 repo_name='infra', 179 repo_name='infra',
173 mastername='tryserver.infra', 180 mastername='tryserver.infra',
174 buildername='infra_presubmit', 181 buildername='infra_presubmit',
175 runhooks=True) + 182 runhooks=True) +
176 api.step_data('presubmit', api.json.output([['infra_presubmit', 183 api.step_data('presubmit', api.json.output([['infra_presubmit',
177 ['compile']]])) 184 ['compile']]]))
178 ) 185 )
179 186
180 yield ( 187 yield (
188 api.test('infra_with_runhooks_and_gerrit') +
189 api.properties.tryserver(
190 gerrit_project='infra/infra',
191 repo_name='infra',
192 mastername='tryserver.infra',
193 buildername='infra_presubmit',
194 runhooks=True) +
195 api.step_data('presubmit', api.json.output([['infra_presubmit',
196 ['compile']]]))
197 )
198
199 yield (
181 api.test('depot_tools_and_gerrit') + 200 api.test('depot_tools_and_gerrit') +
182 api.properties.tryserver_gerrit( 201 api.properties.tryserver(
183 full_project_name='chromium/tools/depot_tools', 202 gerrit_project='chromium/tools/depot_tools',
184 repo_name='depot_tools', 203 repo_name='depot_tools',
185 mastername='tryserver.infra', 204 mastername='tryserver.infra',
186 buildername='presubmit_depot_tools', 205 buildername='presubmit_depot_tools',
187 runhooks=True) + 206 runhooks=True) +
188 api.step_data('presubmit', api.json.output([['depot_tools_presubmit', 207 api.step_data('presubmit', api.json.output([['depot_tools_presubmit',
189 ['test']]])) 208 ['test']]]))
190 ) 209 )
191 210
192 yield ( 211 yield (
193 api.test('recipes-py') + 212 api.test('recipes-py') +
(...skipping 19 matching lines...) Expand all
213 232
214 yield ( 233 yield (
215 api.test('presubmit-infra-failure') + 234 api.test('presubmit-infra-failure') +
216 api.properties.tryserver( 235 api.properties.tryserver(
217 mastername='tryserver.chromium.linux', 236 mastername='tryserver.chromium.linux',
218 buildername='chromium_presubmit', 237 buildername='chromium_presubmit',
219 repo_name='chromium', 238 repo_name='chromium',
220 patch_project='chromium') + 239 patch_project='chromium') +
221 api.step_data('presubmit', api.json.output({}, retcode=2)) 240 api.step_data('presubmit', api.json.output({}, retcode=2))
222 ) 241 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698