Get username logged in Jenkins from Jenkins Workflow (Pipeline) Plugin

后端 未结 10 678
忘了有多久
忘了有多久 2020-12-25 12:36

I am using the Pipeline plugin in Jenkins by Clouldbees (the name was Workflow plugin before), I am trying to get the user name in the Groovy script but I am not able to ach

10条回答
  •  我在风中等你
    2020-12-25 12:58

    To make it work with Jenkins Pipeline:

    Install user build vars plugin

    Then run the following:

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

提交回复
热议问题