15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/shipitron/server/download_build_cache.rb', line 15
def call
Logger.info "Downloading build cache from bucket #{s3_cache_bucket}"
s3_file = bucket.files.head("#{application}.build-cache.archive")
if s3_file.nil?
Logger.warn 'Build cache not found.'
return
end
build_cache = Pathname.new("/home/shipitron/#{application}/#{build_cache_location}")
build_cache.parent.mkpath
result = S3Copy.call(
source: "s3://#{s3_cache_bucket}/#{application}.build-cache.archive",
destination: build_cache.to_s,
region: context.region
)
if result.failure?
fail_with_error!(message: 'Failed to download build cache!')
end
Logger.info 'Download complete.'
end
|