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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: durable-task-plugin
    • Labels:
      None
    • Environment:
      durable-task-plugin: 1.36
    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            Hide
            rpitt Robert Pitt added a comment -

            see duplicate JENKINS-65597

            Show
            rpitt Robert Pitt added a comment - see duplicate JENKINS-65597
            Hide
            rpitt Robert Pitt added a comment -

            See candidate version/fix in PR in other thread – it works for me!

            Show
            rpitt Robert Pitt added a comment - See candidate version/fix in PR in other thread – it works for me!
            Hide
            mcascone Max Cascone added a comment -

            I just ran into this too, thanks for fixing!

            Show
            mcascone Max Cascone added a comment - I just ran into this too, thanks for fixing!

              People

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

                Dates

                Created:
                Updated:
                Resolved: