13 """Attempt to upload files to Gold.
14 This module assumes setup has occurred for the vars and flavor modules.
15 """
16 revision = self.m.properties['revision']
17 results_dir = self.m.flavor.host_dirs.dm_dir
18
19
20
21 image_dest_path = 'gs://%s/dm-images-v1' % self.m.properties['gs_bucket']
22 for ext in ['.png']:
23 files_to_upload = self.m.file.glob_paths(
24 'find %s images' % ext,
25 results_dir,
26 '*%s' % ext,
27 test_data=['someimage.png'])
28
29 files_to_upload = [f for f in files_to_upload if str(f).endswith(ext)]
30 if len(files_to_upload) > 0:
31 extra_gsutil_args = None
32 if self.m.platform.is_mac:
33 extra_gsutil_args = ['-o', 'GSUtil:parallel_process_count=1']
34 self.m.gsutil.cp('%s images' % ext, results_dir.join('*%s' % ext),
35 image_dest_path, extra_gsutil_args=extra_gsutil_args,
36 multithread=True)
37
38 summary_dest_path = 'gs://%s' % self.m.properties['gs_bucket']
39 ref = revision
40
41 if self.m.vars.is_trybot:
42 summary_dest_path =
'/'.
join([summary_dest_path,
'trybot'])
43 ref = '%s_%s' % (str(self.m.vars.issue), str(self.m.vars.patchset))
44
45
46 now = self.m.time.utcnow()
47 summary_dest_path =
'/'.
join([
48 summary_dest_path,
49 'dm-json-v1',
50 str(now.year ).zfill(4),
51 str(now.month).zfill(2),
52 str(now.day ).zfill(2),
53 str(now.hour ).zfill(2),
54 ref,
55 self.m.vars.builder_name,
56 str(
int(calendar.timegm(now.utctimetuple())))])
57
58
59 json_file = results_dir.join(DM_JSON)
60
61 self.m.gsutil.cp('dm.json', json_file,
62 summary_dest_path + '/' + DM_JSON, extra_args=['-Z'])
63
static sk_sp< SkImage > upload(const sk_sp< SkSurface > &surf, SkColor color)
static SkString join(const CommandLineFlags::StringArray &)