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

${DURATION} template contains "and counting" even at job conclusion, for pipeline builds

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • hipchat-plugin
    • None
    • Jenkins 2.19.4 LTS, HipChat Plugin 2.0.0

      I'm doing HipChat notifications in a Pipeline build (via Jenkinsfile) and even at job conclusion – as the very last step in a Jenkinsfile script – the DURATION template's value contains the string "and counting", e.g., "36 sec and counting". I can see this being appropriate while the job is in progress but it's awkward when it's done.

      The default templates sent by the HipChat plugin in a non-pipeline (e.g., freestyle) scenario show job success messages like "Build successful after 36 sec".

      An example of my usage:

      hipchatSend (
          color: 'GREEN',
          credentialId: 'HipChatToken', 
          message: 'Done in ${DURATION}', 
          room: '12456', 
          server: 'hipchat.company.com', 
          v2enabled: true)
      

      This generates a message like this:

      Done in 0.7 sec and counting

      Given that this is a notification-time template evaluation, I don't have the option of find-replace on "and counting" before the notification is sent. How can I get the HipChat plugin to supply a duration value that is just the duration, e.g., "36 sec"? In other words, how does it know (or how can I tell it) that the job is actually done, so that this awkward-sounding working is not added?

            aldaris aldaris
            medianick Nick Jones
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: