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

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

How can I get the comments from a GIT commit from my Bamboo job

This is the scenario I would like to use. Our developer enters a control number(example AB123) in the commit message when he does a commit/push to Stash GIT from SourcerTree. Bamboo then would run a plan that executes a job that compiles the code and places the resulting exe/dll into the artifacts. I would then have a job that will run a script that builds a path including a folder named after the control number AB123 mentioned above. I would then copy the resulting artifact(exe or dll) to that \\path\folder. My question is: how do I access the value from the commit message from my Bamboo task/job?  I've read the variable section of the Bamboo documentation and I've looked into other topics that I thought might work but I haven't been able to piece it together. I'm sure the GIT commit message can be read from Bamboo, right? Is there a better way to get a custom value from GIT over to Bamboo? I'm brand new to both of these products. Thanks!     

1 answer

1 accepted

1 vote
Answer accepted

Hi Bruce,

Unfortunately commit messages aren't exposed as variables, here is the bug report for this


For the time being the best workaround (outside of writing your own inject variable plugin) is to run a git command to grab that data from within the script. You'll want something like 

git log -1 --format=%s%n%b <commit hash>

where the commit hash can pulled via the variable 



The only caveat here is that you may need to upload your keys used to connect to Git to the remote agent servers in order to properly run the git commands agains the repository.





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...

673 views 1 6
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