Skip to content
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
15 changes: 12 additions & 3 deletions eng/pipelines/build-whl-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ jobs:
# Copy the built .pdb files to staging folder for artifacts
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.SourcesDirectory)\mssql_python\pybind\build\$(targetArch)\py$(shortPyVer)\Release'
Contents: 'ddbc_bindings.cp$(shortPyVer)-*.pdbs'
SourceFolder: '$(Build.SourcesDirectory)\mssql_python'
Contents: 'ddbc_bindings.cp$(shortPyVer)-*.pdb'
TargetFolder: '$(Build.ArtifactStagingDirectory)\all-pdbs'
displayName: 'Place PDB file into artifacts directory'

Expand Down Expand Up @@ -158,6 +158,15 @@ jobs:
publishLocation: 'Container'
displayName: 'Publish all PYDs as artifacts'

# Publish the collected .pdb file(s) as build artifacts
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\all-pdbs'
ArtifactName: 'mssql-python-symbols'
publishLocation: 'Container'
displayName: 'Publish all PDBs as build artifacts'

# Publish the python arm64 libraries as build artifacts for next builds if ARM64
# We publish them only for ARM64 builds since we cannot install arm64 Python on x64 host
# This allows us to reuse the libraries in future ARM64 builds
Expand All @@ -169,7 +178,7 @@ jobs:
ArtifactName: 'mssql-python-arm64-libs'
publishLocation: 'Container'
displayName: 'Publish arm64 libs as artifacts'

# Publish the collected wheel file(s) as build artifacts
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
Expand Down
174 changes: 138 additions & 36 deletions eng/pipelines/dummy-release-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,153 @@
name: mssql-python-official-release-pipeline
name: mssql-python-dummy-release-pipeline

variables:
- group: 'ESRP Federated Creds (AME)'

jobs:
- job: ReleaseESRPPackage
displayName: 'Release ESRP Package'
- job: PublishSymbols
# Use the latest Windows image for building
pool:
vmImage: 'windows-latest'

displayName: 'Publish Symbols - Windows'
# Strategy matrix to build all combinations

steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: '$(System.TeamProject)'
definition: 2162
buildVersionToDownload: 'latest'
branchName: '$(Build.SourceBranch)'
artifactName: 'mssql-python-wheels-dist'
targetPath: '$(Build.SourcesDirectory)\dist'
displayName: 'Download release wheel files artifact from latest successful run on main branch'

# Show content of the downloaded artifact
- script: |
echo "Contents of the dist directory:"
dir "$(Build.SourcesDirectory)\dist"
displayName: 'List contents of dist directory'
- task: EsrpRelease@9
displayName: 'ESRP Release'
artifactName: 'mssql-python-symbols'
targetPath: '$(Build.ArtifactStagingDirectory)\all-pdbs'
displayName: 'Download PDB files artifact from latest successful run'

- powershell: 'Write-Host "##vso[task.setvariable variable=ArtifactServices.Symbol.AccountName;]mssql-python"'
displayName: 'Update Symbol.AccountName with mssql-python'

- task: PublishSymbols@2
displayName: 'Upload symbols to mssql-python org'
inputs:
SymbolsFolder: '$(Build.ArtifactStagingDirectory)\all-pdbs'
SearchPattern: '**/*.pdb'
IndexSources: false
SymbolServerType: TeamServices
SymbolsMaximumWaitTime: 60
SymbolExpirationInDays: 1825 # 5 years
SymbolsProduct: mssql-python
# Have kept the default version as the build ID, which is unique for each build
# This will be used to identify the symbols in the symbol server
SymbolsVersion: $(Build.BuildId)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need to change ID for SymbolsVersion - perhaps the driver release version?

# Default artifact name is the build definition name and build ID
# This will be used to identify the symbols in the symbol server
SymbolsArtifactName: $(Build.DefinitionName)-$(Build.BuildId)
Pat: $(System.AccessToken)

- task: AzureCLI@2
displayName: 'Publish symbols'
env:
SymbolServer: '$(SymbolServer)'
SymbolTokenUri: '$(SymbolTokenUri)'
requestName: '$(Build.DefinitionName)-$(Build.BuildId)'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

kept this since requestName needs to be unique for each API call. Might need to change this?

inputs:
connectedservicename: '$(ESRPConnectedServiceName)'
usemanagedidentity: true
keyvaultname: '$(AuthAKVName)'
signcertname: '$(AuthSignCertName)'
clientid: '$(EsrpClientId)'
Intent: 'PackageDistribution'
# Changing content type to Maven release (NOT PyPI) since we want to do dummy release
# for ESRP testing purposes, not for actual PyPI distribution.
# This is a workaround to allow ESRP to process the release without actual PyPI content
# and to avoid ESRP validation errors.
ContentType: 'Maven'
ContentSource: 'Folder'
FolderLocation: '$(Build.SourcesDirectory)/dist'
WaitForReleaseCompletion: true
Owners: '$(owner)'
Approvers: '$(approver)'
ServiceEndpointUrl: 'https://api.esrp.microsoft.com'
MainPublisher: 'ESRPRELPACMAN'
DomainTenantId: '$(DomainTenantId)'
azureSubscription: 'mssql-python-service'
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
# Should be true by default for internal server
$publishToInternalServer = $true
$publishToPublicServer = $false
echo "Publishing request name: $requestName"
echo "Publish to internal server: $publishToInternalServer"
echo "Publish to public server: $publishToPublicServer"
$symbolServer = '$(SymbolServer)'
$tokenUri = '$(SymbolTokenUri)'
$projectName = "mssql-python"
# 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 = '$(requestName)'
$requestNameRegistrationBody = "{'requestName': '$requestName'}"
Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests" -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
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"
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."
echo "1 Succeeded; The request has published successfully"
echo "2 Failed; The request has failed to publish"
echo "3 Cancelled; The request was cancelled"
# - job: ReleaseESRPPackage
# displayName: 'Release ESRP Package'
# pool:
# vmImage: 'windows-latest'

# steps:
# - task: DownloadPipelineArtifact@2
# inputs:
# buildType: 'specific'
# project: '$(System.TeamProject)'
# definition: 2162
# buildVersionToDownload: 'latest'
# branchName: '$(Build.SourceBranch)'
# artifactName: 'mssql-python-wheels-dist'
# targetPath: '$(Build.SourcesDirectory)\dist'
# displayName: 'Download release wheel files artifact from latest successful run on main branch'

# # Show content of the downloaded artifact
# - script: |
# echo "Contents of the dist directory:"
# dir "$(Build.SourcesDirectory)\dist"
# displayName: 'List contents of dist directory'

# - task: EsrpRelease@9
# displayName: 'ESRP Release'
# inputs:
# connectedservicename: '$(ESRPConnectedServiceName)'
# usemanagedidentity: true
# keyvaultname: '$(AuthAKVName)'
# signcertname: '$(AuthSignCertName)'
# clientid: '$(EsrpClientId)'
# Intent: 'PackageDistribution'
# # Changing content type to Maven release (NOT PyPI) since we want to do dummy release
# # for ESRP testing purposes, not for actual PyPI distribution.
# # This is a workaround to allow ESRP to process the release without actual PyPI content
# # and to avoid ESRP validation errors.
# ContentType: 'Maven'
# ContentSource: 'Folder'
# FolderLocation: '$(Build.SourcesDirectory)/dist'
# WaitForReleaseCompletion: true
# Owners: '$(owner)'
# Approvers: '$(approver)'
# ServiceEndpointUrl: 'https://api.esrp.microsoft.com'
# MainPublisher: 'ESRPRELPACMAN'
# DomainTenantId: '$(DomainTenantId)'
Loading