Skip to content

Improve support for ToolInstallation - #34

Merged
froque merged 2 commits into
masterfrom
improve_ToolInstallation_support
Mar 18, 2026
Merged

Improve support for ToolInstallation#34
froque merged 2 commits into
masterfrom
improve_ToolInstallation_support

Conversation

@froque

@froque froque commented Dec 30, 2025

Copy link
Copy Markdown
Member

Better handling for ToolInstallation to use custom installations, behind defaults for Windows and Linux.

Testing done

  • Tested with multiple PowerShellInstallation configurations.
  • Tested migration of existing PowerShellInstallation configurations
  • Tested on Linux and Windows

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@froque
froque requested a review from a team as a code owner December 30, 2025 15:58
Comment thread src/main/java/hudson/plugins/powershell/PowerShell.java Fixed
Comment thread src/main/java/hudson/plugins/powershell/PowerShell.java Fixed
@froque
froque force-pushed the improve_ToolInstallation_support branch 2 times, most recently from 84a840c to d8228d6 Compare December 30, 2025 19:20
@splatteredbits

Copy link
Copy Markdown

Can we get a review on this please? This is something our team needs as well. Is there an new issue somewhere we can ping people on?

@MarkEWaite

Copy link
Copy Markdown
Contributor

Can we get a review on this please? This is something our team needs as well. Is there an new issue somewhere we can ping people on?

While you are waiting for a review, you can install the pre-release build, use it, and report your results with it. That will help you by confirming that it solves your immediate problem and it will help the maintainer because they will know that one other user has confirmed it works for them.

powershell-hpi.zip

@froque

froque commented Jan 12, 2026

Copy link
Copy Markdown
Member Author

I would like someone else to validate this PR. If no one does it, I will merge it in a few weeks.

@froque
froque force-pushed the improve_ToolInstallation_support branch from d8228d6 to 4c5ef77 Compare March 10, 2026 23:54
@splatteredbits

Copy link
Copy Markdown

I've confirmed this works in our instance of Jenkins. Here's the config:

image

And here's the console output showing it ran pwsh:

image

@froque
froque force-pushed the improve_ToolInstallation_support branch 2 times, most recently from 555cc1b to 0e4cbad Compare March 18, 2026 16:07
JENKINS-68052 Improve powershell version selection
JENKINS-76152 The powershell path is wrong when using a custom powershell release from a freestyle job
@froque
froque force-pushed the improve_ToolInstallation_support branch from 0e4cbad to 93f0e63 Compare March 18, 2026 16:36
@froque
froque merged commit 905646d into master Mar 18, 2026
17 checks passed
@froque
froque deleted the improve_ToolInstallation_support branch March 18, 2026 16:46
@jyanesnotariado

jyanesnotariado commented Mar 27, 2026

Copy link
Copy Markdown

Some of my Windows builds are now failing with:

[REDACTED_BUILD_NAME] $ pwsh.exe\powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File [REDACTED_TEMP_PATH]\jenkins10037010213870091985.ps1
The system cannot find the file specified
FATAL: command execution failed

I have two installations defined:
DefaultWindows with path powershell.exe
DefaultLinux with path pwsh
Are we supposed to define DefaultWindowsPwsh now too?
And where did pwsh.exe (with the .exe suffix) come from in the above example, if I did not define it anywhere?
Better docs would be appreciated.

@froque

froque commented Mar 27, 2026

Copy link
Copy Markdown
Member Author

Can you share your powershell installations config file hudson.plugins.powershell.PowerShellInstallation.xml ? Ideally before any changes made to it.

Are we supposed to define DefaultWindowsPwsh now too?

Yes, that was the idea.

Better docs would be appreciated.

any particular thing missing? pull requests are always welcome

@ViperTG

ViperTG commented Apr 6, 2026

Copy link
Copy Markdown

This update is broken, like completely. No Powershell steps works in any of my projects.
Workes fine on v 2.3

This is a simple step with just

$PSVersionTable

It's pretty obviously something in the path as pwsh is getting appended to the pwsh.exe path.

OS: Windows Server 2025
Jenkins: 2.541.3
PowerShell plugin: Version 182.v905646d861a_7

23:37:17 Started by user [***](http://***.***.***.***:9999/user/***)
23:37:17 Running as SYSTEM
23:37:17 Building in workspace C:\ProgramData\Jenkins\.jenkins\workspace\Test\PS test
23:37:17 [PS test] $ '"C:\Program Files\PowerShell\7\pwsh.exe"\pwsh' -NonInteractive -ExecutionPolicy Bypass -File C:\WINDOWS\TEMP\jenkins4256391672735743517.ps1
23:37:17 The parameter is incorrect
23:37:17 FATAL: command execution failed
23:37:17 java.io.IOException: CreateProcess error=87, The parameter is incorrect
23:37:17 	at java.base/java.lang.ProcessImpl.create(Native Method)
23:37:17 	at java.base/java.lang.ProcessImpl.<init>(Unknown Source)
23:37:17 	at java.base/java.lang.ProcessImpl.start(Unknown Source)
23:37:17 Caused: java.io.IOException: Cannot run program ""C:\Program Files\PowerShell\7\pwsh.exe"\pwsh" (in directory "C:\ProgramData\Jenkins\.jenkins\workspace\Test\PS test"): CreateProcess error=87, The parameter is incorrect
23:37:17 	at java.base/java.lang.ProcessBuilder.start(Unknown Source)
23:37:17 	at java.base/java.lang.ProcessBuilder.start(Unknown Source)
23:37:17 	at hudson.Proc$LocalProc.<init>(Proc.java:252)
23:37:17 	at hudson.Proc$LocalProc.<init>(Proc.java:221)
23:37:17 	at hudson.Launcher$LocalLauncher.launch(Launcher.java:995)
23:37:17 	at hudson.Launcher$ProcStarter.start(Launcher.java:507)
23:37:17 	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:144)
23:37:17 	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:92)
23:37:17 	at PluginClassLoader for powershell//hudson.plugins.powershell.PowerShell.perform(PowerShell.java:61)
23:37:17 	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
23:37:17 	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818)
23:37:17 	at hudson.model.Build$BuildExecution.build(Build.java:199)
23:37:17 	at hudson.model.Build$BuildExecution.doRun(Build.java:164)
23:37:17 	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:527)
23:37:17 	at hudson.model.Run.execute(Run.java:1842)
23:37:17 	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
23:37:17 	at hudson.model.ResourceController.execute(ResourceController.java:97)
23:37:17 	at hudson.model.Executor.run(Executor.java:456)
23:37:17 Build step 'PowerShell' marked build as failure
23:37:17 Finished: FAILURE

The plugin xml file contains this

<?xml version='1.1' encoding='UTF-8'?>
<hudson.plugins.powershell.PowerShellInstallation_-DescriptorImpl plugin="[email protected]">
  <installations class="hudson.plugins.powershell.PowerShellInstallation-array">
    <hudson.plugins.powershell.PowerShellInstallation>
      <name>DefaultWindows</name>
      <home>&quot;C:\Program Files\PowerShell\7\pwsh.exe&quot;</home>
      <properties/>
    </hudson.plugins.powershell.PowerShellInstallation>
    <hudson.plugins.powershell.PowerShellInstallation>
      <name>DefaultLinux</name>
      <home>pwsh</home>
      <properties/>
    </hudson.plugins.powershell.PowerShellInstallation>
  </installations>
</hudson.plugins.powershell.PowerShellInstallation_-DescriptorImpl>

@splatteredbits

Copy link
Copy Markdown

@ViperTG Check the HOME configuration of your PowerShell tools. It’s probably set to the path to the PowerShell executable. It should set to the directory of the PowerShell executable. Or, if PowerShell is in PATH, left empty.

@froque

froque commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

@ViperTG while trying to parse old configs, missed when someone changed the default installations.

Just released #47 in release https://github.com/jenkinsci/powershell-plugin/releases/tag/185.v7a_026da_c54ee

@ViperTG

ViperTG commented Apr 7, 2026

Copy link
Copy Markdown

@ViperTG while trying to parse old configs, missed when someone changed the default installations.

Just released #47 in release https://github.com/jenkinsci/powershell-plugin/releases/tag/185.v7a_026da_c54ee

Yep work fine now, thanks.

@jyanesnotariado

Copy link
Copy Markdown

Can you share your powershell installations config file hudson.plugins.powershell.PowerShellInstallation.xml ? Ideally before any changes made to it.

Of course, sorry for the delayed reply

<?xml version='1.1' encoding='UTF-8'?>
<hudson.plugins.powershell.PowerShellInstallation_-DescriptorImpl plugin="[email protected]">
  <installations class="hudson.plugins.powershell.PowerShellInstallation-array">
    <hudson.plugins.powershell.PowerShellInstallation>
      <name>DefaultWindows</name>
      <home>powershell.exe</home>
      <properties/>
    </hudson.plugins.powershell.PowerShellInstallation>
    <hudson.plugins.powershell.PowerShellInstallation>
      <name>DefaultLinux</name>
      <home>pwsh</home>
      <properties/>
    </hudson.plugins.powershell.PowerShellInstallation>
  </installations>
</hudson.plugins.powershell.PowerShellInstallation_-DescriptorImpl>

Are we supposed to define DefaultWindowsPwsh now too?

Yes, that was the idea.

OK!

Better docs would be appreciated.

any particular thing missing? pull requests are always welcome

I mean, a minor update broke everything. If the release notes at least contain a "BREAKING: you now need to define new installations with names DefaultWindowsPwsh ,etc etc" that'd have been enough for me.

I see it's fixed now, thanks a lot everybody. Will update soon and report back if needed.

@froque

froque commented Apr 9, 2026

Copy link
Copy Markdown
Member Author

I mean, a minor update broke everything. If the release notes at least contain a "BREAKING: you now need to define new installations with names DefaultWindowsPwsh ,etc etc" that'd have been enough for me.

This plugin is now using continuous delivery #42. It no longer uses Semantic Versioning, so there are no major or minor changes.

It was not supposed to be a breaking change. But making code changes to work with old persisted changes is hard, and that is why this pull request was open for several weeks awaiting feedback.

@jyanesnotariado

jyanesnotariado commented Apr 10, 2026

Copy link
Copy Markdown

Thanks for all the hard work, I really appreciate your plugin and open source software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants