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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Get name of repository branch from Source Code Checkout task

A Stage in a Bamboo Build Plan contains a Source Code Checkout task which checks out code from one of the Bitbucket repository branches that is linked to the Bamboo Build Plan. 

What specifically do I need to type or do in order to get the name of the repository branch that was checked out by the Source Code Checkout task? 

I have typed

`echo ${bamboo.planRepository.branchName}` 

in a subsequent Task inside the same Stage in the same Build Plan, but this just prints out the name of the default branchName for the entire Build Plan, which is different from the specific branch that was just checked out by the specific Source Code Checkout task about which I need information.

1 answer

`echo ${bamboo.planRepository.<position>.branchName}` 

<position> : position of the repository on plan's repository list (starting with 1 for default repo)

You did not answer the question..  The line of code you gave only supplies information about the Plan-level links to repositories.  By contrast, this question asks how to determine which of those repositories is checked out by a specific Source Code Checkout task in the specific Job.  My question assumes you do not already know the answer.  Your reply assumes that the script already knows the answer because if the script knows the value of the <position> variable, then the script practically knows the rest of the answer. 


Can you suggest an approach that utilizes Job-and-Task-level variables?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

943 views 4 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you