Refactor Global Tool packaging to include SBOM generation (#16860)

* Refactor Global Tool packaging to include SBOM generation

* PR review comments, also fix verbose messages.
This commit is contained in:
Paul Higinbotham
2022-02-09 09:03:39 -08:00
committed by GitHub
parent 7dd0c43fb3
commit cf75ac58f7
4 changed files with 326 additions and 134 deletions
+3 -2
View File
@@ -14,10 +14,11 @@
'Invoke-AzDevOpsLinuxPackageCreation'
'New-DotnetSdkContainerFxdPackage'
'New-ExePackage'
'New-GlobalToolNupkg'
'Start-PrepForGlobalToolNupkg'
'New-GlobalToolNupkgSource'
'New-GlobalToolNupkgFromSource'
'New-ILNugetPackageSource'
'New-ILNugetPackageFromSource'
'New-ILNugetPackage'
'New-MSIPatch'
'New-PSBuildZip'
'New-PSSignedBuildZip'
+252 -122
View File
@@ -4049,11 +4049,10 @@ function ReduceFxDependentPackage
<#
.SYNOPSIS
Create a Global tool nuget package for PowerShell.
Performs clean up work for preparation to running New-GlobalToolNupkgSource package source creation.
.DESCRIPTION
If the UnifiedPackage switch is present, then create a packag with both Windows and Unix runtimes.
Else create two packages, one for Windows and other for Linux.
Unnecessary package source files are removed.
.PARAMETER LinuxBinPath
Path to the folder containing the fxdependent package for Linux.
@@ -4061,28 +4060,19 @@ Path to the folder containing the fxdependent package for Linux.
.PARAMETER WindowsBinPath
Path to the folder containing the fxdependent package for Windows.
.PARAMETER PackageVersion
Version for the NuGet package that will be generated.
.PARAMETER DestinationPath
Path to the folder where the generated packages will be copied to.
.PARAMETER UnifiedPackage
Create package with both Windows and Unix runtimes.
.PARAMETER WindowsDesktopBinPath
Path to the folder containing desktop framework package for Windows.
#>
function New-GlobalToolNupkg
function Start-PrepForGlobalToolNupkg
{
[CmdletBinding()]
param(
[Parameter(Mandatory)] [string] $LinuxBinPath,
[Parameter(Mandatory)] [string] $WindowsBinPath,
[Parameter(Mandatory)] [string] $WindowsDesktopBinPath,
[Parameter(Mandatory)] [string] $PackageVersion,
[Parameter(Mandatory)] [string] $DestinationPath,
[Parameter(ParameterSetName="UnifiedPackage")] [switch] $UnifiedPackage
[Parameter(Mandatory)] [string] $WindowsDesktopBinPath
)
$packageInfo = @()
Write-Log "Start-PrepForGlobalToolNupkg: Running clean up for New-GlobalToolNupkg package creation."
$libCryptoPath = Join-Path $LinuxBinPath 'libcrypto.so.1.0.0'
$libSSLPath = Join-Path $LinuxBinPath 'libssl.so.1.0.0'
@@ -4095,135 +4085,275 @@ function New-GlobalToolNupkg
Remove-Item -Path $libSSLPath -Verbose -Force
}
## Remove unnecessary xml files
# Remove unnecessary xml files
Get-ChildItem -Path $LinuxBinPath, $WindowsBinPath, $WindowsDesktopBinPath -Filter *.xml | Remove-Item -Verbose
}
if ($UnifiedPackage)
<#
.SYNOPSIS
Create a single PowerShell Global tool nuget package NuSpec source directory for the provied
package type.
.DESCRIPTION
A single NuSpec source directory is created for the individual package type, and the created
directory path is set to the environement variable name: "GlobaToolNuSpecSourcePath_${PackageType}".
.PARAMETER PackageType
Global tool package type to create.
.PARAMETER LinuxBinPath
Path to the folder containing the fxdependent package for Linux.
.PARAMETER WindowsBinPath
Path to the folder containing the fxdependent package for Windows.
.PARAMETER WindowsDesktopBinPath
Path to the folder containing desktop framework package for Windows.
.PARAMETER PackageVersion
Version for the NuGet package that will be generated.
#>
function New-GlobalToolNupkgSource
{
[CmdletBinding()]
param(
[Parameter(Mandatory)] [string] $PackageType,
[Parameter(Mandatory)] [string] $LinuxBinPath,
[Parameter(Mandatory)] [string] $WindowsBinPath,
[Parameter(Mandatory)] [string] $WindowsDesktopBinPath,
[Parameter(Mandatory)] [string] $PackageVersion
)
if ($PackageType -ne "Unified")
{
Write-Log "Creating a unified package"
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell"; Type = "Unified"}
$ShimDllPath = Join-Path $WindowsDesktopBinPath "Microsoft.PowerShell.GlobalTool.Shim.dll"
}
else
{
Write-Log "Reducing size of Linux package"
Write-Log "New-GlobalToolNupkgSource: Reducing package size for non-unified packages."
Write-Log "New-GlobalToolNupkgSource: Reducing size of Linux package"
ReduceFxDependentPackage -Path $LinuxBinPath
Write-Log "Reducing size of Windows package"
Write-Log "New-GlobalToolNupkgSource: Reducing size of Windows package"
ReduceFxDependentPackage -Path $WindowsBinPath -KeepWindowsRuntimes
Write-Log "Reducing size of WindowsDesktop package"
Write-Log "New-GlobalToolNupkgSource: Reducing size of WindowsDesktop package"
ReduceFxDependentPackage -Path $WindowsDesktopBinPath -KeepWindowsRuntimes
Write-Log "Creating a Linux and Windows packages"
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell.Linux.Alpine"; Type = "PowerShell.Linux.Alpine"}
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell.Linux.x64"; Type = "PowerShell.Linux.x64"}
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell.Linux.arm32"; Type = "PowerShell.Linux.arm32"}
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell.Linux.arm64"; Type = "PowerShell.Linux.arm64"}
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell.Windows.x64"; Type = "PowerShell.Windows.x64"}
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell.Windows.arm32"; Type = "PowerShell.Windows.arm32"}
}
$packageInfo | ForEach-Object {
$ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
Write-Log "New-GlobalToolNupkgSource: Creating package: $PackageType"
# Add the icon file to the package
Copy-Item -Path $iconPath -Destination "$($_.RootFolder)/$iconFileName" -Verbose
$packageType = $_.Type
switch ($packageType)
switch ($PackageType)
{
"Unified"
{
"Unified"
{
$winFolder = New-Item (Join-Path $ridFolder "win") -ItemType Directory
$unixFolder = New-Item (Join-Path $ridFolder "unix") -ItemType Directory
$ShimDllPath = Join-Path $WindowsDesktopBinPath "Microsoft.PowerShell.GlobalTool.Shim.dll"
Write-Log "Copying runtime assemblies from $WindowsDesktopBinPath"
Copy-Item "$WindowsDesktopBinPath\*" -Destination $winFolder -Recurse
$PackageName = "PowerShell"
$RootFolder = New-TempFolder
Write-Log "Copying runtime assemblies from $LinuxBinPath"
Copy-Item "$LinuxBinPath\*" -Destination $unixFolder -Recurse
Copy-Item -Path $iconPath -Destination "$RootFolder/$iconFileName" -Verbose
Write-Log "Copying shim dll from $ShimDllPath"
Copy-Item $ShimDllPath -Destination $ridFolder
$ridFolder = New-Item -Path (Join-Path $RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
$winFolder = New-Item (Join-Path $ridFolder "win") -ItemType Directory
$unixFolder = New-Item (Join-Path $ridFolder "unix") -ItemType Directory
$shimConfigFile = Join-Path (Split-Path $ShimDllPath -Parent) 'Microsoft.PowerShell.GlobalTool.Shim.runtimeconfig.json'
Write-Log "Copying shim config file from $shimConfigFile"
Copy-Item $shimConfigFile -Destination $ridFolder -ErrorAction Stop
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $WindowsDesktopBinPath"
Copy-Item "$WindowsDesktopBinPath\*" -Destination $winFolder -Recurse
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f (Split-Path $ShimDllPath -Leaf)
}
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $LinuxBinPath"
Copy-Item "$LinuxBinPath\*" -Destination $unixFolder -Recurse
"PowerShell.Linux.Alpine"
{
Write-Log "Copying runtime assemblies from $LinuxBinPath for $packageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-arm64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
Write-Log "New-GlobalToolNupkgSource: Copying shim dll from $ShimDllPath"
Copy-Item $ShimDllPath -Destination $ridFolder
"PowerShell.Linux.x64"
{
Write-Log "Copying runtime assemblies from $LinuxBinPath for $packageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-arm64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-musl-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
$shimConfigFile = Join-Path (Split-Path $ShimDllPath -Parent) 'Microsoft.PowerShell.GlobalTool.Shim.runtimeconfig.json'
Write-Log "New-GlobalToolNupkgSource: Copying shim config file from $shimConfigFile"
Copy-Item $shimConfigFile -Destination $ridFolder -ErrorAction Stop
"PowerShell.Linux.arm32"
{
Write-Log "Copying runtime assemblies from $LinuxBinPath for $packageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-musl-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
"PowerShell.Linux.arm64"
{
Write-Log "Copying runtime assemblies from $LinuxBinPath for $packageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-musl-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
"PowerShell.Windows.x64"
{
Write-Log "Copying runtime assemblies from $WindowsDesktopBinPath for $packageType"
Copy-Item "$WindowsDesktopBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/win-arm -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
"PowerShell.Windows.arm32"
{
Write-Log "Copying runtime assemblies from $WindowsBinPath for $packageType"
Copy-Item "$WindowsBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/win-x64 -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f (Split-Path $ShimDllPath -Leaf)
}
$packageName = $_.PackageName
$nuSpec = $packagingStrings.GlobalToolNuSpec -f $packageName, $PackageVersion, $iconFileName
$nuSpec | Out-File -FilePath (Join-Path $_.RootFolder "$packageName.nuspec") -Encoding ascii
$toolSettings | Out-File -FilePath (Join-Path $ridFolder "DotnetToolSettings.xml") -Encoding ascii
"PowerShell.Linux.Alpine"
{
$PackageName = "PowerShell.Linux.Alpine"
$RootFolder = New-TempFolder
Write-Log "Creating a package: $packageName"
New-NugetPackage -NuSpecPath $_.RootFolder -PackageDestinationPath $DestinationPath
Copy-Item -Path $iconPath -Destination "$RootFolder/$iconFileName" -Verbose
$ridFolder = New-Item -Path (Join-Path $RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $LinuxBinPath for $PackageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-arm64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
"PowerShell.Linux.x64"
{
$PackageName = "PowerShell.Linux.x64"
$RootFolder = New-TempFolder
Copy-Item -Path $iconPath -Destination "$RootFolder/$iconFileName" -Verbose
$ridFolder = New-Item -Path (Join-Path $RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $LinuxBinPath for $PackageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-arm64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-musl-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
"PowerShell.Linux.arm32"
{
$PackageName = "PowerShell.Linux.arm32"
$RootFolder = New-TempFolder
Copy-Item -Path $iconPath -Destination "$RootFolder/$iconFileName" -Verbose
$ridFolder = New-Item -Path (Join-Path $RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $LinuxBinPath for $PackageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-musl-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
"PowerShell.Linux.arm64"
{
$PackageName = "PowerShell.Linux.arm64"
$RootFolder = New-TempFolder
Copy-Item -Path $iconPath -Destination "$RootFolder/$iconFileName" -Verbose
$ridFolder = New-Item -Path (Join-Path $RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $LinuxBinPath for $PackageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-musl-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-x64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
"PowerShell.Windows.x64"
{
$PackageName = "PowerShell.Windows.x64"
$RootFolder = New-TempFolder
Copy-Item -Path $iconPath -Destination "$RootFolder/$iconFileName" -Verbose
$ridFolder = New-Item -Path (Join-Path $RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $WindowsDesktopBinPath for $PackageType"
Copy-Item "$WindowsDesktopBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/win-arm -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
"PowerShell.Windows.arm32"
{
$PackageName = "PowerShell.Windows.arm32"
$RootFolder = New-TempFolder
Copy-Item -Path $iconPath -Destination "$RootFolder/$iconFileName" -Verbose
$ridFolder = New-Item -Path (Join-Path $RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $WindowsBinPath for $PackageType"
Copy-Item "$WindowsBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/win-x64 -Recurse -Force
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}
default { throw "New-GlobalToolNupkgSource: Unkown package type: $PackageType" }
}
$nuSpec = $packagingStrings.GlobalToolNuSpec -f $PackageName, $PackageVersion, $iconFileName
$nuSpec | Out-File -FilePath (Join-Path $RootFolder "$PackageName.nuspec") -Encoding ascii
$toolSettings | Out-File -FilePath (Join-Path $ridFolder "DotnetToolSettings.xml") -Encoding ascii
# Source created.
Write-Log "New-GlobalToolNupkgSource: Global tool package ($PackageName) source created at: $RootFolder"
# Set VSTS environment variable for package NuSpec source path.
$pkgNuSpecSourcePathVar = "GlobalToolNuSpecSourcePath"
Write-Log "New-GlobalToolNupkgSource: Creating NuSpec source path VSTS variable: $pkgNuSpecSourcePathVar"
Write-Host "##vso[task.setvariable variable=$pkgNuSpecSourcePathVar]$RootFolder"
# Set VSTS environment variable for package Name.
$pkgNameVar = "GlobalToolPkgName"
Write-Log "New-GlobalToolNupkgSource: Creating current package name variable: $pkgNameVar"
Write-Host "##vso[task.setvariable variable=$pkgNameVar]$PackageName"
# Set VSTS environment variable for CGManifest file path.
$globalToolCGManifestPFilePath = Join-Path -Path "$env:REPOROOT" -ChildPath "tools\cgmanifest.json"
$globalToolCGManifestFilePath = Resolve-Path -Path $globalToolCGManifestPFilePath -ErrorAction SilentlyContinue
if (($null -eq $globalToolCGManifestFilePath) -or (! (Test-Path -Path $globalToolCGManifestFilePath)))
{
throw "New-GlobalToolNupkgSource: Invalid build source CGManifest file path: $globalToolCGManifestPFilePath"
}
$globalToolCGManifestSourceRoot = New-TempFolder
Write-Log "New-GlobalToolNupkgSource: Creating new CGManifest.json file at: $globalToolCGManifestSourceRoot"
Copy-Item -Path $globalToolCGManifestFilePath -Destination $globalToolCGManifestSourceRoot -Force
$globalToolCGManifestPathVar = "GlobalToolCGManifestPath"
Write-Log "New-GlobalToolNupkgSource: Creating CGManifest path variable, $globalToolCGManifestPathVar, for path: $globalToolCGManifestSourceRoot"
Write-Host "##vso[task.setvariable variable=$globalToolCGManifestPathVar]$globalToolCGManifestSourceRoot"
}
<#
.SYNOPSIS
Create a single PowerShell Global tool nuget package from the provied package source folder.
.DESCRIPTION
Creates a single PowerShell Global tool nuget package based on the provided package NuSpec source
folder (created by New-GlobalNupkgSource), and places the created package in the provided destination
folder.
.PARAMETER PackageNuSpecPath
Location of NuSpec path containing source for package creation.
.PARAMETER PackageName
Name of Global Tool package being created.
.PARAMETER DestinationPath
Path to the folder where the generated package is placed.
#>
function New-GlobalToolNupkgFromSource
{
[CmdletBinding()]
param (
[Parameter(Mandatory)] [string] $PackageNuSpecPath,
[Parameter(Mandatory)] [string] $PackageName,
[Parameter(Mandatory)] [string] $DestinationPath,
[Parameter(Mandatory)] [string] $CGManifestPath
)
if (! (Test-Path -Path $PackageNuSpecPath))
{
throw "New-GlobalToolNupkgFromSource: failed because NuSpec path does not exist: $PackageNuSpecPath"
}
Write-Log "New-GlobalToolNupkgFromSource: Creating package: $PackageName"
New-NugetPackage -NuSpecPath $PackageNuSpecPath -PackageDestinationPath $DestinationPath
Write-Log "New-GlobalToolNupkgFromSource: Removing GlobalTool NuSpec source directory: $PackageNuSpecPath"
Remove-Item -Path $PackageNuSpecPath -Recurse -Force -ErrorAction SilentlyContinue
Write-Log "New-GlobalToolNupkgFromSource: Removing GlobalTool CGManifest source directory: $CGManifestPath"
if (! (Test-Path -Path $CGManifestPath))
{
Write-Verbose -Verbose -Message "New-GlobalToolNupkgFromSource: CGManifest file does not exist: $CGManifestPath"
return
}
Remove-Item -Path $CGManifestPath -Recurse -Force -ErrorAction SilentlyContinue
}
${mainLinuxBuildFolder} = 'pwshLinuxBuild'
@@ -0,0 +1,63 @@
parameters:
- name: PackageVersion
- name: LinuxBinPath
- name: WindowsBinPath
- name: WindowsDesktopBinPath
- name: DestinationPath
- name: ListOfPackageTypes
type: object
default:
- Unified
- PowerShell.Linux.Alpine
- PowerShell.Linux.x64
- PowerShell.Linux.arm32
- PowerShell.Linux.arm64
- PowerShell.Windows.x64
- PowerShell.Windows.arm32
steps:
- pwsh: |
Write-Verbose -Verbose 'LinuxBinPath path: ${{ parameters.LinuxBinPath }}'
Write-Verbose -Verbose 'WindowsBinPath path: ${{ parameters.WindowsBinPath }}'
Write-Verbose -Verbose 'WindowsDesktopBinPath path: ${{ parameters.WindowsDesktopBinPath }}'
Import-Module -Name $env:REPOROOT\build.psm1
Import-Module -Name $env:REPOROOT\tools\packaging
Start-PrepForGlobalToolNupkg -LinuxBinPath '${{ parameters.LinuxBinPath }}' -WindowsBinPath '${{ parameters.WindowsBinPath }}' -WindowsDesktopBinPath '${{ parameters.WindowsDesktopBinPath }}'
displayName: 'Preparation for Global Tools package creation.'
# NOTE: The Unified package must always be created first, and so must always be first in ListOfPackageTypes.
- ${{ each value in parameters.ListOfPackageTypes }}:
- pwsh: |
$PackageType = '${{ value }}'
Write-Verbose -Verbose "PackageType: $PackageType"
Write-Verbose -Verbose 'Destination path: ${{ parameters.PackagePath }}'
# Create global tool NuSpec source for package.
Import-Module -Name $env:REPOROOT\build.psm1
Import-Module -Name $env:REPOROOT\tools\packaging
New-GlobalToolNupkgSource -PackageType $PackageType -PackageVersion '${{ parameters.PackageVersion }}' -LinuxBinPath '${{ parameters.LinuxBinPath }}' -WindowsBinPath '${{ parameters.WindowsBinPath }}' -WindowsDesktopBinPath '${{ parameters.WindowsDesktopBinPath }}'
displayName: 'Create global tool NuSpec source for package.'
- pwsh: |
Get-ChildItem -Path env:
displayName: 'Capture environment variables after Global Tool package source is created.'
# NOTE: The above 'New-GlobalToolNupkgSource' task function sets the 'GlobalToolNuSpecSourcePath', 'GlobalToolPkgName',
# and 'GlobalToolCGManifestPath' environment variables.
- template: Sbom.yml@ComplianceRepo
parameters:
BuildDropPath: $(GlobalToolNuSpecSourcePath)
Build_Repository_Uri: 'https://github.com/powershell/powershell'
PackageName: $(GlobalToolPkgName)
PackageVersion: ${{ parameters.PackageVersion }}
sourceScanPath: $(GlobalToolCGManifestPath)
displayName: SBOM for Global Tool package
- pwsh: |
Import-Module -Name $env:REPOROOT\build.psm1
Import-Module -Name $env:REPOROOT\tools\packaging
New-GlobalToolNupkgFromSource -PackageNuSpecPath "$env:GlobalToolNuSpecSourcePath" -PackageName "$env:GlobalToolPkgName" -DestinationPath '${{ parameters.DestinationPath }}' -CGManifestPath "$env:GlobalToolCGManifestPath"
displayName: 'Create global tool NuSpec package from NuSpec source.'
@@ -133,16 +133,14 @@ jobs:
Get-ChildItem $(winFxdWinDesktopPath)
displayName: Capture fxd folders
- pwsh: |
Import-Module $env:REPOROOT\build.psm1
Import-Module $env:REPOROOT\tools\packaging
Find-Dotnet
# Create unified package first
New-GlobalToolNupkg -UnifiedPackage -LinuxBinPath "$(linuxFxdPath)" -WindowsBinPath "$(winFxdPath)" -WindowsDesktopBinPath "$(winFxdWinDesktopPath)" -PackageVersion "$(Version)" -DestinationPath "$(PackagePath)\globaltool"
# Create packages for dotnet sdk
New-GlobalToolNupkg -LinuxBinPath "$(linuxFxdPath)" -WindowsBinPath "$(winFxdPath)" -WindowsDesktopBinPath "$(winFxdWinDesktopPath)" -PackageVersion "$(Version)" -DestinationPath "$(PackagePath)\globaltool"
displayName: 'Create Global tool packages'
# Create Global Tool packages along with SBOM manifests
- template: global-tool-pkg-sbom.yml
parameters:
PackageVersion: $(Version)
LinuxBinPath: $(linuxFxdPath)
WindowsBinPath: $(winFxdPath)
WindowsDesktopBinPath: $(winFxdWinDesktopPath)
DestinationPath: $(PackagePath)\globaltool
- pwsh: |
Get-ChildItem "$(PackagePath)" -Recurse