Skip to content

Instantly share code, notes, and snippets.

@vincentpaca vincentpaca/s3_upload.rb
Last active Oct 6, 2015

Embed
What would you like to do?
s3_puts_file.rb
require 'aws-sdk'
s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'])
rspec_bucket = obj = s3.bucket(ENV['RSPEC_BUCKET']).object("#{ENV['CI_BUILD_NUMBER']}/#{ENV['TEST_GROUP']}")
cukes_bucket = obj = s3.bucket(ENV['CUKES_BUCKET']).object("#{ENV['CI_BUILD_NUMBER']}/#{ENV['TEST_GROUP']}")
log_files = [ENV['RSPEC_LOG_PATH'], ENV['CUCUMBER_LOG_PATH']]
log_files.each do |log_file|
bucket = log_file.include?("rspec") ? rspec_bucket : cukes_bucket
File.open(log_file, 'rb') do |file|
bucket.delete
bucket.put(body: file)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.