Skip to content

Fix PSVersion parameter version checks and error messages for PowerShell core remoting#16228

Merged
daxian-dbw merged 5 commits intoPowerShell:masterfrom
PaulHigin:remote-psversion
Dec 1, 2021
Merged

Fix PSVersion parameter version checks and error messages for PowerShell core remoting#16228
daxian-dbw merged 5 commits intoPowerShell:masterfrom
PaulHigin:remote-psversion

Conversation

@PaulHigin
Copy link
Copy Markdown
Contributor

PR Summary

This PR addresses issue #16062.

PR Context

Windows PowerShell supports remoting endpoint configurations that run on versions 2,3,4,5 of PowerShell. However, the PowerShell core WinRM plugin only supports endpoints that run in the currently installed version of PowerShell core, and ignores the -PSVersion parameter. This change removes the old supported version checks for the -PSVersion parameter on the configuration cmdlets and now throws a not supported error.

Also, Start-Job used to support running jobs in multiple WindowsPowerShell versions via the -PSVersion parameter, but now only supports version 5.1 in PowerShell core. So this fix updates the version check and error message to provide correct information.

PR Checklist

@ghost ghost assigned daxian-dbw Oct 12, 2021
@PaulHigin PaulHigin requested a review from iSazonov October 12, 2021 17:19
Comment thread src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs Outdated
<data name="PowerShellNotInstalled" xml:space="preserve">
<value>PowerShell {0} is not installed. Install PowerShell {0}, and then try again.</value>
<data name="PowerShellVersionNotSupported" xml:space="preserve">
<value>PowerShell remoting endpoint versioning is not supported on PowerShell Core.</value>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have PowerShell Committee for the decision?
Previously we support side-by-side scenarios, ex. 7.0 and 7.1 versions are installed simultaneously.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PowerShell/powershell-committee reviewed this and we have an existing side-by-side story with PS7 which is to use the full path to pwsh to use a specific version of PS7. We don't believe there is a real world scenario where supporting -PSVersion to specify a PS7 version that would be unsupported by 3 years (at most). If there is a real world scenario that we are not aware of, we recommend opening a Discussion to help us understand. This PR doesn't prevent future support of such a feature if it makes sense.

@daxian-dbw daxian-dbw added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Oct 20, 2021
@daxian-dbw
Copy link
Copy Markdown
Member

@TravisEz13 and @SteveL-MSFT please review when you have time, thanks!

@PaulHigin PaulHigin added the Review - Committee The PR/Issue needs a review from the PowerShell Committee label Nov 2, 2021
Comment thread src/System.Management.Automation/engine/remoting/commands/StartJob.cs Outdated
…tJob.cs

Co-authored-by: James Truher [MSFT] <jimtru@microsoft.com>
Comment thread src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs Outdated
<data name="PowerShellNotInstalled" xml:space="preserve">
<value>PowerShell {0} is not installed. Install PowerShell {0}, and then try again.</value>
<data name="PowerShellVersionNotSupported" xml:space="preserve">
<value>PowerShell remoting endpoint versioning is not supported on PowerShell Core.</value>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PowerShell/powershell-committee reviewed this and we have an existing side-by-side story with PS7 which is to use the full path to pwsh to use a specific version of PS7. We don't believe there is a real world scenario where supporting -PSVersion to specify a PS7 version that would be unsupported by 3 years (at most). If there is a real world scenario that we are not aware of, we recommend opening a Discussion to help us understand. This PR doesn't prevent future support of such a feature if it makes sense.

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 11, 2021
…omShellCommands.cs

Co-authored-by: Steve Lee <slee@microsoft.com>
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 11, 2021
@SteveL-MSFT SteveL-MSFT added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Nov 11, 2021
Comment thread test/powershell/Modules/Microsoft.PowerShell.Core/Job.Tests.ps1 Outdated
@pull-request-quantifier-deprecated
Copy link
Copy Markdown

This PR has 61 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Small
Size       : +15 -46
Percentile : 24.4%

Total files changed: 6

Change summary by file extension:
.cs : +4 -32
.resx : +3 -4
.ps1 : +8 -10

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detetcted.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@ghost ghost added the Review - Needed The PR is being reviewed label Nov 19, 2021
@ghost
Copy link
Copy Markdown

ghost commented Nov 19, 2021

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@daxian-dbw daxian-dbw removed the Review - Needed The PR is being reviewed label Dec 1, 2021
@daxian-dbw daxian-dbw merged commit 64d2fe2 into PowerShell:master Dec 1, 2021
@ghost
Copy link
Copy Markdown

ghost commented Dec 16, 2021

🎉v7.3.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

TrapGodBrim pushed a commit to TrapGodBrim/PowerShell that referenced this pull request Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log Committee-Reviewed PS-Committee has reviewed this and made a decision Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants