stage(‘获取触发任务用户‘) {
steps {
script {
def BUILD_TRIGGER_BY = "${currentBuild.getBuildCauses()[0].shortDescription}"
BUILD_TRIGGER_BY = sh (script: "echo ${BUILD_TRIGGER_BY}|awk -F ‘ ‘ ‘{print $NF}‘", returnStdout: true).trim()
echo "BUILD_TRIGGER_BY: ${BUILD_TRIGGER_BY}"
}
}
}
原文:https://www.cnblogs.com/cat1/p/15128035.html