I need to include information about the user that executed Jenkins job inside JAR Manifest among other things
What variable I need to read it off?
I need to include information about the user that executed Jenkins job inside JAR
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can query Jenkins via its api. See
http://[jenkins-host]/apiorhttps://wiki.jenkins-ci.org/display/JENKINS/Remote+access+APIfor help. The information you need is contained there.To get a feel for it, enter
http://[jenkins-host]/api/xml?depth=2and search for “started by” on the page (make sure set the depth to at least 2).You will need to get that information via a script in your build and then parse it based on the build id.
There already exists Python wrapper for that sort of thing: http://packages.python.org/python-jenkins/
Here’s also an XPath expression that will parse out the “started by…” info by BUILD_ID:
http://[jenkins-host]/api/xml?depth=2&xpath=//build/id[text()='BUILD_ID']/../action/cause/shortDescription/text()(Of course, you need to specify the actual BUILD_ID string).