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

Added powershell/pwsh detection [JENKINS-48803] #88

Closed
wants to merge 1 commit into from

Conversation

orthoxerox
Copy link

Fixes JENKINS-48803 by detecting whether the system has pwsh or powershell at runtime. Prefers the former to the latter. Expects the system that presents itself as Unix-compatible to have which.

@darxriggs
Copy link
Contributor

The pull-requests #55 and #73 also cover this topic.

@gabloe
Copy link
Contributor

gabloe commented Mar 25, 2019

@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: '''
Write-Host 'Foobar'
''', binaryPreference: 'pwsh'

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 :)

@orthoxerox
Copy link
Author

Hm, maybe it would be a better idea to have two separate steps, pwsh and powershell?

@gabloe
Copy link
Contributor

gabloe commented Mar 25, 2019

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.

@jakauppila
Copy link

Separate steps definitely makes it a lot clearer for the end user, especially on Windows; that would be my preference.

@jakauppila
Copy link

Any movement on this? It'd be great to start adopting Powershell Core to ease the transition of our Jenkins servers to Linux.

Copy link
Member

@jetersen jetersen left a 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.

@jakauppila
Copy link

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 binaryPreference option would probably be the next best option.

@jetersen
Copy link
Member

jetersen commented Oct 6, 2019

Trying out a fix to both durable-task and workflow-durable-task-step, hopefully it is simple to maintain 😓

@jetersen
Copy link
Member

jetersen commented Oct 7, 2019

#111 is my attempt at the same thing with a docker fixture test even.
I'll go ahead and submit a downstream PR to workflow-durable-task-step

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.

6 participants