-
Notifications
You must be signed in to change notification settings - Fork 92
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
Added powershell/pwsh detection [JENKINS-48803] #88
Conversation
@darxriggs This gives preference to pwsh, and in Windows systems it is possible to have both Open PowerShell (pwsh) and Windows PowerShell (powershell) side by side. So, from an end user perspective it may be unclear as to which system is being leveraged, especially in systems such as Cygwin. What would be great is for the preference to be given to the user as a pipeline step parameter. E.g. something like: powershell script: ''' Would require some changes in https://github.com/jenkinsci/workflow-durable-task-step-plugin and since this is common across powershell, windows batch, and bourne shell it would need to be generic. Just my two cents :) |
Hm, maybe it would be a better idea to have two separate steps, pwsh and powershell? |
That's also a good solution, and less complicated. |
Separate steps definitely makes it a lot clearer for the end user, especially on Windows; that would be my preference. |
Any movement on this? It'd be great to start adopting Powershell Core to ease the transition of our Jenkins servers to Linux. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far this is the best approach, if admin has installed pwsh they most likely intend to use it.
I would avoid as it would be a lot of duplication to provide both powershell and pwsh step separately, I prefer the current implementation.
But I can see the benefit of giving the choice but it could also cause confusion for the end user writing the pipeline.
I would argue that a choice is required, there are some behavioral differences between Powershell and Pwsh that should require a deliberate decision by the user rather than the simple existence of it on the server. If two separate steps is too much to maintain than the |
Trying out a fix to both durable-task and workflow-durable-task-step, hopefully it is simple to maintain 😓 |
#111 is my attempt at the same thing with a docker fixture test even. |
Fixes JENKINS-48803 by detecting whether the system has
pwsh
orpowershell
at runtime. Prefers the former to the latter. Expects the system that presents itself as Unix-compatible to havewhich
.