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

PowerShell step generates a parse error when starting with [CmdletBinding()]

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      1.37

      Description

      In my attempt to fix Jenkins-59529, I modified the powershellScript.ps1 file to wrap the user's script entered in the powershell/pwsh step in a try/catch. That unfortunately precludes the use of certain script elements e.g. [CmdletBinding()] and param() as they must appear at the top of the file before any other script or statements. There is a rather lengthy discussion of this on the GitHub PR that fixed Jenkins-59529 here.

        Attachments

          Issue Links

            Activity

            Hide
            rpitt Robert Pitt added a comment -
            Show
            rpitt Robert Pitt added a comment - Apparently being fixed in https://github.com/jenkinsci/durable-task-plugin/pull/134
            Hide
            carroll Carroll Chiou added a comment -

            Robert Pittcan you confirm if this PR works for you?

            Show
            carroll Carroll Chiou added a comment - Robert Pitt can you confirm if this PR works for you?
            Hide
            rpitt Robert Pitt added a comment -

            Confirmed works for my scenario - thank you all!

            Show
            rpitt Robert Pitt added a comment - Confirmed works for my scenario - thank you all!
            Hide
            r_keith_hill Keith Hill added a comment -

            Robert Pitt Thanks for confirming.

            Show
            r_keith_hill Keith Hill added a comment - Robert Pitt Thanks for confirming.

              People

              Assignee:
              r_keith_hill Keith Hill
              Reporter:
              r_keith_hill Keith Hill
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: