Skip to content

Commit a4ab587

Browse files
FEAT: Migrate Release (and dummy) Pipelines to use ReleaseJob (#511)
### Work Item / Issue Reference <!-- IMPORTANT: Please follow the PR template guidelines below. For mssql-python maintainers: Insert your ADO Work Item ID below For external contributors: Insert Github Issue number below Only one reference is required - either GitHub issue OR ADO Work Item. --> <!-- mssql-python maintainers: ADO Work Item --> > [AB#43946](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/43946) <!-- External contributors: GitHub Issue --> > GitHub Issue: #<ISSUE_NUMBER> ------------------------------------------------------------------- ### Summary <!-- Insert your summary of changes below. Minimum 10 characters required. --> This pull request restructures both the dummy and official release pipelines to improve clarity, enforce OneBranch policy requirements, and streamline artifact handling. The main changes include splitting the pipelines into explicit preparation/validation and release jobs, ensuring ESRP release steps run on the correct pool, updating artifact paths, and enhancing dry run handling. **Pipeline Restructuring and Policy Compliance:** * Split the pipelines into two explicit jobs: `PrepAndValidate` (for downloading, validating, and staging artifacts using a custom pool) and a release job (`DummyRelease` or `PyPIRelease`) that runs on a 1ES hosted pool as required by OneBranch policy. ESRP release steps are now only in the release job, which depends on the preparation job. (`OneBranchPipelines/dummy-release-pipeline.yml`, `OneBranchPipelines/official-release-pipeline.yml`) [[1]](diffhunk://#diff-f33e687de954b798773c221fa2242934d5ec593abda31b787cdb10d590c1cb76L93-R95) [[2]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL96-R98) [[3]](diffhunk://#diff-f33e687de954b798773c221fa2242934d5ec593abda31b787cdb10d590c1cb76L225-R286) [[4]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL228-R278) * ESRP release jobs now use `templateContext.type: releaseJob` and ensure artifact download and publishing steps are run in the correct environment, preventing accidental production releases from test pipelines. (`OneBranchPipelines/dummy-release-pipeline.yml`, `OneBranchPipelines/official-release-pipeline.yml`) [[1]](diffhunk://#diff-f33e687de954b798773c221fa2242934d5ec593abda31b787cdb10d590c1cb76L225-R286) [[2]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL228-R278) **Artifact Path and Handling Updates:** * Changed artifact and wheel file paths throughout the pipelines to use the new consolidated artifact location (`$(Build.SourcesDirectory)/artifacts/dist`) instead of the previous `dist` folder. This affects validation, ESRP release, and summary steps. (`OneBranchPipelines/dummy-release-pipeline.yml`, `OneBranchPipelines/official-release-pipeline.yml`) [[1]](diffhunk://#diff-f33e687de954b798773c221fa2242934d5ec593abda31b787cdb10d590c1cb76L250-L259) [[2]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL196-R192) [[3]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL250-L259) * Removed unnecessary steps for copying wheels to a separate `dist` folder, as the new artifact structure makes this redundant. (`OneBranchPipelines/official-release-pipeline.yml`) **Dry Run and Summary Improvements:** * Enhanced dry run handling: when release parameters are disabled, a clear summary is shown and release steps are skipped. This logic is now more explicit and avoids accidental releases. (`OneBranchPipelines/dummy-release-pipeline.yml`, `OneBranchPipelines/official-release-pipeline.yml`) [[1]](diffhunk://#diff-f33e687de954b798773c221fa2242934d5ec593abda31b787cdb10d590c1cb76L225-R286) [[2]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL228-R278) [[3]](diffhunk://#diff-f33e687de954b798773c221fa2242934d5ec593abda31b787cdb10d590c1cb76L292-L320) [[4]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL281-L303) **Step Renumbering and Minor Cleanups:** * Updated step numbers and comments for clarity and consistency after restructuring, and removed obsolete or duplicate summary steps. (`OneBranchPipelines/dummy-release-pipeline.yml`, `OneBranchPipelines/official-release-pipeline.yml`) [[1]](diffhunk://#diff-f33e687de954b798773c221fa2242934d5ec593abda31b787cdb10d590c1cb76L119-R120) [[2]](diffhunk://#diff-f33e687de954b798773c221fa2242934d5ec593abda31b787cdb10d590c1cb76L177-R178) [[3]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL122-R123) [[4]](diffhunk://#diff-27a96a9aa4f8678027cc712c73505b5351a98bcd22501bbf5f0ed9617a7a6bffL180-R176) These changes make the pipelines more robust, easier to understand, and compliant with internal release policies. <!-- ### PR Title Guide > For feature requests FEAT: (short-description) > For non-feature requests like test case updates, config updates , dependency updates etc CHORE: (short-description) > For Fix requests FIX: (short-description) > For doc update requests DOC: (short-description) > For Formatting, indentation, or styling update STYLE: (short-description) > For Refactor, without any feature changes REFACTOR: (short-description) > For release related changes, without any feature changes RELEASE: #<RELEASE_VERSION> (short-description) ### Contribution Guidelines External contributors: - Create a GitHub issue first: https://github.com/microsoft/mssql-python/issues/new - Link the GitHub issue in the "GitHub Issue" section above - Follow the PR title format and provide a meaningful summary mssql-python maintainers: - Create an ADO Work Item following internal processes - Link the ADO Work Item in the "ADO Work Item" section above - Follow the PR title format and provide a meaningful summary --> Co-authored-by: Gaurav Sharma <sharmag@microsoft.com>
1 parent 9688b10 commit a4ab587

File tree

2 files changed

+170
-136
lines changed

2 files changed

+170
-136
lines changed

OneBranchPipelines/dummy-release-pipeline.yml

Lines changed: 91 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ extends:
9090
displayName: '[TEST] Dummy Release - Testing ESRP Workflow'
9191

9292
jobs:
93-
- job: DownloadAndTestRelease
94-
displayName: '[TEST] Download Artifacts and Perform Dummy Release'
93+
# Job 1: Download, validate, and stage artifacts (custom pool)
94+
- job: PrepAndValidate
95+
displayName: '[TEST] Download and Validate Artifacts'
9596

9697
pool:
9798
type: windows
@@ -116,7 +117,7 @@ extends:
116117
artifactName: 'drop_Consolidate_ConsolidateArtifacts' # Consolidated artifact with dist/ and symbols/
117118
targetPath: '$(Build.SourcesDirectory)/artifacts'
118119

119-
# Step 3: List downloaded artifacts for verification
120+
# Step 2: List downloaded artifacts for verification
120121
- task: PowerShell@2
121122
displayName: '[TEST] List Downloaded Wheel and Symbol Files'
122123
inputs:
@@ -174,7 +175,7 @@ extends:
174175
Write-Host "Symbols: $(if ($symbols) { $symbols.Count } else { 0 }) files"
175176
Write-Host "====================================="
176177
177-
# Step 3.5: Validate mssql-py-core is a stable version (no dev/alpha/beta/rc)
178+
# Step 3: Validate mssql-py-core is a stable version (no dev/alpha/beta/rc)
178179
- task: PowerShell@2
179180
displayName: '[TEST] Validate mssql-py-core is a stable version'
180181
inputs:
@@ -222,74 +223,7 @@ extends:
222223
parameters:
223224
SymbolsFolder: '$(Build.SourcesDirectory)/symbols'
224225

225-
# Step 6: Copy wheels to ob_outputDirectory for OneBranch artifact publishing
226-
- task: CopyFiles@2
227-
displayName: '[TEST] Stage Wheels for Dummy Release'
228-
inputs:
229-
SourceFolder: '$(Build.SourcesDirectory)/dist'
230-
Contents: '*.whl'
231-
TargetFolder: '$(ob_outputDirectory)/release'
232-
flattenFolders: true
233-
234-
# Step 7: ESRP Dummy Release Task (only if performDummyRelease is true)
235-
# ⚠️ IMPORTANT: Uses Maven ContentType for testing - NOT PyPI!
236-
- ${{ if eq(parameters.performDummyRelease, true) }}:
237-
- task: EsrpRelease@9
238-
displayName: '[TEST] ESRP Dummy Release (Maven - NOT PyPI)'
239-
inputs:
240-
connectedservicename: '$(ESRPConnectedServiceName)'
241-
usemanagedidentity: true
242-
keyvaultname: '$(AuthAKVName)'
243-
signcertname: '$(AuthSignCertName)'
244-
clientid: '$(EsrpClientId)'
245-
Intent: 'PackageDistribution'
246-
# ⚠️ CRITICAL: ContentType is Maven (NOT PyPI) for safe testing
247-
# This ensures no accidental production releases to PyPI
248-
ContentType: 'Maven'
249-
ContentSource: 'Folder'
250-
FolderLocation: '$(Build.SourcesDirectory)/dist'
251-
WaitForReleaseCompletion: true
252-
Owners: '$(owner)'
253-
Approvers: '$(approver)'
254-
ServiceEndpointUrl: 'https://api.esrp.microsoft.com'
255-
MainPublisher: 'ESRPRELPACMAN'
256-
DomainTenantId: '$(DomainTenantId)'
257-
258-
# Step 8: Show test release status
259-
- ${{ if eq(parameters.performDummyRelease, true) }}:
260-
- task: PowerShell@2
261-
displayName: '[TEST] Dummy Release Summary'
262-
inputs:
263-
targetType: 'inline'
264-
script: |
265-
Write-Host "===================================="
266-
Write-Host "⚠️ TEST PIPELINE - DUMMY RELEASE COMPLETED ⚠️"
267-
Write-Host "===================================="
268-
Write-Host "Package: mssql-python (TEST)"
269-
Write-Host "ContentType: Maven (NOT PyPI - Safe for Testing)"
270-
Write-Host "Owners: $(owner)"
271-
Write-Host "Approvers: $(approver)"
272-
Write-Host "Symbols Published: ${{ parameters.publishSymbols }}"
273-
Write-Host "====================================="
274-
Write-Host ""
275-
Write-Host "⚠️ IMPORTANT: This was a DUMMY release using Maven ContentType"
276-
Write-Host " NO packages were released to PyPI"
277-
Write-Host ""
278-
Write-Host "What was tested:"
279-
Write-Host "✓ Artifact download from build pipeline"
280-
Write-Host "✓ Wheel integrity verification"
281-
if ("${{ parameters.publishSymbols }}" -eq "True") {
282-
Write-Host "✓ Symbol publishing to SqlClientDrivers org"
283-
}
284-
Write-Host "✓ ESRP release workflow (Maven ContentType)"
285-
Write-Host ""
286-
Write-Host "Next steps:"
287-
Write-Host "1. Verify dummy release in ESRP portal"
288-
Write-Host "2. Check ESRP approval workflow completion"
289-
Write-Host "3. Verify symbols in SqlClientDrivers org (if published)"
290-
Write-Host "4. For PRODUCTION release, use official-release-pipeline.yml"
291-
Write-Host "====================================="
292-
226+
# Dry run summary (when release is disabled)
293227
- ${{ if eq(parameters.performDummyRelease, false) }}:
294228
- task: PowerShell@2
295229
displayName: '[TEST] Dry Run - Dummy Release Skipped'
@@ -318,3 +252,88 @@ extends:
318252
Write-Host "1. Use official-release-pipeline.yml instead"
319253
Write-Host "2. Official pipeline uses PyPI ContentType"
320254
Write-Host "====================================="
255+
256+
# Job 2: ESRP Release (releaseJob on 1ES hosted pool — required by OneBranch policy)
257+
# EsrpRelease is not allowed in custom pools; must use templateContext.type: releaseJob
258+
- ${{ if eq(parameters.performDummyRelease, true) }}:
259+
- job: DummyRelease
260+
displayName: '[TEST] ESRP Dummy Release (Maven - NOT PyPI)'
261+
dependsOn: PrepAndValidate
262+
263+
templateContext:
264+
type: releaseJob
265+
266+
pool:
267+
type: windows
268+
269+
variables:
270+
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
271+
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
272+
273+
steps:
274+
# Download artifacts directly from build pipeline
275+
- task: DownloadPipelineArtifact@2
276+
displayName: '[TEST] Download Artifacts from Build Pipeline'
277+
inputs:
278+
buildType: 'specific'
279+
project: '$(System.TeamProject)'
280+
definition: 2199
281+
buildVersionToDownload: 'specific'
282+
buildId: $(resources.pipeline.buildPipeline.runID)
283+
artifactName: 'drop_Consolidate_ConsolidateArtifacts'
284+
targetPath: '$(Build.SourcesDirectory)/artifacts'
285+
286+
# ⚠️ IMPORTANT: Uses Maven ContentType for testing - NOT PyPI!
287+
- task: EsrpRelease@9
288+
displayName: '[TEST] ESRP Dummy Release (Maven - NOT PyPI)'
289+
inputs:
290+
connectedservicename: '$(ESRPConnectedServiceName)'
291+
usemanagedidentity: true
292+
keyvaultname: '$(AuthAKVName)'
293+
signcertname: '$(AuthSignCertName)'
294+
clientid: '$(EsrpClientId)'
295+
Intent: 'PackageDistribution'
296+
# ⚠️ CRITICAL: ContentType is Maven (NOT PyPI) for safe testing
297+
# This ensures no accidental production releases to PyPI
298+
ContentType: 'Maven'
299+
ContentSource: 'Folder'
300+
FolderLocation: '$(Build.SourcesDirectory)/artifacts/dist'
301+
WaitForReleaseCompletion: true
302+
Owners: '$(owner)'
303+
Approvers: '$(approver)'
304+
ServiceEndpointUrl: 'https://api.esrp.microsoft.com'
305+
MainPublisher: 'ESRPRELPACMAN'
306+
DomainTenantId: '$(DomainTenantId)'
307+
308+
- task: PowerShell@2
309+
displayName: '[TEST] Dummy Release Summary'
310+
inputs:
311+
targetType: 'inline'
312+
script: |
313+
Write-Host "===================================="
314+
Write-Host "⚠️ TEST PIPELINE - DUMMY RELEASE COMPLETED ⚠️"
315+
Write-Host "===================================="
316+
Write-Host "Package: mssql-python (TEST)"
317+
Write-Host "ContentType: Maven (NOT PyPI - Safe for Testing)"
318+
Write-Host "Owners: $(owner)"
319+
Write-Host "Approvers: $(approver)"
320+
Write-Host "Symbols Published: ${{ parameters.publishSymbols }}"
321+
Write-Host "====================================="
322+
Write-Host ""
323+
Write-Host "⚠️ IMPORTANT: This was a DUMMY release using Maven ContentType"
324+
Write-Host " NO packages were released to PyPI"
325+
Write-Host ""
326+
Write-Host "What was tested:"
327+
Write-Host "✓ Artifact download from build pipeline"
328+
Write-Host "✓ Wheel integrity verification"
329+
if ("${{ parameters.publishSymbols }}" -eq "True") {
330+
Write-Host "✓ Symbol publishing to SqlClientDrivers org"
331+
}
332+
Write-Host "✓ ESRP release workflow (Maven ContentType)"
333+
Write-Host ""
334+
Write-Host "Next steps:"
335+
Write-Host "1. Verify dummy release in ESRP portal"
336+
Write-Host "2. Check ESRP approval workflow completion"
337+
Write-Host "3. Verify symbols in SqlClientDrivers org (if published)"
338+
Write-Host "4. For PRODUCTION release, use official-release-pipeline.yml"
339+
Write-Host "====================================="

0 commit comments

Comments
 (0)