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 ?
You need to install the build user vars plugin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With