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

[builder] make retries configurable #63

Merged
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion lib/omnibus/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ def execute_proc(cmd)
raise
end

def build_retries
Omnibus.config[:build_retries]
end

def execute_sh(cmd)
retries ||= 0
shell = nil
Expand Down Expand Up @@ -243,10 +247,11 @@ def execute_sh(cmd)
shell.error!
end
rescue Exception => e
raise if build_retries.nil? || build_retries == 0
# Getting lots of errors from github, particularly with erlang/rebar
# projects fetching tons of deps via git all the time. This isn't a
# particularly elegant way to solve that problem. But it should work.
if retries >= 3
if retries >= build_retries
ErrorReporter.new(e, self).explain("Failed to build #{name} while running `#{cmd_string}` with #{cmd_opts_for_display}")
raise
else
Expand Down
7 changes: 7 additions & 0 deletions lib/omnibus/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ class Config

# # @!endgroup

# @!group Build Control Parameters

# @! attribute [rw] build_retries
#
# @return [Integer, nil]
build_retries 3

# @!group Validation Methods

# Asserts that the Config object is in a valid state. If invalid
Expand Down