Search code examples
jenkinsbitbucket

Jenkins remove inprogress build on BitBucket if it's not built


To save resources on our Jenkins server we abort intermediate builds if a newer commit is available.

Now BitBucket stays on "In Progress" forever for this intermediate commit. If this intermediate commit is the head on another branch we can't merge.

How can you remove the inprogress notification? I don't want to set the intermediate build to successful if it isn't built. I also don't want to set it to failure because that's also not true, I want to abort the build and remove the inprogress state.

According to https://developer.atlassian.com/server/bitbucket/how-tos/updating-build-status-for-commits/ there's only 3 states. But I want to remove the specified key completely, as if the build never happened.


Solution

  • The only solution I can think of is to ignore the INPROGRESS state and simply notify Bitbucket with either SUCCESS or FAILURE at the end of builds. Since you have no way of determining upfront which build would have another commit pushed before the pipeline is done executing.