@@ -11,137 +11,140 @@ extends:
1111 featureFlags :
1212 WindowsHostVersion : 1ESWindows2022
1313
14- jobs :
15- - job : PublishSymbols
16- # Use the latest Windows image for building
17- pool :
18- vmImage : ' windows-latest'
19- displayName : ' Publish Symbols - Windows'
20- # Strategy matrix to build all combinations
21-
22- steps :
23- - task : UsePythonVersion@0
24- inputs :
25- versionSpec : ' 3.13'
26- architecture : ' x64'
27- addToPath : true
28- displayName : ' Use Python 3.13'
29-
30- # Install required packages: pip, CMake, pybind11
31- - script : |
32- python -m pip install --upgrade pip
33- pip install -r requirements.txt
34- pip install cmake pybind11
35- displayName: 'Install dependencies'
36-
37- # Generate the symbols for the mssql-python package using build.bat
38- - script : |
39- echo "Generating symbols for mssql-python package..."
40- cd mssql_python\pybind
41- build.bat
42- cd ..
43- dir /s /b
44- displayName: 'Generate symbols for mssql-python package'
45-
46- # Copy the generated symbols to the staging folder for artifacts
47- - task : CopyFiles@2
48- inputs :
49- SourceFolder : ' $(Build.SourcesDirectory)\mssql_python'
50- Contents : ' **\*.pdb'
51- TargetFolder : ' $(Build.ArtifactStagingDirectory)\mssql-python-symbols'
52- displayName : ' Copy symbols to staging folder'
53-
54- # Publish the symbols (only pdbs) as an artifact
55- - task : PublishBuildArtifacts@1
56- displayName : ' Publish symbols as build artifact'
57- inputs :
58- PathtoPublish : ' $(Build.ArtifactStagingDirectory)\mssql-python-symbols'
59- ArtifactName : ' mssql-python-symbols'
60- publishLocation : ' Container'
61-
62- - powershell : ' Write-Host "##vso[task.setvariable variable=ArtifactServices.Symbol.AccountName;]SqlClientDrivers"'
63- displayName : ' Update Symbol.AccountName with SqlClientDrivers'
64-
65- - task : PublishSymbols@2
66- displayName : ' Upload symbols to SqlClientDrivers org'
67- inputs :
68- SymbolsFolder : ' $(Build.ArtifactStagingDirectory)\mssql-python-symbols'
69- SearchPattern : ' **/*.pdb'
70- IndexSources : false
71- SymbolServerType : TeamServices
72- SymbolsMaximumWaitTime : 60
73- SymbolExpirationInDays : 1825 # 5 years
74- SymbolsProduct : mssql-python
75- # Have kept the default version as the build ID, which is unique for each build
76- # This will be used to identify the symbols in the symbol server
77- SymbolsVersion : $(Build.BuildId)
78- # Ensuring the symbols are uniquely identified
79- # MDS uses symbolsArtifactName as mds_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(NuGetPackageVersion)_$(System.TimelineId)
80- SymbolsArtifactName : $(System.TeamProject)-$(Build.SourceBranchName)-$(Build.DefinitionName)-$(Build.BuildId)
81- Pat : $(System.AccessToken)
82-
83- - task : AzureCLI@2
84- displayName : ' Publish symbols'
85- env :
86- SymbolServer : ' $(SymbolServer)'
87- SymbolTokenUri : ' $(SymbolTokenUri)'
88- requestName : ' $(System.TeamProject)-$(Build.SourceBranchName)-$(Build.DefinitionName)-$(Build.BuildId)'
89- inputs :
90- azureSubscription : ' SymbolsPublishing-msodbcsql-mssql-python'
91- scriptType : ps
92- scriptLocation : inlineScript
93- inlineScript : |
94- # Should be true by default for internal server
95- $publishToInternalServer = $true
96- $publishToPublicServer = $false
97-
98- echo "Publishing request name: $requestName"
99- echo "Publish to internal server: $publishToInternalServer"
100- echo "Publish to public server: $publishToPublicServer"
101-
102- $symbolServer = '$(SymbolServer)'
103- $tokenUri = '$(SymbolTokenUri)'
104- $projectName = "mssql-python"
105-
106- # Get the access token for the symbol publishing service
107- $symbolPublishingToken = az account get-access-token --resource $tokenUri --query accessToken -o tsv
108-
109- echo "> 1.Symbol publishing token acquired."
110-
111- echo "Registering the request name ..."
112- $requestName = '$(requestName)'
113- $requestNameRegistrationBody = "{'requestName': '$requestName'}"
114- Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $requestNameRegistrationBody
115-
116- echo "> 2.Registration of request name succeeded."
117-
118- echo "Publishing the symbols ..."
119- $publishSymbolsBody = "{'publishToInternalServer': $publishToInternalServer, 'publishToPublicServer': $publishToPublicServer}"
120- echo "Publishing symbols request body: $publishSymbolsBody"
121- Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $publishSymbolsBody
122-
123- echo "> 3.Request to publish symbols succeeded."
124-
125- # The following REST calls are used to check publishing status.
126- echo "> 4.Checking the status of the request ..."
127-
128- Invoke-RestMethod -Method GET -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json"
129-
130- echo "Use below tables to interpret the values of xxxServerStatus and xxxServerResult fields from the response."
131-
132- echo "PublishingStatus"
133- echo "-----------------"
134- echo "0 NotRequested; The request has not been requested to publish."
135- echo "1 Submitted; The request is submitted to be published"
136- echo "2 Processing; The request is still being processed"
137- echo "3 Completed; The request has been completed processing. It can be failed or successful. Check PublishingResult to get more details"
138-
139- echo "PublishingResult"
140- echo "-----------------"
141- echo "0 Pending; The request has not completed or has not been requested."
142- echo "1 Succeeded; The request has published successfully"
143- echo "2 Failed; The request has failed to publish"
144- echo "3 Cancelled; The request was cancelled"
14+ stages :
15+ - stage : PublishSymbols
16+ displayName : ' Publish Symbols'
17+ jobs :
18+ - job : PublishSymbols
19+ # Use the latest Windows image for building
20+ pool :
21+ vmImage : ' windows-latest'
22+ displayName : ' Publish Symbols - Windows'
23+ # Strategy matrix to build all combinations
24+
25+ steps :
26+ - task : UsePythonVersion@0
27+ inputs :
28+ versionSpec : ' 3.13'
29+ architecture : ' x64'
30+ addToPath : true
31+ displayName : ' Use Python 3.13'
32+
33+ # Install required packages: pip, CMake, pybind11
34+ - script : |
35+ python -m pip install --upgrade pip
36+ pip install -r requirements.txt
37+ pip install cmake pybind11
38+ displayName: 'Install dependencies'
39+
40+ # Generate the symbols for the mssql-python package using build.bat
41+ - script : |
42+ echo "Generating symbols for mssql-python package..."
43+ cd mssql_python\pybind
44+ build.bat
45+ cd ..
46+ dir /s /b
47+ displayName: 'Generate symbols for mssql-python package'
48+
49+ # Copy the generated symbols to the staging folder for artifacts
50+ - task : CopyFiles@2
51+ inputs :
52+ SourceFolder : ' $(Build.SourcesDirectory)\mssql_python'
53+ Contents : ' **\*.pdb'
54+ TargetFolder : ' $(Build.ArtifactStagingDirectory)\mssql-python-symbols'
55+ displayName : ' Copy symbols to staging folder'
56+
57+ # Publish the symbols (only pdbs) as an artifact
58+ - task : PublishBuildArtifacts@1
59+ displayName : ' Publish symbols as build artifact'
60+ inputs :
61+ PathtoPublish : ' $(Build.ArtifactStagingDirectory)\mssql-python-symbols'
62+ ArtifactName : ' mssql-python-symbols'
63+ publishLocation : ' Container'
64+
65+ - powershell : ' Write-Host "##vso[task.setvariable variable=ArtifactServices.Symbol.AccountName;]SqlClientDrivers"'
66+ displayName : ' Update Symbol.AccountName with SqlClientDrivers'
67+
68+ - task : PublishSymbols@2
69+ displayName : ' Upload symbols to SqlClientDrivers org'
70+ inputs :
71+ SymbolsFolder : ' $(Build.ArtifactStagingDirectory)\mssql-python-symbols'
72+ SearchPattern : ' **/*.pdb'
73+ IndexSources : false
74+ SymbolServerType : TeamServices
75+ SymbolsMaximumWaitTime : 60
76+ SymbolExpirationInDays : 1825 # 5 years
77+ SymbolsProduct : mssql-python
78+ # Have kept the default version as the build ID, which is unique for each build
79+ # This will be used to identify the symbols in the symbol server
80+ SymbolsVersion : $(Build.BuildId)
81+ # Ensuring the symbols are uniquely identified
82+ # MDS uses symbolsArtifactName as mds_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(NuGetPackageVersion)_$(System.TimelineId)
83+ SymbolsArtifactName : $(System.TeamProject)-$(Build.SourceBranchName)-$(Build.DefinitionName)-$(Build.BuildId)
84+ Pat : $(System.AccessToken)
85+
86+ - task : AzureCLI@2
87+ displayName : ' Publish symbols'
88+ env :
89+ SymbolServer : ' $(SymbolServer)'
90+ SymbolTokenUri : ' $(SymbolTokenUri)'
91+ requestName : ' $(System.TeamProject)-$(Build.SourceBranchName)-$(Build.DefinitionName)-$(Build.BuildId)'
92+ inputs :
93+ azureSubscription : ' SymbolsPublishing-msodbcsql-mssql-python'
94+ scriptType : ps
95+ scriptLocation : inlineScript
96+ inlineScript : |
97+ # Should be true by default for internal server
98+ $publishToInternalServer = $true
99+ $publishToPublicServer = $false
100+
101+ echo "Publishing request name: $requestName"
102+ echo "Publish to internal server: $publishToInternalServer"
103+ echo "Publish to public server: $publishToPublicServer"
104+
105+ $symbolServer = '$(SymbolServer)'
106+ $tokenUri = '$(SymbolTokenUri)'
107+ $projectName = "mssql-python"
108+
109+ # Get the access token for the symbol publishing service
110+ $symbolPublishingToken = az account get-access-token --resource $tokenUri --query accessToken -o tsv
111+
112+ echo "> 1.Symbol publishing token acquired."
113+
114+ echo "Registering the request name ..."
115+ $requestName = '$(requestName)'
116+ $requestNameRegistrationBody = "{'requestName': '$requestName'}"
117+ Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $requestNameRegistrationBody
118+
119+ echo "> 2.Registration of request name succeeded."
120+
121+ echo "Publishing the symbols ..."
122+ $publishSymbolsBody = "{'publishToInternalServer': $publishToInternalServer, 'publishToPublicServer': $publishToPublicServer}"
123+ echo "Publishing symbols request body: $publishSymbolsBody"
124+ Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $publishSymbolsBody
125+
126+ echo "> 3.Request to publish symbols succeeded."
127+
128+ # The following REST calls are used to check publishing status.
129+ echo "> 4.Checking the status of the request ..."
130+
131+ Invoke-RestMethod -Method GET -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json"
132+
133+ echo "Use below tables to interpret the values of xxxServerStatus and xxxServerResult fields from the response."
134+
135+ echo "PublishingStatus"
136+ echo "-----------------"
137+ echo "0 NotRequested; The request has not been requested to publish."
138+ echo "1 Submitted; The request is submitted to be published"
139+ echo "2 Processing; The request is still being processed"
140+ echo "3 Completed; The request has been completed processing. It can be failed or successful. Check PublishingResult to get more details"
141+
142+ echo "PublishingResult"
143+ echo "-----------------"
144+ echo "0 Pending; The request has not completed or has not been requested."
145+ echo "1 Succeeded; The request has published successfully"
146+ echo "2 Failed; The request has failed to publish"
147+ echo "3 Cancelled; The request was cancelled"
145148
146149# - job: ReleaseESRPPackage
147150# displayName: 'Release ESRP Package'
0 commit comments