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

Powershell step in pipeline job outputs UTF-8 BOM

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • Jenkins 2.60.2
      Windows Server 2012 R2
      PSVersion 5.1.15063.502

      Plugins:
      Powershell 1.3
      Pipeline: Build Step 2.5.1
      Pipeline 2.5

      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"'
      

          [JENKINS-46496] Powershell step in pipeline job outputs UTF-8 BOM

          Valeriy Zabawski created issue -
          Andrew Bayer made changes -
          Component/s New: durable-task-plugin [ 18622 ]
          Component/s New: workflow-durable-task-step-plugin [ 21715 ]
          Component/s Original: pipeline-stage-step-plugin [ 21709 ]

          That bug really harm us during upgrade. I wanted to move most powershell scripts to SharedLibrary, any workaround for that?

          Jakub Michalec added a comment - That bug really harm us during upgrade. I wanted to move most powershell scripts to SharedLibrary, any workaround for that?

          Jesse Glick added a comment -

          Jesse Glick added a comment - Maybe fixed by https://github.com/jenkinsci/durable-task-plugin/pull/45?
          Jesse Glick made changes -
          Remote Link New: This issue links to "Page (Jenkins Wiki)" [ 18024 ]

          Gabriel Loewen added a comment - Yes, this has been fixed by  https://github.com/jenkinsci/durable-task-plugin/pull/45?

          Darwin Sanoy added a comment - - edited

          When I updated from 1.15 to 1.17 of the Durable Task plugin, PowerShell scripts stopped executing altogether.

          There is an eternal pause right after Jenkins logs that it is starting the first powershell code.

          Prior to this, it has always output the BOM characters in Jenkins logs - but also always worked.

          When I revert this plug-in to 1.15, it starts working again.

          Everything else is right up to date as of this writing: Jenkins 2.73.3 and Blue Ocean 1.3.3

          My code is a powershell script that is part of the replicated repository.  It is called in a Blue Ocean declarative pipeline using the dot (".") invoke operator so that exit codes are consumed directly by the pipeline.

          I am running on Server 2012 R2 which has been updated to PowerShell 5.1.14409.1005.

          Here is what the call looks like:

          withEnv(["FIBUILDNAME=${jobconsolenamejenkinsvar}","TESTIMAGENAMEPREPEND=${TEST_IMAGENAME_PREPEND}"]) {
          powershell '''
          . "$PWD/Stage1-CreateWindowsAMI.ps1" -EnvironmentParams 'auto' -FIBuildName $env:FIBUILDNAME -FIBuildNumber $env:BUILD_NUMBER -CIBuildURL $env:BUILD_URL -AWSProfile 'instanceprofile' -TestImageNamePrepend $env:TESTIMAGENAMEPREPEND
          '''
          }
          

          jglick

          Darwin Sanoy added a comment - - edited When I updated from 1.15 to 1.17 of the Durable Task plugin, PowerShell scripts stopped executing altogether. There is an eternal pause right after Jenkins logs that it is starting the first powershell code. Prior to this, it has always output the BOM characters in Jenkins logs - but also always worked. When I revert this plug-in to 1.15, it starts working again. Everything else is right up to date as of this writing: Jenkins 2.73.3 and Blue Ocean 1.3.3 My code is a powershell script that is part of the replicated repository.  It is called in a Blue Ocean declarative pipeline using the dot (".") invoke operator so that exit codes are consumed directly by the pipeline. I am running on Server 2012 R2 which has been updated to PowerShell 5.1.14409.1005. Here is what the call looks like: withEnv([ "FIBUILDNAME=${jobconsolenamejenkinsvar}" , "TESTIMAGENAMEPREPEND=${TEST_IMAGENAME_PREPEND}" ]) { powershell ''' . "$PWD/Stage1-CreateWindowsAMI.ps1" -EnvironmentParams 'auto' -FIBuildName $env:FIBUILDNAME -FIBuildNumber $env:BUILD_NUMBER -CIBuildURL $env:BUILD_URL -AWSProfile 'instanceprofile' -TestImageNamePrepend $env:TESTIMAGENAMEPREPEND ''' } jglick

          Gabriel Loewen added a comment - - edited

          Hi Darwin,

          Yes, this issue has been reported and I have sent a PR which fixes the problem.  This issue happens when the workspace has spaces in the path.  For instance: "C:\Program Files (x86)\Jenkins\workspace".  You have a few options to unblock yourself until my code change makes it into the official build.  You can:

          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)

          If you choose #3 just remember to update to the official plugin once my changes have been baked in.

          Thanks,

          Gabriel

          Gabriel Loewen added a comment - - edited Hi Darwin, Yes, this issue has been reported and I have sent a PR which fixes the problem.  This issue happens when the workspace has spaces in the path.  For instance: "C:\Program Files (x86)\Jenkins\workspace".  You have a few options to unblock yourself until my code change makes it into the official build.   You can: 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) If you choose #3 just remember to update to the official plugin once my changes have been baked in. Thanks, Gabriel
          Gabriel Loewen made changes -
          Assignee New: Gabriel Loewen [ gabloe ]
          Gabriel Loewen made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

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

              Created:
              Updated:
              Resolved: