Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes force insertion of '$ErrorActionPreference = "Continue"' if "Stop On Errors" is unchecked #21

Merged

Conversation

jeremypope
Copy link

@jeremypope jeremypope commented Dec 12, 2022

Similar to the intent of #18 to fix the behavior shown in https://issues.jenkins.io/browse/JENKINS-60423, undo the breaking change introduced in version 1.4 where it will force insert the line $ErrorActionPreference = "Continue" if the "Stop On Errors" checkbox is enabled, as this breaks the usage of PowerShell scriptblocks that have advanced parameter blocks at the beginning that contain [CmdletBinding()] and/or param() blocks since these must be the first executable line within a scriptblock if given.

However, this differs from #18 where instead of moving to a choice between Stop, Continue, or no insertion at all, this branch instead just removes the insertion if the option is unchecked, as the default behavior of PowerShell's $ErrorActionPreference is Continue.

tl;dr - Keep the plugin interface and intended behavior the same, but remove the breaking behavior of forcing $ErrorActionPreference = "Continue" into the beginning of the script since this is a default setting

@jeremypope
Copy link
Author

@froque Is there any additional information I need to provide for this?

@froque froque merged commit 6504b68 into jenkinsci:master Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants