| OLD | NEW |
| 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.pipeline_wrapper import BasePipeline | 5 from common.pipeline_wrapper import BasePipeline |
| 6 from common.pipeline_wrapper import pipeline | 6 from common.pipeline_wrapper import pipeline |
| 7 from common.waterfall import buildbucket_client | 7 from common.waterfall import buildbucket_client |
| 8 from model.wf_try_job import WfTryJob | 8 from model.wf_try_job import WfTryJob |
| 9 from model.wf_try_job_data import WfTryJobData | 9 from model.wf_try_job_data import WfTryJobData |
| 10 from waterfall import buildbot | 10 from waterfall import buildbot |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 properties = self._GetBuildProperties( | 51 properties = self._GetBuildProperties( |
| 52 master_name, builder_name, build_number, good_revision, bad_revision, | 52 master_name, builder_name, build_number, good_revision, bad_revision, |
| 53 try_job_type, compile_targets, suspected_revisions) | 53 try_job_type, compile_targets, suspected_revisions) |
| 54 | 54 |
| 55 if try_job_type == TryJobType.COMPILE: | 55 if try_job_type == TryJobType.COMPILE: |
| 56 additional_parameters = {} | 56 additional_parameters = {} |
| 57 else: | 57 else: |
| 58 additional_parameters = {'tests': targeted_tests} | 58 additional_parameters = {'tests': targeted_tests} |
| 59 | 59 |
| 60 try_job = buildbucket_client.TryJob( | 60 try_job = buildbucket_client.TryJob( |
| 61 tryserver_mastername, tryserver_buildername, None, properties, | 61 tryserver_mastername, tryserver_buildername, None, properties, [], |
| 62 additional_parameters, []) | 62 additional_parameters) |
| 63 error, build = buildbucket_client.TriggerTryJobs([try_job])[0] | 63 error, build = buildbucket_client.TriggerTryJobs([try_job])[0] |
| 64 | 64 |
| 65 if error: # pragma: no cover | 65 if error: # pragma: no cover |
| 66 raise pipeline.Retry( | 66 raise pipeline.Retry( |
| 67 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) | 67 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) |
| 68 | 68 |
| 69 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) | 69 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) |
| 70 build_id = build.id | 70 build_id = build.id |
| 71 | 71 |
| 72 if try_job_type == TryJobType.COMPILE: | 72 if try_job_type == TryJobType.COMPILE: |
| 73 try_job_result.compile_results.append({'try_job_id': build_id}) | 73 try_job_result.compile_results.append({'try_job_id': build_id}) |
| 74 else: | 74 else: |
| 75 try_job_result.test_results.append({'try_job_id': build_id}) | 75 try_job_result.test_results.append({'try_job_id': build_id}) |
| 76 try_job_result.try_job_ids.append(build_id) | 76 try_job_result.try_job_ids.append(build_id) |
| 77 try_job_result.put() | 77 try_job_result.put() |
| 78 | 78 |
| 79 # Create a corresponding WfTryJobData entity to capture as much metadata as | 79 # Create a corresponding WfTryJobData entity to capture as much metadata as |
| 80 # early as possible. | 80 # early as possible. |
| 81 try_job_data = WfTryJobData.Create(build_id) | 81 try_job_data = WfTryJobData.Create(build_id) |
| 82 try_job_data.master_name = master_name | 82 try_job_data.master_name = master_name |
| 83 try_job_data.builder_name = builder_name | 83 try_job_data.builder_name = builder_name |
| 84 try_job_data.build_number = build_number | 84 try_job_data.build_number = build_number |
| 85 try_job_data.try_job_type = try_job_type | 85 try_job_data.try_job_type = try_job_type |
| 86 try_job_data.has_compile_targets = bool(compile_targets) | 86 try_job_data.has_compile_targets = bool(compile_targets) |
| 87 try_job_data.has_heuristic_results = bool(suspected_revisions) | 87 try_job_data.has_heuristic_results = bool(suspected_revisions) |
| 88 try_job_data.put() | 88 try_job_data.put() |
| 89 | 89 |
| 90 return build_id | 90 return build_id |
| OLD | NEW |