CircleCI Ideas

Auto-cancel builds for default branch

Originally asked here:

We would like auto-cancel to apply to the default branch, specifically because we have a deploy action associated with it. The deploy is slow and multiple builds are often racing with each other and we occasionally get an older build that finishes after a newer one, leaving us with older code deployed. (This is only for a staging environment deploy in our case though.)

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Feb 5 2018
  • Taking votes
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    November 07, 2018 23:52

    I agree with the original poster. Or, something else that might be nice in the meantime is the ability to auto-cancel jobs are in a Holding status after X of them are in that status. Meaning, We have a bunch of builds that are awaiting prod - since they're not auto-cancelling, i'll end up with a large number of jobs waiting to be promoted to production. My suggestion is to only hang onto the last X number (3, 5, 10) of them, and cancel the rest since it's very unlikely that we'll ever promote such an old build. 

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    May 12, 2019 14:19

    Same here. We use the default `master` branch as a development branch. We want to auto-cancel redundant builds.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    November 19, 2019 15:12

    We would also like this. We don't automatically deploy our default branch, but we do have a couple projects where we often merge several PR's in a short time. Their builds take more than an hour, so this results in either a bunch of wasteful builds, or having to manually cancel these builds.