Reputation: 53
My requirement is to get the end time of the current build in pipeline code. How to get it?
Upvotes: 1
Views: 1251
Reputation: 2214
You can take currentBuild.startTimeInMillis + currentBuild.duration
at the end of the build:
import java.util.Date
import java.text.SimpleDateFormat
...
def endTime = currentBuild.startTimeInMillis + currentBuild.duration
def endTimeString = new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(endTime))
println endTimeString
Upvotes: 1