Jenkins pipeline: get current user
examples/jenkins/current_user.Jenkinsfile
def specificCause = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause') if (specificCause) { println("Executed by user $specificCause.userName") //echo "specificCause: $specificCause" //echo "specificCause: ${specificCause.userId[0]}" echo "specificCause: $specificCause.userName" echo "specificCause: ${specificCause.userName}" //echo "specificCause: $specificCause.shortDescription" }
See also the BuildUser plugin
Published on 2020-01-16
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post