Skip to content

Commit 2bcbe6b

Browse files
authored
ci/rel: publish symbols using the internal symbol request API instead (#16991)
Work is ongoing to remove individually-authenticated service accounts from some pipelines. This moves us closer to that goal. Tested in Nightly 2403.28002.
1 parent 04fa18d commit 2bcbe6b

File tree

5 files changed

+130
-2
lines changed

5 files changed

+130
-2
lines changed

.github/actions/spelling/allow/microsoft.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ DWINRT
3232
enablewttlogging
3333
HOMESHARE
3434
Intelli
35+
issecret
3536
IVisual
3637
libucrt
3738
libucrtd
@@ -74,6 +75,7 @@ sid
7475
Skype
7576
SRW
7677
sxs
78+
symbolrequestprod
7779
Sysinternals
7880
sysnative
7981
systemroot

build/pipelines/ob-nightly.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ extends:
3333
publishSymbolsToPublic: true
3434
publishVpackToWindows: false
3535
symbolExpiryTime: 15
36+
symbolPublishingSubscription: $(SymbolPublishingServiceConnection)
37+
symbolPublishingProject: $(SymbolPublishingProject)
3638
${{ if eq(true, parameters.publishToAzure) }}:
3739
extraPublishJobs:
3840
- template: build/pipelines/templates-v2/job-deploy-to-azure-storage.yml@self

build/pipelines/ob-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@ extends:
8181
terminalInternalPackageVersion: ${{ parameters.terminalInternalPackageVersion }}
8282
publishSymbolsToPublic: ${{ parameters.publishSymbolsToPublic }}
8383
publishVpackToWindows: ${{ parameters.publishVpackToWindows }}
84+
symbolPublishingSubscription: $(SymbolPublishingServiceConnection)
85+
symbolPublishingProject: $(SymbolPublishingProject)
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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

build/pipelines/templates-v2/pipeline-onebranch-full-release-build.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ parameters:
5252
- name: publishVpackToWindows
5353
type: boolean
5454
default: false
55+
- name: symbolPublishingSubscription
56+
type: string
57+
- name: symbolPublishingProject
58+
type: string
5559

5660
- name: extraPublishJobs
5761
type: object
@@ -248,12 +252,13 @@ extends:
248252
displayName: Publish
249253
dependsOn: [Build]
250254
jobs:
251-
- template: ./build/pipelines/templates-v2/job-publish-symbols.yml@self
255+
- template: ./build/pipelines/templates-v2/job-publish-symbols-using-symbolrequestprod-api.yml@self
252256
parameters:
253257
pool: { type: windows }
254258
includePublicSymbolServer: ${{ parameters.publishSymbolsToPublic }}
255-
symbolPatGoesInTaskInputs: true # onebranch tries to muck with the PAT variable, so we need to change how it get the PAT
256259
symbolExpiryTime: ${{ parameters.symbolExpiryTime }}
260+
subscription: ${{ parameters.symbolPublishingSubscription }}
261+
symbolProject: ${{ parameters.symbolPublishingProject }}
257262
variables:
258263
ob_git_checkout: false # This job checks itself out
259264
ob_git_skip_checkout_none: true

0 commit comments

Comments
 (0)