skia2/infra/bots/upload_skps.py
Ravi Mistry bd2d111d23 Copy over git_utils from common and add GitLocalConfig
BUG=skia:5979

# Already ran tryjobs in https://skia-review.googlesource.com/c/4897/11
NOTRY=true
NOTREECHECKS=true
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4897

Change-Id: Iee061101b69b4d1cfb0e640785a19e42c6017ef8
Reviewed-on: https://skia-review.googlesource.com/4897
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2016-11-17 14:43:04 +00:00

70 lines
2.3 KiB
Python

# Copyright 2014 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.
"""Create a CL to update the SKP version."""
import argparse
import os
import subprocess
import sys
import git_utils
CHROMIUM_SKIA = 'https://chromium.googlesource.com/skia.git'
COMMIT_MSG = '''Update SKP version
Automatic commit by the RecreateSKPs bot.
TBR=
NO_MERGE_BUILDS
'''
SKIA_COMMITTER_EMAIL = 'skia.buildbots@gmail.com'
SKIA_COMMITTER_NAME = 'skia.buildbots'
SKIA_REPO = 'https://skia.googlesource.com/skia.git'
def main(target_dir):
subprocess.check_call(['git', 'config', '--local', 'user.name',
SKIA_COMMITTER_NAME])
subprocess.check_call(['git', 'config', '--local', 'user.email',
SKIA_COMMITTER_EMAIL])
if CHROMIUM_SKIA in subprocess.check_output(['git', 'remote', '-v']):
subprocess.check_call(['git', 'remote', 'set-url', 'origin', SKIA_REPO,
CHROMIUM_SKIA])
# Download CIPD.
cipd_sha1 = os.path.join(os.getcwd(), 'infra', 'bots', 'tools', 'luci-go',
'linux64', 'cipd.sha1')
subprocess.check_call(['download_from_google_storage', '-s', cipd_sha1,
'--bucket', 'chromium-luci'])
# First verify that there are no gen_tasks diffs.
gen_tasks = os.path.join(os.getcwd(), 'infra', 'bots', 'gen_tasks.go')
try:
subprocess.check_call(['go', 'run', gen_tasks, '--test'])
except subprocess.CalledProcessError as e:
print >> sys.stderr, ('gen_tasks.go failed, not uploading SKP update:\n\n%s'
% e.output)
sys.exit(1)
# Upload the new version, land the update CL.
with git_utils.GitBranch(branch_name='update_skp_version',
commit_msg=COMMIT_MSG,
commit_queue=True):
upload_script = os.path.join(
os.getcwd(), 'infra', 'bots', 'assets', 'skp', 'upload.py')
subprocess.check_call(['python', upload_script, '-t', target_dir])
subprocess.check_call(['go', 'run', gen_tasks])
subprocess.check_call([
'git', 'add', os.path.join('infra', 'bots', 'tasks.json')])
if '__main__' == __name__:
parser = argparse.ArgumentParser()
parser.add_argument("--target_dir")
args = parser.parse_args()
main(args.target_dir)