Hi, startTime=`date` # rest of the job endTime=`date`
getDuration() ${JCLI} groovy = <<EOF import hudson.model.* println hudson.model.Hudson.instance.getItem("$ {JOB_NAME}").getLastBuild().getExecutor().getElapsedTime() EOF } duration=`getDuration` echo "$startTime $endTime $duration" > somefile /Fatih On Apr 23, 3:36 pm, Dirk Kuypers <kuypers.d...@googlemail.com> wrote: > Hi, > > 2012/4/23 Vinayak <mivina...@gmail.com>: > > > How can I get Start time, End time, Duration of a job. > > I want to print on console at the end or in a particular file. > > Is there any environment variables or plugins are available..? > > do you really want o print into a file? I use the groovy postbuild > pluginhttps://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin > > and added something like this (mostly stolen from the examples at the > wiki page) to every of my continuous jobs to print build location and > duration into the build history: > > def builton = manager.build.getBuiltOnStr() > if (builton == "") { > builton = "master"} > > manager.addShortText(builton + ", " + > manager.build.getTimestampString() + ", ", "grey", "white", "0px", > "white") > > HTH > Dirk > > -- > Never trust a short-haired guru