简体   繁体   中英

How to know who pushed the code to git in jenkins?

I got a error message in jenkins console output & I want to report-mail to that person who committed the code? But how do I find him in jenkins console output?

You can get the e-mail address of the commiter with the following command:

git show -s --format='%aw'

If you have installed git on your Jenkins (which I truly believe) you can simply execute this as bash / sh command or using Jenkins' echo if you want to display it. Using groovy you can even put the e-mail into a variable.

...
script
{
    commiter = sh(returnStdout: true, script: 'git show -s --format='%aw')
    echo "Person who commited: ${commiter}"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM