Multiple fixes in official build pipeline (#21408)

This commit is contained in:
Aditya Patwardhan
2024-04-03 15:06:04 -07:00
committed by GitHub
parent dafe0a803c
commit 94d623169a
7 changed files with 40 additions and 27 deletions
+7 -1
View File
@@ -1,5 +1,11 @@
{
"instanceUrl": "https://msazure.visualstudio.com",
"projectName": "One",
"areaPath": "One\\MGMT\\Compute\\Powershell\\Powershell\\PowerShell Core"
"areaPath": "One\\MGMT\\Compute\\Powershell\\Powershell\\PowerShell Core",
"notificationAliases": [
"adityap@microsoft.com",
"dongbow@microsoft.com",
"pmeinecke@microsoft.com",
"tplunk@microsoft.com"
]
}
@@ -1,14 +1,5 @@
name: UnifiedPackageBuild-$(Build.BuildId)
trigger:
branches:
include:
- master
- release*
pr:
branches:
include:
- master
- release*
trigger: none
parameters:
- name: ForceAzureBlobDelete
@@ -194,7 +185,7 @@ extends:
parameters:
Architecture: x64
BuildConfiguration: minSize
JobName: build_windows_x64_minSize
JobName: build_windows_x64_minSize_release
- template: /.pipelines/templates/windows-hosted-build.yml@self
parameters:
Architecture: x86
@@ -5,7 +5,7 @@ steps:
- pwsh: |
$configPath = "${env:NugetConfigDir}/nuget.config"
Import-Module ${{ parameters.repoRoot }}/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT2) -FeedName AzDevOpsFeed -Destination "${env:NugetConfigDir}"
New-NugetConfigFile -NugetFeedUrl $(PowerShellCore_PublicPackages) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedUserName) -FeedName AzDevOpsFeed -Destination "${env:NugetConfigDir}"
if(-not (Test-Path $configPath))
{
throw "nuget.config is not created"
@@ -20,7 +20,7 @@ steps:
- pwsh: |
$configPath = "${env:NugetConfigDir}/nuget.config"
Import-Module ${{ parameters.repoRoot }}/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(PSInternalNugetFeed) -UserName $(PSInternalNugetFeedUserName) -ClearTextPAT $(PSInternalNugetFeedPAT) -FeedName AzDevOpsFeed -Destination "${env:NugetConfigDir}"
New-NugetConfigFile -NugetFeedUrl $(PowerShellCore_PublicPackages) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedUserName) -FeedName AzDevOpsFeed -Destination "${env:NugetConfigDir}"
if(-not (Test-Path $configPath))
{
throw "nuget.config is not created"
+9 -3
View File
@@ -27,7 +27,7 @@ jobs:
value: $(Build.SourcesDirectory)\PowerShell\.config\tsaoptions.json
- name: ob_sdl_credscan_suppressionsFile
value: $(Build.SourcesDirectory)\PowerShell\.config\suppress.json
- name: BuildConfiguration
- name: BUILDCONFIGURATION
value: ${{ parameters.BuildConfiguration }}
- name: Runtime
value: ${{ parameters.Runtime }}
@@ -66,7 +66,8 @@ jobs:
$runtime = $env:RUNTIME
$params = @{}
if ($env:BuildConfiguration -eq 'minSize') {
if ($env:BUILDCONFIGURATION -eq 'minSize') {
Write-Verbose -Message "Building for minimal size"
$params['ForMinimalSize'] = $true
}
@@ -78,6 +79,11 @@ jobs:
$null = New-Item -ItemType Directory -Path $buildWithSymbolsPath -Force -Verbose
Start-PSBuild -Runtime $runtime -Configuration Release -Output $buildWithSymbolsPath @params -Clean -PSModuleRestore
$outputPath = Join-Path '$(ob_outputDirectory)' 'psoptions'
$null = New-Item -ItemType Directory -Path $outputPath -Force
$psOptPath = "$outputPath/psoptions.json"
Save-PSOptions -PSOptionsPath $psOptPath
Write-Verbose -Verbose "Verifying pdbs exist in build folder"
$pdbs = Get-ChildItem -Path $buildWithSymbolsPath -Recurse -Filter *.pdb
if ($pdbs.Count -eq 0) {
@@ -90,7 +96,7 @@ jobs:
}
}
Write-Verbose -Verbose "Completed building PowerShell for '$env:BuildConfiguration' configuration"
Write-Verbose -Verbose "Completed building PowerShell for '$env:BUILDCONFIGURATION' configuration"
displayName: 'Build Linux - $(Runtime)'
env:
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
+14 -9
View File
@@ -54,7 +54,17 @@ jobs:
$env:AzDevOpsFeedPAT2 = '$(AzDevOpsFeedPAT2)'
# Add -SkipReleaseChecks as a mitigation to unblock release.
# macos-10.15 does not allow creating a folder under root. Hence, moving the folder.
$(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -Symbols -location $(PowerShellRoot) -Build -ArtifactName macosBinResults -Runtime 'osx-${{ parameters.buildArchitecture }}' -SkipReleaseChecks
Import-Module ./build.psm1 -Force
Start-PSBuild -Runtime 'osx-${{ parameters.buildArchitecture }}' -Configuration Release -PSModuleRestore -Clean -Output $(OB_OUTPUTDIRECTORY)
$artifactName = "macosBinResults-${{ parameters.buildArchitecture }}"
$psOptPath = "$(OB_OUTPUTDIRECTORY)/psoptions.json"
Save-PSOptions -PSOptionsPath $psOptPath
# Since we are using custom pool for macOS, we need to use artifact.upload to publish the artifacts
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName]$(OB_OUTPUTDIRECTORY)"
$env:AzDevOpsFeedPAT2 = $null
displayName: 'Build'
env:
@@ -84,7 +94,7 @@ jobs:
- name: ob_sdl_codeql_compiled_enabled
value: false
- name: ob_sdl_sbom_packageName
value: 'Microsoft.Powershell.Windows.${{parameters.buildArchitecture}}'
value: 'Microsoft.Powershell.MacOS.${{parameters.buildArchitecture}}'
steps:
- checkout: self
@@ -100,7 +110,7 @@ jobs:
- task: DownloadPipelineArtifact@2
inputs:
artifact: 'macosBinResults'
artifact: 'macosBinResults-$(BuildArchitecture)'
path: '$(Pipeline.Workspace)\Symbols'
displayName: Download build
@@ -115,12 +125,7 @@ jobs:
Write-Host "sending.. vso[task.setvariable variable=Runtime]$runtime"
Write-Host "##vso[task.setvariable variable=Runtime]$runtime"
$zipPath = Get-Item '$(Pipeline.Workspace)\Symbols\*symbol*${{ parameters.buildArchitecture }}*.zip' -Verbose
Write-Verbose -Verbose "Zip Path: $zipPath"
$expandedFolder = $zipPath.BaseName
Expand-Archive -Path $zipPath -Destination "$(Pipeline.Workspace)\$expandedFolder" -Force
$rootPath = "$(Pipeline.Workspace)\$expandedFolder"
$rootPath = "$(Pipeline.Workspace)\Symbols"
Write-Verbose -Verbose "Setting vso[task.setvariable variable=DropRootPath]$rootPath"
Write-Host "##vso[task.setvariable variable=DropRootPath]$rootPath"
displayName: Expand symbols zip
@@ -89,6 +89,11 @@ jobs:
$null = New-Item -ItemType Directory -Path $buildWithSymbolsPath -Force -Verbose
Start-PSBuild -Runtime $runtime -Configuration Release -Output $buildWithSymbolsPath -Clean -PSModuleRestore @params
$outputPath = Join-Path '$(ob_outputDirectory)' 'psoptions'
$null = New-Item -ItemType Directory -Path $outputPath -Force
$psOptPath = "$outputPath/psoptions.json"
Save-PSOptions -PSOptionsPath $psOptPath
Write-Verbose -Verbose "Verifying pdbs exist in build folder"
$pdbs = Get-ChildItem -Path $buildWithSymbolsPath -Recurse -Filter *.pdb
if ($pdbs.Count -eq 0) {
@@ -15,6 +15,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0-beta1.24154.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0-beta1.24122.1" PrivateAssets="all" />
</ItemGroup>
</Project>