Build self-contained minimal size package for Guest Config team (#14976)
This commit is contained in:
parent
c9d65061af
commit
b63639656d
59
build.psm1
59
build.psm1
|
@ -271,6 +271,7 @@ function Start-PSBuild {
|
|||
[Parameter(ParameterSetName="Default")]
|
||||
[switch]$NoPSModuleRestore,
|
||||
[switch]$CI,
|
||||
[switch]$ForMinimalSize,
|
||||
|
||||
# Skips the step where the pwsh that's been built is used to create a configuration
|
||||
# Useful when changing parsing/compilation, since bugs there can mean we can't get past this step
|
||||
|
@ -321,6 +322,17 @@ function Start-PSBuild {
|
|||
if ("win-arm","win-arm64" -contains $Runtime -and -not $environment.IsWindows) {
|
||||
throw "Cross compiling for win-arm or win-arm64 is only supported on Windows environment"
|
||||
}
|
||||
|
||||
if ($ForMinimalSize) {
|
||||
if ($CrossGen) {
|
||||
throw "Build for the minimal size requires the minimal disk footprint, so `CrossGen` is not allowed"
|
||||
}
|
||||
|
||||
if ($Runtime -and "linux-x64", "win7-x64", "osx-x64" -notcontains $Runtime) {
|
||||
throw "Build for the minimal size is enabled only for following runtimes: 'linux-x64', 'win7-x64', 'osx-x64'"
|
||||
}
|
||||
}
|
||||
|
||||
function Stop-DevPowerShell {
|
||||
Get-Process pwsh* |
|
||||
Where-Object {
|
||||
|
@ -390,6 +402,7 @@ Fix steps:
|
|||
Verbose=$true
|
||||
SMAOnly=[bool]$SMAOnly
|
||||
PSModuleRestore=$PSModuleRestore
|
||||
ForMinimalSize=$ForMinimalSize
|
||||
}
|
||||
$script:Options = New-PSOptions @OptionsArguments
|
||||
|
||||
|
@ -414,7 +427,7 @@ Fix steps:
|
|||
# Framework Dependent builds do not support ReadyToRun as it needs a specific runtime to optimize for.
|
||||
# The property is set in Powershell.Common.props file.
|
||||
# We override the property through the build command line.
|
||||
if($Options.Runtime -like 'fxdependent*') {
|
||||
if($Options.Runtime -like 'fxdependent*' -or $ForMinimalSize) {
|
||||
$Arguments += "/property:PublishReadyToRun=false"
|
||||
}
|
||||
|
||||
|
@ -467,18 +480,21 @@ Fix steps:
|
|||
Push-Location $Options.Top
|
||||
|
||||
if ($Options.Runtime -notlike 'fxdependent*') {
|
||||
if ($Options.Runtime -like 'win-arm*') {
|
||||
$Arguments += "/property:SDKToUse=Microsoft.NET.Sdk"
|
||||
} else {
|
||||
$Arguments += "/property:SDKToUse=Microsoft.NET.Sdk.WindowsDesktop"
|
||||
$sdkToUse = 'Microsoft.NET.Sdk'
|
||||
if ($Options.Runtime -like 'win7-*' -and !$ForMinimalSize) {
|
||||
## WPF/WinForm and the PowerShell GraphicalHost assemblies are included
|
||||
## when 'Microsoft.NET.Sdk.WindowsDesktop' is used.
|
||||
$sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop'
|
||||
}
|
||||
|
||||
$Arguments += "/property:SDKToUse=$sdkToUse"
|
||||
|
||||
Write-Log -message "Run dotnet $Arguments from $PWD"
|
||||
Start-NativeExecution { dotnet $Arguments }
|
||||
Write-Log -message "PowerShell output: $($Options.Output)"
|
||||
|
||||
if ($CrossGen) {
|
||||
## fxdependent package cannot be CrossGen'ed
|
||||
# fxdependent package cannot be CrossGen'ed
|
||||
Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime
|
||||
Write-Log -message "pwsh.exe with ngen binaries is available at: $($Options.Output)"
|
||||
}
|
||||
|
@ -651,14 +667,14 @@ function Restore-PSPackage
|
|||
|
||||
if ($Force -or (-not (Test-Path "$($Options.Top)/obj/project.assets.json"))) {
|
||||
|
||||
$sdkToUse = if (($Options.Runtime -eq 'fxdependent-win-desktop' -or $Options.Runtime -like 'win*')) { # this is fxd or some windows runtime
|
||||
if ($Options.Runtime -like 'win-arm*') {
|
||||
'Microsoft.NET.Sdk'
|
||||
} else {
|
||||
'Microsoft.NET.Sdk.WindowsDesktop'
|
||||
if ($Options.Runtime -eq 'fxdependent-win-desktop') {
|
||||
$sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop'
|
||||
}
|
||||
else {
|
||||
$sdkToUse = 'Microsoft.NET.Sdk'
|
||||
if ($Options.Runtime -like 'win7-*' -and !$Options.ForMinimalSize) {
|
||||
$sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop'
|
||||
}
|
||||
} else {
|
||||
'Microsoft.NET.Sdk'
|
||||
}
|
||||
|
||||
if ($PSModule.IsPresent) {
|
||||
|
@ -784,7 +800,9 @@ function New-PSOptions {
|
|||
|
||||
[switch]$SMAOnly,
|
||||
|
||||
[switch]$PSModuleRestore
|
||||
[switch]$PSModuleRestore,
|
||||
|
||||
[switch]$ForMinimalSize
|
||||
)
|
||||
|
||||
# Add .NET CLI tools to PATH
|
||||
|
@ -883,7 +901,8 @@ function New-PSOptions {
|
|||
-Configuration $Configuration `
|
||||
-PSModuleRestore $PSModuleRestore.IsPresent `
|
||||
-Framework $Framework `
|
||||
-Output $Output
|
||||
-Output $Output `
|
||||
-ForMinimalSize $ForMinimalSize
|
||||
}
|
||||
|
||||
# Get the Options of the last build
|
||||
|
@ -3018,7 +3037,8 @@ function Restore-PSOptions {
|
|||
-Configuration $options.Configuration `
|
||||
-PSModuleRestore $options.PSModuleRestore `
|
||||
-Framework $options.Framework `
|
||||
-Output $options.Output
|
||||
-Output $options.Output `
|
||||
-ForMinimalSize $options.ForMinimalSize
|
||||
|
||||
Set-PSOptions -Options $newOptions
|
||||
}
|
||||
|
@ -3055,7 +3075,11 @@ function New-PSOptionsObject
|
|||
|
||||
[Parameter(Mandatory)]
|
||||
[String]
|
||||
$Output
|
||||
$Output,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[Bool]
|
||||
$ForMinimalSize
|
||||
)
|
||||
|
||||
return @{
|
||||
|
@ -3067,6 +3091,7 @@ function New-PSOptionsObject
|
|||
Output = $Output
|
||||
CrossGen = $CrossGen
|
||||
PSModuleRestore = $PSModuleRestore
|
||||
ForMinimalSize = $ForMinimalSize
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "6.0.100-preview.1.21104.4"
|
||||
"version": "6.0.100-preview.1.21103.13"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ function Start-PSPackage {
|
|||
[string]$Name = "powershell",
|
||||
|
||||
# Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported
|
||||
[ValidateSet("msix", "deb", "osxpkg", "rpm", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop")]
|
||||
[ValidateSet("msix", "deb", "osxpkg", "rpm", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop", "min-size")]
|
||||
[string[]]$Type,
|
||||
|
||||
# Generate windows downlevel package
|
||||
|
@ -47,7 +47,7 @@ function Start-PSPackage {
|
|||
)
|
||||
|
||||
DynamicParam {
|
||||
if ("zip" -eq $Type -or "fxdependent" -eq $Type -or "fxdependent-win-desktop" -eq $Type) {
|
||||
if ($Type -in ('zip', 'min-size') -or $Type -like 'fxdependent*') {
|
||||
# Add a dynamic parameter '-IncludeSymbols' when the specified package type is 'zip' only.
|
||||
# The '-IncludeSymbols' parameter can be used to indicate that the package should only contain powershell binaries and symbols.
|
||||
$ParameterAttr = New-Object "System.Management.Automation.ParameterAttribute"
|
||||
|
@ -105,8 +105,9 @@ function Start-PSPackage {
|
|||
$actualParams = @()
|
||||
|
||||
$crossGenCorrect = $false
|
||||
if ($Runtime -match "arm") {
|
||||
# crossgen doesn't support arm32/64
|
||||
if ($Runtime -match "arm" -or $Type -eq 'min-size') {
|
||||
## crossgen doesn't support arm32/64;
|
||||
## For the min-size package, we intentionally avoid crossgen.
|
||||
$crossGenCorrect = $true
|
||||
}
|
||||
elseif ($Script:Options.CrossGen) {
|
||||
|
@ -299,7 +300,37 @@ function Start-PSPackage {
|
|||
New-PdbZipPackage @Arguments
|
||||
}
|
||||
}
|
||||
"min-size" {
|
||||
# Remove symbol files, xml document files.
|
||||
Remove-Item "$Source\*.pdb", "$Source\*.xml" -Force
|
||||
|
||||
# Add suffix '-gc' because this package is for the Guest Config team.
|
||||
if ($Environment.IsWindows) {
|
||||
$Arguments = @{
|
||||
PackageNameSuffix = "$NameSuffix-gc"
|
||||
PackageSourcePath = $Source
|
||||
PackageVersion = $Version
|
||||
Force = $Force
|
||||
}
|
||||
|
||||
if ($PSCmdlet.ShouldProcess("Create Zip Package")) {
|
||||
New-ZipPackage @Arguments
|
||||
}
|
||||
}
|
||||
elseif ($Environment.IsLinux) {
|
||||
$Arguments = @{
|
||||
PackageSourcePath = $Source
|
||||
Name = $Name
|
||||
PackageNameSuffix = 'gc'
|
||||
Version = $Version
|
||||
Force = $Force
|
||||
}
|
||||
|
||||
if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
|
||||
New-TarballPackage @Arguments
|
||||
}
|
||||
}
|
||||
}
|
||||
{ $_ -like "fxdependent*" } {
|
||||
## Remove PDBs from package to reduce size.
|
||||
if(-not $IncludeSymbols.IsPresent) {
|
||||
|
@ -317,7 +348,7 @@ function Start-PSPackage {
|
|||
if ($PSCmdlet.ShouldProcess("Create Zip Package")) {
|
||||
New-ZipPackage @Arguments
|
||||
}
|
||||
} elseif ($IsLinux) {
|
||||
} elseif ($Environment.IsLinux) {
|
||||
$Arguments = @{
|
||||
PackageSourcePath = $Source
|
||||
Name = $Name
|
||||
|
|
|
@ -18,6 +18,7 @@ param (
|
|||
[switch]$TarX64,
|
||||
[switch]$TarArm,
|
||||
[switch]$TarArm64,
|
||||
[switch]$TarMinSize,
|
||||
[switch]$FxDependent,
|
||||
[switch]$Alpine
|
||||
)
|
||||
|
@ -66,6 +67,7 @@ function BuildPackages {
|
|||
}
|
||||
|
||||
Start-PSBuild @buildParams @releaseTagParam
|
||||
$options = Get-PSOptions
|
||||
|
||||
if ($FxDependent) {
|
||||
Start-PSPackage -Type 'fxdependent' @releaseTagParam -LTS:$LTS
|
||||
|
@ -77,6 +79,22 @@ function BuildPackages {
|
|||
|
||||
if ($TarX64) { Start-PSPackage -Type tar @releaseTagParam -LTS:$LTS }
|
||||
|
||||
if ($TarMinSize) {
|
||||
Write-Verbose -Verbose "---- Min-Size ----"
|
||||
Write-Verbose -Verbose "options.Output: $($options.Output)"
|
||||
Write-Verbose -Verbose "options.Top $($options.Top)"
|
||||
|
||||
$binDir = Join-Path -Path $options.Top -ChildPath 'bin'
|
||||
Write-Verbose -Verbose "Remove $binDir, to get a clean build for min-size package"
|
||||
Remove-Item -Path $binDir -Recurse -Force
|
||||
|
||||
## Build 'min-size' and create 'tar.gz' package for it.
|
||||
$buildParams['Crossgen'] = $false
|
||||
$buildParams['ForMinimalSize'] = $true
|
||||
Start-PSBuild @buildParams @releaseTagParam
|
||||
Start-PSPackage -Type min-size @releaseTagParam -LTS:$LTS
|
||||
}
|
||||
|
||||
if ($TarArm) {
|
||||
## Build 'linux-arm' and create 'tar.gz' package for it.
|
||||
## Note that 'linux-arm' can only be built on Ubuntu environment.
|
||||
|
|
|
@ -12,20 +12,22 @@ param (
|
|||
[string] $destination = "$env:WORKSPACE",
|
||||
|
||||
[ValidateSet("win7-x64", "win7-x86", "win-arm", "win-arm64", "fxdependent", "fxdependent-win-desktop")]
|
||||
[string]$Runtime = 'win7-x64',
|
||||
[string] $Runtime = 'win7-x64',
|
||||
|
||||
[switch] $ForMinimalSize,
|
||||
|
||||
[switch] $Wait,
|
||||
|
||||
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d+)?)?$")]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$ReleaseTag,
|
||||
[string] $ReleaseTag,
|
||||
|
||||
[Parameter(Mandatory,ParameterSetName='IncludeSymbols')]
|
||||
[switch] $Symbols,
|
||||
|
||||
[Parameter(Mandatory,ParameterSetName='packageSigned')]
|
||||
[ValidatePattern("-signed.zip$")]
|
||||
[string]$BuildZip,
|
||||
[string] $BuildZip,
|
||||
|
||||
[Parameter(Mandatory,ParameterSetName='ComponentRegistration')]
|
||||
[switch] $ComponentRegistration
|
||||
|
@ -63,7 +65,8 @@ if ($memoryMB -lt $requiredMemoryMB)
|
|||
}
|
||||
Write-Verbose "Running with $memoryMB MB memory." -Verbose
|
||||
|
||||
try{
|
||||
try
|
||||
{
|
||||
Set-Location $location
|
||||
|
||||
Import-Module "$location\build.psm1" -Force
|
||||
|
@ -93,9 +96,12 @@ try{
|
|||
else
|
||||
{
|
||||
Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -Verbose
|
||||
$buildParams = @{'CrossGen'= $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*"}
|
||||
$buildParams = @{
|
||||
CrossGen = !$ForMinimalSize -and $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*"
|
||||
ForMinimalSize = $ForMinimalSize
|
||||
}
|
||||
|
||||
if($Symbols.IsPresent)
|
||||
if($Symbols)
|
||||
{
|
||||
$buildParams['NoPSModuleRestore'] = $true
|
||||
}
|
||||
|
@ -107,58 +113,62 @@ try{
|
|||
Start-PSBuild -Clean -Runtime $Runtime -Configuration Release @releaseTagParam @buildParams
|
||||
}
|
||||
|
||||
if ($Runtime -eq 'fxdependent')
|
||||
if ($ComponentRegistration)
|
||||
{
|
||||
$pspackageParams = @{'Type'='fxdependent'}
|
||||
Write-Verbose "Exporting project.assets files ..." -Verbose
|
||||
|
||||
$projectAssetsCounter = 1
|
||||
$projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets'
|
||||
$projectAssetsZip = Join-Path -Path $destination -ChildPath 'windowsProjectAssetssymbols.zip'
|
||||
Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object {
|
||||
$subfolder = $_.FullName.Replace($location,'')
|
||||
$subfolder.Replace('project.assets.json','')
|
||||
$itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $subfolder
|
||||
New-Item -Path $itemDestination -ItemType Directory -Force > $null
|
||||
$file = $_.FullName
|
||||
Write-Verbose "Copying $file to $itemDestination" -Verbose
|
||||
Copy-Item -Path $file -Destination "$itemDestination\" -Force
|
||||
$projectAssetsCounter++
|
||||
}
|
||||
|
||||
Compress-Archive -Path $projectAssetsFolder -DestinationPath $projectAssetsZip
|
||||
Remove-Item -Path $projectAssetsFolder -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
return
|
||||
}
|
||||
elseif ($Runtime -eq 'fxdependent-win-desktop')
|
||||
|
||||
if ($Runtime -like 'fxdependent*')
|
||||
{
|
||||
$pspackageParams = @{'Type'='fxdependent-win-desktop'}
|
||||
$pspackageParams = @{'Type' = $Runtime}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pspackageParams = @{'Type'='msi'; 'WindowsRuntime'=$Runtime}
|
||||
## Set the default package type.
|
||||
$pspackageParams = @{'Type' = 'msi'; 'WindowsRuntime' = $Runtime}
|
||||
if ($ForMinimalSize)
|
||||
{
|
||||
## Special case for the minimal size self-contained package.
|
||||
$pspackageParams['Type'] = 'min-size'
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ComponentRegistration.IsPresent -and !$Symbols.IsPresent -and $Runtime -notmatch 'arm' -and $Runtime -notlike 'fxdependent*')
|
||||
if (!$Symbols -and $Runtime -notlike 'fxdependent*' -and !$ForMinimalSize)
|
||||
{
|
||||
Write-Verbose "Starting powershell packaging(msi)..." -Verbose
|
||||
Start-PSPackage @pspackageParams @releaseTagParam
|
||||
}
|
||||
if ($Runtime -notmatch 'arm')
|
||||
{
|
||||
Write-Verbose "Starting powershell packaging(msi)..." -Verbose
|
||||
Start-PSPackage @pspackageParams @releaseTagParam
|
||||
}
|
||||
|
||||
if (!$ComponentRegistration.IsPresent -and !$Symbols.IsPresent -and $Runtime -notin 'fxdependent', 'fxdependent-win-desktop')
|
||||
{
|
||||
$pspackageParams['Type']='msix'
|
||||
$pspackageParams['WindowsRuntime']=$Runtime
|
||||
Write-Verbose "Starting powershell packaging(msix)..." -Verbose
|
||||
Start-PSPackage @pspackageParams @releaseTagParam
|
||||
}
|
||||
|
||||
if (!$ComponentRegistration.IsPresent -and $Runtime -notlike 'fxdependent*')
|
||||
{
|
||||
if (!$Symbols.IsPresent) {
|
||||
$pspackageParams['Type'] = 'zip-pdb'
|
||||
Write-Verbose "Starting powershell symbols packaging(zip)..." -Verbose
|
||||
Start-PSPackage @pspackageParams @releaseTagParam
|
||||
}
|
||||
|
||||
$pspackageParams['Type']='zip'
|
||||
$pspackageParams['IncludeSymbols']=$Symbols.IsPresent
|
||||
Write-Verbose "Starting powershell packaging(zip)..." -Verbose
|
||||
Start-PSPackage @pspackageParams @releaseTagParam
|
||||
|
||||
Write-Verbose "Exporting packages ..." -Verbose
|
||||
|
||||
Get-ChildItem $location\*.msi,$location\*.zip,$location\*.wixpdb,$location\*.msix,$location\*.exe | ForEach-Object {
|
||||
$file = $_.FullName
|
||||
Write-Verbose "Copying $file to $destination" -Verbose
|
||||
Copy-Item -Path $file -Destination "$destination\" -Force
|
||||
}
|
||||
}
|
||||
elseif (!$ComponentRegistration.IsPresent -and $Runtime -like 'fxdependent*')
|
||||
if ($Runtime -like 'fxdependent*' -or $ForMinimalSize)
|
||||
{
|
||||
## Add symbols for just like zip package.
|
||||
$pspackageParams['IncludeSymbols']=$Symbols.IsPresent
|
||||
$pspackageParams['IncludeSymbols']=$Symbols
|
||||
Start-PSPackage @pspackageParams @releaseTagParam
|
||||
|
||||
## Copy the fxdependent Zip package to destination.
|
||||
|
@ -170,31 +180,30 @@ try{
|
|||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose "Exporting project.assets files ..." -Verbose
|
||||
|
||||
$projectAssetsCounter = 1
|
||||
$projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets'
|
||||
$projectAssetsZip = Join-Path -Path $destination -ChildPath 'windowsProjectAssetssymbols.zip'
|
||||
Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object {
|
||||
$subfolder = $_.FullName.Replace($location,'')
|
||||
$subfolder.Replace('project.assets.json','')
|
||||
$itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $subfolder
|
||||
New-Item -Path $itemDestination -ItemType Directory -Force
|
||||
$file = $_.FullName
|
||||
Write-Verbose "Copying $file to $itemDestination" -Verbose
|
||||
Copy-Item -Path $file -Destination "$itemDestination\" -Force
|
||||
$projectAssetsCounter++
|
||||
if (!$Symbols) {
|
||||
$pspackageParams['Type'] = 'zip-pdb'
|
||||
Write-Verbose "Starting powershell symbols packaging(zip)..." -Verbose
|
||||
Start-PSPackage @pspackageParams @releaseTagParam
|
||||
}
|
||||
|
||||
Compress-Archive -Path $projectAssetsFolder -DestinationPath $projectAssetsZip
|
||||
Remove-Item -Path $projectAssetsFolder -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
$pspackageParams['Type']='zip'
|
||||
$pspackageParams['IncludeSymbols']=$Symbols
|
||||
Write-Verbose "Starting powershell packaging(zip)..." -Verbose
|
||||
Start-PSPackage @pspackageParams @releaseTagParam
|
||||
|
||||
Write-Verbose "Exporting packages ..." -Verbose
|
||||
|
||||
Get-ChildItem $location\*.msi,$location\*.zip,$location\*.wixpdb,$location\*.msix,$location\*.exe | ForEach-Object {
|
||||
$file = $_.FullName
|
||||
Write-Verbose "Copying $file to $destination" -Verbose
|
||||
Copy-Item -Path $file -Destination "$destination\" -Force
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Write-Verbose "Beginning build clean-up..." -Verbose
|
||||
if ($Wait.IsPresent)
|
||||
if ($Wait)
|
||||
{
|
||||
$path = Join-Path $PSScriptRoot -ChildPath 'delete-to-continue.txt'
|
||||
$null = New-Item -Path $path -ItemType File
|
||||
|
|
|
@ -76,6 +76,11 @@ stages:
|
|||
parameters:
|
||||
Architecture: x64
|
||||
|
||||
- template: templates/windows-hosted-build.yml
|
||||
parameters:
|
||||
Architecture: x64
|
||||
BuildConfiguration: minSize
|
||||
|
||||
- template: templates/windows-hosted-build.yml
|
||||
parameters:
|
||||
Architecture: x86
|
||||
|
@ -99,42 +104,49 @@ stages:
|
|||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
Architecture: x64
|
||||
parentJob: build_windows_x64
|
||||
parentJob: build_windows_x64_release
|
||||
|
||||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
Architecture: x64
|
||||
BuildConfiguration: minSize
|
||||
parentJob: build_windows_x64_minSize
|
||||
|
||||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
Architecture: x86
|
||||
parentJob: build_windows_x86
|
||||
parentJob: build_windows_x86_release
|
||||
|
||||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
Architecture: arm
|
||||
parentJob: build_windows_arm
|
||||
parentJob: build_windows_arm_release
|
||||
|
||||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
Architecture: arm64
|
||||
parentJob: build_windows_arm64
|
||||
parentJob: build_windows_arm64_release
|
||||
|
||||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
Architecture: fxdependent
|
||||
parentJob: build_windows_fxdependent
|
||||
parentJob: build_windows_fxdependent_release
|
||||
|
||||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
Architecture: fxdependentWinDesktop
|
||||
parentJob: build_windows_fxdependentWinDesktop
|
||||
parentJob: build_windows_fxdependentWinDesktop_release
|
||||
|
||||
- template: templates/windows-package-signing.yml
|
||||
parameters:
|
||||
parentJobs:
|
||||
- sign_windows_x64
|
||||
- sign_windows_x86
|
||||
- sign_windows_arm
|
||||
- sign_windows_arm64
|
||||
- sign_windows_fxdependent
|
||||
- sign_windows_fxdependentWinDesktop
|
||||
- sign_windows_x64_release
|
||||
- sign_windows_x64_minSize
|
||||
- sign_windows_x86_release
|
||||
- sign_windows_arm_release
|
||||
- sign_windows_arm64_release
|
||||
- sign_windows_fxdependent_release
|
||||
- sign_windows_fxdependentWinDesktop_release
|
||||
|
||||
- stage: compliance
|
||||
dependsOn: ['windows']
|
||||
|
|
|
@ -95,7 +95,7 @@ jobs:
|
|||
downloadType: specific
|
||||
itemPattern: '**/*.deb'
|
||||
downloadPath: '$(System.ArtifactsDirectory)\finished'
|
||||
condition: and(eq(variables['buildName'], 'DEB'),succeeded())
|
||||
condition: and(eq(variables['buildName'], 'DEB'), succeeded())
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download tar.gz Artifacts copy'
|
||||
|
@ -104,13 +104,44 @@ jobs:
|
|||
itemPattern: '**/*.tar.gz'
|
||||
downloadPath: '$(System.ArtifactsDirectory)\finished'
|
||||
|
||||
- powershell: |
|
||||
Write-Host 'We handle the min-size package only when uploading for deb build.'
|
||||
Write-Host '- For deb build, the min-size package is moved to a separate folder "finished\minSize",'
|
||||
Write-Host ' so that the min-size package can be uploaded to a different Az Blob container.'
|
||||
Write-Host '- For other builds, the min-size package is removed after being downloaded, so that it'
|
||||
Write-Host ' does not get accidentally uploaded to the wrong Az Blob container.'
|
||||
|
||||
$minSizePkg = '$(System.ArtifactsDirectory)\finished\release\*-gc.tar.gz'
|
||||
if (Test-Path -Path $minSizePkg)
|
||||
{
|
||||
if ('$(buildName)' -eq 'DEB')
|
||||
{
|
||||
$minSizeDir = '$(System.ArtifactsDirectory)\finished\minSize'
|
||||
New-Item -Path $minSizeDir -Type Directory -Force > $null
|
||||
Move-Item -Path $minSizePkg -Destination $minSizeDir
|
||||
|
||||
Write-Host "`nCapture the min-size package moved to the target folder."
|
||||
Get-ChildItem -Path $minSizeDir
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host '$(buildName): Remove the min-size package.'
|
||||
Remove-Item -Path $minSizePkg -Force
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host 'min-size package not found, so skip this step.'
|
||||
}
|
||||
displayName: 'Move minSize package to separate folder'
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download rpm Artifacts copy'
|
||||
inputs:
|
||||
downloadType: specific
|
||||
itemPattern: '**/*.rpm'
|
||||
downloadPath: '$(System.ArtifactsDirectory)\rpm'
|
||||
condition: and(eq(variables['buildName'], 'RPM'),succeeded())
|
||||
condition: and(eq(variables['buildName'], 'RPM'), succeeded())
|
||||
|
||||
- template: EsrpScan.yml@ComplianceRepo
|
||||
parameters:
|
||||
|
@ -145,6 +176,22 @@ jobs:
|
|||
parameters:
|
||||
artifactPath: $(System.ArtifactsDirectory)\finished\release
|
||||
|
||||
# requires windows
|
||||
- task: AzureFileCopy@4
|
||||
displayName: 'Upload to Azure - min-size package for Guest Config'
|
||||
inputs:
|
||||
SourcePath: '$(System.ArtifactsDirectory)\finished\minSize\*'
|
||||
azureSubscription: '$(AzureFileCopySubscription)'
|
||||
Destination: AzureBlob
|
||||
storage: '$(StorageAccount)'
|
||||
ContainerName: '$(AzureVersion)-gc'
|
||||
condition: and(eq(variables['buildName'], 'DEB'), succeeded())
|
||||
|
||||
- template: upload-final-results.yml
|
||||
parameters:
|
||||
artifactPath: $(System.ArtifactsDirectory)\finished\minSize
|
||||
condition: and(eq(variables['buildName'], 'DEB'), succeeded())
|
||||
|
||||
# requires windows
|
||||
- task: AzureFileCopy@4
|
||||
displayName: 'Upload to Azure - RPM - Unsigned'
|
||||
|
|
|
@ -26,7 +26,7 @@ steps:
|
|||
- template: upload-final-results.yml
|
||||
parameters:
|
||||
artifactPath: $(System.ArtifactsDirectory)\signed
|
||||
artifactFilter: PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}.zip
|
||||
artifactFilter: PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}*.zip
|
||||
|
||||
- task: AzureFileCopy@4
|
||||
displayName: 'upload signed zip to Azure - ${{ parameters.architecture }}'
|
||||
|
@ -39,6 +39,17 @@ steps:
|
|||
resourceGroup: '$(StorageResourceGroup)'
|
||||
condition: succeeded()
|
||||
|
||||
- task: AzureFileCopy@4
|
||||
displayName: 'upload signed min-size package (for Guest Config) to Azure - ${{ parameters.architecture }}'
|
||||
inputs:
|
||||
SourcePath: '$(System.ArtifactsDirectory)\signed\PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}-gc.zip'
|
||||
azureSubscription: '$(AzureFileCopySubscription)'
|
||||
Destination: AzureBlob
|
||||
storage: '$(StorageAccount)'
|
||||
ContainerName: '$(AzureVersion)-gc'
|
||||
resourceGroup: '$(StorageResourceGroup)'
|
||||
condition: and(eq('${{ parameters.architecture }}', 'x64'), succeeded())
|
||||
|
||||
- template: upload-final-results.yml
|
||||
parameters:
|
||||
artifactPath: $(System.ArtifactsDirectory)\signed
|
||||
|
|
|
@ -9,8 +9,8 @@ parameters:
|
|||
default: ''
|
||||
|
||||
jobs:
|
||||
- job: build_windows_${{ parameters.Architecture }}
|
||||
displayName: Build Windows - ${{ parameters.Architecture }}
|
||||
- job: build_windows_${{ parameters.Architecture }}_${{ parameters.BuildConfiguration }}
|
||||
displayName: Build Windows - ${{ parameters.Architecture }} ${{ parameters.BuildConfiguration }}
|
||||
condition: succeeded()
|
||||
dependsOn: ${{ parameters.parentJob }}
|
||||
pool:
|
||||
|
@ -56,8 +56,13 @@ jobs:
|
|||
"fxdependentWinDesktop" { "fxdependent-win-desktop" }
|
||||
}
|
||||
|
||||
tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' -Symbols
|
||||
displayName: 'Build Windows Universal - $(Architecture) Symbols zip'
|
||||
$params = @{}
|
||||
if ($env:BuildConfiguration -eq 'minSize') {
|
||||
$params['ForMinimalSize'] = $true
|
||||
}
|
||||
|
||||
tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' -Symbols @params
|
||||
displayName: 'Build Windows Universal - $(Architecture)-$(BuildConfiguration) Symbols zip'
|
||||
|
||||
- powershell: |
|
||||
$packageName = (Get-ChildItem '$(Build.ArtifactStagingDirectory)\Symbols_$(Architecture)').FullName
|
||||
|
|
|
@ -9,8 +9,8 @@ parameters:
|
|||
default: ''
|
||||
|
||||
jobs:
|
||||
- job: sign_windows_${{ parameters.Architecture }}
|
||||
displayName: Package Windows - ${{ parameters.Architecture }}
|
||||
- job: sign_windows_${{ parameters.Architecture }}_${{ parameters.BuildConfiguration }}
|
||||
displayName: Package Windows - ${{ parameters.Architecture }} ${{ parameters.BuildConfiguration }}
|
||||
condition: succeeded()
|
||||
dependsOn: ${{ parameters.parentJob }}
|
||||
pool:
|
||||
|
@ -40,12 +40,8 @@ jobs:
|
|||
ReleaseTagVar: $(ReleaseTagVar)
|
||||
|
||||
- powershell: |
|
||||
$pkgFilter = if ( '$(Architecture)' -eq 'arm' ) {
|
||||
"arm32"
|
||||
}
|
||||
else {
|
||||
'$(Architecture)'
|
||||
}
|
||||
$pkgFilter = if ( '$(Architecture)' -eq 'arm' ) { "arm32" } else { '$(Architecture)' }
|
||||
if ($env:BuildConfiguration -eq 'minSize') { $pkgFilter += '-*' }
|
||||
|
||||
$vstsCommandString = "vso[task.setvariable variable=PkgFilter]$pkgFilter"
|
||||
Write-Host ("sending " + $vstsCommandString)
|
||||
|
@ -249,10 +245,14 @@ jobs:
|
|||
}
|
||||
|
||||
$signedPkg = "$(BuildPackagePath)"
|
||||
|
||||
Write-Verbose -Verbose -Message "signedPkg = $signedPkg"
|
||||
|
||||
$(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)'
|
||||
$params = @{}
|
||||
if ($env:BuildConfiguration -eq 'minSize') {
|
||||
$params['ForMinimalSize'] = $true
|
||||
}
|
||||
|
||||
$(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' @params
|
||||
displayName: 'Build Windows Universal - $(Architecture) Package'
|
||||
|
||||
- powershell: |
|
||||
|
|
|
@ -295,7 +295,7 @@
|
|||
{
|
||||
"Name": "deb",
|
||||
"RepoDestinationPath": "/PowerShell",
|
||||
"BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_ -TarX64 -TarArm -TarArm64",
|
||||
"BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_ -TarX64 -TarArm -TarArm64 -TarMinSize",
|
||||
"DockerFile": "./tools/releaseBuild/Images/microsoft_powershell_ubuntu18.04/Dockerfile",
|
||||
"AdditionalContextFiles" :[ "./tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1"],
|
||||
"DockerImageName": "ps-ubunutu-18-04",
|
||||
|
|
Loading…
Reference in a new issue