Reputation: 23
How can I display the username who executed the build next to the build number? like in the image below
Upvotes: 1
Views: 1647
Reputation: 81
Add Groovy Postbuild and user build vars plugin
edit job configure,check 【Set jenkins user build variables】,then you can get env variables 'BUILD_USER'
Post-build Actions, add 【Groovy Postbuild】, Groovy Script change to
manager.addShortText(manager.envVars['BUILD_USER'])
Upvotes: 0
Reputation: 64031
See, install and enable for the job https://plugins.jenkins.io/build-user-vars-plugin/
Then change name of build using BUILD_USER_ID
variable, like
#${BUILD_NUMBER}: ${GIT_REVISION,length=8} (${GIT_BRANCH}) by ${BUILD_USER_ID}
Upvotes: 0
Reputation: 11
Try entering Started by ([\S]+)
in the section "Post-build Actions ->
Set build description -> Regular expression" of your job config.
Upvotes: 1
Reputation: 349
You can add user name to build description.
currentBuild.description = currentBuild.getBuildCauses().shortDescription[0]
Then you will get something like bellow
* #1 Feb 24, 2020 10:00 AM
| Started by user max
If you want use user only then
currentBuild.description = currentBuild.getBuildCauses().userId[0]
Data structure is :
[{"_class":"hudson.model.Cause$UserIdCause","shortDescription":"Started by user max","userId":"max","userName":"max"}]
Upvotes: 0