본문 바로가기

IT/업무

[Jenkins] build user vars plugin

요약

빌드를 실행한 사용자를 환경 변수로 설정하는 플러그인

 

다운로드

https://plugins.jenkins.io/build-user-vars-plugin

 

예제

서술적 Pipeline

pipeline {
agent { label 'labelname'}

  stages {
    stage('build user') {
      steps {
        wrap([$class: 'BuildUser']) {
          echo "${BUILD_USER}"
          echo "${BUILDS_USER_ID}"
          echo "${BUILD_USER_EMAIL}"
        }
      }
    }
  }
}

 

프리스타일

1. 빌드 설정 > Set Jenkins user build variables 항목 체크

2. Execute Shell - Command

echo "Full name: $BUILD_USER"
echo "User id: $BUILD_USER_ID"
echo "User Email: $BUILD_USER_EMAIL"
exit 0