Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create Branch Plan on Branch Creation

Peter N May 26, 2019

I want to create Branch Plans as soon as a user creates a branch in Bitbucket. We've got polling enabled but the other devs are getting too impatient. I've already setup webhooks to trigger builds as soon as they commit code but creating feature branches still causes grief. I'm looking for a way to get Bitbucket to trigger the creation of the Branch plan.

I can see that I could manually call into the Bamboo API by 

curl -X PUT --user admin:admin http://localhost:8085/rest/api/latest/plan/ABC-UAT/branch/feature-abc-123?vcsBranch="feature/abc-123"

I thought about using a webhook within Bitbucket but I don't see anywhere where I can include variable names (ie branch name). We use GitFlow and we build Branch Plans off of feature and release branches.

1 answer

0 votes
Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 27, 2019

Hi @Peter N ,

You are making things more complicated than they need to be Bamboo offers this functionality for you.

While configuring the Build plan, if you go to the branches tab, you can select the option to create plan branches when a new branch is created in the repository.  This will also automatically trigger an initial build for that branch.

CreatePlanBranches.JPG

It is for that very reason that in most of our plans we switched to using "when a pull request is created" because we have a number of branches that get created to experiment with things and get thrown away.

I hope this helps you!

-James

Peter N May 27, 2019

Thanks James,

We already have that in place. We use the next one "When new branch in repository is created and matches expression" to only look at GitFlow specific branches like 'feature'

This depends on the Branch detection intervalFor our setup it's 300 sec / 5 min. I suppose I could reduce the poll time but I'm looking for a push solution.

Also, we've found the polling hasn't always been reliable either.

Jeyanthan I
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 28, 2019

Hi Peter,

Polling trigger is a resource intensive option; but it has to work. When you say that it isn't reliable, I assume you experience a delay in change detection and triggering a build.  Typically when we see a large delay here, it's related to a contention for the threads that run change detection and the same threads to run your Plans.

Our Support team can help you assist there. A detailed review on how build triggers delay when we use Polling is described in this page - Triggering builds.

Cheers,
Jey

Peter N June 4, 2019

Jey,

We get issues where Bamboo can't proxy through to Bitbucket. It doesn't happen all the time but it's unreliable. I'm constantly getting these errors in the error log.

(com.atlassian.bamboo.plugins.git.GitCommandException : command [/usr/bin/git ls-remote ssh://8a2c36d3-7bf9-4a84-ae2c-xxxxxxxxxxxx@127.0.0.1:55382/name/repo] failed with code 128. Working directory was [/opt/atlassian/bamboo/current/temp]., stderr: Authenticating remote session failed stdout: Warning: Permanently added '[127.0.0.1]:55382' (RSA) to the list of known hosts. BAMBOO-SSH-PROXY: [SSH proxy tried to connect to [git@bitbucket.org/18.205.93.1:22]: and failed due to the following error: [Authenticating remote session failed]: Session is being closed] fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.)

It doesn't hugely affect our day to day running. 

When a user commits, I have Bitbucket call an API endpoint on Bamboo to do a check for code changes. This will cause a build to happen straight away after a commit. I'd like that same feature for creating build plans.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events