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

          Hide
          jakauppila Jared Kauppila added a comment -

          Thank you very much for the very prompt response!

          Show
          jakauppila Jared Kauppila added a comment - Thank you very much for the very prompt response!
          Hide
          gabloe Gabriel Loewen added a comment -

          You're welcome 

          Show
          gabloe Gabriel Loewen added a comment - You're welcome 
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: gabloe
          Path:
          src/main/java/org/jenkinsci/plugins/durabletask/PowershellScript.java
          src/test/java/org/jenkinsci/plugins/durabletask/PowershellScriptTest.java
          http://jenkins-ci.org/commit/durable-task-plugin/7d40a5d772c752b8b580683815dbda40101d97d7
          Log:
          Fixing JENKINS-49754

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: gabloe Path: src/main/java/org/jenkinsci/plugins/durabletask/PowershellScript.java src/test/java/org/jenkinsci/plugins/durabletask/PowershellScriptTest.java http://jenkins-ci.org/commit/durable-task-plugin/7d40a5d772c752b8b580683815dbda40101d97d7 Log: Fixing JENKINS-49754
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Sam Van Oort
          Path:
          src/main/java/org/jenkinsci/plugins/durabletask/PowershellScript.java
          src/test/java/org/jenkinsci/plugins/durabletask/PowershellScriptTest.java
          http://jenkins-ci.org/commit/durable-task-plugin/fb3cf82462d8156824592afb2f5e98e2158afd21
          Log:
          Merge pull request #64 from gabloe/master

          [Fixed JENKINS-49754] - Prevent PowerShell stdout pollution when using returnStdout

          Compare: https://github.com/jenkinsci/durable-task-plugin/compare/6671b39e4f75...fb3cf82462d8

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: src/main/java/org/jenkinsci/plugins/durabletask/PowershellScript.java src/test/java/org/jenkinsci/plugins/durabletask/PowershellScriptTest.java http://jenkins-ci.org/commit/durable-task-plugin/fb3cf82462d8156824592afb2f5e98e2158afd21 Log: Merge pull request #64 from gabloe/master [Fixed JENKINS-49754] - Prevent PowerShell stdout pollution when using returnStdout Compare: https://github.com/jenkinsci/durable-task-plugin/compare/6671b39e4f75...fb3cf82462d8
          Hide
          svanoort Sam Van Oort added a comment -

          I hope you don't mind if I come back and clean up by marking this as released with durable-task v2.20

          Show
          svanoort Sam Van Oort added a comment - I hope you don't mind if I come back and clean up by marking this as released with durable-task v2.20

            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: