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