Skip to content

Commit 7d0e197

Browse files
authored
build: retry PPA upload up to three times (#31099)
1 parent d80da7c commit 7d0e197

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

build/ci.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -883,11 +883,17 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) {
883883
os.WriteFile(idfile, sshkey, 0600)
884884
}
885885
}
886-
// Upload
886+
// Upload. This doesn't always work, so try up to three times.
887887
dest := sshUser + "@ppa.launchpad.net"
888-
if err := build.UploadSFTP(idfile, dest, incomingDir, files); err != nil {
889-
log.Fatal(err)
888+
for i := 0; i < 3; i++ {
889+
err := build.UploadSFTP(idfile, dest, incomingDir, files)
890+
if err == nil {
891+
return
892+
}
893+
log.Println("PPA upload failed:", err)
894+
time.Sleep(5 * time.Second)
890895
}
896+
log.Fatal("PPA upload failed all attempts.")
891897
}
892898

893899
func getenvBase64(variable string) []byte {

0 commit comments

Comments
 (0)