Cancel previous builds on new push

I’d like to have drone cancel any previously queued or running builds when a new push happens on a branch, such that only the tip of the branch is built. Is there a way to make this happen?

3 Likes

There is an open issue you can subscribe to for updates https://github.com/drone/drone/issues/1980

+1 to implement this feature

1 Like

This link appears to be broken. Is this issue still open?

This feature is available. You can use the following command to update the repository settings to auto-cancel push and pull requests:

drone repo update <repo> \
  --auto-cancel-pushes \
  --auto-cancel-pull-requests

Drone will only cancel pending builds by default. If you want to cancel both pending and running builds, you need to update the repository settings with the following flag:

drone repo update <repo> \
  --auto-cancel-running
2 Likes