def main(target_dir, gitcookies): 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 uploading SKP update:\n\n%s' % e.output) sys.exit(1) # Skip GCE Auth in depot_tools/gerrit_utils.py. Use gitcookies instead. os.environ['SKIP_GCE_AUTH_FOR_GIT'] = 'True' os.environ['GIT_COOKIES_PATH'] = gitcookies os.environ['USE_CIPD_GCE_AUTH'] = 'True' # Upload the new version, land the update CL as the update-skps user. config_dict = { 'user.name': SKIA_COMMITTER_NAME, 'user.email': SKIA_COMMITTER_EMAIL, 'http.cookiefile': gitcookies, } with git_utils.GitLocalConfig(config_dict): 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') ])
def main(): parser = argparse.ArgumentParser() parser.add_argument("--gitcookies") parser.add_argument("--bookmaker_binary") parser.add_argument("--fiddlecli_output") args = parser.parse_args() with git_utils.NewGitCheckout(repository=SKIA_REPO): config_dict = { 'user.name': SKIA_COMMITTER_NAME, 'user.email': SKIA_COMMITTER_EMAIL, 'http.cookiefile': args.gitcookies, } # Skip GCE Auth in depot_tools/gerrit_utils.py. Use gitcookies instead. os.environ['SKIP_GCE_AUTH_FOR_GIT'] = 'True' os.environ['GIT_COOKIES_PATH'] = args.gitcookies with git_utils.GitLocalConfig(config_dict): with git_utils.GitBranch(branch_name='update_md_files', commit_msg=COMMIT_MSG, commit_queue=True, 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.'
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 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 = [] with open(args.tasks_json) as tasks_json: 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: if args.repo_name == 'skia': 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, 'http.cookiefile': args.gitcookies, } 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'])