Avoid duplicate builds by commit alone (vs. commit + branch)


We’d love to be able to reduce some of our build clutter during peak shipping hours. We don’t enable much that’s different for our primary branch vs. feature branches, so one thing we’d love to be able to do is to skip building the same commit on our primary branch if it’s the same commit has already had a successful build on the feature branch. This would happen if the engineer rebased their commit and no merges had been made since their rebase.

Currently, you can tell Buildkite not to rebuild the same commit if it’s already been done on a feature branch, but that skipping logic doesn’t apply across branches in a rebasing workflow.

We have some other services that have usage-based pricing, so avoiding these runs would save us some non-trivial expense in addition to reducing capacity use when most of our engineers are at work.

Hey Geoff! That’s an interesting suggestion, I’ll pass it onto the team!

In the mean time, if you’re really keen to avoid the costly runs, a work around could be to run a script on your primary branch to hit the Builds API for your feature branch, and compare the two commit SHAs. Then you could either exit 0 if the build has already successfully run on a feature branch, or continue with a pipeline upload and run the primary pipeline as normal.

1 Like