1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Update meta/config of the specified Skia repo."""
import argparse
import json
import os
import subprocess
import sys
import urllib2
import git_utils
SKIA_REPO_TEMPLATE = 'https://skia.googlesource.com/%s.git'
CQ_INCLUDE_CHROMIUM_TRYBOTS = [
('luci.chromium.try', [
'android_optional_gpu_tests_rel',
'linux_chromium_compile_dbg_ng',
'linux_chromium_dbg_ng',
'linux_chromium_rel_ng',
'linux_optional_gpu_tests_rel',
'mac_chromium_compile_dbg_ng',
'mac_chromium_compile_rel_ng',
'mac_chromium_dbg_ng',
'mac_chromium_rel_ng',
'mac_optional_gpu_tests_rel',
'win_chromium_compile_dbg_ng',
'win_chromium_dbg_ng',
'win_optional_gpu_tests_rel',
]),
('master.tryserver.blink', [
'linux_trusty_blink_dbg',
'linux_trusty_blink_rel',
'mac10.10_blink_rel',
'mac10.11_blink_rel',
'mac10.11_retina_blink_rel',
'mac10.12_blink_rel',
'win10_blink_rel',
'win7_blink_rel',
]),
('master.tryserver.chromium.linux', [
'linux_chromium_compile_rel_ng',
]),
('master.tryserver.chromium.win', [
'win_chromium_compile_rel_ng',
'win7_chromium_rel_ng',
'win10_chromium_x64_rel_ng',
]),
('master.tryserver.chromium.android', [
'android_blink_rel',
'android_compile_dbg',
'android_compile_rel',
'android_n5x_swarming_dbg',
'android_n5x_swarming_rel',
])
]
def addChromiumTrybots(f):
for master, bots in CQ_INCLUDE_CHROMIUM_TRYBOTS:
f.write('[bucket "%s"]\n' % master)
for bot in bots:
f.write('\tbuilder = %s\n' % bot)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--repo_name")
parser.add_argument("--tasks_json")
args = parser.parse_args()
skia_repo = SKIA_REPO_TEMPLATE % args.repo_name
with git_utils.NewGitCheckout(repository=skia_repo):
# Fetch and checkout the meta/config branch.
subprocess.check_call(['git', 'fetch', skia_repo, 'refs/meta/config:cfg'])
subprocess.check_call(['git', 'checkout', 'cfg'])
# Create list of tryjobs from tasks_json.
tryjobs = []
with open(args.tasks_json) as tasks_json:
data = json.load(tasks_json)
for job in data['jobs'].keys():
if not job.startswith('Upload-'):
tryjobs.append(job)
tryjobs.sort()
# Write to buildbucket.config.
buildbucket_config = os.path.join(os.getcwd(), 'buildbucket.config')
with open(buildbucket_config, 'w') as f:
if args.repo_name == 'skia':
addChromiumTrybots(f)
# Adding all Skia jobs.
f.write('[bucket "skia.primary"]\n')
for job in tryjobs:
f.write('\tbuilder = ' + job + '\n')
subprocess.check_call(['git', 'add', 'buildbucket.config'])
try:
subprocess.check_call(
['git', 'commit', '-m', 'Update builders in buildbucket.config'])
except subprocess.CalledProcessError:
print 'No changes to buildbucket.config'
return
subprocess.check_call(['git', 'push', skia_repo, 'cfg:refs/meta/config'])
if '__main__' == __name__:
main()
|