Is there any variable for total build time in pipeline plugin?

319 views
Skip to first unread message

Denis Kot

unread,
Sep 19, 2016, 4:34:38 AM9/19/16
to Jenkins Users
I would like to send message from pipeline to hipchat contains total build time, i.e.:
job-pipeline #3007 SUCCESSFUL after 1 min 42 sec
How can I implement it?

Baptiste Mathus

unread,
Sep 19, 2016, 2:58:34 PM9/19/16
to jenkins...@googlegroups.com
long startTime = System.currentTimeMillis()

// Do what you need

long elapsedMillis = System.currentTimeMillis() - startTime;

Then use ^^^^

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e2cfa64b-e613-4f8b-87fa-7566de88e9f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cuong Tran

unread,
Sep 19, 2016, 3:24:22 PM9/19/16
to Jenkins Users

Baptiste Mathus

unread,
Sep 19, 2016, 3:28:30 PM9/19/16
to jenkins...@googlegroups.com
Not a bad idea indeed ;-).

--
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+unsubscribe@googlegroups.com.

thomas....@teamaol.com

unread,
Sep 20, 2016, 6:32:34 AM9/20/16
to Jenkins Users
Mmhhhh   ... I tried that ... with a sleep of 10 seconds before. The result is 0. In opposite to the variant with using System.currentTimeMillis which works fine.

Denis Kot

unread,
Sep 20, 2016, 7:05:32 AM9/20/16
to jenkins...@googlegroups.com
Same problem. Getting 0.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/n_HRKM26Scg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9c9a5056-6c59-47e5-a720-6220e2005f96%40googlegroups.com.

Denis Kot

unread,
Sep 20, 2016, 10:18:24 AM9/20/16
to jenkins...@googlegroups.com
Nice, but how to convert milliseconds to HH:MM:SS in groovy script, in particular in pipeline plugin?

Denis Kot


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/n_HRKM26Scg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS4p51PJOoQLrWSjERApSCvNb9PQe34Fv84quyiPfiNaDw%40mail.gmail.com.

Baptiste Mathus

unread,
Sep 20, 2016, 1:54:04 PM9/20/16
to jenkins...@googlegroups.com

We should offer high level utility DSL steps for that maybe. Also to help with whitelisting. In the meantime, simply Google for "groovy date formatting".


Reply all
Reply to author
Forward
0 new messages