Skip to content

Instantly share code, notes, and snippets.

@vincentpaca
Last active October 6, 2015 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vincentpaca/193da337276e4e28dbed to your computer and use it in GitHub Desktop.
Save vincentpaca/193da337276e4e28dbed to your computer and use it in GitHub Desktop.
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