.buildkite/scripts/smart-retry/README.md
Smart retry handles automatic retries for tasks/tests in two different scenarios:
The basic idea is that when a Buildkite step fails, or is cancelled due to the spot instance being terminated, we need to retry the step, but skip all of the successful work we did in the previous test.
There are a lot of edge cases. You could have a scenario like:
All 4 attempts have to be thought of as a single, combined run to understand what the end result is. The end result that is relevant to the user is:
Here's the overall process that makes this work, ignoring spot preemptions for now:
task-status from the previous step, and have Gradle skip all tests/tasks that completed successfully across previous attempts.task-status file with the final status of all tests and tasks.task-status from the previous attempt, if there was one, so that each attempt has a cumulative view of all the previous attempts.Here's how the above process additionally handles spot preemptions:
task-status file as usual.PREEMPTED and also add a value for the preemption time. Upload the buildscan as normal.In the subsequent retry, any tests/tasks that didn't fully complete before the preemption (or never ran at all), will execute.
task-status report at the end of execution