Why does my Groovy script run in the Jenkins Script Console but not as a Groovy Postbuild Script? -


this script runs in jenkins script console not groovy postbuild script.

job = hudson.model.hudson.instance.getitem("myjob") build = job.getlastbuild() action = build.getaction(jenkins.metrics.impl.timeinqueueaction.class) 
  • jenkins ver. 1.625.3
  • groovy postbuild plugin v 2.0

it fails on last line. have metrics plugin installed v 3.0.11 should give me access metrics library.

it seems have somehow import timeinqueueaction class int plugin, script console can access it.

can help?

edit: error get:

5:03:40 groovy.lang.missingpropertyexception: no such property: jenkins class: script1 15:03:40    @ org.codehaus.groovy.runtime.scriptbytecodeadapter.unwrap(scriptbytecodeadapter.java:50) 15:03:40    @ org.codehaus.groovy.runtime.callsite.pogogetpropertysite.getproperty(pogogetpropertysite.java:49) 15:03:40    @ org.codehaus.groovy.runtime.callsite.abstractcallsite.callgroovyobjectgetproperty(abstractcallsite.java:231) 15:03:40    @ script1.run(script1.groovy:3) 15:03:40    @ groovy.lang.groovyshell.evaluate(groovyshell.java:580) 15:03:40    @ groovy.lang.groovyshell.evaluate(groovyshell.java:618) 15:03:40    @ groovy.lang.groovyshell.evaluate(groovyshell.java:589) 15:03:40    @ org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.securegroovyscript.evaluate(securegroovyscript.java:166) 15:03:40    @ org.jvnet.hudson.plugins.groovypostbuild.groovypostbuildrecorder.perform(groovypostbuildrecorder.java:355) 15:03:40    @ hudson.tasks.buildstepmonitor$1.perform(buildstepmonitor.java:20) 15:03:40    @ hudson.model.abstractbuild$abstractbuildexecution.perform(abstractbuild.java:785) 15:03:40    @ hudson.model.abstractbuild$abstractbuildexecution.performallbuildsteps(abstractbuild.java:726) 15:03:40    @ hudson.model.build$buildexecution.post2(build.java:185) 15:03:40    @ hudson.model.abstractbuild$abstractbuildexecution.post(abstractbuild.java:671) 15:03:40    @ hudson.model.run.execute(run.java:1766) 15:03:40    @ hudson.model.freestylebuild.run(freestylebuild.java:43) 15:03:40    @ hudson.model.resourcecontroller.execute(resourcecontroller.java:98) 15:03:40    @ hudson.model.executor.run(executor.java:408) 15:03:41 finished: success 

it turned out upgrading plugin 2.0 2.3.1 did trick.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -