java.lang.UnsupportedOperationException:没有已知的类 jenkins.tasks.SimpleBuildWrapper 的实现在 jenkins 中被命名为 BuildUser

2024-01-01

我在 Jenkins 中准备脚本如下,在构建作业时出现错误。这项工作是向用户发送电子邮件input进行下一步。

 [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: "[email protected] /cdn-cgi/l/email-protection",
             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' "
        }
    }
   }
}

有人可以评论一下吗?


你需要安装构建用户变量插件 https://plugins.jenkins.io/build-user-vars-plugin/

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

java.lang.UnsupportedOperationException:没有已知的类 jenkins.tasks.SimpleBuildWrapper 的实现在 jenkins 中被命名为 BuildUser 的相关文章

随机推荐