2019-08-12 18:35:16 -03:00
|
|
|
parameters:
|
|
|
|
Include: '*.exe, *.dll, *.pyd, *.cat, *.ps1'
|
|
|
|
Exclude: 'vcruntime*, libffi*, libcrypto*, libssl*'
|
|
|
|
|
2019-06-14 18:20:16 -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
|
|
|
|
|
|
|
|
steps:
|
2019-08-12 18:35:16 -03:00
|
|
|
- template: ./checkout.yml
|
2019-06-14 18:20:16 -03:00
|
|
|
- template: ./find-sdk.yml
|
|
|
|
|
|
|
|
- powershell: |
|
|
|
|
Write-Host "##vso[build.addbuildtag]signed"
|
|
|
|
displayName: 'Add build tags'
|
|
|
|
|
2019-06-17 20:32:05 -03:00
|
|
|
- task: DownloadPipelineArtifact@1
|
2019-06-14 18:20:16 -03:00
|
|
|
displayName: 'Download artifact: unsigned_bin_$(Name)'
|
|
|
|
inputs:
|
|
|
|
artifactName: unsigned_bin_$(Name)
|
2019-06-17 20:32:05 -03:00
|
|
|
targetPath: $(Build.BinariesDirectory)\bin
|
2019-06-14 18:20:16 -03:00
|
|
|
|
|
|
|
- powershell: |
|
2019-08-12 18:35:16 -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 18:20:16 -03:00
|
|
|
signtool sign /a /n "$(SigningCertificate)" /fd sha256 /d "$(SigningDescription)" $files
|
|
|
|
displayName: 'Sign binaries'
|
2019-06-17 20:32:05 -03:00
|
|
|
workingDirectory: $(Build.BinariesDirectory)\bin
|
2019-06-14 18:20:16 -03:00
|
|
|
|
|
|
|
- powershell: |
|
2019-08-12 18:35:16 -03:00
|
|
|
$files = (gi ${{ parameters.Include }} -Exclude ${{ parameters.Exclude }})
|
2019-06-14 18:20:16 -03:00
|
|
|
$failed = $true
|
|
|
|
foreach ($retry in 1..10) {
|
|
|
|
signtool timestamp /t http://timestamp.verisign.com/scripts/timestamp.dll $files
|
|
|
|
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 20:32:05 -03:00
|
|
|
workingDirectory: $(Build.BinariesDirectory)\bin
|
2019-06-14 18:20:16 -03:00
|
|
|
continueOnError: true
|
|
|
|
|
2019-06-17 20:32:05 -03:00
|
|
|
- task: PublishPipelineArtifact@0
|
2019-06-14 18:20:16 -03:00
|
|
|
displayName: 'Publish artifact: bin_$(Name)'
|
|
|
|
inputs:
|
2019-06-17 20:32:05 -03:00
|
|
|
targetPath: '$(Build.BinariesDirectory)\bin'
|
|
|
|
artifactName: bin_$(Name)
|
2019-06-14 18:20:16 -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 20:32:05 -03:00
|
|
|
- task: PublishPipelineArtifact@0
|
2019-06-14 18:20:16 -03:00
|
|
|
displayName: 'Publish artifact: cert'
|
|
|
|
inputs:
|
2019-06-17 20:32:05 -03:00
|
|
|
targetPath: '$(Build.BinariesDirectory)\cert'
|
|
|
|
artifactName: cert
|
2019-06-14 18:20:16 -03:00
|
|
|
|
|
|
|
|
|
|
|
- job: Mark_Unsigned
|
|
|
|
displayName: Tag unsigned build
|
|
|
|
condition: and(succeeded(), not(variables['SigningCertificate']))
|
|
|
|
|
|
|
|
pool:
|
|
|
|
vmName: win2016-vs2017
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout: none
|
|
|
|
|
|
|
|
- powershell: |
|
|
|
|
Write-Host "##vso[build.addbuildtag]unsigned"
|
|
|
|
displayName: 'Add build tag'
|