diff --git a/eng/pipelines/common/templates/steps/publish-symbols-step.yml b/eng/pipelines/common/templates/steps/publish-symbols-step.yml index 52e622d9a3..715e0e8bdd 100644 --- a/eng/pipelines/common/templates/steps/publish-symbols-step.yml +++ b/eng/pipelines/common/templates/steps/publish-symbols-step.yml @@ -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 @@ -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' @@ -78,17 +106,38 @@ 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() - - 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}" + + 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 @@ -96,33 +145,30 @@ steps: 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." diff --git a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml index cabb39e11f..b0a80cba3a 100644 --- a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml +++ b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml @@ -72,7 +72,7 @@ variables: value: ${{ parameters['CurrentNetFxVersion'] }} resources: - repositories: + repositories: - repository: templates type: git name: OneBranch.Pipelines/GovernedTemplates @@ -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 @@ -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 diff --git a/eng/pipelines/libraries/build-variables.yml b/eng/pipelines/libraries/build-variables.yml index 3dd87fe7d7..0f5d439c6d 100644 --- a/eng/pipelines/libraries/build-variables.yml +++ b/eng/pipelines/libraries/build-variables.yml @@ -6,4 +6,3 @@ variables: - template: common-variables.yml@self - - template: mds-variables.yml@self diff --git a/eng/pipelines/libraries/common-variables.yml b/eng/pipelines/libraries/common-variables.yml index 736a5fe79e..2d87abbb27 100644 --- a/eng/pipelines/libraries/common-variables.yml +++ b/eng/pipelines/libraries/common-variables.yml @@ -13,6 +13,13 @@ variables: # AuthAKVName # AuthSignCertName + - group: akv-variables-v2 + # SymbolsAzureSubscription + # SymbolsPublishProjectName + # SymbolsPublishServer + # SymbolsPublishTokenUri + # SymbolsUploadAccount + - name: Configuration value: Release - name: CommitHead @@ -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) diff --git a/eng/pipelines/libraries/mds-validation-variables.yml b/eng/pipelines/libraries/mds-validation-variables.yml index d7723a059f..13d4df9c6f 100644 --- a/eng/pipelines/libraries/mds-validation-variables.yml +++ b/eng/pipelines/libraries/mds-validation-variables.yml @@ -6,7 +6,6 @@ variables: - template: common-variables.yml@self - - template: mds-variables.yml@self - name: TempFolderName # extract the nuget package here value: temp diff --git a/eng/pipelines/libraries/mds-variables.yml b/eng/pipelines/libraries/mds-variables.yml deleted file mode 100644 index cfb6c7621d..0000000000 --- a/eng/pipelines/libraries/mds-variables.yml +++ /dev/null @@ -1,10 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -variables: - - group: Release Variables - # SymbolServer - # SymbolTokenUri