Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 63 additions & 17 deletions eng/pipelines/common/templates/steps/publish-symbols-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ parameters:
- name: symbolServer
type: string
default: '$(SymbolServer)'

- name: symbolTokenUri
type: string
default: '$(SymbolTokenUri)'

- name: symbolsArtifactName
type: string

- name: publishToServers
type: object
default:
default:
internal: true
public: true

Expand All @@ -52,6 +52,34 @@ steps:
displayName: 'Update Symbol.AccountName with ${{parameters.SymAccount}}'
condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})

- powershell: |
Write-Host "Symbols publishing task variables:"
Write-Host " SymAccount=${{ parameters.SymAccount }}"
Write-Host " publishSymbols=${{ parameters.publishSymbols }}"
Write-Host " symbolsVersion=${{ parameters.symbolsVersion }}"
Write-Host " symbolServer=${{ parameters.symbolServer }}"
Write-Host " symbolTokenUri=${{ parameters.symbolTokenUri }}"
Write-Host " symbolsArtifactName=${{ parameters.symbolsArtifactName }}"
Write-Host " publishToServers.internal=${{ parameters.publishToServers.internal }}"
Write-Host " publishToServers.public=${{ parameters.publishToServers.public }}"
Write-Host " referenceType=${{ parameters.referenceType }}"
Write-Host " product=${{ parameters.product }}"
Write-Host " Build.SourcesDirectory=$(Build.SourcesDirectory)"
Write-Host " Configuration=$(Configuration)"
Write-Host " NuGetPackageVersion=$(NuGetPackageVersion)"
Write-Host " PublishSymbols=$(PublishSymbols)"
Write-Host " SymbolServer=$(SymbolServer)"
Write-Host " SymbolTokenUri=$(SymbolTokenUri)"
Write-Host "PublishSymbols@2 inputs:"
Write-Host " SymbolsFolder=$(Build.SourcesDirectory)\\artifacts\\${{ parameters.referenceType }}\\bin"
Write-Host " SearchPattern line 1=Windows_NT/$(Configuration).AnyCPU/**/Microsoft.Data.SqlClient.pdb"
Write-Host " SearchPattern line 2=Unix/$(Configuration).AnyCPU/**/Microsoft.Data.SqlClient.pdb"
Write-Host " SymbolsProduct=Microsoft.Data.SqlClient"
Write-Host " SymbolsVersion=${{ parameters.symbolsVersion }}"
Write-Host " SymbolsArtifactName=${{ parameters.symbolsArtifactName }}"
displayName: 'Log symbols publishing variables'
condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})

- ${{ if eq(parameters.product, 'MDS') }}:
- task: PublishSymbols@2
displayName: 'Upload symbols to ${{parameters.SymAccount }} org'
Expand All @@ -78,51 +106,69 @@ steps:
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
$azureSubscription = "Symbols publishing Workload Identity federation service-ADO.Net"
$publishToInternalServer = "${{parameters.publishToServers.internal }}".ToLower()
$publishToPublicServer = "${{parameters.publishToServers.public }}".ToLower()
Comment on lines +109 to 111
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the AzureCLI inline script, $azureSubscription is assigned but never used (the task already sets azureSubscription via inputs). This adds noise and can be misleading when troubleshooting—consider removing the unused variable, or use it to validate/log the configured subscription consistently.

Copilot uses AI. Check for mistakes.

echo "Publishing request name: ${{parameters.symbolsArtifactName }}"
echo "Publish to internal server: $publishToInternalServer"
echo "Publish to public server: $publishToPublicServer"
$requestName = "${{parameters.symbolsArtifactName }}"

$symbolServer = "${{parameters.symbolServer }}"
$tokenUri = "${{parameters.symbolTokenUri }}"
# Registered project name in the symbol publishing pipeline: https://portal.microsofticm.com/imp/v3/incidents/incident/520844254/summary
$projectName = "Microsoft.Data.SqlClient.SNI"
$registerRequestUri = "https://$symbolServer.trafficmanager.net/projects/$projectName/requests"
$publishRequestUri = "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName"
$statusRequestUri = "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName"
$requestNameRegistrationBody = "{'requestName': '$requestName'}"
$publishSymbolsBody = "{'publishToInternalServer': $publishToInternalServer, 'publishToPublicServer': $publishToPublicServer}"
Comment on lines +121 to +122
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$requestNameRegistrationBody and $publishSymbolsBody are built using single quotes and string interpolation. Single quotes are not valid JSON and this approach won’t escape special characters in $requestName, which can cause hard-to-diagnose REST failures. Consider constructing a PowerShell hashtable/object and using ConvertTo-Json for the request bodies.

Copilot uses AI. Check for mistakes.

echo "Symbols publishing API variables:"
echo " azureSubscription=$azureSubscription"
echo " symbolServer=$symbolServer"
echo " tokenUri=$tokenUri"
echo " projectName=$projectName"
echo " requestName=$requestName"
echo " publishToInternalServer=$publishToInternalServer"
echo " publishToPublicServer=$publishToPublicServer"

echo "Symbols publishing URLs:"
echo " registerRequestUri=$registerRequestUri"
echo " publishRequestUri=$publishRequestUri"
echo " statusRequestUri=$statusRequestUri"

echo "Symbols publishing HTTP bodies:"
echo " requestNameRegistrationBody=$requestNameRegistrationBody"
echo " publishSymbolsBody=$publishSymbolsBody"

# Get the access token for the symbol publishing service
$symbolPublishingToken = az account get-access-token --resource $tokenUri --query accessToken -o tsv

echo "> 1.Symbol publishing token acquired."

echo "Registering the request name ..."
$requestName = "${{parameters.symbolsArtifactName }}"
$requestNameRegistrationBody = "{'requestName': '$requestName'}"
Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $requestNameRegistrationBody
Invoke-RestMethod -Method POST -Uri $registerRequestUri -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $requestNameRegistrationBody

echo "> 2.Registration of request name succeeded."

echo "Publishing the symbols ..."
$publishSymbolsBody = "{'publishToInternalServer': $publishToInternalServer, 'publishToPublicServer': $publishToPublicServer}"
echo "Publishing symbols request body: $publishSymbolsBody"
Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $publishSymbolsBody
Invoke-RestMethod -Method POST -Uri $publishRequestUri -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $publishSymbolsBody

echo "> 3.Request to publish symbols succeeded."

# The following REST calls are used to check publishing status.
echo "> 4.Checking the status of the request ..."

Invoke-RestMethod -Method GET -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json"
Invoke-RestMethod -Method GET -Uri $statusRequestUri -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json"

echo "Use below tables to interpret the values of xxxServerStatus and xxxServerResult fields from the response."

echo "PublishingStatus"
echo "-----------------"
echo "0 NotRequested; The request has not been requested to publish."
echo "1 Submitted; The request is submitted to be published"
echo "2 Processing; The request is still being processed"
echo "3 Completed; The request has been completed processing. It can be failed or successful. Check PublishingResult to get more details"

echo "PublishingResult"
echo "-----------------"
echo "0 Pending; The request has not completed or has not been requested."
Expand Down
9 changes: 7 additions & 2 deletions eng/pipelines/dotnet-sqlclient-signing-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ variables:
value: ${{ parameters['CurrentNetFxVersion'] }}

resources:
repositories:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
Expand All @@ -85,6 +85,11 @@ extends:
# Suggested by MerlinBot (https://sqlclientdrivers.visualstudio.com/ADO.Net/_git/dotnet-sqlclient/pullrequest/4882)
EnableCDPxPAT: false
WindowsHostVersion: 1ESWindows2022
networkIsolation:
# The ADO.Net pipeline that uses this file (sqlclient-6.1-official) seems to have inherited
# a restrictive network isolation policy that is causing symbol publishing to fail. Force
# the most permissive policy to work around this issue.
policy: Permissive
globalSdl: # https://aka.ms/obpipelines/sdl
tsa:
# The OneBranch template will set 'break' to false for the other SDL
Expand Down Expand Up @@ -114,7 +119,7 @@ extends:
break: true # always break the build on policheck issues. You can disable it by setting to 'false'
exclusionsFile: $(REPOROOT)\.config\PolicheckExclusions.xml
asyncSdl:
enabled: false
enabled: false
credscan:
enabled: ${{ not(parameters['isPreview']) }}
suppressionsFile: $(REPOROOT)/.config/CredScanSuppressions.json
Expand Down
1 change: 0 additions & 1 deletion eng/pipelines/libraries/build-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@

variables:
- template: common-variables.yml@self
- template: mds-variables.yml@self
14 changes: 14 additions & 0 deletions eng/pipelines/libraries/common-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ variables:
# AuthAKVName
# AuthSignCertName

- group: akv-variables-v2
# SymbolsAzureSubscription
# SymbolsPublishProjectName
# SymbolsPublishServer
# SymbolsPublishTokenUri
# SymbolsUploadAccount

- name: Configuration
value: Release
- name: CommitHead
Expand Down Expand Up @@ -51,3 +58,10 @@ variables:
value: '$(Major).$(Minor)$(Patch).$(Build.BuildNumber)'
- name: nuspecPath
value: '$(REPOROOT)/tools/specs/Microsoft.Data.SqlClient.nuspec'

# Symbols Publishing Aliases
# Map the akv-variables-v2 group names to the shorter names used by publish-symbols-step.yml
- name: SymbolServer
value: $(SymbolsPublishServer)
- name: SymbolTokenUri
value: $(SymbolsPublishTokenUri)
1 change: 0 additions & 1 deletion eng/pipelines/libraries/mds-validation-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

variables:
- template: common-variables.yml@self
- template: mds-variables.yml@self

- name: TempFolderName # extract the nuget package here
value: temp
Expand Down
10 changes: 0 additions & 10 deletions eng/pipelines/libraries/mds-variables.yml

This file was deleted.

Loading