Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46556

Build Start time End time and Duration of a build in Jenkins

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • timestamper-plugin
    • None
    • Both Windows and Linux.

      Dear Team,

      Could you let me know how can I get Build Start time, End time, Duration of a build in Jenkins for each Job. Means I wanted to print the same on console out at the end, So please help me with this.

      My Jenkins Master Server Version – 2.46.2 LTS version.

      -Mohan

          [JENKINS-46556] Build Start time End time and Duration of a build in Jenkins

          Steven G Brown added a comment - - edited

          Sorry for the delay Mohan. My JIRA emails weren't coming through.

          If I understand correctly, you want to add a script to the build which will output these details?

          You can retrieve the information in XML or JSON format with the Remote access API. Start by opening a build in your browser, then adding /api to the URL to see the instructions. For example, to download the JSON format during the build, access $BUILD_URL/api/json.

          Hope this helps.

          Steven G Brown added a comment - - edited Sorry for the delay Mohan. My JIRA emails weren't coming through. If I understand correctly, you want to add a script to the build which will output these details? You can retrieve the information in XML or JSON format with the Remote access API. Start by opening a build in your browser, then adding /api to the URL to see the instructions. For example, to download the JSON format during the build, access $BUILD_URL/api/json . Hope this helps.

          Mohan added a comment -

          Hi Steven, No problem. My requirement is how do i can get the Build start time, End time and total time taken at last in the console output for each job?

          For this do we have any jenkins plugin or scipts available? If so let me know thank you.

          Mohan added a comment - Hi Steven, No problem. My requirement is how do i can get the Build start time, End time and total time taken at last in the console output for each job? For this do we have any jenkins plugin or scipts available? If so let me know thank you.

          I'm not aware of any existing plugin or script for this. You might try asking on the Jenkins user mailing list.

          If not, you will have to write your own script which calls the Remote access API. This plugin looks helpful:
          https://wiki.jenkins.io/display/JENKINS/Global+Post+Script+Plugin

          Steven G Brown added a comment - I'm not aware of any existing plugin or script for this. You might try asking on the Jenkins user mailing list. If not, you will have to write your own script which calls the Remote access API. This plugin looks helpful: https://wiki.jenkins.io/display/JENKINS/Global+Post+Script+Plugin

          Mohan added a comment -

          Okay thanks Steve. I will check. Thanks for your time and support.

          Mohan added a comment - Okay thanks Steve. I will check. Thanks for your time and support.

          Prashant Dubey added a comment - - edited

          Hi smohan08,

          I am looking for the problem. It would be helpful if you share your solution.

          Prashant Dubey added a comment - - edited Hi smohan08 , I am looking for the problem. It would be helpful if you share your solution.

            stevengbrown Steven G Brown
            smohan08 Mohan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: