Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github_packages: additional retry of skopeo copy with backoff #14932

Merged
merged 2 commits into from
Mar 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Library/Homebrew/github_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,21 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, keep_old:
"org.opencontainers.image.ref.name" => version_rebuild)

puts
args = ["copy", "--retry-times=5", "--all", "oci:#{root}", image_uri.to_s]
args = ["copy", "--retry-times=2", "--all", "oci:#{root}", image_uri.to_s]
if dry_run
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
Expand Down