<p>There are some issues with the way you have implemented your CI workflows:</p>
<ul>
<li>It sounds like CodeFresh is attempting to do a build on the branch that is being merged and deleted.  Instead, you should be building on your integration branch (e.g., Develop, master).</li>
<li>If you choose to adopt a Pull Request workflow, you'll still have this issue if the code is merged and the source branch is deleted before the branch build completes.</li>
</ul>
<p>Consider implementing a workflow where you only build a branch if there is a Pull Request and the branch is updated.  Otherwise, stick to compiling just the mainline integration branch.  This will ultimately speed up your CI process as well.</p>

CC BY-SA 4.0
2021-07-09T21:36:09.890Z
2021-07-09T21:36:09.890Z
Wesley Rolnick
<p>I configured Bitbucket webhook to trigger on Repository push.
After each merge (which also deletes the source branch) it triggers build, which fails in Codefresh because of deleted branch.</p>
<p>Does anyone have the same experience?
How do you deal with it?</p>

CC BY-SA 4.0
2021-07-06T08:37:15.680Z
We usually use 'Pull Request' based bitbucket triggers to our build server, which helps avoid these issues and allows us more control of the CI system.
Noam Helmer
CC BY-SA 4.0
2021-07-07T21:06:27.587Z
Even with  'Pull Request' based bitbucket triggers we get failed builds because of deleted branches.
isobretatel
CC BY-SA 4.0
2021-07-09T14:52:33.483Z
When you define 'Pull Request' based bitbucket trigger you can control when it will be triggered - you can set it to trigger when a pull request is opened or code was updated, then it wont trigger when a branch was deleted.
Noam Helmer
<bitbucket><builds><codefresh>
Bitbucket triggers builds on deleted branches
isobretatel
# Bitbucket triggers builds on deleted branches

(Asked by: username_0 on 2021-07-02)

I configured Bitbucket webhook to trigger on Repository push.
After each merge (which also deletes the source branch) it triggers build, which fails in Codefresh because of deleted branch.

Does anyone have the same experience?
How do you deal with it?

**Tags:** bitbucket, builds, codefresh

> **Comments:**
> **username_1**: We usually use 'Pull Request' based bitbucket triggers to our build server, which helps avoid these issues and allows us more control of the CI system.  
> **username_0**: Even with  'Pull Request' based bitbucket triggers we get failed builds because of deleted branches.  
> **username_1**: When you define 'Pull Request' based bitbucket trigger you can control when it will be triggered - you can set it to trigger when a pull request is opened or code was updated, then it wont trigger when a branch was deleted.  

---

## 1 answers

### Answer by username_2 on 2021-07-09. Score: 1

There are some issues with the way you have implemented your CI workflows:

* It sounds like CodeFresh is attempting to do a build on the branch that is being merged and deleted. Instead, you should be building on your integration branch (e.g., Develop, master).
* If you choose to adopt a Pull Request workflow, you'll still have this issue if the code is merged and the source branch is deleted before the branch build completes.

Consider implementing a workflow where you only build a branch if there is a Pull Request and the branch is updated. Otherwise, stick to compiling just the mainline integration branch. This will ultimately speed up your CI process as well.


---

