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.
This commit is contained in:
David Taylor 2022-12-21 15:31:03 +00:00 committed by GitHub
parent e90c2cabfc
commit a6af981e1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -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