Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Determine which Repo triggered a build


I have a build plan that has multiple Git Repos.  I also have a polling trigger setup that checks all of them.  if any of them have new commits, the build triggers.  this works great.

what i need,  is a way to determine from environment and/or bamboo variables, which repo triggered the build. currently bamboo gives me every repo's info in the form of "bamboo_planRepository_#_key=value"

This information is available on the build summary page in the commit section as seen below


2 answers

Hi @Ari_Mahpour

You could get this information by comparing revisions of each source repository. You will need to check the following Bamboo variables:

  • bamboo_planRepository_#_revision
  • bamboo_planRepository_#_previousRevision

Considering this could be a pain for you I spent some time to build a bash shell script to do this. It is just an example of how this could be done. Please be careful with a loop like this since it can hold your build in running state forever.

echo ===========================================================
while true
   if [ -z "${!repoRevision}" ]; then
      if [ ${!repoRevision} != ${!prevRepoRevision} ]
        echo 'The repository '${!repoName}' ('${!repoBranch}') was updated'
        echo 'Revision: '${!repoRevision}
        echo 'Previous revision: '${!prevRepoRevision}
      i=$(( $i + 1 ))
echo ===========================================================

⚠️It will not work for Windows. In case you run windows agents you will need to design a similar script for using a windows shell of your preference.

The output should be something like:

19-Jun-2019 18:24:24 ===========================================================
19-Jun-2019 18:24:24 The repository javahello (master) was updated
19-Jun-2019 18:24:24 Revision: c3df16947412c1ca69f9e58998d8dd645221f8f5
19-Jun-2019 18:24:24 Previous revision: 55db9a76e132b853c2309aa2cf6c1963e53f06f4
19-Jun-2019 18:24:24 ===========================================================

 I hope that helps you to achieve what you want.

This is awesome.  Never noticed that the previous and current rev vars could be the same.  Thanks!

You are welcome @josh bouganim
I'm glad to be helpful.
Have a good one!

0 votes

thank you for the solution but the bamboo team should really make these trigger variables available.

Any chance?

Suggest an answer

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

Bamboo Data Center - Early Access Program

G’day Bamboo customers, The wait is almost over! We are in the final stages of work on the first release of Bamboo Data Center, our self-managed enterprise offering of Bamboo. This Data Center offe...

953 views 0 16
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