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

Powershell step in pipeline job outputs UTF-8 BOM

    XMLWordPrintable

Details

    Description

      Powershell step in pipeline outputs UTF-8 BOM characters with Powershell output.

      [workspace] Running PowerShell script
      Hello
      

      If I run the same command (Write-Host "Hello") in a usual build job as a Powershell step it outputs normal output:

      [workspace] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Users\VALERY~1.ZAB\AppData\Local\Temp\jenkins2440165524934484537.ps1'"
      Hello
      Finished: SUCCESS
      

      Here's my powershell step code:

      powershell 'Write-Host "Hello"'
      

      Attachments

        Issue Links

          Activity

            dziki_jam Valeriy Zabawski created issue -
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Component/s durable-task-plugin [ 18622 ]
            Component/s workflow-durable-task-step-plugin [ 21715 ]
            Component/s pipeline-stage-step-plugin [ 21709 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "Page (Jenkins Wiki)" [ 18024 ]
            gabloe Gabriel Loewen made changes -
            Assignee Gabriel Loewen [ gabloe ]
            gabloe Gabriel Loewen made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            gabloe Gabriel Loewen made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            kkkuba Jakub Michalec made changes -
            Comment [ {code:java}
            C:\CI\Jenkins\...@tmp\durable-f7d18e60\powershellWrapper.ps1 : You
            cannot call a method on a null-valued expression.
            At C:\CI\Jenkins\...@tmp\durable-f7d18e60\powershellHelper.ps1:30
            char:7
            + & $MainScript *>&1 | Out-FileNoBom -FilePath $LogFile; $LastExi ...
            + ~~~~~~~~~~~~~~~~~~
                + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
                + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,powershellWrapper.ps1{code}
             

            I get above error when passing to ps script parameter with space eq 95f9a9463de59ce3f9f5807643ab32feaffa30ad      refs/heads/master

            (passed to -commitHash)
            {code:java}
            powershell(script: """
            . .\\scripts\\artifactsPicker.ps1 -storageAccountName $storageAccount `
            -branchName $pipelineParams.branchName `
            -packageParameters "$packageParameters" `
            -buildNewPackage $pipelineParams.buildNewPkg `
            -commitHash "$getLastPackageHash" `
            """){code}
             

            Script was working o 1.15, failure since I update to 1.17

              ]
            svanoort Sam Van Oort made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Closed [ 6 ]

            People

              gabloe Gabriel Loewen
              dziki_jam Valeriy Zabawski
              Votes:
              6 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: