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!
Hi Bruce,
Unfortunately commit messages aren't exposed as variables, here is the bug report for this https://jira.atlassian.com/browse/BAM-11958
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
bamboo.planRepository.<position>.revision
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.
Thanks!
Turner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.