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

Side by Side Diff: appengine/findit/waterfall/schedule_try_job_pipeline.py

Issue 1591003002: [Findit] Modify tryjob pipelines to trigger try jobs for test failure. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: . Created 4 years, 11 months 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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 common import buildbucket_client 5 from common import buildbucket_client
6 from model.wf_try_job import WfTryJob 6 from model.wf_try_job import WfTryJob
7 from pipeline_wrapper import BasePipeline 7 from pipeline_wrapper import BasePipeline
8 from pipeline_wrapper import pipeline 8 from pipeline_wrapper import pipeline
9 from waterfall import waterfall_config 9 from waterfall import waterfall_config
10 10
11 11
12 class ScheduleTryJobPipeline(BasePipeline): 12 class ScheduleTryJobPipeline(BasePipeline):
13 """A pipeline for scheduling a new tryjob for current build.""" 13 """A pipeline for scheduling a new tryjob for current build."""
14 14
15 def _getBuildProperties(self, recipe, master_name, builder_name, 15 def _getBuildProperties(
16 good_revision, bad_revision, compile_targets): 16 self, master_name, builder_name, good_revision, bad_revision,
17 17 try_job_type, compile_targets, targeted_tests):
18 properties = { 18 properties = {
19 'recipe': recipe, 19 'recipe': 'findit/chromium/%s' % try_job_type,
20 'good_revision': good_revision, 20 'good_revision': good_revision,
21 'bad_revision': bad_revision, 21 'bad_revision': bad_revision,
22 'target_mastername': master_name, 22 'target_mastername': master_name
23 'target_buildername': builder_name
24 } 23 }
25 24
25 if try_job_type == 'compile':
26 properties['target_buildername'] = builder_name
27 else:
28 properties['target_testername'] = builder_name
29
30
26 if compile_targets: 31 if compile_targets:
27 properties['compile_targets'] = compile_targets 32 properties['compile_targets'] = compile_targets
28 33
34 if targeted_tests:
35 properties['tests'] = targeted_tests
36
29 return properties 37 return properties
30 38
31 # Arguments number differs from overridden method - pylint: disable=W0221 39 # Arguments number differs from overridden method - pylint: disable=W0221
32 def run( 40 def run(
33 self, master_name, builder_name, build_number, 41 self, master_name, builder_name, build_number, good_revision,
34 good_revision, bad_revision, compile_targets): 42 bad_revision, try_job_type, compile_targets, targeted_tests):
35 tryserver_mastername, tryserver_buildername = ( 43 tryserver_mastername, tryserver_buildername = (
36 waterfall_config.GetTrybotForWaterfallBuilder( 44 waterfall_config.GetTrybotForWaterfallBuilder(
37 master_name, builder_name)) 45 master_name, builder_name))
38 46
39 recipe = 'findit/chromium/compile'
40 properties = self._getBuildProperties( 47 properties = self._getBuildProperties(
41 recipe, master_name, builder_name, good_revision, bad_revision, 48 master_name, builder_name, good_revision, bad_revision,
42 compile_targets) 49 try_job_type, compile_targets, targeted_tests)
43 50
44 try_job = buildbucket_client.TryJob( 51 try_job = buildbucket_client.TryJob(
45 tryserver_mastername, tryserver_buildername, None, properties, []) 52 tryserver_mastername, tryserver_buildername, None, properties, [])
46 error, build = buildbucket_client.TriggerTryJobs([try_job])[0] 53 error, build = buildbucket_client.TriggerTryJobs([try_job])[0]
47 54
48 if error: # pragma: no cover 55 if error: # pragma: no cover
49 raise pipeline.Retry( 56 raise pipeline.Retry(
50 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) 57 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason))
51 58
52 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) 59 try_job_result = WfTryJob.Get(master_name, builder_name, build_number)
53 try_job_result.compile_results.append({'try_job_id': build.id}) 60 if try_job_type == 'compile':
61 try_job_result.compile_results.append({'try_job_id': build.id})
62 else:
63 try_job_result.test_results.append({'try_job_id': build.id})
54 try_job_result.put() 64 try_job_result.put()
55 65
56 return build.id 66 return build.id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698