2019-08-12 18:09:36 -03:00
|
|
|
parameters:
|
|
|
|
Include: '*.exe, *.dll, *.pyd, *.cat, *.ps1'
|
|
|
|
Exclude: 'vcruntime*, libffi*, libcrypto*, libssl*'
|
|
|
|
|
2019-06-14 12:29:20 -03:00
|
|
|
jobs:
|
|
|
|
- job: Sign_Python
|
|
|
|
displayName: Sign Python binaries
|
|
|
|
condition: and(succeeded(), variables['SigningCertificate'])
|
|
|
|
|
|
|
|
pool:
|
|
|
|
name: 'Windows Release'
|
|
|
|
|
|
|
|
workspace:
|
|
|
|
clean: all
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
win32:
|
|
|
|
Name: win32
|
|
|
|
amd64:
|
|
|
|
Name: amd64
|
2019-11-20 13:30:47 -04:00
|
|
|
arm64:
|
|
|
|
Name: arm64
|
2019-06-14 12:29:20 -03:00
|
|
|
|
|
|
|
steps:
|
2019-08-12 18:09:36 -03:00
|
|
|
- template: ./checkout.yml
|
2019-06-14 12:29:20 -03:00
|
|
|
- template: ./find-sdk.yml
|
|
|
|
|
2020-08-06 13:36:22 -03:00
|
|
|
- powershell: |
|
|
|
|
$d = (.\PCbuild\build.bat -V) | %{ if($_ -match '\s+(\w+):\s*(.+)\s*$') { @{$Matches[1] = $Matches[2];} }};
|
|
|
|
Write-Host "##vso[task.setvariable variable=SigningDescription]Python $($d.PythonVersion)"
|
|
|
|
displayName: 'Update signing description'
|
|
|
|
condition: and(succeeded(), not(variables['SigningDescription']))
|
|
|
|
|
2019-06-14 12:29:20 -03:00
|
|
|
- powershell: |
|
|
|
|
Write-Host "##vso[build.addbuildtag]signed"
|
|
|
|
displayName: 'Add build tags'
|
|
|
|
|
2019-06-17 19:27:36 -03:00
|
|
|
- task: DownloadPipelineArtifact@1
|
2019-06-14 12:29:20 -03:00
|
|
|
displayName: 'Download artifact: unsigned_bin_$(Name)'
|
|
|
|
inputs:
|
|
|
|
artifactName: unsigned_bin_$(Name)
|
2019-06-17 19:27:36 -03:00
|
|
|
targetPath: $(Build.BinariesDirectory)\bin
|
2019-06-14 12:29:20 -03:00
|
|
|
|
|
|
|
- powershell: |
|
2019-08-12 18:09:36 -03:00
|
|
|
copy "$(Build.SourcesDirectory)\Lib\venv\scripts\common\Activate.ps1" .
|
|
|
|
displayName: 'Copy files from source'
|
|
|
|
workingDirectory: $(Build.BinariesDirectory)\bin
|
|
|
|
|
|
|
|
- powershell: |
|
|
|
|
$files = (gi ${{ parameters.Include }} -Exclude ${{ parameters.Exclude }})
|
2019-06-14 12:29:20 -03:00
|
|
|
signtool sign /a /n "$(SigningCertificate)" /fd sha256 /d "$(SigningDescription)" $files
|
|
|
|
displayName: 'Sign binaries'
|
2019-06-17 19:27:36 -03:00
|
|
|
workingDirectory: $(Build.BinariesDirectory)\bin
|
2019-06-14 12:29:20 -03:00
|
|
|
|
|
|
|
- powershell: |
|
2019-08-12 18:09:36 -03:00
|
|
|
$files = (gi ${{ parameters.Include }} -Exclude ${{ parameters.Exclude }})
|
2019-06-14 12:29:20 -03:00
|
|
|
$failed = $true
|
|
|
|
foreach ($retry in 1..10) {
|
2020-11-03 18:31:49 -04:00
|
|
|
signtool timestamp /tr http://timestamp.digicert.com/ /td sha256 $files
|
2019-06-14 12:29:20 -03:00
|
|
|
if ($?) {
|
|
|
|
$failed = $false
|
|
|
|
break
|
|
|
|
}
|
|
|
|
sleep 5
|
|
|
|
}
|
|
|
|
if ($failed) {
|
|
|
|
Write-Host "##vso[task.logissue type=error]Failed to timestamp files"
|
|
|
|
}
|
|
|
|
displayName: 'Timestamp binaries'
|
2019-06-17 19:27:36 -03:00
|
|
|
workingDirectory: $(Build.BinariesDirectory)\bin
|
2019-06-14 12:29:20 -03:00
|
|
|
continueOnError: true
|
|
|
|
|
2019-06-17 19:27:36 -03:00
|
|
|
- task: PublishPipelineArtifact@0
|
2019-06-14 12:29:20 -03:00
|
|
|
displayName: 'Publish artifact: bin_$(Name)'
|
|
|
|
inputs:
|
2019-06-17 19:27:36 -03:00
|
|
|
targetPath: '$(Build.BinariesDirectory)\bin'
|
|
|
|
artifactName: bin_$(Name)
|
2019-06-14 12:29:20 -03:00
|
|
|
|
|
|
|
|
|
|
|
- job: Dump_CertInfo
|
|
|
|
displayName: Capture certificate info
|
|
|
|
condition: and(succeeded(), variables['SigningCertificate'])
|
|
|
|
|
|
|
|
pool:
|
|
|
|
name: 'Windows Release'
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout: none
|
|
|
|
|
|
|
|
- powershell: |
|
|
|
|
$m = 'CN=$(SigningCertificate)'
|
|
|
|
$c = ((gci Cert:\CurrentUser\My), (gci Cert:\LocalMachine\My)) | %{ $_ } | `
|
|
|
|
?{ $_.Subject -match $m } | `
|
|
|
|
select -First 1
|
|
|
|
if (-not $c) {
|
|
|
|
Write-Host "Failed to find certificate for $(SigningCertificate)"
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
$d = mkdir "$(Build.BinariesDirectory)\tmp" -Force
|
|
|
|
$cf = "$d\cert.cer"
|
|
|
|
[IO.File]::WriteAllBytes($cf, $c.Export("Cer"))
|
|
|
|
$csha = (certutil -dump $cf | sls "Cert Hash\(sha256\): (.+)").Matches.Groups[1].Value
|
|
|
|
|
|
|
|
$info = @{ Subject=$c.Subject; SHA256=$csha; }
|
|
|
|
|
|
|
|
$d = mkdir "$(Build.BinariesDirectory)\cert" -Force
|
|
|
|
$info | ConvertTo-JSON -Compress | Out-File -Encoding utf8 "$d\certinfo.json"
|
|
|
|
displayName: "Extract certificate info"
|
|
|
|
|
2019-06-17 19:27:36 -03:00
|
|
|
- task: PublishPipelineArtifact@0
|
2019-06-14 12:29:20 -03:00
|
|
|
displayName: 'Publish artifact: cert'
|
|
|
|
inputs:
|
2019-06-17 19:27:36 -03:00
|
|
|
targetPath: '$(Build.BinariesDirectory)\cert'
|
|
|
|
artifactName: cert
|
2019-06-14 12:29:20 -03:00
|
|
|
|
|
|
|
|
|
|
|
- job: Mark_Unsigned
|
|
|
|
displayName: Tag unsigned build
|
|
|
|
condition: and(succeeded(), not(variables['SigningCertificate']))
|
|
|
|
|
|
|
|
pool:
|
2020-02-28 20:21:46 -04:00
|
|
|
vmImage: windows-2019
|
2019-06-14 12:29:20 -03:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout: none
|
|
|
|
|
|
|
|
- powershell: |
|
|
|
|
Write-Host "##vso[build.addbuildtag]unsigned"
|
|
|
|
displayName: 'Add build tag'
|