Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the "changes" (commit message) that triggered a Jenkins build?

Tags:

jenkins

I can go to

http://myjenkins:8080/job/Project/42/changes

and see the commit message that triggered a particular Jenkins build.

However, I want to grab this via REST API or something. I'm not having any luck in search. Is there an easy way to do this?

like image 762
Wayne Werner Avatar asked Aug 06 '14 21:08

Wayne Werner


1 Answers

Here's an example of how to get the comment, affected files and commit ID from a Jenkins build:

curl http://jenkins/job/JOB_NAME/BUILD_NUMBER/api/json?pretty=true&tree=changeSet[items[comment,affectedPaths,commitId]]

Here's an explanation of how the tree and depth parameters work.

like image 97
gareth_bowles Avatar answered Sep 17 '22 11:09

gareth_bowles