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

Timestamper does not work properly with Windows style line endings

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • timestamper-plugin
    • None

      When using timestamper with either PowerShell or Windows Batch pipeline steps the timestamps do not get added to the console output.  I suspect this is because in these steps the console log has Windows style line endings of CRLF instead of unix style.

      Example repro:

      node("Windows") {
          timestamps {
              bat """
              @echo off
              echo These
              echo lines
              echo should
              echo have
              echo timestamps
              """
              powershell """
              Write-Host "These"
              Write-Host "lines"
              Write-Host "should"
              Write-Host "have"
              Write-Host "timestamps"
              """
          }
      }

       
      Result:

      [Pipeline] { (hide)
      [Pipeline] timestamps (hide)
      [Pipeline] { (hide)
      [Pipeline] bat (hide)
      2018-11-13 10:08:00 [TestTimestamper] Running batch script
      These
      lines
      should
      have
      timestamps
      [Pipeline] powershell (hide)
      2018-11-13 10:08:00 [TestTimestamper] Running PowerShell script
      These
      lines
      should
      have
      timestamps
      [Pipeline] }
      [Pipeline] // timestamps
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline

       

          [JENKINS-54611] Timestamper does not work properly with Windows style line endings

          Gabriel Loewen created issue -
          Gabriel Loewen made changes -
          Description Original: When using timestamper with either PowerShell or Windows Batch pipeline steps the timestamps do not get added to the console output.  I suspect this is because in these steps the console log has Windows style line endings of CRLF instead of unix style.

          Example repro:

           
          {code:java}
          node("Windows") {
              timestamps {
                  bat """
                  @echo off
                  echo These
                  echo lines
                  echo should
                  echo have
                  echo timestamps
                  """
                  powershell """
                  Write-Host "These"
                  Write-Host "lines"
                  Write-Host "should"
                  Write-Host "have"
                  Write-Host "timestamps"
                  """
              }
          }{code}
           
          Result:

           
          {noformat}
          [Pipeline] { (hide)
          [Pipeline] timestamps (hide)
          [Pipeline] { (hide)
          [Pipeline] bat (hide)
          2018-11-13 10:08:00 [TestTimestamper] Running batch script
          These
          lines
          should
          have
          timestamps
          [Pipeline] powershell (hide)
          2018-11-13 10:08:00 [TestTimestamper] Running PowerShell script
          These
          lines
          should
          have
          timestamps
          [Pipeline] }
          [Pipeline] // timestamps
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline{noformat}
           
          New: When using timestamper with either PowerShell or Windows Batch pipeline steps the timestamps do not get added to the console output.  I suspect this is because in these steps the console log has Windows style line endings of CRLF instead of unix style.

          Example repro:
          {code:java}
          node("Windows") {
              timestamps {
                  bat """
                  @echo off
                  echo These
                  echo lines
                  echo should
                  echo have
                  echo timestamps
                  """
                  powershell """
                  Write-Host "These"
                  Write-Host "lines"
                  Write-Host "should"
                  Write-Host "have"
                  Write-Host "timestamps"
                  """
              }
          }{code}
           
           Result:
          {noformat}
          [Pipeline] { (hide)
          [Pipeline] timestamps (hide)
          [Pipeline] { (hide)
          [Pipeline] bat (hide)
          2018-11-13 10:08:00 [TestTimestamper] Running batch script
          These
          lines
          should
          have
          timestamps
          [Pipeline] powershell (hide)
          2018-11-13 10:08:00 [TestTimestamper] Running PowerShell script
          These
          lines
          should
          have
          timestamps
          [Pipeline] }
          [Pipeline] // timestamps
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline{noformat}
           
          Gabriel Loewen made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]

          The issue went away after restarting Jenkins...  Resolving for now, but confused why this was the resolution.

          Gabriel Loewen added a comment - The issue went away after restarting Jenkins...  Resolving for now, but confused why this was the resolution.
          Gabriel Loewen made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            stevengbrown Steven G Brown
            gabloe Gabriel Loewen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: