|
1 | | -name: mssql-python-official-release-pipeline |
| 1 | +trigger: none |
| 2 | + |
| 3 | +name: mssql-python-dummy-release-pipeline |
2 | 4 |
|
3 | 5 | variables: |
4 | 6 | - group: 'ESRP Federated Creds (AME)' |
| 7 | + # Add OneBranch required variables as a separate item in the list |
| 8 | + - name: ob_outputDirectory |
| 9 | + value: '$(Build.ArtifactStagingDirectory)/out' |
| 10 | + - name: ob_artifactBaseName |
| 11 | + value: 'mssql-python' |
| 12 | + |
| 13 | +resources: |
| 14 | + repositories: |
| 15 | + - repository: templates |
| 16 | + type: git |
| 17 | + name: OneBranch.Pipelines/GovernedTemplates |
| 18 | + ref: refs/heads/main |
| 19 | + |
| 20 | +extends: |
| 21 | + template: v2/OneBranch.Official.CrossPlat.yml@templates |
| 22 | + parameters: |
| 23 | + featureFlags: |
| 24 | + WindowsHostVersion: 1ESWindows2022 |
| 25 | + |
| 26 | + stages: |
| 27 | + - stage: PublishSymbols |
| 28 | + displayName: 'Publish Symbols' |
| 29 | + jobs: |
| 30 | + - job: PublishSymbols |
| 31 | + # Use the latest Windows image for building |
| 32 | + pool: |
| 33 | + type: 'windows' |
| 34 | + displayName: 'Publish Symbols - Windows' |
| 35 | + |
| 36 | + # OneBranch required variables must be at job level |
| 37 | + variables: |
| 38 | + ob_outputDirectory: '$(Build.SourcesDirectory)\out' |
| 39 | + ob_artifactBaseName: 'mssql-python-symbols' |
| 40 | + |
| 41 | + steps: |
| 42 | + - task: UsePythonVersion@0 |
| 43 | + inputs: |
| 44 | + versionSpec: '3.13' |
| 45 | + architecture: 'x64' |
| 46 | + addToPath: true |
| 47 | + displayName: 'Use Python 3.13' |
| 48 | + |
| 49 | + # Install required packages: pip, CMake, pybind11 |
| 50 | + - script: | |
| 51 | + python -m pip install --upgrade pip |
| 52 | + pip install -r requirements.txt |
| 53 | + displayName: 'Install dependencies' |
| 54 | +
|
| 55 | + # Generate the symbols for the mssql-python package using build.bat |
| 56 | + - script: | |
| 57 | + echo "Generating symbols for mssql-python package..." |
| 58 | + cd mssql_python\pybind |
| 59 | + build.bat |
| 60 | + cd .. |
| 61 | + dir /s /b |
| 62 | + displayName: 'Generate symbols for mssql-python package' |
| 63 | +
|
| 64 | + # Copy the generated symbols to OneBranch output directory |
| 65 | + - task: CopyFiles@2 |
| 66 | + inputs: |
| 67 | + SourceFolder: '$(Build.SourcesDirectory)\mssql_python' |
| 68 | + Contents: '**\*.pdb' |
| 69 | + TargetFolder: '$(ob_outputDirectory)\symbols' |
| 70 | + displayName: 'Copy symbols to OneBranch output directory' |
| 71 | + |
| 72 | + # OneBranch will automatically upload artifacts from ob_outputDirectory |
| 73 | + # No need for PublishBuildArtifacts task |
| 74 | + |
| 75 | + - powershell: 'Write-Host "##vso[task.setvariable variable=ArtifactServices.Symbol.AccountName;]SqlClientDrivers"' |
| 76 | + displayName: 'Update Symbol.AccountName with SqlClientDrivers' |
| 77 | + |
| 78 | + - task: PublishSymbols@2 |
| 79 | + displayName: 'Upload symbols to SqlClientDrivers org' |
| 80 | + inputs: |
| 81 | + SymbolsFolder: '$(Build.ArtifactStagingDirectory)\mssql-python-symbols' |
| 82 | + SearchPattern: '**/*.pdb' |
| 83 | + IndexSources: false |
| 84 | + SymbolServerType: TeamServices |
| 85 | + SymbolsMaximumWaitTime: 60 |
| 86 | + SymbolExpirationInDays: 1825 # 5 years |
| 87 | + SymbolsProduct: mssql-python |
| 88 | + # Have kept the default version as the build ID, which is unique for each build |
| 89 | + # This will be used to identify the symbols in the symbol server |
| 90 | + SymbolsVersion: $(Build.BuildId) |
| 91 | + # Ensuring the symbols are uniquely identified |
| 92 | + # MDS uses symbolsArtifactName as mds_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(NuGetPackageVersion)_$(System.TimelineId) |
| 93 | + SymbolsArtifactName: $(System.TeamProject)-$(Build.SourceBranchName)-$(Build.DefinitionName)-$(Build.BuildId) |
| 94 | + Pat: $(System.AccessToken) |
| 95 | + |
| 96 | + - task: AzureCLI@2 |
| 97 | + displayName: 'Publish symbols' |
| 98 | + env: |
| 99 | + SymbolServer: '$(SymbolServer)' |
| 100 | + SymbolTokenUri: '$(SymbolTokenUri)' |
| 101 | + requestName: '$(System.TeamProject)-$(Build.SourceBranchName)-$(Build.DefinitionName)-$(Build.BuildId)' |
| 102 | + inputs: |
| 103 | + azureSubscription: 'SymbolsPublishing-msodbcsql-mssql-python' |
| 104 | + scriptType: ps |
| 105 | + scriptLocation: inlineScript |
| 106 | + inlineScript: | |
| 107 | + # Should be true by default for internal server |
| 108 | + $publishToInternalServer = $true |
| 109 | + $publishToPublicServer = $false |
5 | 110 |
|
6 | | -jobs: |
7 | | -- job: ReleaseESRPPackage |
8 | | - displayName: 'Release ESRP Package' |
9 | | - pool: |
10 | | - vmImage: 'windows-latest' |
| 111 | + echo "Publishing request name: $requestName" |
| 112 | + echo "Publish to internal server: $publishToInternalServer" |
| 113 | + echo "Publish to public server: $publishToPublicServer" |
| 114 | +
|
| 115 | + $symbolServer = '$(SymbolServer)' |
| 116 | + $tokenUri = '$(SymbolTokenUri)' |
| 117 | + $projectName = "mssql-python" |
| 118 | +
|
| 119 | + # Get the access token for the symbol publishing service |
| 120 | + $symbolPublishingToken = az account get-access-token --resource $tokenUri --query accessToken -o tsv |
| 121 | +
|
| 122 | + echo "> 1.Symbol publishing token acquired." |
| 123 | +
|
| 124 | + echo "Registering the request name ..." |
| 125 | + $requestName = '$(requestName)' |
| 126 | + $requestNameRegistrationBody = "{'requestName': '$requestName'}" |
| 127 | + Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $requestNameRegistrationBody |
| 128 | +
|
| 129 | + echo "> 2.Registration of request name succeeded." |
| 130 | +
|
| 131 | + echo "Publishing the symbols ..." |
| 132 | + $publishSymbolsBody = "{'publishToInternalServer': $publishToInternalServer, 'publishToPublicServer': $publishToPublicServer}" |
| 133 | + echo "Publishing symbols request body: $publishSymbolsBody" |
| 134 | + Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $publishSymbolsBody |
| 135 | +
|
| 136 | + echo "> 3.Request to publish symbols succeeded." |
| 137 | +
|
| 138 | + # The following REST calls are used to check publishing status. |
| 139 | + echo "> 4.Checking the status of the request ..." |
| 140 | +
|
| 141 | + Invoke-RestMethod -Method GET -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" |
| 142 | + |
| 143 | + echo "Use below tables to interpret the values of xxxServerStatus and xxxServerResult fields from the response." |
| 144 | + |
| 145 | + echo "PublishingStatus" |
| 146 | + echo "-----------------" |
| 147 | + echo "0 NotRequested; The request has not been requested to publish." |
| 148 | + echo "1 Submitted; The request is submitted to be published" |
| 149 | + echo "2 Processing; The request is still being processed" |
| 150 | + echo "3 Completed; The request has been completed processing. It can be failed or successful. Check PublishingResult to get more details" |
| 151 | + |
| 152 | + echo "PublishingResult" |
| 153 | + echo "-----------------" |
| 154 | + echo "0 Pending; The request has not completed or has not been requested." |
| 155 | + echo "1 Succeeded; The request has published successfully" |
| 156 | + echo "2 Failed; The request has failed to publish" |
| 157 | + echo "3 Cancelled; The request was cancelled" |
| 158 | +
|
| 159 | +# - job: ReleaseESRPPackage |
| 160 | +# displayName: 'Release ESRP Package' |
| 161 | +# pool: |
| 162 | +# vmImage: 'windows-latest' |
11 | 163 |
|
12 | | - steps: |
13 | | - - task: DownloadPipelineArtifact@2 |
14 | | - inputs: |
15 | | - buildType: 'specific' |
16 | | - project: '$(System.TeamProject)' |
17 | | - definition: 2162 |
18 | | - buildVersionToDownload: 'latest' |
19 | | - branchName: '$(Build.SourceBranch)' |
20 | | - artifactName: 'mssql-python-wheels-dist' |
21 | | - targetPath: '$(Build.SourcesDirectory)\dist' |
22 | | - displayName: 'Download release wheel files artifact from latest successful run on main branch' |
23 | | - |
24 | | - # Show content of the downloaded artifact |
25 | | - - script: | |
26 | | - echo "Contents of the dist directory:" |
27 | | - dir "$(Build.SourcesDirectory)\dist" |
28 | | - displayName: 'List contents of dist directory' |
29 | | -
|
30 | | - - task: EsrpRelease@9 |
31 | | - displayName: 'ESRP Release' |
32 | | - inputs: |
33 | | - connectedservicename: '$(ESRPConnectedServiceName)' |
34 | | - usemanagedidentity: true |
35 | | - keyvaultname: '$(AuthAKVName)' |
36 | | - signcertname: '$(AuthSignCertName)' |
37 | | - clientid: '$(EsrpClientId)' |
38 | | - Intent: 'PackageDistribution' |
39 | | - # Changing content type to Maven release (NOT PyPI) since we want to do dummy release |
40 | | - # for ESRP testing purposes, not for actual PyPI distribution. |
41 | | - # This is a workaround to allow ESRP to process the release without actual PyPI content |
42 | | - # and to avoid ESRP validation errors. |
43 | | - ContentType: 'Maven' |
44 | | - ContentSource: 'Folder' |
45 | | - FolderLocation: '$(Build.SourcesDirectory)/dist' |
46 | | - WaitForReleaseCompletion: true |
47 | | - Owners: '$(owner)' |
48 | | - Approvers: '$(approver)' |
49 | | - ServiceEndpointUrl: 'https://api.esrp.microsoft.com' |
50 | | - MainPublisher: 'ESRPRELPACMAN' |
51 | | - DomainTenantId: '$(DomainTenantId)' |
| 164 | +# steps: |
| 165 | +# - task: DownloadPipelineArtifact@2 |
| 166 | +# inputs: |
| 167 | +# buildType: 'specific' |
| 168 | +# project: '$(System.TeamProject)' |
| 169 | +# definition: 2162 |
| 170 | +# buildVersionToDownload: 'latest' |
| 171 | +# branchName: '$(Build.SourceBranch)' |
| 172 | +# artifactName: 'mssql-python-wheels-dist' |
| 173 | +# targetPath: '$(Build.SourcesDirectory)\dist' |
| 174 | +# displayName: 'Download release wheel files artifact from latest successful run on main branch' |
| 175 | + |
| 176 | +# # Show content of the downloaded artifact |
| 177 | +# - script: | |
| 178 | +# echo "Contents of the dist directory:" |
| 179 | +# dir "$(Build.SourcesDirectory)\dist" |
| 180 | +# displayName: 'List contents of dist directory' |
| 181 | + |
| 182 | +# - task: EsrpRelease@9 |
| 183 | +# displayName: 'ESRP Release' |
| 184 | +# inputs: |
| 185 | +# connectedservicename: '$(ESRPConnectedServiceName)' |
| 186 | +# usemanagedidentity: true |
| 187 | +# keyvaultname: '$(AuthAKVName)' |
| 188 | +# signcertname: '$(AuthSignCertName)' |
| 189 | +# clientid: '$(EsrpClientId)' |
| 190 | +# Intent: 'PackageDistribution' |
| 191 | +# # Changing content type to Maven release (NOT PyPI) since we want to do dummy release |
| 192 | +# # for ESRP testing purposes, not for actual PyPI distribution. |
| 193 | +# # This is a workaround to allow ESRP to process the release without actual PyPI content |
| 194 | +# # and to avoid ESRP validation errors. |
| 195 | +# ContentType: 'Maven' |
| 196 | +# ContentSource: 'Folder' |
| 197 | +# FolderLocation: '$(Build.SourcesDirectory)/dist' |
| 198 | +# WaitForReleaseCompletion: true |
| 199 | +# Owners: '$(owner)' |
| 200 | +# Approvers: '$(approver)' |
| 201 | +# ServiceEndpointUrl: 'https://api.esrp.microsoft.com' |
| 202 | +# MainPublisher: 'ESRPRELPACMAN' |
| 203 | +# DomainTenantId: '$(DomainTenantId)' |
0 commit comments