Update Enable-PSRemoting so configuration name for Preview releases#7202
Update Enable-PSRemoting so configuration name for Preview releases#7202TravisEz13 merged 7 commits intoPowerShell:masterfrom
Enable-PSRemoting so configuration name for Preview releases#7202Conversation
| // TODO: This should be PSVersionInfo.PSVersionName once we get | ||
| // closer to release. Right now it doesn't support alpha versions. | ||
| return System.String.Concat("PowerShell.", PSVersionInfo.GitCommitId); | ||
| string version = PSVersionInfo.GitCommitId; |
There was a problem hiding this comment.
It would be nice if both these code paths included comments with examples demonstrating what is expected. Otherwise it is a bit confusing.
| if ($dotPos -ne -1) {{ | ||
| $powershellVersionMajor = $powershellVersionMajor.Substring(0, $dotPos) | ||
| }} | ||
| if ($PSVersionTable.PSVersion.ToString().Contains(""preview"")) |
There was a problem hiding this comment.
I don't see how appending "preview" gets the Issue PowerShell.6.1.0-preview.3 endpoint name. Where does the ending ".3" come from?
| string version = PSVersionInfo.GitCommitId; | ||
| if (version.StartsWith("v")) | ||
| { | ||
| version = version.Substring(1, version.Length - 1); |
There was a problem hiding this comment.
You can use the simpler String.Substring(int startIndex) overload
| # but instead creating a PowerShell.6-Preview endpoint | ||
| if ($PSVersionTable.PSVersion.ToString().Contains(""preview"")) | ||
| {{ | ||
| $powershellVersionMajor += ""-Preview"" |
There was a problem hiding this comment.
Minor note: I'm curious why we don't use the same casing for Preview as we do in the version string? In one case, we have mixed case Preview (PowerShell.6-Preview) while in the other, lower case (PowerShell.6.1.0-preview.715)
There was a problem hiding this comment.
semver.org uses lowercase for their examples of alpha and beta releases, but I don't see any language indicating it must be lowercase. We should consider having a capital P in the semver and package name, but that's outside the scope of this PR.
There was a problem hiding this comment.
capitals are not allowed in many semver. I've had to add ToLower to many places in the code to ensure we can release without error.
a69edd0 to
e293501
Compare
Enable-PSRemoting so configuration name for Preview releasesEnable-PSRemoting so configuration name for Preview releases
e293501 to
aa6b5ce
Compare
| shellName += "-Preview"; | ||
| } | ||
|
|
||
| return shellName; |
There was a problem hiding this comment.
We build GitCommitId in PSVersionInfo - so maybe build the shellName there too? This can simplify the script below too. And tests.
There was a problem hiding this comment.
@iSazonov that's a great suggestion. The alternative is that we add the v to install-powershellremoting.ps1 for the version specific endpoint to make it predictable but inconsistent with the generic 6 and 6-preview endpoints. Let's discuss this in the issue.
There was a problem hiding this comment.
Adding or removing v to preview isn't problem but breaking change for release. I believe it is better to use the same code for both versions and the same formatting for both endpoint names.
There was a problem hiding this comment.
I believe that it is better to fix the preview version - this is acceptable for version update 6.0 -> 6.1.
Enable-PSRemoting so configuration name for Preview releasesEnable-PSRemoting so configuration name for Preview releases
Enable-PSRemoting so configuration name for Preview releasesEnable-PSRemoting so configuration name for Preview releases
cdcd180 to
dab083b
Compare
dab083b to
36954a5
Compare
| internal static string GetWinrmPluginShellName() | ||
| { | ||
| // PowerShell Core uses a versioned directory to hold the plugin | ||
| // TODO: This should be PSVersionInfo.PSVersionName once we get |
There was a problem hiding this comment.
Does the removal of this TODO mean we no longer intend for this to happen?
There was a problem hiding this comment.
Removal of this comment means that the current design supports semver (pre-release labels)
daxian-dbw
left a comment
There was a problem hiding this comment.
LGTM. Left a non-blocking comment.
| }} | ||
| # If we are running a Preview version, we don't want to clobber the generic PowerShell.6 endpoint | ||
| # but instead creating a PowerShell.6-Preview endpoint | ||
| if ($PSVersionTable.PSVersion.ToString().Contains(""preview"")) |
There was a problem hiding this comment.
nit: Maybe checking !string.IsNullOrEmpty($PSVersionTable.PSVersion.PreReleaseLabel) is slightly better.
This is not a blocking comment.
There was a problem hiding this comment.
Just realized it's in script, then even simpler: if ($PSVersionTable.PSVersion.PreReleaseLabel)
There was a problem hiding this comment.
One concern is that the current proposal for corefx for SemanticVersion type has a different member: https://github.com/dotnet/corefx/issues/13526
Eventually, we'll want to move to the corefx SemanticVersion type. I'll change it now and we'll update the code base later to adopt SemanticVersion.
There was a problem hiding this comment.
I'll change it now and we'll update the code base later to adopt SemanticVersion.
That sounds great!
There was a problem hiding this comment.
@SteveL-MSFT Maybe open tracking issue for moving to the corefx SemanticVersion type?
…#7202) The intent was to have the version of the PSSessionConfiguration name not include the `v` for the version string. Also, Preview releases should standardize on `PowerShell.6-Preview` instead of clobbering `PowerShell.6` so that stable and preview can co-exist side-by-side. Need to verify on Win10 IoT if `Install-PowerShellRemoting.ps1` is still needed anymore as it may be possible to run `pwsh -c enable-psremoting` from within Windows PowerShell Core removing the need for that script which duplicates `Enable-PSRemoting` capability. Update: Not able to get the current master build working on Win10 IoT, getting `Invalid access to memory` error. Will have to investigate this separately from this PR and keep `Install-PowerShellRemoting.ps1` for now. Fix #7119
PR Summary
Intent was to have the version of the PSSessionConfiguration name not include the
vfor the version string. Also, Preview releases should standardize onPowerShell.6-Previewinstead of clobberingPowerShell.6so that stable and preview can co-exist side-by-side.Need to verify on Win10 IoT if
Install-PowerShellRemoting.ps1is still needed anymore as it may be possible to runpwsh -c enable-psremotingfrom within Windows PowerShell Core removing the need for that script which duplicatesEnable-PSRemotingcapability.Update: Not able to get current master build working on Win10 IoT, getting
Invalid access to memoryerror. Will have to investigate this separately from this PR and keepInstall-PowerShellRemoting.ps1for now.Fix #7119
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests