Skip to content

Commit db93d49

Browse files
committed
build: retry PPA upload up to three times (#31099)
1 parent 293a300 commit db93d49

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
@@ -888,11 +888,17 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) {
888888
os.WriteFile(idfile, sshkey, 0600)
889889
}
890890
}
891-
// Upload
891+
// Upload. This doesn't always work, so try up to three times.
892892
dest := sshUser + "@ppa.launchpad.net"
893-
if err := build.UploadSFTP(idfile, dest, incomingDir, files); err != nil {
894-
log.Fatal(err)
893+
for i := 0; i < 3; i++ {
894+
err := build.UploadSFTP(idfile, dest, incomingDir, files)
895+
if err == nil {
896+
return
897+
}
898+
log.Println("PPA upload failed:", err)
899+
time.Sleep(5 * time.Second)
895900
}
901+
log.Fatal("PPA upload failed all attempts.")
896902
}
897903

898904
func getenvBase64(variable string) []byte {

0 commit comments

Comments
 (0)