本文介绍了java.lang.UnsupportedOperationException:类jenkins.tasks.SimpleBuildWrapper的未知实现在jenkins中被命名为BuildUser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Jenkins中准备脚本,如下所示,在构建作业时出现错误.这项工作是向用户发送电子邮件,以供 input
进行下一步.
I preparing script in Jenkins as below where I getting error while build job. This job is send email to user for input
for next step.
[Pipeline] End of Pipeline
java.lang.UnsupportedOperationException: no known implementation of class jenkins.tasks.SimpleBuildWrapper is named BuildUser
at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:549)
at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:473)
...
...
版本:
$ java --version
openjdk 11.0.11 2021-04-20
jenkins : 2.277.3
管道代码:
def user
node {
wrap([$class: 'BuildUser']) {
user = env.BUILD_USER_ID
}
emailext mimeType: 'text/html',
subject: "[Jenkins]${currentBuild.fullDisplayName}",
to: "user@xxx.com",
body: '''<a href="${BUILD_URL}input">click to approve</a>'''
}
pipeline {
agent any
stages {
stage('deploy') {
input {
message "Should we continue?"
ok "Yes"
}
when {
expression { user == 'hardCodeApproverJenkinsId'}
}
steps {
sh "echo 'describe your deployment' "
}
}
}
}
任何人都可以对此进行评论吗?
Can anyone please review this, please ?
推荐答案
您需要安装构建用户vars插件
这篇关于java.lang.UnsupportedOperationException:类jenkins.tasks.SimpleBuildWrapper的未知实现在jenkins中被命名为BuildUser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!