Is there a way to create a plan branch with the java spec api?
I don't see any examples here:
https://docs.atlassian.com/bamboo-specs-docs/6.4.0/specs-java.html
And I can't find anything here:
https://docs.atlassian.com/bamboo-specs/6.4.1/?_ga=2.194413293.1722865494.1522673805-876250858.1520866475
Hello @Tom Adamo,
Please, refer to "Manual branch management" under https://docs.atlassian.com/bamboo-specs-docs/6.4.0/specs-java.html#automatic-branch-management
Kind regards,
Rafael
Or you can refer "Automatic branch management" part the https://docs.atlassian.com/bamboo-specs-docs/6.4.0/specs-java.html#automatic-branch-management
Here is one example
<span>Plan</span> <span>plan</span> <span>=</span> <span>new</span> <span>Plan</span><span>(</span><span>project</span><span>,</span> <span>planName</span><span>,</span> <span>planKey</span><span>)</span> <span>.</span><span>planRepositories</span><span>(</span><span>new</span> <span>GitRepository</span><span>()</span> <span>.</span><span>name</span><span>(</span><span>"my-repo"</span><span>)</span> <span>.</span><span>url</span><span>(</span><span>"ssh://git@bitbucket.org:my-company/my-repo.git"</span><span>)</span> <span>.</span><span>branch</span><span>(</span><span>"master"</span><span>))</span> <span>.</span><span>planBranchManagement</span><span>(</span><span>new</span> <span>PlanBranchManagement</span><span>()</span> <span>.</span><span>createForVcsBranchMatching</span><span>(</span><span>"^JIRA-[0-9]+"</span><span>)</span> <span>.</span><span>triggerBuildsLikeParentPlan</span><span>());</span>
Feel free to ping me if you have other questions
Thanks.
I want to get them created, not configure the settings. This part (sort-of) answered my question: https://docs.atlassian.com/bamboo-specs-docs/6.4.0/specs-java.html#manual-branch-management
@Tom Adamo Not really. The above code registers the plan to a specific branch pattern "^JIRA-[0-9]+", when a new branch matching that pattern is created, a branch in Bamboo is created for it. That is how it work.
Unless you want to create your branch in Bamboo manually when your branch in SCM is created everytime, then this is not what you want
I already have a repo with existing branches. So, I don't want to just configure the branch management. I want to actually create a plan branch from a script.
Your example will configure the plan to wait until a repo branch (JIRA-1) is created, then it will create the corresponding plan branch. But, I already have the repo branch (JIRA-1) created and I don't want to have to go into the UI and create the plan branch manually.
This is creating separate plans for each branch, not plan branches, no?
It looks like you're new here. Sign in or register to get started.