Reputation: 55
i need to build a job in Jenkins, to get latest git commit message every time a commit is done and to store it in a variable.Can anyone suggest a plugin or a way to do this?
Upvotes: 0
Views: 10736
Reputation: 2707
Need to analyze a currentBuild.changeSets
. Full answer in another stackoverflow topic. Also, you can read a doc here
Upvotes: 1
Reputation: 371
Use command line and get the commit message that you want and create a file as key value and inject the variable:
Step by step:
Install git plugin, EnvInject Plugin.
Get the last git commit by the command git log -p -1
and parse from that what you need.
Create a file as key value for example LAST_COMMIT_ID=cab123gfbdak
Use the envInject as file (this load the key value file that you created to Jenkins as Jenkins variable).
Good luck.
Upvotes: 2