dockly 1.4.6 → 1.4.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,15 +58,20 @@ class Dockly::BuildCache::Base
58
58
  file_path = File.join(tmp_dir,file_name)
59
59
 
60
60
  FileUtils.mkdir_p(File.dirname(file_path))
61
- unless File.exist?(file_path)
61
+ file = unless File.exist?(file_path)
62
+ debug 'Pulling build cache from s3'
62
63
  object = connection.get_object(s3_bucket, file_name)
64
+ debug 'Pulled build cache from s3'
63
65
 
64
66
  file = File.open(file_path, 'w+b')
65
67
  file.write(object.body)
66
68
  file.tap(&:rewind)
67
69
  else
70
+ info 'Build cache already exists locally'
68
71
  File.open(file_path, 'rb')
69
72
  end
73
+
74
+ file
70
75
  rescue Excon::Errors::NotFound
71
76
  nil
72
77
  end
@@ -13,8 +13,12 @@ class Dockly::BuildCache::Docker < Dockly::BuildCache::Base
13
13
  cache = copy_output_dir(container)
14
14
  debug "pushing #{output_directory} to s3"
15
15
  push_to_s3(cache)
16
+ debug "pushed #{output_directory} to s3"
16
17
  cache.close
17
- self.image = container.commit
18
+ debug "commiting the completed container with id: #{container.id}"
19
+ image = self.image = container.commit
20
+ debug "created image with id: #{image.id}"
21
+ image
18
22
  end
19
23
 
20
24
  def push_cache(version)
@@ -22,11 +26,12 @@ class Dockly::BuildCache::Docker < Dockly::BuildCache::Base
22
26
  if cache = pull_from_s3(version)
23
27
  debug "inserting to #{output_directory}"
24
28
  container = image.run("mkdir -p #{File.dirname(output_directory)}")
25
- image_with_dir = container.tap { |c| c.wait }.commit
29
+ image_with_dir = container.tap(&:wait).commit
26
30
  self.image = image_with_dir.insert_local(
27
31
  'localPath' => cache.path,
28
32
  'outputPath' => File.dirname(output_directory)
29
33
  )
34
+ debug "inserted cache into #{output_directory}"
30
35
  cache.close
31
36
  else
32
37
  info "could not find #{s3_object(version)}"
@@ -64,9 +69,11 @@ class Dockly::BuildCache::Docker < Dockly::BuildCache::Base
64
69
 
65
70
  def run_command(command)
66
71
  resp = ""
72
+ debug "running command `#{command}` on image #{image.id}"
67
73
  container = image.run(["/bin/bash", "-lc", "cd #{command_directory} && #{command}"])
68
74
  container.attach { |source,chunk| resp += chunk }
69
75
  status = container.wait['StatusCode']
76
+ debug "`#{command}` exited with status #{status}, resulting container id: #{conatiner.id}"
70
77
  [status, resp.strip, container]
71
78
  end
72
79
  end
@@ -1,3 +1,3 @@
1
1
  module Dockly
2
- VERSION = '1.4.6'
2
+ VERSION = '1.4.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.4.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: