| OLD | NEW |
| (Empty) |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 DEPS = [ | |
| 6 'depot_tools/bot_update', | |
| 7 'depot_tools/gclient', | |
| 8 'depot_tools/git', | |
| 9 'depot_tools/presubmit', | |
| 10 'recipe_engine/json', | |
| 11 'recipe_engine/path', | |
| 12 'recipe_engine/properties', | |
| 13 'recipe_engine/python', | |
| 14 'depot_tools/tryserver', | |
| 15 ] | |
| 16 | |
| 17 | |
| 18 def _run_presubmit(api, patch_root, bot_update_step): | |
| 19 upstream = bot_update_step.json.output['properties'].get( | |
| 20 api.gclient.c.got_revision_mapping[ | |
| 21 'infra/go/src/github.com/luci/luci-go']) | |
| 22 # The presubmit must be run with proper Go environment. | |
| 23 # infra/go/env.py takes care of this. | |
| 24 presubmit_cmd = [ | |
| 25 'python', # env.py will replace with this its sys.executable. | |
| 26 api.presubmit.presubmit_support_path, | |
| 27 '--root', api.path['slave_build'].join(patch_root), | |
| 28 '--commit', | |
| 29 '--verbose', '--verbose', | |
| 30 '--issue', api.properties['issue'], | |
| 31 '--patchset', api.properties['patchset'], | |
| 32 '--skip_canned', 'CheckRietveldTryJobExecution', | |
| 33 '--skip_canned', 'CheckTreeIsOpen', | |
| 34 '--skip_canned', 'CheckBuildbotPendingBuilds', | |
| 35 '--rietveld_url', api.properties['rietveld'], | |
| 36 '--rietveld_fetch', | |
| 37 '--upstream', upstream, | |
| 38 '--rietveld_email', '' | |
| 39 ] | |
| 40 api.python('presubmit', api.path['checkout'].join('go', 'env.py'), | |
| 41 presubmit_cmd, env={'PRESUBMIT_BUILDER': '1'}) | |
| 42 | |
| 43 | |
| 44 def _commit_change(api, patch_root): | |
| 45 api.git('-c', 'user.email=commit-bot@chromium.org', | |
| 46 '-c', 'user.name=The Commit Bot', | |
| 47 'commit', '-a', '-m', 'Committed patch', | |
| 48 name='commit git patch', | |
| 49 cwd=api.path['slave_build'].join(patch_root)) | |
| 50 | |
| 51 | |
| 52 def RunSteps(api): | |
| 53 api.gclient.set_config('luci_go') | |
| 54 # patch_root must match the luci-go repo, not infra checkout. | |
| 55 for path in api.gclient.c.got_revision_mapping: | |
| 56 if 'luci-go' in path: | |
| 57 patch_root = path | |
| 58 break | |
| 59 bot_update_step = api.bot_update.ensure_checkout(force=True, | |
| 60 patch_root=patch_root) | |
| 61 | |
| 62 is_presubmit = 'presubmit' in api.properties.get('buildername', '').lower() | |
| 63 if is_presubmit: | |
| 64 _commit_change(api, patch_root) | |
| 65 api.gclient.runhooks() | |
| 66 | |
| 67 # This downloads the third parties, so that the next step doesn't have junk | |
| 68 # output in it. | |
| 69 api.python( | |
| 70 'go third parties', | |
| 71 api.path['checkout'].join('go', 'env.py'), | |
| 72 ['go', 'version']) | |
| 73 | |
| 74 if is_presubmit: | |
| 75 with api.tryserver.set_failure_hash(): | |
| 76 _run_presubmit(api, patch_root, bot_update_step) | |
| 77 else: | |
| 78 api.python( | |
| 79 'go build', | |
| 80 api.path['checkout'].join('go', 'env.py'), | |
| 81 ['go', 'build', 'github.com/luci/luci-go/...']) | |
| 82 | |
| 83 api.python( | |
| 84 'go test', | |
| 85 api.path['checkout'].join('go', 'env.py'), | |
| 86 ['go', 'test', 'github.com/luci/luci-go/...']) | |
| 87 | |
| 88 | |
| 89 def GenTests(api): | |
| 90 yield ( | |
| 91 api.test('luci_go') + | |
| 92 api.properties.git_scheduled( | |
| 93 path_config='kitchen', | |
| 94 buildername='luci-go-linux64', | |
| 95 buildnumber=123, | |
| 96 mastername='chromium.infra', | |
| 97 repository='https://chromium.googlesource.com/external/github.com/luci/l
uci-go', | |
| 98 ) | |
| 99 ) | |
| 100 yield ( | |
| 101 api.test('presubmit_try_job') + | |
| 102 api.properties.tryserver( | |
| 103 path_config='kitchen', | |
| 104 mastername='tryserver.infra', | |
| 105 buildername='Luci-go Presubmit', | |
| 106 ) + api.step_data('presubmit', api.json.output([[]])) | |
| 107 ) | |
| OLD | NEW |