Revert "[engine] Don't catch cancellations in except"

This reverts commit b2ab5f39fa6f3b4d44e069e3da9009e3050f89eb.

Reason for revert: breaks build roller

Original change's description:
> [engine] Don't catch cancellations in except
>
> Steps might be cancelled because they're in a self.m.time.timeout()
> context, or because the overall build is being cancelled. The first case
> is much like a failed step, and the caller likely wants to handle it as
> a failed step. The latter case is not like a failed step, but more like
> a KeyboardInterrupt. KeyboardInterrupt doesn't inherit from Exception,
> so it's not caught by 'except Exception:' blocks. It inherits from
> BaseException. This ensures that when a user hits Ctrl-C, very few
> exception handlers are invoked to process the KeyboardInterrupt, and the
> process simply exits.
>
> Add a new exception type, CancelledBuild, that inherits directly from
> BaseException. Add handling of this exception type in a couple places,
> but mostly let it propagate untouched. This ensures that a cancelled
> build won't be processed by an exception handler that doesn't understand
> that the build has been cancelled.
>
> Example failure: http://ci.chromium.org/b/8699098381363633537/infra
>
> Bug: b/456536120
> Change-Id: Iab371e7ada59b035efbddfe781a9e44017f7f463
> Recipe-Manual-Change: build
> Recipe-Manual-Change: chromiumos
> Recipe-Manual-Change: fuchsia
> Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/7120818
> Commit-Queue: Rob Mohr <mohrr@google.com>
> Reviewed-by: Robbie Iannucci <iannucci@google.com>

Bug: b/456536120
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Idd6a5ba72e625b9c99ad56686f2402a1bdd2ce4c
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/7124691
Reviewed-by: Robbie Iannucci <iannucci@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Robbie Iannucci <iannucci@google.com>
Auto-Submit: Rob Mohr <mohrr@google.com>
15 files changed
tree: bc9861adb5d0567dfd8c6e08a600a5ae3c6d2951
  1. doc/
  2. infra/
  3. misc/
  4. recipe_engine/
  5. recipe_modules/
  6. recipe_proto/
  7. recipes/
  8. unittests/
  9. .editorconfig
  10. .gitattributes
  11. .gitignore
  12. .pycharm.vpython3
  13. .style.yapf
  14. .vpython3
  15. .vscode.vpython3
  16. AUTHORS
  17. codereview.settings
  18. CONTRIBUTORS
  19. GEMINI.md
  20. LICENSE
  21. OWNERS
  22. PRESUBMIT.py
  23. pyproject.toml
  24. README.md
  25. README.recipes.md
  26. recipe.warnings
  27. recipes.py
  28. SECURITY_TEAM_OWNERS
README.md

Recipes

Recipes are a domain-specific language (embedded in Python) for specifying sequences of subprocess calls in a cross-platform and testable way.

They allow writing build flows which integrate with the rest of LUCI.

Documentation for the recipe engine (including this file!). Take a look at the user guide for some hints on how to get started. See the implementation details doc for more detailed implementation information about the recipe engine.

Contributing

  • Sign the Google CLA.
  • Make sure your user.email and user.name are configured in git config.

Run the following to setup the code review tool and create your first review:

# Get `depot_tools` in $PATH if you don't have it
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $HOME/src/depot_tools
export PATH="$PATH:$HOME/src/depot_tools"

# Check out the recipe engine repo
git clone https://chromium.googlesource.com/infra/luci/recipes-py $HOME/src/recipes-py

# make your change
cd $HOME/src/recipes-py
git new-branch cool_feature
# hack hack
git commit -a -m "This is awesome"

# This will ask for your Google Account credentials.
git cl upload -s -r joe@example.com
# Wait for approval over email.
# Click "Submit to CQ" button or ask reviewer to do it for you.
# Wait for the change to be tested and landed automatically.

Use git cl help and git cl help <cmd> for more details.