Chromium Code Reviews

Side by Side Diff: scripts/slave/bot_update.py

Issue 1382203002: bot_update (+recipe_module): treat patch download as infra failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: comment Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # TODO(hinoka): Use logging. 6 # TODO(hinoka): Use logging.
7 7
8 import cStringIO 8 import cStringIO
9 import codecs 9 import codecs
10 import collections 10 import collections
(...skipping 1562 matching lines...)
1573 print 'We failed gclient sync, lets delete the checkout and retry.' 1573 print 'We failed gclient sync, lets delete the checkout and retry.'
1574 ensure_no_checkout(dir_names, '*') 1574 ensure_no_checkout(dir_names, '*')
1575 gclient_output = ensure_checkout(**checkout_parameters) 1575 gclient_output = ensure_checkout(**checkout_parameters)
1576 except PatchFailed as e: 1576 except PatchFailed as e:
1577 if options.output_json: 1577 if options.output_json:
1578 # Tell recipes information such as root, got_revision, etc. 1578 # Tell recipes information such as root, got_revision, etc.
1579 emit_json(options.output_json, 1579 emit_json(options.output_json,
1580 did_run=True, 1580 did_run=True,
1581 root=first_sln, 1581 root=first_sln,
1582 log_lines=[('patch error', e.output),], 1582 log_lines=[('patch error', e.output),],
1583 patch_apply_return_code=e.code,
1583 patch_root=options.patch_root, 1584 patch_root=options.patch_root,
1584 patch_failure=True, 1585 patch_failure=True,
1585 step_text='%s PATCH FAILED' % step_text) 1586 step_text='%s PATCH FAILED' % step_text)
1586 else: 1587 else:
1587 # If we're not on recipes, tell annotator about our got_revisions. 1588 # If we're not on recipes, tell annotator about our got_revisions.
1588 emit_log_lines('patch error', e.output) 1589 emit_log_lines('patch error', e.output)
1589 print '@@@STEP_TEXT@%s PATCH FAILED@@@' % step_text 1590 print '@@@STEP_TEXT@%s PATCH FAILED@@@' % step_text
1590 raise 1591 raise
1591 1592
1592 # Revision is an svn revision, unless it's a git master. 1593 # Revision is an svn revision, unless it's a git master.
(...skipping 80 matching lines...)
1673 1674
1674 try: 1675 try:
1675 # Dun dun dun, the main part of bot_update. 1676 # Dun dun dun, the main part of bot_update.
1676 revisions, step_text = prepare(options, git_slns, active) 1677 revisions, step_text = prepare(options, git_slns, active)
1677 checkout(options, git_slns, specs, buildspec, master, svn_root, revisions, 1678 checkout(options, git_slns, specs, buildspec, master, svn_root, revisions,
1678 step_text) 1679 step_text)
1679 1680
1680 except Inactive: 1681 except Inactive:
1681 # Not active, should count as passing. 1682 # Not active, should count as passing.
1682 pass 1683 pass
1683 except PatchFailed: 1684 except PatchFailed as e:
1684 emit_flag(options.flag_file) 1685 emit_flag(options.flag_file)
1685 # Return a specific non-zero exit code for patch failure (because it is 1686 # Return a specific non-zero exit code for patch failure (because it is
1686 # a failure), but make it different than other failures to distinguish 1687 # a failure), but make it different than other failures to distinguish
1687 # between infra failures (independent from patch author), and patch 1688 # between infra failures (independent from patch author), and patch
1688 # failures (that patch author can fix). 1689 # failures (that patch author can fix). However, PatchFailure due to
1690 # download patch failure is still an infra problem.
1691 if e.code == 3:
1692 # Patch download problem.
1693 return 87
1694 # Genuine patch problem.
1689 return 88 1695 return 88
1690 except Exception: 1696 except Exception:
1691 # Unexpected failure. 1697 # Unexpected failure.
1692 emit_flag(options.flag_file) 1698 emit_flag(options.flag_file)
1693 raise 1699 raise
1694 else: 1700 else:
1695 emit_flag(options.flag_file) 1701 emit_flag(options.flag_file)
1696 1702
1697 1703
1698 if __name__ == '__main__': 1704 if __name__ == '__main__':
1699 sys.exit(main()) 1705 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/bot_update/__init__.py » ('j') | scripts/slave/recipe_modules/bot_update/api.py » ('J')

Powered by Google App Engine