Plan Branches Not Always Created When Relative Branch Is Created In BitBucket
Asked by Nikolaos Rafail Papadakis:

Hello,

We have multiple Bamboo build plans with the same configuration both in Bamboo and in their relative BitBucket's repo, but we have observed that for some of them the creation for their plan branches is not happening for all of them when the relative branch is created in their BitBucket's repo.

We use the same regex for all of them in order to separate which branches we want to be created (only the ones starting with "release"), but as it seems it works only for some of them, not for all.

The workaround is to manually create the branch plan from the "Branch" menu, but it should be created automatically and not have to do this manually each time. It seems a buggy case for me, since configuration and branching regex are the same for all the plans.

Any ideas about why this keeps happening and what may be the root cause of this case?


Answers:
author: Nikolaos Rafail Papadakis
body: Hello,

Since Friday has arrived, I am here to share the results for this case till now.

After applying the aforementioned changes, plans that have run this week seem to be working as expected regarding auto builds triggered and branch plans auto creation. Though, we'll continue to monitor the case, since we have a lot more plans to check.

So, to sum up, the main problem here (apart from our wrong regex in some cases) was that :

**BitBucket repository's project key was declared ++with lower case++ characters in relative ++Bamboo Specs plans++ , while it should be ++with upper case++.**

Additionally, after this was fixed, the issue disappeared for the new branches created after the fix. ++But for branches already existing in BitBucket before fix was applied++, there are needed the following two manual actions in order for the auto builds to start being triggered as expected :

1. **Manually ++create and enable++ the desired plan branch in Bamboo** (Plan Configuration -\> Branches -\> Create plan branch \[on the right of this page\]).
2. **Manually run a first build for this branch plan** , since **++a minimum of one build is required++** for the auto build trigger process to work successfully.

These are the findings/conclusions I had to share. Hope this helps anyone else facing the same issue with their plans.

Kind Regards,

Nikos

comments: author: Daniel Santos
body: Hi [@Nikolaos Rafail Papadakis](/t5/user/viewprofilepage/user-id/3070613)  

Thank you very much for coming here to share your findings.

It personally means a lot to me when I see someone caring about unknown people. That is what you are doing here taking part of your time to share what you got (even facing multiple issues with our spam queue).  

Thank you very much, Nikolaos!


author: Daniel Santos
body: Hello [@Nikolaos Rafail Papadakis](/t5/user/viewprofilepage/user-id/3070613)

I would love to be able to reproduce this one and open a bug if necessary.  
I have a couple of questions to allow me moving forward:

* What is the affected Bamboo version?
* Can you give me the exact regex used?
* For which names the feature works?
* For which names it doesn't work?
* Are you recreating branches that were deleted in the past?

I'll wait for your comments.

comments: author: Nikolaos Rafail Papadakis
body: Hello [@Daniel Santos](/t5/user/viewprofilepage/user-id/502125)

Affected Bamboo version : **6.1.1**

Regex used : **\^release.\***

Regarding the names that it works, it's not the case. It happens for branch names starting with "release" (as expected), but not for all plans. That's the problem here. The same regex triggers the branch creation for most of the plans, but not for all.

Regarding the recreation of branches, I've observed this case that it needs to redeclare the branch plan in Bamboo. For the aforementioned case, this should not be a problem, since we recently started a new branch naming convention for release branches, so they surely have not been created earlier in the past.

Please, let me know if you need more info, in case I could provide it. We will keep monitoring this and let you know when this happens again. But the case remains as described above.

If you have any idea/suggestion to check as a probable root cause, also let me know to investigate.

PS : This is what we have observed till now to be the case with "release" branch plans creation. Maybe there is similar problems with other regex, that we haven't observed yet.

KR,

Nick


author: Nikolaos Rafail Papadakis
body: I just observed that the problem doesn't exist only for regex "**\^release.\*** ". It also happened for another regex (**\^((?!release).)** ), where we want branches to be created if they ++do not++ start with "release".

As it seems this specific plan except for the problem with auto branch creation, it also faces the problem described in the following issue:

<https://community.atlassian.com/t5/Bamboo-questions/Plan-Branches-Build-Not-Always-Triggered-On-Relative-BitBucket-s/qaq-p/1199754#M25652>

So, probably something goes completely wrong with this plan (and some others who have similar trigger issues).

I will provide the requested info to the ticket opened from aforementioned issue which may be useful for your investigation.


author: Daniel Santos
body: Hi [@Nikolaos Rafail Papadakis](/t5/user/viewprofilepage/user-id/3070613)

I see there were some findings on the ticket <https://community.atlassian.com/t5/Bamboo-questions/Plan-Branches-Build-Not-Always-Triggered-On-Relative-BitBucket-s/qaq-p/1199754#M25652>.

Is this problem still happening?  
Can you try?

* **\^release.\*$** This one should work without the line ending probably, I'm adding the $ just for safety.
* **\^((?!release).)\*$**This one is a negative sentence so it should try to match the full line. Without the star \* it should not work properly. I'm also adding the $ for completion.


author: Nikolaos Rafail Papadakis
body: Hello Daniel,

There were two problems regarding this case.

The first one is that the negative regex was wrong and should be like the way you suggested. To be accurate. we tried "**\^(?!release).\*$**" and it also worked!

The second one was that **BitBucket repository's project key was declared with lower case characters in relative ++bamboo specs plans++, while it should be with upper case** in order to work as expected, and this was what we discussed in the ticket opened for the other issue you mentioned.

After these two changes were made, the triggers of the relative problematic plans started to work successfully this time.

I asked in the ticket to keep the case open until the end of this week in order to monitor and observe if everything works as expected after applying above two changes in bamboo specs plans. So, I will update both threads on Friday depending on the results till then.

Kind Regards,

Nick


author: Daniel Santos
body: Hey [@Nikolaos Rafail Papadakis](/t5/user/viewprofilepage/user-id/3070613)

Thank you very much for sharing your findings here. This will help other users to understand what was causing the issue. It all makes sense now.

I'll wait for your latest updates then. =\]