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



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/shipitron/server/upload_build_cache.rb', line 14

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

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

  result = S3Copy.call(
    source: build_cache.to_s,
    destination: "s3://#{s3_cache_bucket}/#{application}.build-cache.archive",
    region: context.region
  )
  if result.failure?
    Logger.warn 'Failed to upload build cache!'
  else
    Logger.info 'Upload complete.'
  end
end