skia2/infra/bots/upload_md.py
Ravi Mistry 63fac808ee Disable bookmaker CLs automatic CQ+2 for now
Disable till problem described in
https://bugs.chromium.org/p/skia/issues/detail?id=8151#c8 is fixed

Bug: skia:8151
Change-Id: Ie726829f3b13b587e14192dbf0104d04934a18dc
Reviewed-on: https://skia-review.googlesource.com/142503
Reviewed-by: Ravi Mistry <rmistry@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
2018-07-19 17:25:25 +00:00

71 lines
2.1 KiB
Python

# 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 and upload markdown files using the output of fiddlecli."""
import argparse
import os
import subprocess
import sys
import git_utils
SKIA_REPO = 'https://skia.googlesource.com/skia.git'
COMMIT_MSG = '''Update markdown files
Automatic commit by the Housekeeper-Nightly-Bookmaker bot.
TBR=rmistry@google.com
NO_MERGE_BUILDS
'''
CC_LIST = ['rmistry@google.com', 'caryclark@google.com']
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--bookmaker_binary")
parser.add_argument("--fiddlecli_output")
args = parser.parse_args()
with git_utils.NewGitCheckout(repository=SKIA_REPO):
with git_utils.GitBranch(branch_name='update_md_files',
commit_msg=COMMIT_MSG,
commit_queue=False,
upload=False,
cc_list=CC_LIST) as git_branch:
# Run bookmaker binary.
cmd = [args.bookmaker_binary,
'-b', 'docs',
'-f', args.fiddlecli_output,
'-r', 'site/user/api',
]
try:
subprocess.check_call(cmd)
except subprocess.CalledProcessError as e:
print >> sys.stderr, (
'Running %s failed, not uploading markdowns update:\n\n%s' % (
cmd, e.output))
sys.exit(1)
# Verify that only files in the expected directory are going to be
# committed and uploaded.
diff_files = subprocess.check_output(['git', 'diff', '--name-only'])
for diff_file in diff_files.split():
if not diff_file.startswith('site/user/api/'):
print >> sys.stderr, (
'Some files in %s were not in the site/user/api dir. '
'Not uploading them' % diff_files)
sys.exit(1)
if diff_files:
subprocess.check_call(['git', 'add', '-u'])
git_branch.commit_and_upload(False)
else:
print 'No changes so nothing to upload.'
if '__main__' == __name__:
main()