Class: Shipitron::Server::UploadBuildCache

Inherits:
Object
  • Object
show all
Includes:
Metaractor
Defined in:
lib/shipitron/server/upload_build_cache.rb

Instance Method Summary collapse

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/shipitron/server/upload_build_cache.rb', line 12

def call
  Logger.info "Uploading build cache to bucket #{s3_cache_bucket}"

  build_cache = Pathname.new("/home/shipitron/#{application}/tmp/build-cache.tar.gz")
  unless build_cache.exist?
    Logger.warn 'Build cache not found.'
    return
  end

  build_cache.open('rb') do |local_file|
    bucket.files.create(
      key: "#{application}.build-cache.tar.gz",
      body: local_file.read
    )
  end
end