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

BAMBOO get commits that triggered build

andreiverdes August 4, 2015

Hi!

Is there a way to get the git log with the commits that triggered the build from the command line inside the build agent?

I'm building an Android app with gradle and push it to Crashlytics alongside with a changelog.txt file. I would like to add those commits to a changelog.txt per build so I would know what that build is about.


Thanks!

PS: Sorry if I'm not offering enough details, it's my first question here laugh

2 answers

1 accepted

6 votes
Answer accepted
Alex Soto August 6, 2015

If you're submitting things via a script, you can use bamboo variables to get the build's revision and get the commit log and write it to a file.

Here's an example using git:

git log ${bamboo.planRepository.previousRevision}..${bamboo.planRepository.revision} --oneline > ./commits.txt

 

Other bamboo variables: https://confluence.atlassian.com/display/BAMBOO/Bamboo+variables

andreiverdes August 7, 2015

This seems to do the trick! Thanks!

shubham patni February 7, 2017

I tried following but this say "log: command not found"

gitlog=git log ${bamboo.planRepository.previousRevision}..${bamboo.planRepository.revision} 

What am I doing wrong here ? 

faheem.armanyous@cnb.com June 24, 2019

The variable $bamboo.planRepository.revision  only revers to the commit hash of the default repository in the plan. not the commit that actually triggered the plan in a multiple repository plan configuration.  in my scenario the actual variable for revision is 

$bamboo_planRepository_9_revision

is there a variable for the repo name or the exact commit that triggered the plan without having to figure out the repository position. ?

Thanks

BIF01 March 1, 2021

is there a variable for the repo name that triggered the plan ?

Same question.

0 votes
Jaime S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 5, 2015

Hi, Andrei.

 

I'm not sure if you can get this information from the agent within the instance, but this information is available under the 'Commits' tab in Bamboo itself in the build information, if that's helpful.

Kind regards,
Jaime Kirch da Silveira
Atlassian Cloud Support

BIF01 March 1, 2021

this information is available under the 'Commits' tab in Bamboo itself in the build information

Any REST API for that?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events