diff --git a/Library/Homebrew/github_packages.rb b/Library/Homebrew/github_packages.rb index f0e8541847..c08fae7d5d 100644 --- a/Library/Homebrew/github_packages.rb +++ b/Library/Homebrew/github_packages.rb @@ -412,7 +412,16 @@ class GitHubPackages puts "#{skopeo} #{args.join(" ")} --dest-creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN" else args << "--dest-creds=#{user}:#{token}" - system_command!(skopeo, verbose: true, print_stdout: true, args: args) + retry_count = 0 + begin + system_command!(skopeo, verbose: true, print_stdout: true, args: args) + rescue ErrorDuringExecution + retry_count += 1 + odie "Cannot perform an upload to registry after retrying multiple times!" if retry_count >= 5 + sleep 5*retry_count + retry + end + package_name = "#{GitHubPackages.repo_without_prefix(repo)}/#{image_name}" ohai "Uploaded to https://github.com/orgs/#{org}/packages/container/package/#{package_name}" end