OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 """A continious builder for build repo which simulates recipes.""" | 4 """A continious builder for build repo which simulates recipes.""" |
5 | 5 |
6 DEPS = [ | 6 DEPS = [ |
7 'depot_tools/bot_update', | 7 'depot_tools/bot_update', |
8 'depot_tools/gclient', | 8 'depot_tools/gclient', |
9 'depot_tools/git', | 9 'depot_tools/git', |
10 'file', | 10 'file', |
(...skipping 13 matching lines...) Expand all Loading... |
24 return api.git(*a, **kw) | 24 return api.git(*a, **kw) |
25 return git | 25 return git |
26 | 26 |
27 | 27 |
28 def RunSteps(api): | 28 def RunSteps(api): |
29 api.gclient.set_config('depot_tools') | 29 api.gclient.set_config('depot_tools') |
30 api.bot_update.ensure_checkout(force=True, patch_root='depot_tools') | 30 api.bot_update.ensure_checkout(force=True, patch_root='depot_tools') |
31 # Make sure our checkout of depot_tools is used. | 31 # Make sure our checkout of depot_tools is used. |
32 env = {'PATH': api.path.pathsep.join([str(api.path['checkout']), '%(PATH)s'])} | 32 env = {'PATH': api.path.pathsep.join([str(api.path['checkout']), '%(PATH)s'])} |
33 | 33 |
34 | 34 git = run_git(api, api.path['checkout'], env) |
35 repo = api.path['slave_build'].join('test_repo') | 35 git('commit', '-a', '-m', 'whatever') |
36 repo_hooks = repo.join('.git', 'hooks') | 36 git('cl', 'issue', '1718153002') |
37 | 37 git('cl', 'try-results', '-p', '60001') |
38 # api.file.rmtree('remove repo', repo) | |
39 api.python.inline('remove repo workaround for http://crbug.com/589201', | |
40 """ | |
41 import shutil, sys, os | |
42 shutil.rmtree(sys.argv[1], ignore_errors=True) | |
43 """, args=[str(repo)]) | |
44 | |
45 api.git.checkout( | |
46 url='https://chromium.googlesource.com/playground/gerrit-cq/normal', | |
47 ref='master', | |
48 dir_path=repo) | |
49 | |
50 git = run_git(api, repo, env) | |
51 git('cl', '--version', name='version') | |
52 git('config', '--local', | |
53 'user.email', '182615506979@project.gserviceaccount.com') | |
54 git('config', '--local', 'user.name', 'chrome-bot on gce') | |
55 git('branch', '-D', 'feature', | |
56 ok_ret='any', name='delete old feature branch') | |
57 api.file.remove('remove hooks', repo_hooks.join('commit-msg'), ok_ret='any') | |
58 git('new-branch', 'feature') | |
59 api.file.write('hack hack', repo.join('patchset.data'), | |
60 '%s-%s-%s' % (api.properties['mastername'], | |
61 api.properties['buildername'], | |
62 api.properties['buildnumber'])) | |
63 git('add', 'patchset.data') | |
64 git('commit', '-m', 'Normal message.') | |
65 git('cl', 'upload', '--squash', '-f', name='git cl upload') | |
66 try: | |
67 for a in api.file.listdir('check hooks', repo.join('.git', 'hooks')): | |
68 if a == 'commit-msg': | |
69 api.step.active_result.presentation.status = api.step.FAILURE | |
70 raise api.step.StepFailure('commit-msg hook got installed') | |
71 finally: | |
72 # Gerrit equivalent is Abandon. | |
73 git('cl', 'set-close', name='git cl set-close') | |
74 | |
75 | 38 |
76 def GenTests(api): | 39 def GenTests(api): |
77 yield ( | 40 yield ( |
78 api.test('normal') + | 41 api.test('normal') + |
79 api.properties.generic( | 42 api.properties.generic( |
80 mastername='chromium.infra', | 43 mastername='chromium.infra', |
81 buildername='depot_tools Gerrit Git Cl', | 44 buildername='depot_tools Gerrit Git Cl', |
82 revision='deadbeaf', | 45 revision='deadbeaf', |
83 ) | 46 ) |
84 ) | 47 ) |
OLD | NEW |