From a6af981e1b5b3fa71f03fee174f5fb7d272995b8 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 21 Dec 2022 15:31:03 +0000 Subject: [PATCH] DEV: Add retry logic to `plugin:install_all_official` (#19551) This task sometimes fails in CI due to temporary network issues. Retrying twice should help resolve those situations without needing to manually restart the job. --- lib/tasks/plugin.rake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/tasks/plugin.rake b/lib/tasks/plugin.rake index ddff6524986..c3c822eed45 100644 --- a/lib/tasks/plugin.rake +++ b/lib/tasks/plugin.rake @@ -32,9 +32,16 @@ task 'plugin:install_all_official' do repo += ".git" end - status = system("git clone #{repo} #{path}") - unless status - abort("Failed to clone #{repo}") + attempts = 0 + begin + attempts += 1 + system("git clone #{repo} #{path}", exception: true) + rescue StandardError + if attempts >= 3 + abort("Failed to clone #{repo}") + end + STDERR.puts "Failed to clone #{repo}... trying again..." + retry end end end