Jenkins Pipeline: Enable timestamps in build log console
Solution 1
For scripted pipeline just wrap your script in timestamps { }
Eg.
timestamps {
// do your job
}
Note: You must have the timestamper plugin installed: wiki.jenkins.io/display/JENKINS/Timestamper
Solution 2
Adding options to the declarative pipeline
pipeline {
agent any
options { timestamps () }
// stages and rest of pipeline.
}
Credit goes to the comment above Jenkins Pipeline: Enable timestamps in build log console
Solution 3
I'm wondering why @roomsg comment on the accepted answer didn't become an answer.
I just noticed that (at least in our setup) you can configure this globally: check the "Enabled for all Pipeline builds" in the "Timestamper" section in Jenkins configuration
I think this is the best answering for Q. So,in case you have access as admin you can set it for all pipeline jobs through GUI
lanoxx
I am software developer with focus on web technologies and internet computing. My skills are in Java and the Web stack including HTML5, CSS and Javascript. I also love to program in C in my free time, where I spend time developing applications for Linux using the GTK+ libraries from the Gnome project. Currently I am the maintainer and developer of the tilda terminal. I have a big interest for everything that is open source, especially when it runs on Linux.
Updated on December 01, 2020Comments
-
lanoxx over 3 years
How can I display build timestamps for each line of a multi-branch pipeline project? Is it a supported feature? If yes, does it need to be enabled in the
Jenkinsfile
or is there a GUI option?