Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get build time stamp from Jenkins build variables?

How can I get build time stamp of the latest build from Jenkins? I want to insert this value in the Email subject in post build actions.

like image 712
rkkreddy Avatar asked Jun 15 '14 05:06

rkkreddy


People also ask

How do I get total build time in Jenkins?

You can use ${currentBuild. durationString} to get build duration.

What is Jenkins timestamp?

The timestamp format can be configured via the Manage Jenkins, Configure System page. There is a panel on the left-hand side of the console page which allows either the system clock time or the elapsed time to be displayed. The time zone used to display the timestamps can be configured by setting a system property.

Which Jenkins plugin allows to add timestamps to the console output?

After installing the Timestamper Plugin, you have to configure each job by manually checking the "Add timestamps to the Console Output" option.


1 Answers

Build Timestamp Plugin will be the Best Answer to get the TIMESTAMPS in the Build process.

Follow the below Simple steps to get the "BUILD_TIMESTAMP" variable enabled.

STEP 1:

Manage Jenkins -> Plugin Manager -> Installed... Search for "Build Timestamp Plugin". Install with or without Restart. 

STEP 2:

Manage Jenkins -> Configure System. Search for 'Build Timestamp' section, then Enable the CHECKBOX. Select the TIMEZONE, TIME format you want to setup with..Save the Page. 

USAGE:

When Configuring the Build with ANT or MAVEN,  Please declare a Global variable as,  E.G.  btime=${BUILD_TIMESTAMP} (use this in your Properties box in ANT or MAVEN Build Section)  use 'btime' in your Code to any String Variables etc.. 

enter image description here

enter image description here

like image 91
Raghav Tallam Avatar answered Oct 04 '22 00:10

Raghav Tallam