blob: 0e2607e68bbb622f3b06d257f1edd009bbad6f9a [file] [log] [blame]
Ravi Mistry01b48e72017-05-17 14:28:06 -04001# Copyright 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Update meta/config of the specified Skia repo."""
6
7
8import argparse
9import json
10import os
11import subprocess
12import sys
13import urllib2
14
15import git_utils
16
17
Ravi Mistry01b48e72017-05-17 14:28:06 -040018SKIA_REPO_TEMPLATE = 'https://skia.googlesource.com/%s.git'
19
Hal Canary287a3fe2017-05-18 11:29:04 -040020CQ_INCLUDE_CHROMIUM_TRYBOTS = [
Eric Boren464846e2018-03-15 13:34:23 -040021 ('luci.chromium.try', [
Yuly Novikov73bd3db2018-03-21 16:21:49 -040022 'android_optional_gpu_tests_rel',
Ravi Mistrya19381d2018-04-16 14:07:21 -040023 'linux_chromium_compile_dbg_ng',
24 'linux_chromium_dbg_ng',
25 'linux_chromium_rel_ng',
Eric Boren464846e2018-03-15 13:34:23 -040026 'linux_optional_gpu_tests_rel',
Eric Borene8faee72018-03-21 16:23:25 -040027 'mac_chromium_compile_dbg_ng',
Ravi Mistrya19381d2018-04-16 14:07:21 -040028 'mac_chromium_compile_rel_ng',
29 'mac_chromium_dbg_ng',
30 'mac_chromium_rel_ng',
Corentin Wallez578a8f12018-03-20 13:42:43 -040031 'mac_optional_gpu_tests_rel',
Ravi Mistrya19381d2018-04-16 14:07:21 -040032 'win_chromium_compile_dbg_ng',
33 'win_chromium_dbg_ng',
Corentin Walleza5914282018-04-11 15:45:39 -040034 'win_optional_gpu_tests_rel',
Eric Boren464846e2018-03-15 13:34:23 -040035 ]),
Hal Canary287a3fe2017-05-18 11:29:04 -040036 ('master.tryserver.blink', [
Hal Canary287a3fe2017-05-18 11:29:04 -040037 'linux_trusty_blink_dbg',
Mike Kleinfb4d3f02017-10-25 09:53:23 -040038 'linux_trusty_blink_rel',
39 'mac10.10_blink_rel',
40 'mac10.11_blink_rel',
41 'mac10.11_retina_blink_rel',
42 'mac10.12_blink_rel',
43 'win10_blink_rel',
44 'win7_blink_rel',
Hal Canary287a3fe2017-05-18 11:29:04 -040045 ]),
46 ('master.tryserver.chromium.linux', [
Hal Canary287a3fe2017-05-18 11:29:04 -040047 'linux_chromium_compile_rel_ng',
Hal Canary287a3fe2017-05-18 11:29:04 -040048 ]),
49 ('master.tryserver.chromium.win', [
Hal Canary287a3fe2017-05-18 11:29:04 -040050 'win_chromium_compile_rel_ng',
Ravi Mistry01f70aa2017-10-17 08:16:28 -040051 'win7_chromium_rel_ng',
52 'win10_chromium_x64_rel_ng',
Hal Canary287a3fe2017-05-18 11:29:04 -040053 ]),
54 ('master.tryserver.chromium.android', [
Mike Kleinf8e353d2017-10-25 12:06:09 -040055 'android_blink_rel',
Hal Canary287a3fe2017-05-18 11:29:04 -040056 'android_compile_dbg',
57 'android_compile_rel',
Ravi Mistry01f70aa2017-10-17 08:16:28 -040058 'android_n5x_swarming_dbg',
59 'android_n5x_swarming_rel',
Hal Canary287a3fe2017-05-18 11:29:04 -040060 ])
61]
Ravi Mistry01b48e72017-05-17 14:28:06 -040062
63
64def addChromiumTrybots(f):
Hal Canary287a3fe2017-05-18 11:29:04 -040065 for master, bots in CQ_INCLUDE_CHROMIUM_TRYBOTS:
Ravi Mistry01b48e72017-05-17 14:28:06 -040066 f.write('[bucket "%s"]\n' % master)
Hal Canary287a3fe2017-05-18 11:29:04 -040067 for bot in bots:
Ravi Mistry01b48e72017-05-17 14:28:06 -040068 f.write('\tbuilder = %s\n' % bot)
69
70
Eric Borencff9f952017-10-17 09:18:18 -040071def main():
72 parser = argparse.ArgumentParser()
Eric Borencff9f952017-10-17 09:18:18 -040073 parser.add_argument("--repo_name")
74 parser.add_argument("--tasks_json")
75 args = parser.parse_args()
76
77 skia_repo = SKIA_REPO_TEMPLATE % args.repo_name
Ravi Mistry01b48e72017-05-17 14:28:06 -040078 with git_utils.NewGitCheckout(repository=skia_repo):
79 # Fetch and checkout the meta/config branch.
80 subprocess.check_call(['git', 'fetch', skia_repo, 'refs/meta/config:cfg'])
81 subprocess.check_call(['git', 'checkout', 'cfg'])
82
83 # Create list of tryjobs from tasks_json.
84 tryjobs = []
Eric Borencff9f952017-10-17 09:18:18 -040085 with open(args.tasks_json) as tasks_json:
Ravi Mistry01b48e72017-05-17 14:28:06 -040086 data = json.load(tasks_json)
87 for job in data['jobs'].keys():
88 if not job.startswith('Upload-'):
89 tryjobs.append(job)
90 tryjobs.sort()
91
92 # Write to buildbucket.config.
93 buildbucket_config = os.path.join(os.getcwd(), 'buildbucket.config')
94 with open(buildbucket_config, 'w') as f:
95
Eric Borencff9f952017-10-17 09:18:18 -040096 if args.repo_name == 'skia':
Ravi Mistry01b48e72017-05-17 14:28:06 -040097 addChromiumTrybots(f)
98
99 # Adding all Skia jobs.
100 f.write('[bucket "skia.primary"]\n')
101 for job in tryjobs:
102 f.write('\tbuilder = ' + job + '\n')
103
Eric Boren32f84782018-04-23 08:20:57 -0400104 subprocess.check_call(['git', 'add', 'buildbucket.config'])
105 try:
106 subprocess.check_call(
107 ['git', 'commit', '-m', 'Update builders in buildbucket.config'])
108 except subprocess.CalledProcessError:
109 print 'No changes to buildbucket.config'
110 return
Ravi Mistry01b48e72017-05-17 14:28:06 -0400111
Eric Boren32f84782018-04-23 08:20:57 -0400112 subprocess.check_call(['git', 'push', skia_repo, 'cfg:refs/meta/config'])
Ravi Mistry01b48e72017-05-17 14:28:06 -0400113
114
115if '__main__' == __name__:
Eric Borencff9f952017-10-17 09:18:18 -0400116 main()