slack - jenkins: Find the triggering user of a job for the build-script -


we're using jenkins , slack. i'm trying setup slack notification build, , notifucation include more information - resort custom message.

i found $git_branch , $build_number , $job_name , other interesting guys, , put them use.

but lack way mention cause triggered build - polling on scm, or user pressed build now. later of extreme importance - in jobs deploy target environment...

can recommend me way detect triggering cause , add custom message?

btw - i'd want information not slack notification. i'd add information signature file add every artifact (as other things)

use build user vars plugin:

https://wiki.jenkins-ci.org/display/jenkins/build+user+vars+plugin

you have variables:

  • build_user – full name of user started build,
  • build_user_first_name – first name of user started build,
  • build_user_last_name – last name of user started build,
  • build_user_id – id of user started build.

*if want other job can use below url:

http://[jenkins-server]/job/[job-name]/[build-number]/api/xml?xpath=(//action/cause/shortdescription)

it directly return line:

< shortdescription>started user foobar< /shortdescription>


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -