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

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: If different tests within the same step fail in different revisions, all revisions should be culpri… 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 try job 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
26 if compile_targets: 25 if try_job_type == 'compile':
27 properties['compile_targets'] = compile_targets 26 properties['target_buildername'] = builder_name
27 if compile_targets:
28 properties['compile_targets'] = compile_targets
29 else: # try_job_type is 'test'.
30 properties['target_testername'] = builder_name
31 if targeted_tests:
stgao 2016/01/26 00:51:41 For test failures, we will always require the ``ta
chanli 2016/01/27 18:49:55 Done.
32 properties['tests'] = targeted_tests
28 33
29 return properties 34 return properties
30 35
31 # Arguments number differs from overridden method - pylint: disable=W0221 36 # Arguments number differs from overridden method - pylint: disable=W0221
32 def run( 37 def run(
33 self, master_name, builder_name, build_number, 38 self, master_name, builder_name, build_number, good_revision,
34 good_revision, bad_revision, compile_targets): 39 bad_revision, try_job_type, compile_targets, targeted_tests):
35 tryserver_mastername, tryserver_buildername = ( 40 tryserver_mastername, tryserver_buildername = (
36 waterfall_config.GetTrybotForWaterfallBuilder( 41 waterfall_config.GetTrybotForWaterfallBuilder(
37 master_name, builder_name)) 42 master_name, builder_name))
38 43
39 recipe = 'findit/chromium/compile'
40 properties = self._getBuildProperties( 44 properties = self._getBuildProperties(
41 recipe, master_name, builder_name, good_revision, bad_revision, 45 master_name, builder_name, good_revision, bad_revision,
42 compile_targets) 46 try_job_type, compile_targets, targeted_tests)
43 47
44 try_job = buildbucket_client.TryJob( 48 try_job = buildbucket_client.TryJob(
45 tryserver_mastername, tryserver_buildername, None, properties, []) 49 tryserver_mastername, tryserver_buildername, None, properties, [])
46 error, build = buildbucket_client.TriggerTryJobs([try_job])[0] 50 error, build = buildbucket_client.TriggerTryJobs([try_job])[0]
47 51
48 if error: # pragma: no cover 52 if error: # pragma: no cover
49 raise pipeline.Retry( 53 raise pipeline.Retry(
50 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) 54 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason))
51 55
52 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) 56 try_job_result = WfTryJob.Get(master_name, builder_name, build_number)
53 try_job_result.compile_results.append({'try_job_id': build.id}) 57 if try_job_type == 'compile':
58 try_job_result.compile_results.append({'try_job_id': build.id})
59 else:
60 try_job_result.test_results.append({'try_job_id': build.id})
54 try_job_result.put() 61 try_job_result.put()
55 62
56 return build.id 63 return build.id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698