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

Modernize Infra Client support for Powershell on Windows #10330

Closed
jobsolete opened this issue Aug 19, 2020 · 10 comments
Closed

Modernize Infra Client support for Powershell on Windows #10330

jobsolete opened this issue Aug 19, 2020 · 10 comments
Labels

Comments

@jobsolete
Copy link

Summary

PowerShell, .NET, and DSC on Windows are deprecated and are primarily being replaced by PowerShell Core, .NET Core, and DSC Core.

Existing Infra Client resources are built around PowerShell and DSC and need to be proactively modernized to support the new framework so we can support new functionality in a timely manner.

Background

PowerShell, up to version 5.1, is now colloquially known as "Windows PowerShell" to differentiate it from "PowerShell Core" which is version 6.0 and later. The former is built on .NET and the later on the replacement cross-platform .NET Core. As implied by the serial versioning, Microsoft has indicated that PowerShell Core replaces Windows PowerShell in the future. Windows PowerShell is receiving no new development, but in the interim both can be installed side-by-side as Microsoft achieves feature parity. Additionally, the Desired State Configuration (DSC) feature that provides broad integration with many parts of the Microsoft ecosystem is replaced by DSC Core which is evolving into an Azure service as well.

Windows PowerShell 5.1 was released in August 2016 and all development in the Microsoft ecosystem over the past few years has focused on the new tools.

Infra Client has no support for PowerShell Core at this time.

Features

  • Infra Client internals updated for PowerShell Core (e.g. Chef::PowerShell, powershell_out, powershell_exec)
  • Infra Client resources updated for PowerShell Core (e.g. powershell_script)
  • Infra Client resources updated for DSC Core (e.g. dsc_script, dsc_resource)
  • Train support for Powershell Core (pwsh)

Aha! Link: https://chef.aha.io/features/SH-171

@jobsolete jobsolete added this to the Desktop H2 2020 milestone Aug 19, 2020
@btm btm added the Epic label Aug 19, 2020
@jakauppila
Copy link
Contributor

Would this include support for executing PowerShell Core scripts on non-Windows machines?

@mwrock
Copy link
Member

mwrock commented Sep 2, 2020

@jakauppila this is currently scoped to windows only scenarios. It would definitely be nice to get powershell resources available for linux but I think that would deserve its own issue.

@jeremyciak
Copy link
Contributor

jeremyciak commented Sep 10, 2020

I'm curious if (and suggesting that) this could be approached in a non-disruptive way by adopting the "pwsh" or "core" nomenclature instead of "powershell" for all of the replacements that would opt into PowerShell Core. Using the above examples:

  • Infra Client internals updated for PowerShell Core (e.g. Chef::Pwsh, pwsh_out, pwsh_exec)
  • Infra Client resources updated for PowerShell Core (e.g. pwsh_script)
  • Infra Client resources updated for DSC Core (e.g. dsc_core_script, dsc_core_resource)

This would also give those wanting to consume PowerShell on non-Windows machines a clearly named resource for their use.

@mwrock
Copy link
Member

mwrock commented Sep 12, 2020

@jeremyciak we were thinking of adding an interpreter property to the existing resources. It would default to Windows Powershell but you could specify pwsh. I'm sure it will be quite some time yet but Microsoft will eventually only ship the xplat powershell. They have already dropped the "core" label.

@jeremyciak
Copy link
Contributor

jeremyciak commented Sep 12, 2020

@mwrock I was definitely mulling that over as an option as well, but that has more potential to break things or require much more conditional code to support the implementation. I was thinking "path of least resistance" to try and streamline this initiative moving forward.

@mwrock
Copy link
Member

mwrock commented Sep 14, 2020

@jeremyciak we definitely want to avoid breaking changes here but all working powershell based resources today should not be affected by this work. They will continue to use the "windows powershell" binary. One will need to explicitly specify the "pwsh" interpreter to "opt in" to the cross platform version of powershell.

Because the powershell team has stated that "we consider PowerShell 7 and beyond to be the one, true PowerShell going forward," we would like to avoid creating a new set of resources.

@mwrock
Copy link
Member

mwrock commented Sep 14, 2020

I added a few issues to this epic.

Given the uncertain state of DSC interoperability with cross-platform powershell, this epic will not be altering the dsc_resource or dsc_script resources. They leverage Chef::Util::DSC::LocalConfigurationManager and Chef::Util::Powershell::Cmdlet which use powershell.exe. No other non-DSC resource or utility uses those classes so we can safely leave them alone for now. Currently, cross platform powershell offers little to experimental support for interacting with the LCM. The LCM continues to exclusively use windows powershell to apply DSC configurations. There is no published roadmap for DSC that discusses how or when this will be updated.

@jeremyciak
Copy link
Contributor

Is this something a bit too fundamentally crucial to let outsiders contribute towards? I would love to help with this if possible. Let me know!

@mwrock
Copy link
Member

mwrock commented Sep 15, 2020

Happy to take contributions @jeremyciak ! It is work I plan on starting now and I will be focusing on the more nebulous powershell_exec issue #10430 . You are welcome to contribute to either of the other 2 issues (#10328 or #10329). Let me know if you have any questions or if I can help you get started in any way.

@mwrock
Copy link
Member

mwrock commented Oct 10, 2020

closing since all PRs have been merged

@mwrock mwrock closed this as completed Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants