Thanks Andrew, looks good. So with this patch currentBuild.duration should 
be non 0 and there should be currentBuild.durationString, is that correct?

Nick

On Tuesday, March 21, 2017 at 2:19:18 PM UTC+13, Andrew Bayer wrote:
>
> And a PR up at 
> https://github.com/jenkinsci/workflow-support-plugin/pull/33
>
> On Mon, Mar 20, 2017 at 6:11 PM, Andrew Bayer <[email protected] 
> <javascript:>> wrote:
>
>> This is more of a general Pipeline matter than just Declarative, fwiw. 
>> I've opened https://issues.jenkins-ci.org/browse/JENKINS-42952 for this 
>> and will get a PR up shortly.
>>
>> A.
>>
>> On Mar 20, 2017 15:41, "Nick Le Mouton" <[email protected] 
>> <javascript:>> wrote:
>>
>> Hi,
>>
>> My current jobs use the Slack plugin which notifies a channel when a 
>> build completes, e.g. job name - #2423 Success after 1 min 49 sec. I'm 
>> trying to replicate the same message in declarative pipelines, but I can't 
>> seem to find a way to get the build duration. I have tried using 
>> currentBuild.duration (which ends up evaluating to 0) and tried 
>> currentBuild.rawBuild.getDurationString(), but Jenkins throws an error 
>> about not being able to run functions from this context.
>>
>> How can I get this to work?
>>
>> Thanks
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" 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-users/9f994a50-f671-42fe-ac77-b75a608daa53%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/9f994a50-f671-42fe-ac77-b75a608daa53%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" 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-users/04047271-1d52-4113-890c-6fe21a0649d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to