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

Daniel Nugent November 2, 2012

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

1 vote
Answer accepted
PiotrA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 2, 2012

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.

0 votes
Daniel Nugent November 2, 2012

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.

0 votes
PiotrA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 2, 2012

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,

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events