As for running a build for each changelist, that is a feature request that hasn't yet been acted upon (first answered in This Question).
The specific changelist information is in the metadata for the job. I'm not sure you can get to it during the build phase, but you can definitely see it afterwards. The Summary of Changes
section shows just the changelists since the last build.
In the builds
directory for each job, there is a changelog.xml
file that contains entries for each individual "changelog entry", which in the case of Perforce is a changelist. The changenumber
element of each entry
indicates the changelist number from perforce.
Finally, if you want to scrape the information for an automated process external to the Jenkins server, you can retrieve XML data on the last build by retrieving:
http://{sereveraddress}/job/{jobname}/lastSuccessfulBuild/api/xml
Which will return an XML structure containing the changeSet
list of item
s which each have the changeNumber
in them (along with the msg
and each affectedPath
). This data is also available in json.