I want to execute code which is written(and generated) as string I made .Jenkinsfile file:
pipeline {
stages {
stage('validation') {
steps{
script{
new GroovyShell().evaluate("""build (job:'myjob' , parameters:[string(name: 'FOO', value: "BAR")]""")
}
}
}
}
}
And I receive error:
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: Script1.string() is applicable for argument types: (java.util.LinkedHashMap) values: [[name:FOO, value:BAR]]
Possible solutions: toString(), toString(), print(java.lang.Object), print(java.io.PrintWriter), print(java.lang.Object), run()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:71)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:80)
I do not need to use exactly GroovyShell, any variant of executing string will be appropriate for me