I need to pass the username of the requestor of a build down to the script that is actually doing the work. Looking at the console output for a particular build, the first line is always "Started by user foo," so Jenkins is clearly keeping track of who triggered the build. So it should be possible to pass that information down to the job..... The question is, how?
相关问题
- Jenkins - cmd is not recognized
- When using Nokogiri, how do you suppress the inser
- Where Jenkins stores plugin configuration
- Multi-branch configuration with externally-defined
- X-I.: command not found, and failed to build certa
相关文章
- dotnet restore还原nuget包时无法加载 https://api.nuget.org/
- jenkins在window集群环境中如何部署自动化发布?
- jenkins + Publish over FTP 自动部署前端React项目
- jenkins自定打包部署React前端项目遇到的问题。
- Handling ffmpeg library interface change when upgr
- Best way to manage docker containers with supervis
- Access BitBucket payload data in Jenkins pipeline
- Build errors of missing packages in Visual Studio
user30997
Please check out Jenkins Build User Vars plugin, it does what you need:
It is used to set following user build variables:
I tried to use Jenkins Build User Vars plugin and notify a HipChat room that a build was started by a certain user, but
BUILD_USER
variable was not available to HipChat plugin, possibly because HipChat action happened before Build User Vars plugin injects the variable.So I installed pre-scm-buildstep plugin and added:
]
I managed to get it (on Jenkins 2.58):
Of course you need to set permissions in Jenkins to be able to call these methods. It's not always the 0th Cause object you are looking for, e.g. it may be another one if you replay another user's build (did not test this).
The username isn't put in an easy-to-fetch environment variable, but you can get it using the xml (or json or python) api - as soon as you start a build,
http://[jenkins-server]/job/[job-name]/[build-number]/api/xml
is populated with details:In your Job add "Execute system Groovy script":