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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9f994a50-f671-42fe-ac77-b75a608daa53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to