From 41be404e3cc4b0febd8e51b1011facb0944919e7 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 5 Dec 2017 10:03:09 -0800 Subject: [PATCH 1/3] Update release build --- .../PowerShellPackage.ps1 | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 index 152df1330d3..1b3e0688aba 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 @@ -10,7 +10,7 @@ param ( [string] $destination = "$env:WORKSPACE", [ValidateSet("win7-x64", "win7-x86")] - [string]$Runtime = 'win10-x64', + [string]$Runtime = 'win7-x64', [switch] $Wait, @@ -80,8 +80,7 @@ try{ else { Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -verbose - $buildParams = @{} - $buildParams['CrossGen'] = $true + $buildParams = @{'CrossGen'=$true} if(!$Symbols.IsPresent) { $buildParams['PSModuleRestore'] = $true @@ -90,12 +89,7 @@ try{ Start-PSBuild -Clean -Runtime $Runtime -Configuration Release @releaseTagParam @buildParams } - $pspackageParams = @{'Type'='msi'} - if ($Runtime -ne 'win10-x64') - { - $pspackageParams += @{'WindowsRuntime'=$Runtime} - } - + $pspackageParams = @{'Type'='msi'; 'WindowsRuntime'=$Runtime} if(!$Symbols.IsPresent) { Write-Verbose "Starting powershell packaging(msi)..." -verbose @@ -112,8 +106,8 @@ try{ Write-Verbose "Exporting packages ..." -verbose - Get-ChildItem $location\*.msi,$location\*.zip | Select-Object -ExpandProperty FullName | ForEach-Object { - $file = $_ + Get-ChildItem $location\*.msi,$location\*.zip | ForEach-Object { + $file = $_.FullName Write-Verbose "Copying $file to $destination" -verbose Copy-Item -Path $file -Destination "$destination\" -Force } From 4b5ba7edabb6a4504ca1c43f8ba4a6b38a971828 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 5 Dec 2017 15:12:20 -0800 Subject: [PATCH 2/3] Minor refactoring of the build script --- tools/packaging/packaging.psm1 | 20 ++++++++------------ tools/releaseBuild/build.json | 8 ++++---- tools/releaseBuild/updateSigning.ps1 | 2 +- tools/releaseBuild/vstsbuild.ps1 | 6 +++--- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 05cf70a59a4..bbcd0f43abd 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -170,13 +170,6 @@ function Start-PSPackage { # Copy file which go into symbols.zip Get-ChildItem -Path $buildSource | Where-Object {$toExclude -inotcontains $_.Name} | Copy-Item -Destination $symbolsSource -Recurse - # Exclude Pester until we move it to PSModuleRestore - $pesterPath = Join-Path -Path $symbolsSource -ChildPath 'Modules\Pester' - if(Test-Path -Path $pesterPath) - { - Remove-Item -Path $pesterPath -Recurse -Force -ErrorAction SilentlyContinue - } - # Zip symbols.zip to the root package $zipSource = Join-Path $symbolsSource -ChildPath '*' $zipPath = Join-Path -Path $Source -ChildPath 'symbols.zip' @@ -426,6 +419,7 @@ function New-TempFolder return $tempFolder } + function New-PSSignedBuildZip { param( @@ -441,17 +435,17 @@ function New-PSSignedBuildZip # Replace unsigned binaries with signed $signedFilesFilter = Join-Path -Path $signedFilesPath -ChildPath '*' - Get-ChildItem -path $signedFilesFilter -Recurse | Select-Object -ExpandProperty FullName | Foreach-Object -Process { + Get-ChildItem -path $signedFilesFilter -Recurse -File | Select-Object -ExpandProperty FullName | Foreach-Object -Process { $relativePath = $_.Replace($signedFilesPath,'') $destination = Join-Path -Path $buildPath -ChildPath $relativePath log "replacing $destination with $_" Copy-Item -Path $_ -Destination $destination -force } - # Remove `signed` folder in buildpath now that signed binaries are copied - if (Test-Path $BuildPath\signed) + # Remove '$signedFilesPath' now that signed binaries are copied + if (Test-Path $signedFilesPath) { - Remove-Item -Recurse -Force -Path $BuildPath\signed + Remove-Item -Recurse -Force -Path $signedFilesPath } $name = split-path -Path $BuildPath -Leaf @@ -477,10 +471,12 @@ function Expand-PSSignedBuild ) $psModulePath = Split-Path -path $PSScriptRoot - # Expand unsigned build + # Expand signed build $buildPath = Join-Path -path $psModulePath -childpath 'ExpandedBuild' $null = New-Item -path $buildPath -itemtype Directory -force Expand-Archive -path $BuildZip -destinationpath $buildPath -Force + # Remove the zip file that contains only those files from the parent folder of 'publish'. + # That zip file is used for compliance scan. Remove-Item -Path (Join-Path -Path $buildPath -ChildPath '*.zip') -Recurse $windowsExecutablePath = (Join-Path $buildPath -ChildPath 'pwsh.exe') diff --git a/tools/releaseBuild/build.json b/tools/releaseBuild/build.json index 7d118122a73..abf7cfc263e 100644 --- a/tools/releaseBuild/build.json +++ b/tools/releaseBuild/build.json @@ -50,7 +50,7 @@ ], "DockerImageName": "ps-winsrvcore", "BinaryBucket": "symbols", - "BinariesExpected": 1, + "ArtifactsExpected": 1, "VariableForExtractedBinariesPath": "Symbols_x64" }, { @@ -69,7 +69,7 @@ ], "DockerImageName": "ps-winsrvcore", "BinaryBucket": "symbols", - "BinariesExpected": 1, + "ArtifactsExpected": 1, "VariableForExtractedBinariesPath": "Symbols_x86" }, { @@ -88,7 +88,7 @@ ], "DockerImageName": "ps-winsrvcore", "BinaryBucket": "signed", - "BinariesExpected": 2 + "ArtifactsExpected": 2 }, { "Name": "win7-x86-package", @@ -106,7 +106,7 @@ ], "DockerImageName": "ps-winsrvcore", "BinaryBucket": "signed", - "BinariesExpected": 2 + "ArtifactsExpected": 2 } ], "Linux": [ diff --git a/tools/releaseBuild/updateSigning.ps1 b/tools/releaseBuild/updateSigning.ps1 index 185e32d7510..6cf637cb5b2 100644 --- a/tools/releaseBuild/updateSigning.ps1 +++ b/tools/releaseBuild/updateSigning.ps1 @@ -27,7 +27,7 @@ $signingXml.SignConfigXML.job | ForEach-Object -Process { { $newSignType = $signTypes[$signType] Write-Host "Updating $($_.src) to $newSignType" - $_.signType = $signTypes[$signType] + $_.signType = $newSignType } } } diff --git a/tools/releaseBuild/vstsbuild.ps1 b/tools/releaseBuild/vstsbuild.ps1 index eec59a472bc..e4a1e47f3f9 100644 --- a/tools/releaseBuild/vstsbuild.ps1 +++ b/tools/releaseBuild/vstsbuild.ps1 @@ -58,10 +58,10 @@ End { # Use temp as destination if not running in VSTS $destFolder = $env:temp - if($env:Build_ArtifactStagingDirectory) + if($env:BUILD_STAGINGDIRECTORY) { # Use artifact staging if running in VSTS - $destFolder = $env:Build_ArtifactStagingDirectory + $destFolder = $env:BUILD_STAGINGDIRECTORY } $BuildPackagePath = New-PSSignedBuildZip -BuildPath $BuildPath -SignedFilesPath $SignedFilesPath -DestinationFolder $destFolder @@ -113,7 +113,7 @@ End { BuildPackageName = $buildPackageName } - Invoke-Build -RepoPath $resolvedRepoRoot -BuildJsonPath './tools/releaseBuild/build.json' -Name $Name -Parameters $buildParameters -AdditionalFiles $AdditionalFiles + Invoke-Build -RepoPath $resolvedRepoRoot -BuildJsonPath './tools/releaseBuild/build.json' -Name $Name -Parameters $buildParameters -AdditionalFiles $AdditionalFiles } catch { From e04cdeb7762d43197d2bdad2b88c215a5d7753b0 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 5 Dec 2017 21:46:48 -0800 Subject: [PATCH 3/3] Address comment --- tools/releaseBuild/build.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/releaseBuild/build.json b/tools/releaseBuild/build.json index abf7cfc263e..cdeddbc0e37 100644 --- a/tools/releaseBuild/build.json +++ b/tools/releaseBuild/build.json @@ -49,7 +49,7 @@ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1" ], "DockerImageName": "ps-winsrvcore", - "BinaryBucket": "symbols", + "BinaryBucket": "results", "ArtifactsExpected": 1, "VariableForExtractedBinariesPath": "Symbols_x64" }, @@ -68,7 +68,7 @@ ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1" ], "DockerImageName": "ps-winsrvcore", - "BinaryBucket": "symbols", + "BinaryBucket": "results", "ArtifactsExpected": 1, "VariableForExtractedBinariesPath": "Symbols_x86" },