Minor refactoring of the release build scripts (#5632)

* Update release build

* Minor refactoring of the build script
This commit is contained in:
Dongbo Wang
2017-12-07 10:28:16 -08:00
committed by Travis Plunk
parent d4e802148c
commit 237ac0b740
5 changed files with 23 additions and 33 deletions
+8 -12
View File
@@ -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')
@@ -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
}
+6 -6
View File
@@ -49,8 +49,8 @@
".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "symbols",
"BinariesExpected": 1,
"BinaryBucket": "results",
"ArtifactsExpected": 1,
"VariableForExtractedBinariesPath": "Symbols_x64"
},
{
@@ -68,8 +68,8 @@
".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "symbols",
"BinariesExpected": 1,
"BinaryBucket": "results",
"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": [
+1 -1
View File
@@ -27,7 +27,7 @@ $signingXml.SignConfigXML.job | ForEach-Object -Process {
{
$newSignType = $signTypes[$signType]
Write-Host "Updating $($_.src) to $newSignType"
$_.signType = $signTypes[$signType]
$_.signType = $newSignType
}
}
}
+3 -3
View File
@@ -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
{