mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-23 17:53:58 +08:00
Integrate building NuGet package in the coordinated build (#8947)
This commit is contained in:
parent
5d54f1aa38
commit
81d37fcb84
@ -92,4 +92,11 @@ jobs:
|
||||
- build_windows_x86
|
||||
- build_windows_fxdependent
|
||||
|
||||
- template: templates/updateBuildTable.yml
|
||||
- template: templates/nuget.yml
|
||||
parameters:
|
||||
parentJobs:
|
||||
- WinPackageSigningJob
|
||||
- build_deb
|
||||
- build_rpm
|
||||
- build_alpine
|
||||
- build_macOS
|
||||
|
169
tools/releaseBuild/azureDevOps/templates/nuget.yml
Normal file
169
tools/releaseBuild/azureDevOps/templates/nuget.yml
Normal file
@ -0,0 +1,169 @@
|
||||
parameters:
|
||||
parentJobs: []
|
||||
|
||||
jobs:
|
||||
- job: build_nuget
|
||||
dependsOn:
|
||||
${{ parameters.parentJobs }}
|
||||
displayName: Build NuGet packages
|
||||
condition: succeeded()
|
||||
pool: PowerShell
|
||||
variables:
|
||||
linuxArm32Path: '$(System.ArtifactsDirectory)/linuxArm32'
|
||||
winArm32Path: '$(System.ArtifactsDirectory)/winArm32'
|
||||
linuxX64Path: '$(System.ArtifactsDirectory)/linuxX64'
|
||||
macOSPath: '$(System.ArtifactsDirectory)/macOS'
|
||||
winArm64Path: '$(System.ArtifactsDirectory)/winArm64'
|
||||
winX64Path: '$(System.ArtifactsDirectory)/winX64'
|
||||
winX86Path: '$(System.ArtifactsDirectory)/winX86'
|
||||
GenAPIToolPath: '$(System.ArtifactsDirectory)/GenAPI'
|
||||
PackagePath: '$(System.ArtifactsDirectory)/UnifiedPackagePath'
|
||||
|
||||
steps:
|
||||
|
||||
- powershell: |
|
||||
$content = Get-Content "$(Build.SourcesDirectory)/global.json" -Raw | ConvertFrom-Json
|
||||
$vstsCommandString = "vso[task.setvariable variable=SDKVersion]$($content.sdk.version)"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
displayName: 'Find SDK version from global.json'
|
||||
|
||||
- task: DotNetCoreInstaller@0
|
||||
displayName: 'Use .NET Core SDK from global.json'
|
||||
inputs:
|
||||
version: '$(SDKVersion)'
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download PowerShell build artifacts'
|
||||
inputs:
|
||||
buildType: specific
|
||||
project: '9d7f7aa4-6f41-480d-a367-82eb278461a1'
|
||||
pipeline: 696
|
||||
downloadType: specific
|
||||
itemPattern: |
|
||||
finalResults/PowerShell-*-win-*.zip
|
||||
finalResults/powershell-*.tar.gz
|
||||
results/powershell-*-osx-x64.tar.gz
|
||||
downloadPath: '$(System.ArtifactsDirectory)'
|
||||
|
||||
- powershell: 'Get-ChildItem $(System.ArtifactsDirectory) -recurse'
|
||||
displayName: 'Capture downloaded artifacts'
|
||||
|
||||
- powershell: |
|
||||
$packagePath = (Join-Path $(System.ArtifactsDirectory) packages)
|
||||
New-Item $packagePath -ItemType Directory -Force > $null
|
||||
$packages = Get-ChildItem $(System.ArtifactsDirectory) -Include *.zip, *.tar.gz -Recurse
|
||||
$packages | ForEach-Object { Copy-Item $_.FullName -Destination $packagePath -Verbose }
|
||||
Get-ChildItem $packagePath -Recurse
|
||||
displayName: 'Conflate packages to same folder'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files linuxArm32'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-linux-arm32.tar.gz'
|
||||
destinationFolder: '$(linuxArm32Path)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files linuxX64'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-linux-x64.tar.gz'
|
||||
destinationFolder: '$(linuxX64Path)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files macOS files'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-osx*.tar.gz'
|
||||
destinationFolder: '$(macOSPath)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files win-arm32'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-arm32.zip'
|
||||
destinationFolder: '$(winArm32Path)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files win-arm64'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-arm64.zip '
|
||||
destinationFolder: '$(winArm64Path)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files win-X64'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-x64.zip '
|
||||
destinationFolder: '$(winX64Path)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files win-X86'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-x86.zip '
|
||||
destinationFolder: '$(winX86Path)'
|
||||
|
||||
- task: PkgESInstallNuGetToolsPackage@10
|
||||
displayName: 'Install package Microsoft.DotNet.BuildTools.GenAPI'
|
||||
inputs:
|
||||
packageName: Microsoft.DotNet.BuildTools.GenAPI
|
||||
packageVersion: '1.0.0-beta-00081'
|
||||
packageSources: 'https://nuget.org/api/v2'
|
||||
installRoot: '$(GenAPIToolPath)'
|
||||
|
||||
- template: SetVersionVariables.yml
|
||||
parameters:
|
||||
ReleaseTagVar: $(ReleaseTagVar)
|
||||
|
||||
- task: NuGetToolInstaller@0
|
||||
displayName: 'Install NuGet 4.9.3'
|
||||
inputs:
|
||||
versionSpec: 4.9.3
|
||||
|
||||
|
||||
- powershell: |
|
||||
Import-Module $env:BUILD_SOURCESDIRECTORY\build.psm1
|
||||
Import-Module $env:BUILD_SOURCESDIRECTORY\tools\packaging
|
||||
New-UnifiedNugetPackage -PackagePath "$(PackagePath)" -PackageVersion "$(Version)" -winx86BinPath "$(winX86Path)" -winx64BinPath "$(winX64Path)" -winArm32BinPath "$(winArm32Path)" -winArm64BinPath "$(winArm64Path)" -linuxArm32BinPath "$(linuxArm32Path)" -linuxBinPath "$(linuxX64Path)" -osxBinPath "$(macOSPath)" -GenAPIToolPath "$(GenAPIToolPath)"
|
||||
displayName: 'Create Nuget Package Folders'
|
||||
|
||||
- powershell: |
|
||||
Get-ChildItem "$(PackagePath)" -Recurse
|
||||
displayName: Capture generated packages
|
||||
|
||||
- powershell: |
|
||||
$packages = Get-ChildItem "$(PackagePath)\*.nupkg" | Select-Object -ExpandProperty FullName
|
||||
|
||||
if($packages.Count -lt 1)
|
||||
{
|
||||
throw "No packages created"
|
||||
}
|
||||
|
||||
$(Build.SourcesDirectory)\tools\releaseBuild\generatePackgeSigning.ps1 -Path $(PackagePath)\NugetSigning.xml -NuPkgFiles $packages
|
||||
displayName: Create signing file
|
||||
|
||||
- task: PkgESCodeSign@10
|
||||
displayName: 'CodeSign Nuget Packages'
|
||||
inputs:
|
||||
signConfigXml: '$(PackagePath)\NugetSigning.xml'
|
||||
inPathRoot: '$(PackagePath)'
|
||||
outPathRoot: '$(System.ArtifactsDirectory)\signed'
|
||||
|
||||
- powershell: |
|
||||
Import-Module $(Build.SourcesDirectory)\build.psm1 -Force
|
||||
Get-ChildItem -Recurse "$(System.ArtifactsDirectory)\signed\*.nupkg" -Verbose | ForEach-Object { Start-NativeExecution -sb { nuget.exe verify -All $_.FullName } }
|
||||
displayName: Verify all packages are signed
|
||||
|
||||
- task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@3
|
||||
displayName: 'Run MpCmdRun.exe'
|
||||
inputs:
|
||||
FileDirPath: '$(PackagePath)'
|
||||
TreatStaleSignatureAs: Warning
|
||||
|
||||
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2
|
||||
displayName: 'Publish Security Analysis Logs'
|
||||
|
||||
- template: upload-final-results.yml
|
||||
parameters:
|
||||
artifactPath: '$(System.ArtifactsDirectory)\signed'
|
||||
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
displayName: 'Component Detection'
|
||||
inputs:
|
||||
sourceScanPath: '$(PackagePath)'
|
@ -1,49 +0,0 @@
|
||||
jobs:
|
||||
- job: updateBuildTable
|
||||
displayName: Update Build Information Table
|
||||
dependsOn:
|
||||
${{ parameters.parentJobs }}
|
||||
|
||||
# the package ES pools don't have the latest module needed to run this job
|
||||
pool:
|
||||
name: Hosted Mac Internal
|
||||
|
||||
timeoutInMinutes: 15
|
||||
|
||||
steps:
|
||||
- template: SetVersionVariables.yml
|
||||
parameters:
|
||||
ReleaseTagVar: $(ReleaseTagVar)
|
||||
|
||||
- powershell: |
|
||||
install-module azstoragetable.travisez13 -Scope CurrentUser -Force -SkipPublisherCheck
|
||||
displayName: 'Install Azure Table Module'
|
||||
|
||||
- powershell: |
|
||||
$az_key = ConvertTo-SecureString -Force -String '$(az_key)' -AsPlainText
|
||||
$az_key_cred = [PSCredential]::new('$(az_appid)',$az_key)
|
||||
|
||||
Write-Verbose "Connecting to Azure ..." -verbose
|
||||
Connect-AzAccount -ServicePrincipal -Credential $az_key_cred -TenantId '$(az_tenantid)' -force -scope process
|
||||
|
||||
$table = Get-AzStorageTableTable -resourceGroup pscoredata -storageAccountName pscorebuilddata -tableName buildData
|
||||
|
||||
Write-Verbose "Removing existing row, if it exists ..." -verbose
|
||||
$row = Remove-AzStorageTableRow -table $table -partitionkey '$(System.DefinitionId)' -rowKey '$(ReleaseTagVar)'
|
||||
|
||||
Write-Verbose "Adding new row ..." -verbose
|
||||
$result = Add-AzStorageTableRow -table $table -partitionkey '$(System.DefinitionId)' -rowKey '$(ReleaseTagVar)' -property @{
|
||||
buildid = '$(Build.BuildId)'
|
||||
}
|
||||
While(!$result.IsCompleted)
|
||||
{
|
||||
Write-Verbose -message "waiting for result" -verbose
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
|
||||
if(!$result.IsCompletedSuccessfully)
|
||||
{
|
||||
$result
|
||||
throw "adding row failed"
|
||||
}
|
||||
displayName: 'Add Row to Build Information Table'
|
Loading…
Reference in New Issue
Block a user