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

durable-task-plugin v1.36 breaks powershell use of param()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • durable-task-plugin
    • None
    • durable-task-plugin: 1.36

      The added try-catch breaks valid usage of PowerShell param(). param() is required to be the first thing in a script or function so adding the try-catch breaks this.

       

      Mentioned here:

      Culprit code:

       

      Running this:

      powershell(script: 'param ([string] $abc = "def")')
      

      fails with this error:

      [Pipeline] powershell
      powershell.exe : param : The term 'param' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 
      At C:\Jenkins\durable-a1234567\powershellWrapper.ps1:3 char:1
      + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (param : The ter...program. Check :String) [], RemoteException
          + FullyQualifiedErrorId : NativeCommandError
       
      the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At C:\Jenkins\durable-a1234567\powershellScript.ps1:1 char:7
      + try { param ([string] $abc = "def") } catch { throw }
      +       ~~~~~
          + CategoryInfo          : ObjectNotFound: (param:String) [], ParentContainsErrorRecordException
          + FullyQualifiedErrorId : CommandNotFoundException

            Unassigned Unassigned
            nixonk Nixon Kwok
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: