Automatically cancel on going builds if a new one is pending

We are running an import that triggers a build if new posts are created. Problem we are having is we are running 4 different imports so the builds tend to stack up. Unfortunately this creates two problems; unnecessary builds and a delay in publish time for our time sensitive material. A feature that would enable us to automatically cancel on going builds if a new one is pending would be greatly appreciated.

4 Likes

hey zamson, thanks for explaining that. This sounds like a feature request, so I am moving your post to the features section of this forum.

1 Like

I would also like this feature. I have an app that publishes each file as a separate git commit (a separate issue I’ve raised elsewhere), and the Netlify behavior means it will likely build and publish the first commit, skip a few, build the next, and so on. It may or may not actually build and publish the final commit.

The current behavior is unpredictable, and I would prefer it if new commits caused all previous builds to be cancelled. Not only would this make things more predictable, it would also reduce the load on Netlify servers by reducing the number of unnecessary builds

Hi, @WheresAlice. Thank you for sharing your input. However, I also want to point out this is a thread with no activity in 3+ years so it may help to consider workarounds.

The most common workaround we have for this scenario is this:

  • there is a setting which the Netlify support team can enable that prevents new commits from triggering builds
  • however, the repo remains linked to the site and new builds can still be triggered using webhook URLs
  • you then configure an automation (like a GitHub Action) that calls the webhook only when you determine that it is time to do so

That workflow above allows you to still use a build & deploy workflow with a Git repo but you will be in complete control of when new builds are triggered. They will only trigger when you call the webhook (or click a “retry deploy” button in the UI).

If you like, we can also first enable this feature on a testing site so you can see if it will work for this use-case or not. This will allow you to test on some non-production site before making the same change there.

If you want to test this, please send us the site id or site subdomain for the site you want to try this with. Note, you can link the same Git repo to more than one site, so you can make a testing site that way if you want to (linking the existing repo to a newly created site). The “build only for webhooks” site setting for one site will not affect the other.