Skip to content

Add fail-fast flag to src batch

Erik Seliger requested to merge gabe/feature-fail-fast into main

Created by: gabtorre

This adds a new --fail-fast flag to the src batch commands. When enabled, any errors encountered while executing steps in a repository will stop the execution of the whole batch spec. The flag is off by default, so existing behavior is preserved.

  • A new CancelableContext type was added to support cancellation with errors. The batch commands now wrap the context with this to enable fail-fast behavior.
  • Updated contextCancelOnInterrupt to support cancellation with error causes.
  • Added error check in executeBatchSpec to surface fail-fast cancellation errors.
  • Errors now propagate up by calling the cancel context's Cause()
  • Minor code reorganizations around log file handling to return logs if -fail-fast and -keep-logs are used together.

Test plan

Updated tests.

Merge request reports

Loading