Class: Kitchen::Transport::Dokken

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/transport/dokken.rb

Overview

A Transport which uses Docker tricks to execute commands and transfer files.

Commands run through docker exec against the runner container. File transfer only happens when the daemon cannot read the host filesystem; then the files go over ssh into the data container, which shares its volumes with the runner.

Author:

Defined Under Namespace

Classes: Connection

Instance Method Summary collapse

Instance Method Details

#connection(state) {|connection| ... } ⇒ Connection

Returns a connection to the runner container.

Parameters:

  • state (Hash)

    mutable instance state

Yield Parameters:

  • connection (Connection)

    the connection, if a block is given

Returns:

  • (Connection)

    a connection to the runner container



76
77
78
79
80
81
82
83
84
# File 'lib/kitchen/transport/dokken.rb', line 76

def connection(state, &block)
  options = connection_options(config.to_hash.merge(state))

  if @connection && @connection_options == options
    reuse_connection(&block)
  else
    create_new_connection(options, &block)
  end
end

#docker_for_mac_or_win?TrueClass, FalseClass

Detect whether or not we are running in Docker for Mac or Windows

Returns:

  • (TrueClass, FalseClass)


493
494
495
496
497
498
499
500
501
# File 'lib/kitchen/transport/dokken.rb', line 493

def docker_for_mac_or_win?
  ::Docker.info(::Docker::Connection.new(config[:docker_host_url], {}))["Name"] == "docker-desktop"
# `::StandardError`, spelled out. This method lives inside module
# Kitchen, where a bare `StandardError` resolves to
# Kitchen::StandardError -- which Excon::Error::Socket is not, so an
# unreachable daemon would escape instead of answering "no".
rescue ::StandardError
  false
end