Skip to content

Commit

Permalink
Merge pull request #881 from travis-ci/revert-877-s3-quiet-opt
Browse files Browse the repository at this point in the history
Revert "Provide `quiet` option to S3 provider"
  • Loading branch information
BanzaiMan committed Oct 4, 2018
2 parents db97734 + 50054af commit 704b77f
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions lib/dpl/provider/s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def max_threads

def check_app
end

def needs_key?
false
end
Expand Down Expand Up @@ -72,7 +72,7 @@ def push_app
glob_args = ["**/*"]
glob_args << File::FNM_DOTMATCH if options[:dot_match]
files = Dir.glob(*glob_args).reject {|f| File.directory?(f)}
result = upload_multithreaded(files)
upload_multithreaded(files)

if suffix = options[:index_document_suffix]
api.bucket(option(:bucket)).website.put(
Expand All @@ -85,15 +85,13 @@ def push_app
end

Dir.chdir(old_pwd)
result
end

def upload_multithreaded(files)
file_number = 0
mutex = Mutex.new
threads = []
log "Beginning upload of #{files.length} files with #{max_threads} threads."
failures = []

max_threads.times do |i|
threads[i] = Thread.new {
Expand All @@ -112,19 +110,14 @@ def upload_multithreaded(files)
opts[:storage_class] = options[:storage_class] if options[:storage_class]
opts[:server_side_encryption] = "AES256" if options[:server_side_encryption]
unless File.directory?(filename)
log "uploading #{filename.inspect} with #{opts.inspect}" unless quiet?
log "uploading #{filename.inspect} with #{opts.inspect}"
result = api.bucket(option(:bucket)).object(upload_path(filename)).upload_file(filename, opts)
unless result
warn "error while uploading #{filename.inspect}"
failures << filename
end
warn "error while uploading #{filename.inspect}" unless result
end
end
}
end
threads.each { |t| t.join }

failures.empty?
end

def deploy
Expand Down Expand Up @@ -174,10 +167,6 @@ def get_option_value_by_filename(option_values, filename)
preferred_value = option_values.select {|value| value.kind_of?(String) }.last if preferred_value.nil?
return preferred_value
end

def quiet?
options[:quiet]
end
end
end
end

0 comments on commit 704b77f

Please sign in to comment.