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

Powershell step in pipeline job outputs UTF-8 BOM

    XMLWordPrintable

    Details

    • Similar Issues:

      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

            Hide
            9yorpydqqi4n RME added a comment -

            How quickly can this be turned around, please?

            Show
            9yorpydqqi4n RME added a comment - How quickly can this be turned around, please?
            Hide
            sfenu Stefano Fenu added a comment - - edited

            Hi,

            I have the problem described in

            https://stackoverflow.com/questions/47527274/jenkins-pipeline-powershell-script-hangs

            One of the replies (https://stackoverflow.com/a/47829048/1953115) mentions this issue.

            So I tried approaches (described above) 2 and 3 of the following ones:

            1. Revert back to Durable Task 1.15
            2. Create a workspace for your projects in a location without any spaces in the path
            3. Clone my repo: https://github.com/gabloe/durable-task-plugin, build the plugin locally, and then install the plugin from the local build (durable-task.hpi)

            ( I could not try approach 1 as I have other plugins that seem to depend on that version)

            But my powershell command on a slave node still hangs.

            Here is the Jenkinsfile snippet:

             

                  stage('install to my.server') {
                    node('my.server') {
                      bat "set"
                      powershell 'Write-Output "Hello, World!"'
                    }
                  }

             

            Any idea how to fix that?

            Best regards

            Stefano

            Show
            sfenu Stefano Fenu added a comment - - edited Hi, I have the problem described in https://stackoverflow.com/questions/47527274/jenkins-pipeline-powershell-script-hangs One of the replies ( https://stackoverflow.com/a/47829048/1953115) mentions this issue. So I tried approaches (described above) 2 and 3 of the following ones: Revert back to Durable Task 1.15 Create a workspace for your projects in a location without any spaces in the path Clone my repo:  https://github.com/gabloe/durable-task-plugin , build the plugin locally, and then install the plugin from the local build (durable-task.hpi) ( I could not try approach 1 as I have other plugins that seem to depend on that version) But my powershell command on a slave node still hangs. Here is the Jenkinsfile snippet:         stage('install to my.server') {         node('my.server') {           bat "set"           powershell 'Write-Output "Hello, World!"'         }       }   Any idea how to fix that? Best regards Stefano
            Hide
            gabloe Gabriel Loewen added a comment -

            Hi Stefano Fenu,

            Can you send the system information of the Jenkins master/slave where your job is getting executed? Windows version, PowerShell version, and .NET version installed. If you built the plugin out of my repo then all of the unit tests would have been executed, and they test a variety of scenarios that should have caught any issue that you described. Since the .hpi file was produced, and I'm assuming that you didn't see a bunch of errors in the output, then you shouldn't be experiencing this issue. So, I'm not sure why that approach did not work for you.

            The issue has been fixed in my bug rollup PR that was just merged into the official repo, so you should also try again once the next release is out, which should be very soon.

            Thanks,

            Gabriel

            Show
            gabloe Gabriel Loewen added a comment - Hi Stefano Fenu , Can you send the system information of the Jenkins master/slave where your job is getting executed? Windows version, PowerShell version, and .NET version installed . If you built the plugin out of my repo then all of the unit tests would have been executed, and they test a variety of scenarios that should have caught any issue that you described. Since the .hpi file was produced, and I'm assuming that you didn't see a bunch of errors in the output, then you shouldn't be experiencing this issue. So, I'm not sure why that approach did not work for you. The issue has been fixed in my bug rollup PR that was just merged into the official repo, so you should also try again once the next release is out, which should be very soon. Thanks, Gabriel
            Hide
            sfenu Stefano Fenu added a comment -

            Hi,

            Thanks for your help.

            Actually the problem was simpler, as the master was ok with powershell version (5.1) but the slave was using an unsupported powershell version (2.0)

            I upgraded powershell in the slave to 4.0 and now the test powershell command works.

            Just for a complete information, I have not (yet) reverted back the steps 2 and 3:

            • Create a workspace for your projects in a location without any spaces in the path
            • Clone my repo: https://github.com/gabloe/durable-task-plugin, build the plugin locally, and then install the plugin from the local build (durable-task.hpi)

            Best Regards

            Stefano

            Show
            sfenu Stefano Fenu added a comment - Hi, Thanks for your help. Actually the problem was simpler, as the master was ok with powershell version (5.1) but the slave was using an unsupported powershell version (2.0) I upgraded powershell in the slave to 4.0 and now the test powershell command works. Just for a complete information, I have not (yet) reverted back the steps 2 and 3: Create a workspace for your projects in a location without any spaces in the path Clone my repo:  https://github.com/gabloe/durable-task-plugin , build the plugin locally, and then install the plugin from the local build (durable-task.hpi) Best Regards Stefano
            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:
                dziki_jam Valeriy Zabawski
              • Votes:
                6 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: