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

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

    Details

    • Type: Task
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Component/s: timestamper-plugin
    • Labels:
      None
    • Environment:
      Both Windows and Linux.
    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Hide
          stevengbrown 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.

          Show
          stevengbrown 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.
          Hide
          smohan08 Mohan S 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.

          Show
          smohan08 Mohan S 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.
          Hide
          stevengbrown 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

          Show
          stevengbrown 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
          Hide
          smohan08 Mohan S added a comment -

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

          Show
          smohan08 Mohan S added a comment - Okay thanks Steve. I will check. Thanks for your time and support.
          Hide
          prashant_dubey Prashant Dubey added a comment - - edited

          Hi Mohan S,

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

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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: