java.lang.UnsupportedOperationException:类jenkins.tasks.SimpleBuildWrapper的未知实现在jenkins中被命名为BuildUser [英] java.lang.UnsupportedOperationException: no known implementation of class jenkins.tasks.SimpleBuildWrapper is named BuildUser in jenkins

查看:126
本文介绍了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 ?

推荐答案

您需要安装 查看全文

相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆