-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathpipeline-publish.yml
More file actions
179 lines (160 loc) · 7.42 KB
/
Copy pathpipeline-publish.yml
File metadata and controls
179 lines (160 loc) · 7.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# pipeline-publish.yml
#
# Release pipeline for the msal Python package — manually triggered only.
# Source: https://github.com/AzureAD/microsoft-authentication-library-for-python
#
# Publish targets:
# test.pypi.org (Preview / RC) — preview releases via MSAL-Test-Python-Upload SC
# (SC creation pending test.pypi.org API token)
# pypi.org (ESRP Production) — production releases via ESRP (EsrpRelease@12) using MSAL-ESRP-AME SC
#
# For pipeline documentation, see .Pipelines/CI-AND-RELEASE-PIPELINES.md.
parameters:
- name: packageVersion
displayName: 'Package version to publish (must match msal/sku.py, e.g. 1.36.0 or 1.36.0rc1)'
type: string
- name: publishTarget
displayName: 'Publish target'
type: string
values:
- 'test.pypi.org (Preview / RC)'
- 'pypi.org (ESRP Production)'
trigger: none # manual runs only — no automatic branch or tag triggers
pr: none
# Stage flow:
#
# PreBuildCheck ─► Validate ─► UnitTests ─► E2ETests ─► Build ─► PublishMSALPython (publishTarget == Preview)
# └─► PublishPyPI (publishTarget == ESRP Production)
stages:
# PreBuildCheck, Validate, UnitTests, and E2ETests stages are defined in the shared template.
- template: template-pipeline-stages.yml
parameters:
packageVersion: ${{ parameters.packageVersion }}
runPublish: true
# ══════════════════════════════════════════════════════════════════════════════
# Stage 3 · Build — build sdist + wheel
# ══════════════════════════════════════════════════════════════════════════════
- stage: Build
displayName: 'Build package'
dependsOn: E2ETests
condition: in(dependencies.E2ETests.result, 'Succeeded', 'SucceededWithIssues')
jobs:
- job: BuildDist
displayName: 'Build sdist + wheel (Python 3.12)'
pool:
vmImage: ubuntu-latest
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
displayName: 'Use Python 3.12'
- script: |
python -m pip install --upgrade pip build twine
displayName: 'Install build toolchain'
- script: |
python -m build
displayName: 'Build sdist and wheel'
- script: |
python -m twine check dist/*
displayName: 'Verify distribution (twine check)'
- task: PublishPipelineArtifact@1
displayName: 'Publish dist/ as pipeline artifact'
inputs:
targetPath: dist/
artifact: python-dist
# ══════════════════════════════════════════════════════════════════════════════
# Stage 4a · Publish to test.pypi.org (Preview / RC)
# Note: requires MSAL-Test-Python-Upload SC in ADO (pending test.pypi.org API token)
# ══════════════════════════════════════════════════════════════════════════════
- stage: PublishMSALPython
displayName: 'Publish to test.pypi.org (Preview)'
dependsOn: Build
condition: >
and(
in(dependencies.Build.result, 'Succeeded', 'SucceededWithIssues'),
eq('${{ parameters.publishTarget }}', 'test.pypi.org (Preview / RC)')
)
jobs:
- deployment: DeployMSALPython
displayName: 'Upload to test.pypi.org'
pool:
vmImage: ubuntu-latest
environment: MSAL-Python
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download python-dist artifact'
inputs:
artifactName: python-dist
targetPath: $(Pipeline.Workspace)/python-dist
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
displayName: 'Use Python 3.12'
- script: |
python -m pip install --upgrade pip twine
displayName: 'Install twine'
# TODO: create MSAL-Test-Python-Upload SC with test.pypi.org API token, then uncomment:
# - task: TwineAuthenticate@1
# displayName: 'Authenticate with MSAL-Test-Python-Upload'
# inputs:
# pythonUploadServiceConnection: MSAL-Test-Python-Upload
# - script: |
# python -m twine upload \
# -r "MSAL-Test-Python-Upload" \
# --config-file $(PYPIRC_PATH) \
# --skip-existing \
# $(Pipeline.Workspace)/python-dist/*
# displayName: 'Upload to test.pypi.org'
- script: echo "Publish to test.pypi.org skipped — MSAL-Test-Python-Upload SC not yet created."
displayName: 'Skip upload (SC pending)'
# ══════════════════════════════════════════════════════════════════════════════
# Stage 4b · Publish to PyPI (ESRP Production)
# Uses EsrpRelease@12 via the MSAL-ESRP-AME service connection.
# IMPORTANT: configure a required manual approval on this environment in
# ADO → Pipelines → Environments → MSAL-Python-Release → Approvals and checks.
# IMPORTANT: EsrpRelease@12 requires a Windows agent.
# ══════════════════════════════════════════════════════════════════════════════
- stage: PublishPyPI
displayName: 'Publish to PyPI (ESRP Production)'
dependsOn: Build
condition: >
and(
in(dependencies.Build.result, 'Succeeded', 'SucceededWithIssues'),
eq('${{ parameters.publishTarget }}', 'pypi.org (ESRP Production)')
)
jobs:
- deployment: DeployPyPI
displayName: 'Upload to PyPI via ESRP'
pool:
vmImage: windows-latest
environment: MSAL-Python-Release
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download python-dist artifact'
inputs:
artifactName: python-dist
targetPath: $(Pipeline.Workspace)/python-dist
- task: EsrpRelease@12
displayName: 'Publish to PyPI via ESRP'
inputs:
connectedservicename: 'MSAL-ESRP-AME'
usemanagedidentity: true
keyvaultname: 'MSALVault'
signcertname: 'MSAL-ESRP-Release-Signing'
clientid: '8650ce2b-38d4-466a-9144-bc5c19c88112'
intent: 'PackageDistribution'
contenttype: 'PyPi'
contentsource: 'Folder'
folderlocation: '$(Pipeline.Workspace)/python-dist'
waitforreleasecompletion: true
owners: 'ryauld@microsoft.com,avdunn@microsoft.com'
approvers: 'avdunn@microsoft.com,bogavril@microsoft.com'
serviceendpointurl: 'https://api.esrp.microsoft.com'
mainpublisher: 'ESRPRELPACMAN'
domaintenantid: '33e01921-4d64-4f8c-a055-5bdaffd5e33d'