Skip to content

Commit 49fe45b

Browse files
committed
Properly redo looping on TS servers on signing (#254)
Code lifted from GH.elastic/windows-installers#386 (cherry picked from commit af9e0b2)
1 parent f4494a1 commit 49fe45b

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

installer/build/scripts/Build.fsx

+11-12
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,17 @@ module Builder =
9595
<| sprintf "Could not kill process %s %s after timeout." proc.StartInfo.FileName redactedArgs
9696
failwithf "Process %s %s timed out." proc.StartInfo.FileName redactedArgs
9797
proc.WaitForExit()
98-
proc.ExitCode
99-
100-
let mutable notSigned = true
101-
for server in timestampServers do
102-
if notSigned then
103-
let exitCode = sign server
104-
if (exitCode = 0) then
105-
notSigned <- false
106-
else
107-
tracefn "Signing with a timestamp from %s failed with code: %i" server exitCode
108-
if notSigned then failwithf "Signing failed"
109-
else tracefn "Signing succeeded."
98+
(timestampServer, proc.ExitCode)
99+
100+
let validExitCode =
101+
timestampServers
102+
|> Seq.map sign
103+
|> Seq.takeWhile (fun (server, exitCode) -> exitCode <> 0)
104+
|> Seq.tryFind (fun (server, exitCode) -> exitCode = 0)
105+
106+
match validExitCode with
107+
| Some (server, exitCode) -> failwithf "Signing with a timestamp from %s failed with code: %i" server exitCode
108+
| None -> tracefn "Signing succeeded."
110109

111110
// Using DotNetZip due to errors with CMAKE zip files: https://github.com/fsharp/FAKE/issues/775
112111
let unzipFile(zipFolder: string, unzipFolder: string) =

0 commit comments

Comments
 (0)