mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 11:17:53 +01:00
They made secure strings the default. Doing it this way maintains compatibility with the version before and after the default changed. This fixes symbol publication.
117 lines
4.3 KiB
YAML
117 lines
4.3 KiB
YAML
parameters:
|
|
- name: includePublicSymbolServer
|
|
type: boolean
|
|
default: false
|
|
- name: pool
|
|
type: object
|
|
default: []
|
|
- name: dependsOn
|
|
type: object
|
|
default: null
|
|
- name: versionNumber
|
|
type: string
|
|
default: '0.0.1'
|
|
- name: artifactStem
|
|
type: string
|
|
default: ''
|
|
- name: jobName
|
|
type: string
|
|
default: PublishSymbols
|
|
- name: symbolExpiryTime
|
|
type: string
|
|
default: 36530 # This is the default from PublishSymbols@2
|
|
- name: variables
|
|
type: object
|
|
default: {}
|
|
- name: subscription
|
|
type: string
|
|
- name: symbolProject
|
|
type: string
|
|
|
|
jobs:
|
|
- job: ${{ parameters.jobName }}
|
|
${{ if ne(length(parameters.pool), 0) }}:
|
|
pool: ${{ parameters.pool }}
|
|
${{ if eq(parameters.includePublicSymbolServer, true) }}:
|
|
displayName: Publish Symbols to Internal and MSDL
|
|
${{ else }}:
|
|
displayName: Publish Symbols Internally
|
|
dependsOn: ${{ parameters.dependsOn }}
|
|
variables:
|
|
${{ insert }}: ${{ parameters.variables }}
|
|
SymbolsArtifactName: "PowerToys_${{parameters.versionNumber}}_$(Build.BuildNumber)"
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
fetchDepth: 1
|
|
fetchTags: false # Tags still result in depth > 1 fetch; we don't need them here
|
|
submodules: true
|
|
persistCredentials: True
|
|
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: Download all PDBs from all prior build phases
|
|
inputs:
|
|
itemPattern: '**/*.pdb'
|
|
targetPath: '$(Build.SourcesDirectory)/symbolStaging'
|
|
|
|
- powershell: |-
|
|
Get-PackageProvider -Name NuGet -ForceBootstrap
|
|
Install-Module -Verbose -AllowClobber -Force Az.Accounts, Az.Storage, Az.Network, Az.Resources, Az.Compute
|
|
displayName: Install Azure Module Dependencies
|
|
|
|
# Transit the Azure token from the Service Connection into a secret variable for the rest of the pipeline to use.
|
|
- task: AzurePowerShell@5
|
|
displayName: Generate an Azure Token
|
|
inputs:
|
|
azureSubscription: ${{ parameters.subscription }}
|
|
azurePowerShellVersion: LatestVersion
|
|
pwsh: true
|
|
ScriptType: InlineScript
|
|
Inline: |-
|
|
$AzToken = (Get-AzAccessToken -AsSecureString -ResourceUrl api://30471ccf-0966-45b9-a979-065dbedb24c1).Token | ConvertFrom-SecureString -AsPlainText
|
|
Write-Host "##vso[task.setvariable variable=SymbolAccessToken;issecret=true]$AzToken"
|
|
|
|
|
|
- task: PublishSymbols@2
|
|
displayName: Publish Symbols (to current Azure DevOps tenant)
|
|
continueOnError: True
|
|
inputs:
|
|
SymbolsFolder: '$(Build.SourcesDirectory)/symbolStaging'
|
|
SearchPattern: '**/*.pdb'
|
|
IndexSources: false
|
|
DetailedLog: true
|
|
SymbolsMaximumWaitTime: 30
|
|
SymbolServerType: 'TeamServices'
|
|
SymbolsProduct: 'PowerToys Converged Symbols'
|
|
SymbolsVersion: '${{ parameters.versionNumber }}'
|
|
SymbolsArtifactName: $(SymbolsArtifactName)
|
|
SymbolExpirationInDays: ${{ parameters.symbolExpiryTime }}
|
|
env:
|
|
LIB: $(Build.SourcesDirectory)
|
|
|
|
- pwsh: |-
|
|
# Prepare the defaults for IRM
|
|
$PSDefaultParameterValues['Invoke-RestMethod:Headers'] = @{ Authorization = "Bearer $(SymbolAccessToken)" }
|
|
$PSDefaultParameterValues['Invoke-RestMethod:ContentType'] = "application/json"
|
|
$PSDefaultParameterValues['Invoke-RestMethod:Method'] = "POST"
|
|
|
|
$BaseUri = "https://symbolrequestprod.trafficmanager.net/projects/${{ parameters.symbolProject }}/requests"
|
|
|
|
# Prepare the request
|
|
$expiration = (Get-Date).Add([TimeSpan]::FromDays(${{ parameters.symbolExpiryTime }}))
|
|
$createRequestBody = @{
|
|
requestName = "$(SymbolsArtifactName)";
|
|
expirationTime = $expiration.ToString();
|
|
}
|
|
Write-Host "##[debug]Starting request $($createRequestBody.requestName) with expiration date of $($createRequestBody.expirationTime)"
|
|
Invoke-RestMethod -Uri "$BaseUri" -Body ($createRequestBody | ConvertTo-Json -Compress) -Verbose
|
|
|
|
# Request symbol publication
|
|
$publishRequestBody = @{
|
|
publishToInternalServer = $true;
|
|
publishToPublicServer = $${{ parameters.includePublicSymbolServer }};
|
|
}
|
|
Write-Host "##[debug]Submitting request $($createRequestBody.requestName) ($($publishRequestBody | ConvertTo-Json -Compress))"
|
|
Invoke-RestMethod -Uri "$BaseUri/$($createRequestBody.requestName)" -Body ($publishRequestBody | ConvertTo-Json -Compress) -Verbose
|
|
displayName: Publish Symbols using internal REST API
|