OLD | NEW |
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 | 5 |
6 # Recipe for uploading DM results. | 6 # Recipe for uploading DM results. |
7 | 7 |
8 | 8 |
9 DEPS = [ | 9 DEPS = [ |
10 'build/file', | 10 'build/file', |
11 'recipe_engine/json', | 11 'recipe_engine/json', |
12 'recipe_engine/path', | 12 'recipe_engine/path', |
13 'recipe_engine/properties', | 13 'recipe_engine/properties', |
14 'recipe_engine/shutil', | 14 'recipe_engine/shutil', |
15 'recipe_engine/step', | 15 'recipe_engine/step', |
16 'recipe_engine/time', | 16 'recipe_engine/time', |
17 ] | 17 ] |
18 | 18 |
19 | 19 |
20 import time | 20 import calendar |
21 | 21 |
22 | 22 |
23 DM_JSON = 'dm.json' | 23 DM_JSON = 'dm.json' |
24 GS_BUCKET = 'gs://skia-infra-gm' | 24 GS_BUCKET = 'gs://skia-infra-gm' |
25 UPLOAD_ATTEMPTS = 5 | 25 UPLOAD_ATTEMPTS = 5 |
26 VERBOSE_LOG = 'verbose.log' | 26 VERBOSE_LOG = 'verbose.log' |
27 | 27 |
28 | 28 |
29 def cp(api, name, src, dst, extra_args=None): | 29 def cp(api, name, src, dst, extra_args=None): |
30 cmd = ['gsutil', 'cp'] | 30 cmd = ['gsutil', 'cp'] |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 # Upload the JSON summary and verbose.log. | 85 # Upload the JSON summary and verbose.log. |
86 now = api.time.utcnow() | 86 now = api.time.utcnow() |
87 summary_dest_path = '/'.join([ | 87 summary_dest_path = '/'.join([ |
88 'dm-json-v1', | 88 'dm-json-v1', |
89 str(now.year ).zfill(4), | 89 str(now.year ).zfill(4), |
90 str(now.month).zfill(2), | 90 str(now.month).zfill(2), |
91 str(now.day ).zfill(2), | 91 str(now.day ).zfill(2), |
92 str(now.hour ).zfill(2), | 92 str(now.hour ).zfill(2), |
93 revision, | 93 revision, |
94 builder_name, | 94 builder_name, |
95 str(int(time.mktime(now.utctimetuple())))]) | 95 str(int(calendar.timegm(now.utctimetuple())))]) |
96 | 96 |
97 # Trybot results are further siloed by issue/patchset. | 97 # Trybot results are further siloed by issue/patchset. |
98 if builder_name.endswith('-Trybot'): | 98 if builder_name.endswith('-Trybot'): |
99 if not (issue and patchset): # pragma: nocover | 99 if not (issue and patchset): # pragma: nocover |
100 raise Exception('issue and patchset properties are required for trybots.') | 100 raise Exception('issue and patchset properties are required for trybots.') |
101 summary_dest_path = '/'.join(('trybot', summary_dest_path, issue, patchset)) | 101 summary_dest_path = '/'.join(('trybot', summary_dest_path, issue, patchset)) |
102 | 102 |
103 summary_dest_path = '/'.join((GS_BUCKET, summary_dest_path)) | 103 summary_dest_path = '/'.join((GS_BUCKET, summary_dest_path)) |
104 | 104 |
105 cp(api, 'JSON and logs', tmp_dir.join('*'), summary_dest_path, | 105 cp(api, 'JSON and logs', tmp_dir.join('*'), summary_dest_path, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 'event.change.number': '2100', | 152 'event.change.number': '2100', |
153 } | 153 } |
154 yield ( | 154 yield ( |
155 api.test('recipe_with_gerrit_patch') + | 155 api.test('recipe_with_gerrit_patch') + |
156 api.properties( | 156 api.properties( |
157 buildername=builder, | 157 buildername=builder, |
158 revision='abc123', | 158 revision='abc123', |
159 path_config='kitchen', | 159 path_config='kitchen', |
160 **gerrit_kwargs) | 160 **gerrit_kwargs) |
161 ) | 161 ) |
OLD | NEW |