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

Side by Side Diff: scripts/slave/recipes/simple_ci.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 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 from recipe_engine.recipe_api import Property 5 from recipe_engine.recipe_api import Property
6 6
7 7
8 DEPS = [ 8 DEPS = [
9 'recipe_engine/properties', 9 'recipe_engine/properties',
10 'recipe_engine/python', 10 'recipe_engine/python',
11 'recipe_engine/raw_io', 11 'recipe_engine/raw_io',
12 'recipe_engine/step', 12 'recipe_engine/step',
13 ] 13 ]
14 14
15 PROPERTIES = { 15 PROPERTIES = {
16 'gerrit': Property(kind=str, help='Gerrit host', default=None, 16 # New Gerrit patch properties.
17 param_name='gerrit_host'), 17 'patch_storage': Property(kind=str, default=None),
18 'patch_project': Property(kind=str, help='Gerrit project', default=None, 18 'patch_gerrit_url': Property(kind=str, default=None),
19 param_name='gerrit_project'), 19 'patch_repository_url': Property(kind=str, default=None),
20 'event.patchSet.ref': Property(kind=str, help='Gerrit patch ref', 20 'patch_ref': Property(kind=str, default=None),
21 default=None, param_name='gerrit_patch_ref'), 21
22 # Non-patch jobs properties.
22 'repository': Property(kind=str, help='Full url to a Git repository', 23 'repository': Property(kind=str, help='Full url to a Git repository',
23 default=None, param_name='repo_url'), 24 default=None, param_name='repo_url'),
24 'refspec': Property(kind=str, help='Refspec to checkout', default='master'), 25 'refspec': Property(kind=str, help='Refspec to checkout', default='master'),
25 'category': Property(kind=str, help='Build category', default=None),
26 } 26 }
27 27
28 28
29 def RunSteps(api, category, repo_url, refspec, gerrit_host, gerrit_project, 29 def RunSteps(api, repo_url, refspec, patch_storage, patch_repository_url,
30 gerrit_patch_ref): 30 patch_ref):
31 if category == 'cq': 31 if patch_storage:
32 assert gerrit_host.startswith('https://') 32 assert patch_storage == 'gerrit'
33 repo_url = '%s/%s' % (gerrit_host.rstrip('/'), gerrit_project) 33 assert patch_repository_url and patch_ref
34 refspec = gerrit_patch_ref 34 repo_url = patch_repository_url
35 refspec = patch_ref
35 36
36 assert repo_url and refspec, 'repository url and refspec must be given' 37 assert repo_url and refspec, 'repository url and refspec must be given'
37 assert repo_url.startswith('https://') 38 assert repo_url.startswith('https://')
38 39
39 api.step('git init', ['git', 'init']) 40 api.step('git init', ['git', 'init'])
40 api.step('git reset', ['git', 'reset', '--hard']) 41 api.step('git reset', ['git', 'reset', '--hard'])
41 api.step('git fetch', ['git', 'fetch', repo_url, '%s' % refspec]) 42 api.step('git fetch', ['git', 'fetch', repo_url, '%s' % refspec])
42 api.step('git checkout', ['git', 'checkout', 'FETCH_HEAD']) 43 api.step('git checkout', ['git', 'checkout', 'FETCH_HEAD'])
43 api.step('git submodule update', ['git', 'submodule', 'update', 44 api.step('git submodule update', ['git', 'submodule', 'update',
44 '--init', '--recursive']) 45 '--init', '--recursive'])
(...skipping 19 matching lines...) Expand all
64 if cmd[0] == 'python' and len(cmd) >= 2: 65 if cmd[0] == 'python' and len(cmd) >= 2:
65 api.python(name, script=cmd[1], args=cmd[2:]) 66 api.python(name, script=cmd[1], args=cmd[2:])
66 else: 67 else:
67 api.step(name, cmd) 68 api.step(name, cmd)
68 69
69 70
70 def GenTests(api): 71 def GenTests(api):
71 yield api.test('ci') + api.properties( 72 yield api.test('ci') + api.properties(
72 repository='https://chromium.googlesource.com/infra/infra', 73 repository='https://chromium.googlesource.com/infra/infra',
73 ) 74 )
74 yield api.test('cq_try') + api.properties.tryserver_gerrit( 75 yield api.test('cq_try') + api.properties.tryserver(
75 full_project_name='infra/infra', 76 gerrit_project='infra/infra',
76 ) 77 )
77 yield api.test('ci_fail_but_run_all') + api.properties( 78 yield api.test('ci_fail_but_run_all') + api.properties(
78 repository='https://chromium.googlesource.com/infra/infra', 79 repository='https://chromium.googlesource.com/infra/infra',
79 refspec='release-52' 80 refspec='release-52'
80 ) + api.override_step_data('test: ./a.sh', retcode=1) 81 ) + api.override_step_data('test: ./a.sh', retcode=1)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698