Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -426,6 +419,7 @@ function New-TempFolder

return $tempFolder
}

function New-PSSignedBuildZip
{
param(
Expand All @@ -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
Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ param (
[string] $destination = "$env:WORKSPACE",

[ValidateSet("win7-x64", "win7-x86")]
[string]$Runtime = 'win10-x64',
[string]$Runtime = 'win7-x64',

[switch] $Wait,

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
}
Expand Down
12 changes: 6 additions & 6 deletions tools/releaseBuild/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
{
Expand All @@ -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"
},
{
Expand All @@ -88,7 +88,7 @@
],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "signed",
"BinariesExpected": 2
"ArtifactsExpected": 2
},
{
"Name": "win7-x86-package",
Expand All @@ -106,7 +106,7 @@
],
"DockerImageName": "ps-winsrvcore",
"BinaryBucket": "signed",
"BinariesExpected": 2
"ArtifactsExpected": 2
}
],
"Linux": [
Expand Down
2 changes: 1 addition & 1 deletion tools/releaseBuild/updateSigning.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $signingXml.SignConfigXML.job | ForEach-Object -Process {
{
$newSignType = $signTypes[$signType]
Write-Host "Updating $($_.src) to $newSignType"
$_.signType = $signTypes[$signType]
$_.signType = $newSignType
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/releaseBuild/vstsbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down