Skip to content

Commit

Permalink
Add retry timeout and wait period between checks
Browse files Browse the repository at this point in the history
  • Loading branch information
slide committed May 19, 2020
1 parent b00bb75 commit 143cf49
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion msi/build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,24 @@ Get-ChildItem .\bin\Release -Filter *.msi -Recurse |
Write-Host "Signing installer"
# always disable tracing here
Set-PSDebug -Trace 0
while($True) {
$retries = 10
while($retries -gt 0) {
$p = Start-Process -Wait -PassThru -NoNewWindow -FilePath "signtool.exe" -ArgumentList "sign /v /f `"${env:PKCS12_FILE}`" /p ${env:SIGN_STOREPASS} /t http://timestamp.verisign.com/scripts/timestamp.dll /d `"Jenkins Automation Server ${JenkinsVersion}`" /du `"https://jenkins.io`" $_.FullName"
$p.WaitForExit()
# we will retry until we get a good exit code
if($p.ExitCode -eq 0) {
break
} else {
Start-Sleep -Seconds 10
$retries--
}
}

if($retries -lt 0) {
Write-Error "signtool did not complete successfully after 10 tries"
exit -1
}

if($UseTracing) { Set-PSDebug -Trace 1 }

Write-Host "Checking the signature"
Expand Down

0 comments on commit 143cf49

Please sign in to comment.