How do you refer to a Branch's artifact if you do not know the branch "number" beforehand?

I'm trying to setup a build that pulls artifacts from several other parent builds and am having some trouble figuring out how to correlate the branch "id" for a specific plan (the integer appended to the plan key) with the branch name. The variable $bamboo.repository.branch.name seems to only contain the branch name from the version control repo.

For example, I have two branches, master and release. master's "id" is 0 and the Plan name looks like MYPLAN0 while release's id is 1 and the plan name looks like MYPLAN1.

Is there a way to easily refer to branches in Bamboo by the version control branch name? Is there some variable that makes it easy to generate a URL to the corresponding branch of another Plan? Dependencies are capable of being linked based on plan name, but I can find no way to actually pull in artifacts.

Ideally, it'd be as simple as MYPLAN/branch/master or MYPLAN/branch/release and then all routes normally following MYPLAN could instead follow the branch name.

3 answers

1 accepted

Oh, and there is a ticket in the Bamboo issues tracker that you might be interested in: https://jira.atlassian.com/browse/BAM-12154 - basically it is the same feature request you would like to have, isn't it? Might be a good idea to add yourself as a watcher/voter to that issue.

Hi,

I'd try a REST api to obtain a proper branch-plan. AFAIK there is REST resource in Bamboo that for a given master-plan key and for a given branch name will return you in the response the relevant plan-branch key. Probably you could use that to craft the necessary urls by yourself... or maybe not.

The REST resources I'm thinking of are:

* http://docs.atlassian.com/bamboo/REST/4.2-SNAPSHOT/#idp85888 plan/{projectKey}-{buildKey}/branch/{branchName}

* http://docs.atlassian.com/bamboo/REST/4.2-SNAPSHOT/#idp113040 /plan/{projectKey}-{buildKey}/vcsBranches

regards,

More or less that ticket would do what I'm asking for, yes. Will add myself as a watcher/voter.

Guess I'll try the API too.

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

4,341 views 20 13
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you