| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Maybe in another PR, or this one if you prefer, but it would be nice to also include the commit hash in the version info similar to what the clr does:
@ C:\Program Files\PowerShell\6.0.0-alpha.18 #293 PS> (dir .\System.Collections.dll).VersionInfo.ProductVersion 4.6.24705.01. Commit Hash: 4d1af962ca0fede10beb01d197367c2f90e92c97
Sorry, something went wrong.
There was a problem hiding this comment.
We should stop generating this file.
Sorry, something went wrong.
There was a problem hiding this comment.
I use the file in a test. Can we leave the file in repo but exclude it from release and publish?
Sorry, something went wrong.
There was a problem hiding this comment.
I don't see that file being used in any tests. i do see the string powershell.version in a test, but it sort of looks like a broken test to me.
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, it is a broken test and I added a fix in the PR.
Sorry, something went wrong.
There was a problem hiding this comment.
I see. It might be fine if you generated the file alongside other test artifacts, but I would not create it in $PSHome.
Sorry, something went wrong.
|
Jason Shirk (@lzybkr) Please clarify - currently git --git-dir=".git" describe --dirty --abbrev=60 return v6.0.0-alpha.18-60-gb09e9b570c757b9869f454276aa708eac307f5b1 where last part is a hash - do you want change formatting? v6.0.0-alpha.18-60 Commit Hash: gb09e9b570c757b9869f454276aa708eac307f5b1 |
Sorry, something went wrong.
|
I'm always a fan of better formatting. I suggest reading the documentation on describe, and we might consider using --long to always get the hash. Note that the g is not part of the hash, the format (with --long) is {tag}-{# of commits past tag}-g{hash of head}. |
Sorry, something went wrong.
|
We would parse the long formatted "git describe" and output in the desired form, ex.: |
Sorry, something went wrong.
|
Sounds good, though I would omit Commits if it is 0 (which will be the common case) and maybe use the phrase Additional Commits. |
Sorry, something went wrong.
|
Jason Shirk (@lzybkr) powershell.version is still used in Install-PowerShellRemoting.ps1. I see #2671 Should we fix the script here? If yes how can we fix this? Can we use there PSVersionTable.PSVersion? |
Sorry, something went wrong.
|
I added commit to fix #3739 |
Sorry, something went wrong.
|
Ilya (@iSazonov) thanks for fixing this. The hard-coded alpha string caused me huge effort in beta.1 release.
E:\PowerShell\.gitignore E:\PowerShell\.spelling E:\PowerShell\build.psm1 E:\PowerShell\build.sh E:\PowerShell\build.sh E:\PowerShell\src\powershell-native\Install-PowerShellRemoting.ps1 E:\PowerShell\src\powershell-unix\powershell-unix.csproj E:\PowerShell\src\powershell-win-core\powershell-win-core.csproj E:\PowerShell\src\System.Management.Automation\engine\PSVersionInfo.cs E:\PowerShell\src\System.Management.Automation\engine\PSVersionInfo.cs E:\PowerShell\test\powershell\Host\PSVersionTable.Tests.ps1 Some of those files are not updated in this PR. I think all appearances of powershell.version need to be reviewed and updated. |
Sorry, something went wrong.
|
This is the third conflict over the past 24 hours in build.psm1 😄 - I'll resolve tomorrow. I use powershell.version file in tests. So you might have to leave it in .gitignore I'm afraid that I won't be able to fix build.sh - can I delegate this anybody? |
Sorry, something went wrong.
There was a problem hiding this comment.
I'm not sure if this test is really useful. The content contained in powershell.version is guaranteed (by the build script) to be the same as in PSVersionInfo.generated.cs. The only possible failure I can see for this test is that we are running tests outside of where powershell was being built and thus powershell.vesrion is not available.
I believe it's more useful to check if both GitCommitId and PSVersion are nonempty and GitCommitId starts with PSVersion, or something like that.
Sorry, something went wrong.
There was a problem hiding this comment.
I tried to do the test with direct checking. It seems indirect validation will catch a bug too.
Fixed.
Sorry, something went wrong.
There was a problem hiding this comment.
This section should be moved to a separate function (better to make the function invisible from outside the module, but not required) so that Start-PSBuild won't keep expanding its size 😄
And also, move the call to that function after we check/do ResGen, so that the System.Management.Automation\gen folder is guaranteed to exist and the New-Item line can be removed.
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed.
Sorry, something went wrong.
|
Ilya (@iSazonov) Sorry that I have to change build.psm1 many times in the past day -- obviously our release process and test infrastructure are still far away from perfect 😦 As for build.sh, writing an equivalent bash script to do the same would be (1) not easy (2) hard to maintain 2 scripts for the same thing in future. One option is to extract this logic and write C# code to do it, like the existing ResGen and TypeCatalogGen. Then we can just call dotnet run from both powershell script and bash script. I'm not sure how many people are using build.sh honestly, and not really sure if this worth the effort. |
Sorry, something went wrong.
New commits were pushed.
|
appveyor temporaryly failed - I restart. |
Sorry, something went wrong.
|
I only fix but don't test 'Install-PowerShellRemoting.ps1'. |
Sorry, something went wrong.
|
Ilya (@iSazonov) - I ran across this relevant blog post which suggests an assembly attribute that we should also use. I think we can ignore the part in that blog post about finding the sha without git - we've been using git to do this already with no complaints. |
Sorry, something went wrong.
|
This is exactly what we use. Used to use GitVersion but now we're doing our own computation of build metadata: Get-FileVersionInfo P:\Repositories\BuildResults\Foo_Master_CompleteBuild\5.2.0.105\64BitDevelopment \Release\Foo.dll | ForEach-Object ProductVersion 5.2.0+105.Branch.master.Sha.31e45082cd1093133b6687dd172daa04b2a10940.Built.20170505T1739 And we do use git to get the SHA1, branch, etc. This is the function we use: function GetGitBuildMetadata([string]$SemVer, [string]$Revision) {
$timestamp = Get-Date -Format yyyyMMddTHHmm
$sha1 = git rev-parse --verify HEAD
$branch = git rev-parse --abbrev-ref HEAD
if (!$branch -or ($branch -eq 'HEAD')) {
if ($env:BUILD_SOURCEBRANCH) {
$branch = $env:BUILD_SOURCEBRANCH.Trim().Replace("refs/heads/", "").Replace("refs/","")
}
else {
$branch = 'unknown'
}
}
$prereleaseTag = if ($branch -notmatch 'master|release') { '-prerelease' } else { '' }
$metadata = "${SemVer}${prereleaseTag}+${Revision}.Branch.${branch}.Sha.${sha1}.Built.${timestamp}"
$metadata
} |
Sorry, something went wrong.
|
Closed the PR by accident 🤕 |
Sorry, something went wrong.
|
Dongbo Wang (@daxian-dbw) GetVersion isn't still ported 😕 GitTools/GitVersion#1175 |
Sorry, something went wrong.
|
Dongbo Wang (@daxian-dbw) I don't believe that tampering with version attributes of a file by itself is a security concern, since are many other ways of file tampering for malicious purposes. The way to guard against file tampering is with application white listing (and black listing for deprecated versions) where approved file versions are validated through file signing or catalog signing. |
Sorry, something went wrong.
|
I took the next step. Now all projects have common properties and assemblies get version from Start-PSBuild. |
Sorry, something went wrong.
|
This PR is getting too complex, and I think we'd better break it down.
We need to draw to a conclusion first to know what work items would be. Then we break down the work items so that they can be addressed in multiple PRs, instead of one PR with too many changes. I vote for NO.3 proposal. Jason Shirk (@lzybkr) Ilya (@iSazonov) please share your opinions. |
Sorry, something went wrong.
|
In brief I agree with NO.3 Perhaps we should create a Meta Issue to split the work on small pieces:
|
Sorry, something went wrong.
Generate C# file with a constant containing current version GitCommitId. Correct test for GitCommitId.
+ Format GitCommitId version string
Fix Install-PowerShellRemoting.ps1 Fix test Fix build.psm1
| if ($($matchVersion[1]) -ne "0") { | ||
| $Global:formattedVersion += " Additional commits: $($matchVersion[2])" | ||
| } | ||
| $Global:formattedVersion += " Commit Hash: $($matchVersion[3])" |
There was a problem hiding this comment.
James Truher (@JamesWTruher) the telemetry you're receiving is from Ilya (@iSazonov) running a build of PowerShell with this (not yet committed to master) change.
Sorry, something went wrong.
There was a problem hiding this comment.
the new version string format breaks our telemetry. I'm not really sure that the additional data provides more benefit. Is is possible to go back to the original format?
Sorry, something went wrong.
| Stop-Process -Verbose | ||
| } | ||
|
|
||
| # Generate version constant for $PSVersionTable |
There was a problem hiding this comment.
This change in formatting breaks our telemetry
Sorry, something went wrong.
|
The PR shouldn't be merged - it is only for tracking multiple changes. We split the PR on some light-weight PRs. Jason Shirk (@lzybkr) Dongbo Wang (@daxian-dbw) Could you please comment? How can we resolve the conflict with telemetry? |
Sorry, something went wrong.
|
The work is covered b #4863. So close this PR. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Resolve #3676
Fix #3739
Generate C# file with a constant containing current version GitCommitId.
Correct a test for GitCommitId.