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

Streams other than StdOut getting returned when using returnStdOut on PowerShell Step

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Component/s: durable-task-plugin
    • Labels:
      None
    • Environment:
      Windows Server 2012 R2
      Jenkins 2.89.4
      Durable Task Plugin 1.18
    • Similar Issues:

      Description

      When executing the following pipeline with a verbose flag on a function and returnStdout specified, I am seeing the Verbose stream getting returned with Stdout.

      node{
        def psOutput = powershell(returnStdout: true, script: """
                            function Get-TestFunction {
                              [CmdletBinding()]
                              Param
                              (
                              )
      
                              Begin{
                              }
                              Process{
                                Write-Output 'hello'
                                Write-Verbose 'world'
                              }
                              End{
                              }
                            }
      
                            Get-TestFunction  -verbose
                        """)
        echo psOutput
      }
      

      Console Output:.

      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] node
      Running on Jenkins in D:\Jenkins-Windows\workspace\jaredtest
      [Pipeline] {
      [Pipeline] powershell
      [jaredtest] Running PowerShell script
      [Pipeline] echo
      hello
      VERBOSE: world
      
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      

      I would expect to see the Verbose stream getting written within the PowerShell script output. This is causing issues as we use the -verbose flag to see the details of things as they execute, but depend on Stdout to take action later on.

      If I perform the same pipeline on Durable Task Pipeline 1.14, I get the following output:

      [Pipeline] node
      Running on master in D:\Jenkins-Windows\workspace\jaredtest
      [Pipeline] {
      [Pipeline] powershell
      [jaredtest] Running PowerShell script
      world
      Cannot contact : java.nio.file.NoSuchFileException: D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-7c2251e3\output.txt
      [Pipeline] echo
      hello
      
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      

        Attachments

          Activity

          jakauppila Jared Kauppila created issue -
          gabloe Gabriel Loewen made changes -
          Field Original Value New Value
          Assignee Gabriel Loewen [ gabloe ]
          svanoort Sam Van Oort made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Done [ 10000 ]

            People

            • Assignee:
              gabloe Gabriel Loewen
              Reporter:
              jakauppila Jared Kauppila
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: