@@ -64,10 +64,10 @@ stages:
6464 vmImage : ' windows-latest'
6565
6666 variables :
67- - ${{ if eq(parameters.Sign, 'true') }} :
68- - group : CPythonSign
6967 - ${{ if eq(parameters.TestSign, 'true') }} :
7068 - group : CPythonTestSign
69+ - ${{ elseif eq(parameters.Sign, 'true') }} :
70+ - group : CPythonSign
7171 - ${{ if eq(parameters.Publish, 'true') }} :
7272 - group : PythonOrgPublish
7373
@@ -131,6 +131,26 @@ stages:
131131 displayName: 'Install signing tool and generate files'
132132 workingDirectory: $(Build.BinariesDirectory)
133133
134+ - task : AzureCLI@2
135+ displayName : ' Azure Login (1/2)'
136+ inputs :
137+ azureSubscription : ' Python Signing'
138+ scriptType : ' ps'
139+ scriptLocation : ' inlineScript'
140+ inlineScript : |
141+ "##vso[task.setvariable variable=AZURE_CLIENT_ID;issecret=true]${env:servicePrincipalId}"
142+ "##vso[task.setvariable variable=AZURE_ID_TOKEN;issecret=true]${env:idToken}"
143+ "##vso[task.setvariable variable=AZURE_TENANT_ID;issecret=true]${env:tenantId}"
144+ addSpnToEnvironment : true
145+
146+ - powershell : >
147+ az login --service-principal
148+ -u $(AZURE_CLIENT_ID)
149+ --tenant $(AZURE_TENANT_ID)
150+ --allow-no-subscriptions
151+ --federated-token $(AZURE_ID_TOKEN)
152+ displayName: 'Azure Login (2/2)'
153+
134154 - powershell : |
135155 python make.py
136156 displayName: 'Build package'
@@ -151,10 +171,6 @@ stages:
151171 }
152172 displayName: 'Sign binaries'
153173 workingDirectory: $(LAYOUT_DIR)
154- env:
155- AZURE_CLIENT_ID: $(TrustedSigningClientId)
156- AZURE_CLIENT_SECRET: $(TrustedSigningSecret)
157- AZURE_TENANT_ID: $(TrustedSigningTenantId)
158174
159175 - powershell : |
160176 python make-msix.py
@@ -186,10 +202,6 @@ stages:
186202 }
187203 displayName: 'Sign MSIX package'
188204 workingDirectory: $(DIST_DIR)
189- env:
190- AZURE_CLIENT_ID: $(TrustedSigningClientId)
191- AZURE_CLIENT_SECRET: $(TrustedSigningSecret)
192- AZURE_TENANT_ID: $(TrustedSigningTenantId)
193205
194206 - powershell : >
195207 dir *.msi | %{
@@ -201,28 +213,23 @@ stages:
201213 }
202214 displayName: 'Sign MSI package'
203215 workingDirectory: $(DIST_DIR)
204- env:
205- AZURE_CLIENT_ID: $(TrustedSigningClientId)
206- AZURE_CLIENT_SECRET: $(TrustedSigningSecret)
207- AZURE_TENANT_ID: $(TrustedSigningTenantId)
208216
209- - ${{ if eq(parameters.Sign, 'true') }} :
210- - powershell : Write-Host "##vso[build.addbuildtag]signed"
211- displayName : ' Add signed build tag'
212- - ${{ elseif eq(parameters.TestSign, 'true') }} :
217+ - ${{ if eq(parameters.TestSign, 'true') }} :
213218 - powershell : Write-Host "##vso[build.addbuildtag]test-signed"
214219 displayName : ' Add test-signed build tag'
220+ - ${{ elseif eq(parameters.Sign, 'true') }} :
221+ - powershell : Write-Host "##vso[build.addbuildtag]signed"
222+ displayName : ' Add signed build tag'
215223
216224 - publish : $(DIST_DIR)
217225 artifact : dist
218226 displayName : Publish distribution artifacts
219227
220228 - ${{ if eq(parameters.PostTest, 'true') }} :
221- - ${{ if eq(parameters.Sign, 'true') }} :
229+ - ${{ if and(ne(parameters.TestSign, 'true'), eq(parameters.Sign, 'true') ) }} :
222230 - powershell : |
223231 $msix = dir "$(DIST_DIR)\*.msix" | ?{ -not ($_.BaseName -match '.+-store') } | select -first 1
224232 Add-AppxPackage $msix
225- Get-AppxPackage PythonSoftwareFoundation.PythonManager
226233 displayName: 'Install signed MSIX'
227234
228235 - ${{ else }} :
@@ -231,53 +238,62 @@ stages:
231238 cp $msix "${msix}.zip"
232239 Expand-Archive "${msix}.zip" (mkdir -Force $env:TEST_MSIX)
233240 Add-AppxPackage -Register "${env:TEST_MSIX}\appxmanifest.xml"
234- Get-AppxPackage PythonSoftwareFoundation.PythonManager
235241 displayName: 'Register unsigned MSIX'
236242 env:
237243 TEST_MSIX: $(TEST_MSIX_DIR)
238244
239245 - powershell : |
240- gcm pymanager
241- gcm pywmanager
242- # These are likely present due to the machine configuration,
246+ $p = Get-AppxPackage PythonSoftwareFoundation.PythonManager
247+ $p
248+ Set-AppxPackageAutoUpdateSettings $p.PackageFamilyName -CheckOnLaunch $false
249+ Set-AppxPackageAutoUpdateSettings $p.PackageFamilyName -ShowPrompt $false
250+ Set-AppxPackageAutoUpdateSettings $p.PackageFamilyName -PauseUpdates -HoursToPause 1
251+ Get-AppxPackageAutoUpdateSettings $p.PackageFamilyName
252+ displayName: 'Update MSIX settings'
253+
254+ - powershell : |
255+ # Some of these are likely present due to the machine configuration,
243256 # but we'll check for them anyway.
244- gcm py
245- gcm python
246- gcm pyw
247- gcm pythonw
257+ gcm pymanager, pywmanager, py, python, pyw, pythonw | Format-Table -AutoSize
248258 displayName: 'Ensure global commands are present'
249259
250260 - powershell : |
251261 pymanager help
252262 displayName: 'Show help output'
263+ timeoutInMinutes: 1
253264
254265 - powershell : |
255266 pymanager install -vv default
256267 displayName: 'Install default runtime'
268+ timeoutInMinutes: 5
257269 env:
258270 PYMANAGER_DEBUG: true
259271
260272 - powershell : |
261273 pymanager list
262274 displayName: 'List installed runtimes'
275+ timeoutInMinutes: 1
263276 env:
264277 PYMANAGER_DEBUG: true
265278
266279 - powershell : |
267280 pymanager --list-paths
268281 displayName: 'List installed runtimes (legacy)'
282+ timeoutInMinutes: 1
269283 env:
270284 PYMANAGER_DEBUG: true
271285
272286 - powershell : |
273287 pymanager exec -m site
274288 displayName: 'Launch default runtime'
289+ timeoutInMinutes: 1
275290 env:
276291 PYMANAGER_DEBUG: true
277292
278293 - powershell : |
279294 pymanager uninstall -y default
280295 displayName: 'Uninstall runtime'
296+ timeoutInMinutes: 3
281297 env:
282298 PYMANAGER_DEBUG: true
283299
@@ -291,6 +307,7 @@ stages:
291307 pymanager install --configure -y
292308 if ($?) { pymanager list }
293309 displayName: 'Emulate first launch'
310+ timeoutInMinutes: 5
294311 env:
295312 PYTHON_MANAGER_INCLUDE_UNMANAGED: false
296313 PYTHON_MANAGER_CONFIG: .\test-config.json
@@ -302,6 +319,7 @@ stages:
302319 pymanager list --source .\bundle
303320 pymanager install --source .\bundle 3 3-32 3-64 3-arm64
304321 displayName: 'Offline bundle download and install'
322+ timeoutInMinutes: 5
305323 env:
306324 PYMANAGER_DEBUG: true
307325
0 commit comments