Make the ErrorActionPreference selection optional#18
Closed
Mark-Corsillo-Bose wants to merge 2 commits intojenkinsci:masterfrom
Closed
Make the ErrorActionPreference selection optional#18Mark-Corsillo-Bose wants to merge 2 commits intojenkinsci:masterfrom
Mark-Corsillo-Bose wants to merge 2 commits intojenkinsci:masterfrom
Conversation
added 2 commits
February 11, 2022 16:00
This changes the "stopOnError" checkbox to a select, offering an option to *not* override the ErrorActionPreference for a script. This is to address situations where Powershell scripts include param() blocks, which causes a script to fail if there are any commands preceding them in a script.
Author
|
I think the test that failed is designed to fail to verify some functionality that was added in a recent version? |
froque
requested changes
Feb 18, 2022
| Assume.assumeTrue(isPowerShellAvailable()); | ||
| FreeStyleProject project1 = r.createFreeStyleProject("project1"); | ||
| project1.getBuildersList().add(new PowerShell("wrong command", true, true, null)); | ||
| project1.getBuildersList().add(new PowerShell("wrong command", "noOverride", true, null)); |
Member
There was a problem hiding this comment.
should be stopOnError
where true was is now "stopOnError"
please add another test testBuildBadCommandisIgnored with "continueOnError"
Add a second test with a param() block
| private Integer unstableReturn; | ||
|
|
||
| private final boolean stopOnError; | ||
| private String errorAction; |
Member
There was a problem hiding this comment.
Upgrading a jenkins with existing jobs to this version fails:
ERROR: Build step failed with exception
java.lang.NullPointerException
at hudson.plugins.powershell.PowerShell.getContents(PowerShell.java:129)
at hudson.tasks.CommandInterpreter.createScriptFile(CommandInterpreter.java:202)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:120)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:92)
at hudson.plugins.powershell.PowerShell.perform(PowerShell.java:48)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:164)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:516)
at hudson.model.Run.execute(Run.java:1889)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:100)
at hudson.model.Executor.run(Executor.java:433)
Build step 'PowerShell' marked build as failure
Finished: FAILURE
Author
|
Closing this PR in light of #21 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes the "stopOnError" checkbox to a select, offering an option to not override the ErrorActionPreference for a script. This is to address situations where Powershell scripts include param() blocks, which causes a script to fail if there are any commands preceding them in a script.
https://issues.jenkins.io/browse/JENKINS-60423