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

Successful powershell steps can fail due to handling of output

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • durable-task-plugin
    • None
    • Jenkins 2.109
      durable-task 1.18

      My builds started failing since updating to durable task plugin 1.18.  It would appear that the main script execution line was setting $LASTEXITCODE to 1 but $MAINSCRIPT was exiting with 0.

      powershellHelper.ps1 line 53 is currently:

      & { & $MainScript | Out-FileNoBom -Writer $OutputWriter } *>&1 | Out-FileNoBom -Writer $LogWriter;

      And my take is that Out-FileNoBom can contribute to the $LASTEXITCODE, so the step can fail because of a logging error.  I found removing the $LogWriter or even the "*>&1" made it start working in a sandbox outside of Jenkins. I think that running $MainScript in isolation and capturing that $LASTEXITCODE, then doing the logging may be a more robust solution?

      I've switched to using bat commands as a work around in the mean time.

            Unassigned Unassigned
            say_ten Matt Cheale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: