From 7d0e197def6d50eebb8116e7f2b52f95a90c0aef Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 30 Jan 2025 14:06:50 +0100 Subject: [PATCH] build: retry PPA upload up to three times (#31099) --- build/ci.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build/ci.go b/build/ci.go index 4a83fb9a88..de47e8e541 100644 --- a/build/ci.go +++ b/build/ci.go @@ -883,11 +883,17 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) { os.WriteFile(idfile, sshkey, 0600) } } - // Upload + // Upload. This doesn't always work, so try up to three times. dest := sshUser + "@ppa.launchpad.net" - if err := build.UploadSFTP(idfile, dest, incomingDir, files); err != nil { - log.Fatal(err) + for i := 0; i < 3; i++ { + err := build.UploadSFTP(idfile, dest, incomingDir, files) + if err == nil { + return + } + log.Println("PPA upload failed:", err) + time.Sleep(5 * time.Second) } + log.Fatal("PPA upload failed all attempts.") } func getenvBase64(variable string) []byte {