2017-05-17 18:28:06 +00:00
|
|
|
# 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_COMMITTER_EMAIL = 'update-meta-config@skia.org'
|
|
|
|
SKIA_COMMITTER_NAME = 'Update Meta Config'
|
|
|
|
SKIA_REPO_TEMPLATE = 'https://skia.googlesource.com/%s.git'
|
|
|
|
|
2017-05-18 15:29:04 +00:00
|
|
|
CQ_INCLUDE_CHROMIUM_TRYBOTS = [
|
|
|
|
('master.tryserver.blink', [
|
|
|
|
'linux_trusty_blink_dbg',
|
2017-10-25 13:53:23 +00:00
|
|
|
'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',
|
2017-05-18 15:29:04 +00:00
|
|
|
]),
|
|
|
|
('master.tryserver.chromium.linux', [
|
|
|
|
'linux_chromium_compile_dbg_ng',
|
|
|
|
'linux_chromium_compile_rel_ng',
|
|
|
|
'linux_chromium_dbg_ng',
|
|
|
|
'linux_chromium_rel_ng',
|
|
|
|
'linux_optional_gpu_tests_rel',
|
|
|
|
]),
|
|
|
|
('master.tryserver.chromium.mac', [
|
|
|
|
'mac_chromium_compile_dbg_ng',
|
|
|
|
'mac_chromium_compile_rel_ng',
|
|
|
|
'mac_chromium_dbg_ng',
|
|
|
|
'mac_chromium_rel_ng',
|
|
|
|
'mac_optional_gpu_tests_rel',
|
|
|
|
]),
|
|
|
|
('master.tryserver.chromium.win', [
|
|
|
|
'win_chromium_compile_dbg_ng',
|
|
|
|
'win_chromium_compile_rel_ng',
|
|
|
|
'win_chromium_dbg_ng',
|
|
|
|
'win_optional_gpu_tests_rel',
|
2017-10-17 12:16:28 +00:00
|
|
|
'win7_chromium_rel_ng',
|
|
|
|
'win10_chromium_x64_rel_ng',
|
2017-05-18 15:29:04 +00:00
|
|
|
]),
|
|
|
|
('master.tryserver.chromium.android', [
|
2017-10-25 16:06:09 +00:00
|
|
|
'android_blink_rel',
|
2017-05-18 15:29:04 +00:00
|
|
|
'android_compile_dbg',
|
|
|
|
'android_compile_rel',
|
2017-10-17 12:16:28 +00:00
|
|
|
'android_n5x_swarming_dbg',
|
|
|
|
'android_n5x_swarming_rel',
|
2017-05-18 15:29:04 +00:00
|
|
|
'android_optional_gpu_tests_rel',
|
|
|
|
])
|
|
|
|
]
|
2017-05-17 18:28:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
def addChromiumTrybots(f):
|
2017-05-18 15:29:04 +00:00
|
|
|
for master, bots in CQ_INCLUDE_CHROMIUM_TRYBOTS:
|
2017-05-17 18:28:06 +00:00
|
|
|
f.write('[bucket "%s"]\n' % master)
|
2017-05-18 15:29:04 +00:00
|
|
|
for bot in bots:
|
2017-05-17 18:28:06 +00:00
|
|
|
f.write('\tbuilder = %s\n' % bot)
|
|
|
|
|
|
|
|
|
2017-10-17 13:18:18 +00:00
|
|
|
def main():
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("--gitcookies")
|
|
|
|
parser.add_argument("--repo_name")
|
|
|
|
parser.add_argument("--tasks_json")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
skia_repo = SKIA_REPO_TEMPLATE % args.repo_name
|
2017-05-17 18:28:06 +00:00
|
|
|
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 = []
|
2017-10-17 13:18:18 +00:00
|
|
|
with open(args.tasks_json) as tasks_json:
|
2017-05-17 18:28:06 +00:00
|
|
|
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:
|
|
|
|
|
2017-10-17 13:18:18 +00:00
|
|
|
if args.repo_name == 'skia':
|
2017-05-17 18:28:06 +00:00
|
|
|
addChromiumTrybots(f)
|
|
|
|
|
|
|
|
# Adding all Skia jobs.
|
|
|
|
f.write('[bucket "skia.primary"]\n')
|
|
|
|
for job in tryjobs:
|
|
|
|
f.write('\tbuilder = ' + job + '\n')
|
|
|
|
|
|
|
|
# Push the change as the update-meta-config user.
|
|
|
|
config_dict = {
|
|
|
|
'user.name': SKIA_COMMITTER_NAME,
|
|
|
|
'user.email': SKIA_COMMITTER_EMAIL,
|
2017-10-17 13:18:18 +00:00
|
|
|
'http.cookiefile': args.gitcookies,
|
2017-05-17 18:28:06 +00:00
|
|
|
}
|
|
|
|
with git_utils.GitLocalConfig(config_dict):
|
|
|
|
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__:
|
2017-10-17 13:18:18 +00:00
|
|
|
main()
|