lib/dockly/build_cache/docker.rb in dockly-1.4.6 vs lib/dockly/build_cache/docker.rb in dockly-1.4.7

- old
+ new

@@ -11,24 +11,29 @@ status, body, container = run_command(build_command) raise "Build Cache `#{build_command}` failed to run." unless status.zero? cache = copy_output_dir(container) debug "pushing #{output_directory} to s3" push_to_s3(cache) + debug "pushed #{output_directory} to s3" cache.close - self.image = container.commit + debug "commiting the completed container with id: #{container.id}" + image = self.image = container.commit + debug "created image with id: #{image.id}" + image end def push_cache(version) ensure_present! :output_dir if cache = pull_from_s3(version) debug "inserting to #{output_directory}" container = image.run("mkdir -p #{File.dirname(output_directory)}") - image_with_dir = container.tap { |c| c.wait }.commit + image_with_dir = container.tap(&:wait).commit self.image = image_with_dir.insert_local( 'localPath' => cache.path, 'outputPath' => File.dirname(output_directory) ) + debug "inserted cache into #{output_directory}" cache.close else info "could not find #{s3_object(version)}" end end @@ -62,11 +67,13 @@ end end def run_command(command) resp = "" + debug "running command `#{command}` on image #{image.id}" container = image.run(["/bin/bash", "-lc", "cd #{command_directory} && #{command}"]) container.attach { |source,chunk| resp += chunk } status = container.wait['StatusCode'] + debug "`#{command}` exited with status #{status}, resulting container id: #{conatiner.id}" [status, resp.strip, container] end end