Jenkins – Username

In order to find out Jenkins username, you need a plugin user build vars

Go to Jenkins settings

 

Section “Manage Plugins

 

Go to the “Available” tab and specify “user build vars” in the search.

Install it.

 

An example of using a plugin from Pipeline:

pipeline {
  agent any
  stages {
    stage('Output') {
      steps {
        script {
          wrap([$class: 'BuildUser']) {
            echo "Build was started by user: ${BUILD_USER}"
          }
        }
      }
    }
  }
}

 

The module also has the following variables:

  • BUILD_USER – Full name (first name + last name)
  • BUILD_USER_FIRST_NAME – First name
  • BUILD_USER_LAST_NAME – Last name
  • BUILD_USER_ID – Jenkins user ID
  • BUILD_USER_EMAIL – Email address

Tagged: Tags

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments