|
| 1 | +parameters: |
| 2 | + - name: includePublicSymbolServer |
| 3 | + type: boolean |
| 4 | + default: false |
| 5 | + - name: pool |
| 6 | + type: object |
| 7 | + default: [] |
| 8 | + - name: dependsOn |
| 9 | + type: object |
| 10 | + default: null |
| 11 | + - name: artifactStem |
| 12 | + type: string |
| 13 | + default: '' |
| 14 | + - name: jobName |
| 15 | + type: string |
| 16 | + default: PublishSymbols |
| 17 | + - name: symbolExpiryTime |
| 18 | + type: string |
| 19 | + default: 36530 # This is the default from PublishSymbols@2 |
| 20 | + - name: variables |
| 21 | + type: object |
| 22 | + default: {} |
| 23 | + - name: subscription |
| 24 | + type: string |
| 25 | + - name: symbolProject |
| 26 | + type: string |
| 27 | + |
| 28 | +jobs: |
| 29 | +- job: ${{ parameters.jobName }} |
| 30 | + ${{ if ne(length(parameters.pool), 0) }}: |
| 31 | + pool: ${{ parameters.pool }} |
| 32 | + ${{ if eq(parameters.includePublicSymbolServer, true) }}: |
| 33 | + displayName: Publish Symbols to Internal and MSDL |
| 34 | + ${{ else }}: |
| 35 | + displayName: Publish Symbols Internally |
| 36 | + dependsOn: ${{ parameters.dependsOn }} |
| 37 | + variables: |
| 38 | + ${{ insert }}: ${{ parameters.variables }} |
| 39 | + steps: |
| 40 | + - checkout: self |
| 41 | + clean: true |
| 42 | + fetchDepth: 1 |
| 43 | + fetchTags: false # Tags still result in depth > 1 fetch; we don't need them here |
| 44 | + submodules: true |
| 45 | + persistCredentials: True |
| 46 | + |
| 47 | + - task: PkgESSetupBuild@12 |
| 48 | + displayName: Package ES - Setup Build |
| 49 | + inputs: |
| 50 | + disableOutputRedirect: true |
| 51 | + |
| 52 | + - task: DownloadPipelineArtifact@2 |
| 53 | + displayName: Download all PDBs from all prior build phases |
| 54 | + inputs: |
| 55 | + itemPattern: '**/*.pdb' |
| 56 | + targetPath: '$(Build.SourcesDirectory)/bin' |
| 57 | + |
| 58 | + - powershell: |- |
| 59 | + Get-PackageProvider -Name NuGet -ForceBootstrap |
| 60 | + Install-Module -Verbose -AllowClobber -Force Az.Accounts, Az.Storage, Az.Network, Az.Resources, Az.Compute |
| 61 | + displayName: Install Azure Module Dependencies |
| 62 | +
|
| 63 | + # Transit the Azure token from the Service Connection into a secret variable for the rest of the pipeline to use. |
| 64 | + - task: AzurePowerShell@5 |
| 65 | + displayName: Generate an Azure Token |
| 66 | + inputs: |
| 67 | + azureSubscription: ${{ parameters.subscription }} |
| 68 | + azurePowerShellVersion: LatestVersion |
| 69 | + pwsh: true |
| 70 | + ScriptType: InlineScript |
| 71 | + Inline: |- |
| 72 | + $AzToken = (Get-AzAccessToken -ResourceUrl api://30471ccf-0966-45b9-a979-065dbedb24c1).Token |
| 73 | + Write-Host "##vso[task.setvariable variable=SymbolAccessToken;issecret=true]$AzToken" |
| 74 | +
|
| 75 | +
|
| 76 | + - task: PublishSymbols@2 |
| 77 | + displayName: Publish Symbols (to current Azure DevOps tenant) |
| 78 | + continueOnError: True |
| 79 | + inputs: |
| 80 | + SymbolsFolder: '$(Build.SourcesDirectory)/bin' |
| 81 | + SearchPattern: '**/*.pdb' |
| 82 | + IndexSources: false |
| 83 | + DetailedLog: true |
| 84 | + SymbolsMaximumWaitTime: 30 |
| 85 | + SymbolServerType: 'TeamServices' |
| 86 | + SymbolsProduct: 'Windows Terminal Converged Symbols' |
| 87 | + SymbolsVersion: '$(XES_APPXMANIFESTVERSION)' |
| 88 | + SymbolsArtifactName: 'WindowsTerminal_$(XES_APPXMANIFESTVERSION)' |
| 89 | + SymbolExpirationInDays: ${{ parameters.symbolExpiryTime }} |
| 90 | + env: |
| 91 | + LIB: $(Build.SourcesDirectory) |
| 92 | + |
| 93 | + - pwsh: |- |
| 94 | + # Prepare the defaults for IRM |
| 95 | + $PSDefaultParameterValues['Invoke-RestMethod:Headers'] = @{ Authorization = "Bearer $(SymbolAccessToken)" } |
| 96 | + $PSDefaultParameterValues['Invoke-RestMethod:ContentType'] = "application/json" |
| 97 | + $PSDefaultParameterValues['Invoke-RestMethod:Method'] = "POST" |
| 98 | +
|
| 99 | + $BaseUri = "https://symbolrequestprod.trafficmanager.net/projects/${{ parameters.symbolProject }}/requests" |
| 100 | +
|
| 101 | + # Prepare the request |
| 102 | + $expiration = (Get-Date).Add([TimeSpan]::FromDays(${{ parameters.symbolExpiryTime }})) |
| 103 | + $createRequestBody = @{ |
| 104 | + requestName = "WindowsTerminal_$(XES_APPXMANIFESTVERSION)"; |
| 105 | + expirationTime = $expiration.ToString(); |
| 106 | + } |
| 107 | + Write-Host "##[debug]Starting request $($createRequestBody.requestName) with expiration date of $($createRequestBody.expirationTime)" |
| 108 | + Invoke-RestMethod -Uri "$BaseUri" -Body ($createRequestBody | ConvertTo-Json -Compress) -Verbose |
| 109 | +
|
| 110 | + # Request symbol publication |
| 111 | + $publishRequestBody = @{ |
| 112 | + publishToInternalServer = $true; |
| 113 | + publishToPublicServer = $${{ parameters.includePublicSymbolServer }}; |
| 114 | + } |
| 115 | + Write-Host "##[debug]Submitting request $($createRequestBody.requestName) ($($publishRequestBody | ConvertTo-Json -Compress))" |
| 116 | + Invoke-RestMethod -Uri "$BaseUri/$($createRequestBody.requestName)" -Body ($publishRequestBody | ConvertTo-Json -Compress) -Verbose |
| 117 | + displayName: Publish Symbols using internal REST API |
0 commit comments