0
votes

I have "Build User Vars"(user build vars plugin - V 1.5) plugin installed in Jenkins(Version 1.565) but in the job configuration, "set jenkins user build variable" checkbox option is not available. Could someone please help me in understanding what is wrong with my Jenkins?

3

3 Answers

2
votes

You must upgrade your Jenkins to at least version 1.609. If you cannot, downgrade the plugin to version 1.4.

See the plugin changelog for details.

1
votes

If your Jenkins' version is greater than 1.609 and you still can't find it in the configuration, in order to access the plugins' variables simply wrap the code in the Jenkinsfile with "BuildUser" class as so:

 wrap([$class: 'BuildUser']) {
      echo "BUILD_USER=${BUILD_USER}"
      echo "env.BUILD_USER_EMAIL=${env.BUILD_USER_EMAIL}"
  }
0
votes

Documentation of the plugin "build user vars" is not really easy to understand.

Here some examples working for me:

stage('Pluto') {
  steps {
    sh " sleep 2"
    sh "echo 'pluto'"
    wrap([$class: 'BuildUser']) {
      sh "echo '${BUILD_USER_EMAIL}'"
    }
  }
}


post {
    success {
        wrap([$class: 'BuildUser']) {
          sh " echo '${BUILD_USER_EMAIL}'"
        }
    }
}