From 4fbc1d5563fe7bfa51286e01a8077b0fb02ccfd7 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 27 Feb 2018 18:45:38 -0800 Subject: [PATCH 1/9] simplify productversion in key paths and UI --- assets/Product.wxs | 45 +++++++++++++++++----------------- tools/packaging/packaging.psm1 | 7 ++++++ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/assets/Product.wxs b/assets/Product.wxs index 0054862dcd5..a7c48f9ff88 100644 --- a/assets/Product.wxs +++ b/assets/Product.wxs @@ -9,18 +9,17 @@ - - + + - - + + + - - @@ -28,7 +27,7 @@ - + @@ -172,43 +171,43 @@ ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL - + - + - + - + - + - + - + - + - + - + - + - + @@ -219,14 +218,14 @@ - + diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index e12beba9522..49cb2d0cf5b 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -2280,7 +2280,13 @@ function New-MSIPackage $wixPaths = Get-WixPath $ProductSemanticVersion = Get-PackageSemanticVersion -Version $ProductVersion + $simpleProductVersion = '6' $isPreview = $ProductSemanticVersion -like '*-*' + if($isPreview) + { + $simpleProductVersion += '-preview' + } + $ProductVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $ProductVersion $assetsInSourcePath = Join-Path $ProductSourcePath 'assets' @@ -2301,6 +2307,7 @@ function New-MSIPackage [Environment]::SetEnvironmentVariable("ProductName", $ProductName, "Process") [Environment]::SetEnvironmentVariable("ProductCode", $ProductCode, "Process") [Environment]::SetEnvironmentVariable("ProductVersion", $ProductVersion, "Process") + [Environment]::SetEnvironmentVariable("SimpleProductVersion", $simpleProductVersion, "Process") [Environment]::SetEnvironmentVariable("ProductSemanticVersion", $ProductSemanticVersion, "Process") [Environment]::SetEnvironmentVariable("ProductVersionWithName", $productVersionWithName, "Process") if(!$isPreview) From 53e1d5ce1e9a07f616d189eea58b53390367af33 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 20 Mar 2018 16:21:58 -0700 Subject: [PATCH 2/9] set path dialog default --- tools/packaging/packaging.psm1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 49cb2d0cf5b..6773407b1a0 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -2312,11 +2312,13 @@ function New-MSIPackage [Environment]::SetEnvironmentVariable("ProductVersionWithName", $productVersionWithName, "Process") if(!$isPreview) { + [Environment]::SetEnvironmentVariable("AddPathDefault", '1', "Process") [Environment]::SetEnvironmentVariable("UpgradeCodeX64", '31ab5147-9a97-4452-8443-d9709f0516e1', "Process") [Environment]::SetEnvironmentVariable("UpgradeCodeX86", '1d00683b-0f84-4db8-a64f-2f98ad42fe06', "Process") } else { + [Environment]::SetEnvironmentVariable("AddPathDefault", '0', "Process") [Environment]::SetEnvironmentVariable("UpgradeCodeX64", '39243d76-adaf-42b1-94fb-16ecf83237c8', "Process") [Environment]::SetEnvironmentVariable("UpgradeCodeX86", '86abcfbd-1ccc-4a88-b8b2-0facfde29094', "Process") } From e1549d07bfa7e0d2bacca111f54ff9d368dfe188 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 20 Mar 2018 16:42:59 -0700 Subject: [PATCH 3/9] [Package] add dialog to determine if path should be set --- assets/Product.wxs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/assets/Product.wxs b/assets/Product.wxs index a7c48f9ff88..90f5153874c 100644 --- a/assets/Product.wxs +++ b/assets/Product.wxs @@ -21,6 +21,7 @@ + @@ -164,6 +165,7 @@ + ADD_PATH - - - + + + + From 5ecb99cf2b5a246c2b887313b1a0fd5c1fde1198 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 26 Mar 2018 18:36:20 -0700 Subject: [PATCH 4/9] [package] update condition --- assets/Product.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/Product.wxs b/assets/Product.wxs index 90f5153874c..27e13103c6d 100644 --- a/assets/Product.wxs +++ b/assets/Product.wxs @@ -165,7 +165,7 @@ - ADD_PATH + ADD_PATH=1 - - From 33165ef8b2c933076a8c410b9028f8843f2cdcad Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 28 Mar 2018 19:11:31 -0700 Subject: [PATCH 8/9] Address PR feedback --- test/packaging/windows/msi.tests.ps1 | 36 +++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index d9e751a9670..2f67d3a47c0 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -21,6 +21,7 @@ function Invoke-Msiexec { [Switch]$Uninstall, [Parameter(Mandatory)] + [ValidateScript({Test-Path -Path $_})] [String]$MsiPath, [Parameter(ParameterSetName = 'Install')] @@ -41,62 +42,63 @@ function Invoke-Msiexec { } } - $argumentList = "$switch $MsiPath /quiet /l*vx $script:msiLog $additionalOptions" + $argumentList = "$switch $MsiPath /quiet /l*vx $msiLog $additionalOptions" $msiExecProcess = Start-Process msiexec.exe -Wait -ArgumentList $argumentList -NoNewWindow -PassThru if ($msiExecProcess.ExitCode -ne 0) { $exitCode = $msiExecProcess.ExitCode - throw "$action MSI failed and returned error code $exitCode. MSI Log was uploaded as artifact." + throw "$action MSI failed and returned error code $exitCode." } } Describe -Name "Windows MSI" -Fixture { BeforeAll { - $script:msiX64Path = $env:PsMsiX64Path - $script:beforePath = @(([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | + $msiX64Path = $env:PsMsiX64Path + + # Get any existing powershell core in the path + $beforePath = @(([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | Where-Object {$_ -like '*files\powershell*'}) - $resolvedTestDrive = (Resolve-Path "Testdrive:\").providerPath - $script:msiLog = Join-Path -Path $resolvedTestDrive -ChildPath 'msilog.txt' + $msiLog = Join-Path -Path $TestDrive -ChildPath 'msilog.txt' - foreach ($pathPart in $script:beforePath) { + foreach ($pathPart in $beforePath) { Write-Warning "Found existing PowerShell path: $pathPart" } if (!(Test-Elevated)) { Write-Warning "Tests must be elevated" } - $script:uploadedLog = $false + $uploadedLog = $false } BeforeEach { $Error.Clear() } AfterEach { - if ($Error.Count -ne 0 -and !$script:uploadedLog) { + if ($Error.Count -ne 0 -and !$uploadedLog) { if ($env:APPVEYOR) { Push-AppveyorArtifact $msiLog } else { - Copy-Item -Path $script:msiLog -Destination $env:temp -Force + Copy-Item -Path $msiLog -Destination $env:temp -Force Write-Verbose "MSI log is at $env:temp\msilog.txt" -Verbose } - $script:uploadedLog = $true + $uploadedLog = $true } } Context "Add Path disabled" { - It "MSI should install without error" -Skip:(!(Test-Elevated) -or !$script:msiX64Path) { + It "MSI should install without error" -Skip:(!(Test-Elevated)) { { Invoke-MsiExec -Install -MsiPath $msiX64Path -Properties @{ADD_PATH = 0} } | Should -Not -Throw } - It -name "MSI should have not be updated path" -Skip:(!(Test-Elevated) -or !$script:msiX64Path) -test { + It "MSI should have not be updated path" -Skip:(!(Test-Elevated)) { $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | Where-Object {$_ -like '*files\powershell*' -and $_ -notin $beforePath} $psPath | Should -BeNullOrEmpty } - It "MSI should uninstall without error" -Skip:(!(Test-Elevated) -or !$script:msiX64Path) { + It "MSI should uninstall without error" -Skip:(!(Test-Elevated)) { { Invoke-MsiExec -Uninstall -MsiPath $msiX64Path } | Should -Not -Throw @@ -104,20 +106,20 @@ Describe -Name "Windows MSI" -Fixture { } Context "Add Path enabled" { - It "MSI should install without error" -Skip:(!(Test-Elevated) -or !$script:msiX64Path) { + It "MSI should install without error" -Skip:(!(Test-Elevated)) { { Invoke-MsiExec -Install -MsiPath $msiX64Path -Properties @{ADD_PATH = 1} } | Should -Not -Throw } - It -name "MSI should have updated path" -Skip:(!(Test-Elevated) -or !$script:msiX64Path) -test { + It "MSI should have updated path" -Skip:(!(Test-Elevated)) { $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | Where-Object {$_ -like '*files\powershell*' -and $_ -notin $beforePath} $psPath | Should -Not -BeNullOrEmpty } - It "MSI should uninstall without error" -Skip:(!(Test-Elevated) -or !$script:msiX64Path) { + It "MSI should uninstall without error" -Skip:(!(Test-Elevated)) { { Invoke-MsiExec -Uninstall -MsiPath $msiX64Path } | Should -Not -Throw From 9702cde43c150b81aec6319db14d3efb66fb8197 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 28 Mar 2018 19:11:55 -0700 Subject: [PATCH 9/9] [Package] Add counts to failure message fix typo --- tools/appveyor.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index b020649e7d9..d290e394a23 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -489,7 +489,7 @@ function Invoke-AppveyorFinish # the packaging tests find the MSI package using env:PSMsiX64Path $env:PSMsiX64Path = $artifacts | Where-Object { $_.EndsWith(".msi")} - # Install the lastest Pester and import it + # Install the latest Pester and import it Install-Module Pester -Force -SkipPublisherCheck Import-Module Pester -Force @@ -499,7 +499,7 @@ function Invoke-AppveyorFinish # fail the CI job if the tests failed, or nothing passed if($packagingTestResult.FailedCount -ne 0 -or !$packagingTestResult.PassedCount) { - throw "Packaging tests failed" + throw "Packaging tests failed ($($packagingTestResult.FailedCount) failed/$($packagingTestResult.PassedCount) passed)" } # only publish assembly nuget packages if it is a daily build and tests passed