Skip to content

Commit afa885b

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

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

Rakefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,20 @@ 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+
head_hash = nil
140+
141+
loop do
142+
head_hash = `curl -fs -H 'accept: application/vnd.github.v3.sha' https://api.github.com/repos/ruby/ruby/commits/master`.chomp
143+
if $?.success? || count.zero?
144+
break
145+
else
146+
p "get_ruby_master_head_hash failed: #{head_hash.inspect}"
147+
count -= 1
148+
sleep 5
149+
end
141150
end
151+
142152
if cache_path
143153
File.write(cache_path, head_hash)
144154
end

0 commit comments

Comments
 (0)