We're using Jenkins and Slack. I'm trying to setup a slack notification about a build, and I would like the notifucation to include more information - so I resort to the custom message.
I found about $GIT_BRANCH
and $BUILD_NUMBER
and $JOB_NAME
and other interesting guys, and put them to use.
But I lack a way to mention the cause that triggered the build - be it a polling on the scm, or a user that pressed build now. The later is of extreme importance - especially in jobs that deploy to a target environment...
Can anybody recommend me a way to detect the triggering cause and add it to the custom message?
BTW - I'd want this information not only for slack notification. I'd like to add this information to a signature file that we add to every artifact (as well as other things)
Use the Build User Vars Plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Build+User+Vars+Plugin
You will have the variables:
*If you want to get it from other job you can use the below URL:
It will directly return the line:
< shortDescription>Started by user foobar< /shortDescription>