pipline获取触发任务的用户名

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://*.com/questions/36194316/how-to-get-the-build-user-in-jenkins-when-job-triggered-by-timer

pipline获取触发任务的用户名

上一篇:鸿蒙TabList实例


下一篇:最小高度树