Skip to main content

How to use Build User Vars Plugin with Pipeline?

Comments

3 comments

  • 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

    1
  • Joe Tavin

    Try without invoking sh, just echo direct like so:

    stage('stage1') {
      steps {
        wrap([$class: 'BuildUser']) {
          echo "${BUILD_USER}"
          echo "${BUILD_USER_ID}"
          echo "${BUILD_USER_EMAIL}"
        }
    }
    -2
  • Denis Chekhlov

    https://stackoverflow.com/questions/35902664/get-user-name-from-jenkins-workflow-pipeline-plugin/48649228#48649228

    ```

    pipeline {
      agent any
    
      stages {
        stage('build user') {
          steps {
            wrap([$class: 'BuildUser']) {
              sh 'echo "${BUILD_USER}"'
            }
          }
        }
      }
    }
    ```

    WORKS!

    1

Please sign in to leave a comment.

About CloudBees Support

Our Support Engineers are available to help with any questions or problems you may have with any of our products.