skia2/infra/bots/update_go_deps.py
Eric Boren 84ae6410b9 [infra] Add nightly UpdateGoDEPS
The go_deps asset is almost two months old...

Bug: skia:
Change-Id: I3910d1812a3c8ec4b599e959b76f8d60202b877a
Reviewed-on: https://skia-review.googlesource.com/157425
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
2018-09-27 19:54:26 +00:00

51 lines
1.5 KiB
Python

# Copyright 2018 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 go_deps asset version."""
import os
import subprocess
import sys
import git_utils
COMMIT_MSG = '''Update go_deps asset
Automatic commit by the UpdateGoDEPS bot.
TBR=borenet@google.com
'''
SKIA_REPO = 'https://skia.googlesource.com/skia.git'
def main():
with git_utils.NewGitCheckout(repository=SKIA_REPO):
# 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 updating Go DEPS:\n\n%s' % e.output)
sys.exit(1)
# Upload the new version, land the update CL as the update-go-deps user.
with git_utils.GitBranch(branch_name='update_go_deps_version',
commit_msg=COMMIT_MSG,
commit_queue=True):
script = os.path.join(
os.getcwd(), 'infra', 'bots', 'assets', 'go_deps',
'create_and_upload.py')
subprocess.check_call(['python', script])
subprocess.check_call(['go', 'run', gen_tasks])
subprocess.check_call([
'git', 'add', os.path.join('infra', 'bots', 'tasks.json')])
if '__main__' == __name__:
main()