Skip to content

Commit 8872532

Browse files
committed
Retry to get HEAD commit
1 parent d6ab6b2 commit 8872532

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Rakefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,19 @@ namespace :docker do
135135
return File.read(cache_path)
136136
end
137137

138-
head_hash = `curl -fs -H 'accept: application/vnd.github.v3.sha' https://api.github.com/repos/ruby/ruby/commits/master`.chomp
139-
unless $?.success?
140-
raise "get_ruby_master_head_hash failed: #{head_hash.inspect}"
138+
count = 5
139+
140+
loop do
141+
head_hash = `curl -fs -H 'accept: application/vnd.github.v3.sha' https://api.github.com/repos/ruby/ruby/commits/master`.chomp
142+
if $?.success? || count.zero?
143+
break
144+
else
145+
p "get_ruby_master_head_hash failed: #{head_hash.inspect}"
146+
count -= 1
147+
sleep 5
148+
end
141149
end
150+
142151
if cache_path
143152
File.write(cache_path, head_hash)
144153
end

0 commit comments

Comments
 (0)