0

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)
    ...
    ...

Version :

$ java --version
 openjdk 11.0.11 2021-04-20

jenkins : 2.277.3

Pipeline code:

def user
node {
wrap([$class: 'BuildUser']) {
user = env.BUILD_USER_ID
}

emailext mimeType: 'text/html',
             subject: "[Jenkins]${currentBuild.fullDisplayName}",
             to: "[email protected]",
             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 Answer 1

1

Have you installed the Build User Vars Plugin? This plugin provides the "BuildUser" class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.