How to use Build User Vars Plugin with Pipeline?

Issue

How do I access variables provided by Build User Vars Plugin in Pipeline jobs.

Environment

Resolution

Example:

wrap([$class: 'BuildUser']) {
 // https://wiki.jenkins-ci.org/display/JENKINS/Build+User+Vars+Plugin variables available inside this block

  sh 'echo ${BUILD_USER}'
}

NOTE: Requires version 1.5 of Build User Vars Plugin

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Nachoyo89 Nachoyo89

    I tried this on multibranch pipeline and it doesn't work.

    stage('stage1') {
      steps {
        wrap([$class: 'BuildUser']) {
          sh 'echo "${BUILD_USER}"'
          sh 'echo "${BUILD_USER_ID}"'
          sh 'echo "${BUILD_USER_EMAIL}"'
        }
    }


    I am using version 1.5 of Build User Vars Plugin

    Edited by Nachoyo89 Nachoyo89
Please sign in to leave a comment.