"currentBuild" doesn't work too.
I forgot to add that we are using Groovy Event Listener Plugin to publish data.
So, this script is executed in 'onFinalized' method.
>>> Caught unhandled exception! No such property: currentBuild for class:
>>> script1471951099891369958697
groovy.lang.MissingPropertyException: No such property: currentBuild for class:
script1471951099891369958697
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at
org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at
script1471951099891369958697.run(script1471951099891369958697.groovy:9)
at script1471951099891369958697$run.call(Unknown Source)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl.runScript(GlobalEventsPlugin.groovy:305)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl.this$3$runScript(GlobalEventsPlugin.groovy)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl$this$3$runScript.callCurrent(Unknown
Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl$this$3$runScript.callCurrent(Unknown
Source)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl.safeExecGroovyCode(GlobalEventsPlugin.groovy:275)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl.this$3$safeExecGroovyCode(GlobalEventsPlugin.groovy)
at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl.safeExecGroovyCode(GlobalEventsPlugin.groovy)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl.this$3$safeExecGroovyCode(GlobalEventsPlugin.groovy)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl$this$3$safeExecGroovyCode.callCurrent(Unknown
Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl$this$3$safeExecGroovyCode.callCurrent(Unknown
Source)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalEventsPlugin$DescriptorImpl.processEvent(GlobalEventsPlugin.groovy:219)
at
org.jenkinsci.plugins.globalEventsPlugin.GlobalRunListener.onFinalized(GlobalRunListener.java:54)
at
hudson.model.listeners.RunListener.fireFinalized(RunListener.java:232)
at hudson.model.Run.onEndBuilding(Run.java:1893)
at
org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:522)
at
org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1000(WorkflowRun.java:107)
at
org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:759)
at
org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:799)
at
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$4.run(CpsThreadGroup.java:320)
at
org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:32)
at
hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
at
jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
On Tuesday, 23 August 2016 12:14:02 UTC+2, Daniel Beck wrote:
>
> currentBuild, mostly.
>
> See the /pipeline-syntax/globals URL on your Jenkins.
>
> > On 23.08.2016, at 11:59, Jimilian <[email protected] <javascript:>>
> wrote:
> >
> > Hi!
> >
> > My team started to convert jobs from Freestyle jobs to Pipeline jobs,
> and we figured out that `Thread.currentThread().executable` doesn't work
> anymore.
> > What's best replacement for this?
> >
> > Br, Alex
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Jenkins Developers" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected] <javascript:>.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/637b921d-a6e8-49ef-be84-876e54b0b1e7%40googlegroups.com.
>
>
> > For more options, visit https://groups.google.com/d/optout.
>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/e139890d-8e9e-4be3-9f3a-2e6f47670cb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.