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

Powershell Pipeline Step hangs if capturing Stdout and output is null

    Details

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

      Description

      If the Powershell step is configured with 'returnStdout: true' and the script does not produce output, than [IO.File]::WriteAllLines fails when converting the temporaryOutput.txt, this causes the job to hang:

      [jaredtest] Running PowerShell script
      Cannot contact : java.nio.file.NoSuchFileException: D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\output.txt
      

      Pipeline script to recreate:

      node{
        def output = powershell(returnStdout: true, script: '')
        echo output
      }
      

      Executing `powershellWrapper.ps1` directly in the workspace results in the following error:

      PS H:\> D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\powershellWrapper.ps1
      Exception calling "WriteAllLines" with "2" argument(s): "Value cannot be null.
      Parameter name: contents"
      At D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\powershellWrapper.ps1:1 char:585
      + ... utput.txt"; [IO.File]::WriteAllLines("D:\Jenkins-Windows\workspace\ja ...
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ArgumentNullException
      

        Attachments

          Issue Links

            Activity

            Hide
            ericlouvard Éric Louvard added a comment -

            you not even need to capture the output to reproduce this issue.
            Regards.

            Show
            ericlouvard Éric Louvard added a comment - you not even need to capture the output to reproduce this issue. Regards.
            Show
            gabloe Gabriel Loewen added a comment - Fixed in PR  https://github.com/jenkinsci/durable-task-plugin/pull/51
            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/main/resources/org/jenkinsci/plugins/durabletask/powershellHelper.ps1
            src/test/java/org/jenkinsci/plugins/durabletask/PowershellScriptTest.java
            http://jenkins-ci.org/commit/durable-task-plugin/4a06f3cc8eb9053c0bf5597a06b69163c005c3b0
            Log:
            Merge pull request #51 from gabloe/master

            Fixed JENKINS-46876, JENKINS-46508, JENKINS-46496, JENKINS-48057, and JENKINS-47797

            Compare: https://github.com/jenkinsci/durable-task-plugin/compare/7c12b3a72cb4...4a06f3cc8eb9

            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/main/resources/org/jenkinsci/plugins/durabletask/powershellHelper.ps1 src/test/java/org/jenkinsci/plugins/durabletask/PowershellScriptTest.java http://jenkins-ci.org/commit/durable-task-plugin/4a06f3cc8eb9053c0bf5597a06b69163c005c3b0 Log: Merge pull request #51 from gabloe/master Fixed JENKINS-46876 , JENKINS-46508 , JENKINS-46496 , JENKINS-48057 , and JENKINS-47797 Compare: https://github.com/jenkinsci/durable-task-plugin/compare/7c12b3a72cb4...4a06f3cc8eb9
            Hide
            svanoort Sam Van Oort added a comment -

            Released with 1.18

            Show
            svanoort Sam Van Oort added a comment - Released with 1.18

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: