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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • durable-task-plugin
    • None
    • Windows Server 2012 R2
      Jenkins 2.89.4
      Durable Task Plugin 1.18

      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
      

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

              Created:
              Updated:
              Resolved: