I have a webhook that will trigger Jenkins build when there is a new or updated pull requests for the repos.
It will trigger the bitbucket notification to show the build status.
However, when the PR has multiple updates, it will trigger multiple builds that are tied to the PR. This is a problem as if any of the builds fails or never completes for a reason, the PR is stuck as there is a branch restriction set:
"Check the last commit for at least 1 successful build, no failed builds, and no in progress builds"
ie.

4 builds were successful after the 1st build got stuck in a never completed state. This prevented the PR from being merged

This PR has 6 builds that were unsuccessful, but the last one is successful. However, since it doesn't pass the PR requirements for merging:
"Check the last commit for at least 1 successful build, no failed builds, and no in progress builds"
It is not allowed to merge.
I am using the bitbucketStatusNotify function, passing in buildState, reposSlug, and commitID.
ie.
bitbucketStatusNotify(buildState: "SUCCESS", repoSlug: "my-repos", commitId: "xyzzy")
Is there a way to cancel previous build states and only have the latest one tied to the PR?
Thanks.