java.lang.UnsupportedOperationException: no known implementation of class jenkins.tasks.SimpleBuildWrapper is named BuildUser
	at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:449)
	at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:401)
	at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:340)
	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:281)
	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:201)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:208)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)

jenkinsfile:

env.BUILD_USER = ''

 wrap([$class: 'BuildUser']) {

 env.BUILD_USER = sh(returnStdout: true, script: 'echo "$BUILD_USER"').trim()

 }

是因为jenkins没有安装plugin(user build vars plugin)

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐