cli/lib/rbld_engine.rb in rbld-1.1.0 vs cli/lib/rbld_engine.rb in rbld-1.2.0
- old
+ new
@@ -6,10 +6,11 @@
require_relative 'rbld_log'
require_relative 'rbld_config'
require_relative 'rbld_utils'
require_relative 'rbld_print'
require_relative 'rbld_reg_docker'
+require_relative 'rbld_reg_dockerhub'
require_relative 'rbld_reg_fs'
require_relative 'rbld_fileops'
module Rebuild::Engine
extend Rebuild::Utils::Errors
@@ -268,10 +269,11 @@
end
end
rebuild_errors \
UnsupportedDockerService: 'Unsupported docker service: %s',
+ InaccessibleDockerService: 'Unable to reach the docker engine',
EnvironmentIsModified: 'Environment is modified, commit or checkout first',
EnvironmentNotKnown: 'Unknown environment %s',
NoChangesToCommit: 'No changes to commit for %s',
EnvironmentDeploymentFailure: 'Failed to deploy from %s',
EnvironmentAlreadyExists: 'Environment %s already exists',
@@ -283,11 +285,11 @@
class DockerContext
def self.from_file(file)
base = %Q{
FROM scratch
- ADD #{file} /
+ ADD #{File.basename( file )} /
}
new( base, file )
end
@@ -602,22 +604,27 @@
# Use TCP connection instead
Docker.url = 'tcp://127.0.0.1:2375' if OS.windows?
end
def check_connectivity
- begin
- @docker_api.validate_version!
+ @docker_api.validate_version!
+
rescue Docker::Error::VersionError => msg
+ rbld_log.fatal( msg )
raise UnsupportedDockerService, msg
- end
- end
+ rescue => msg
+ rbld_log.fatal( msg )
+ raise InaccessibleDockerService
+ end
def registry
return @registry if @registry
case @cfg.remote!.type
when 'docker'
reg_module = Rebuild::Registry::Docker
+ when 'dockerhub'
+ reg_module = Rebuild::Registry::DockerHub
when 'rebuild'
reg_module = Rebuild::Registry::FS
else
raise "Remote type #{@cfg.remote!.type} is unknown"
end