kitchen-dokken 2.8.1 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen/driver/dokken.rb +4 -2
- data/lib/kitchen/driver/dokken_version.rb +1 -1
- data/lib/kitchen/helpers.rb +3 -3
- data/lib/kitchen/provisioner/dokken.rb +11 -2
- data/lib/kitchen/transport/dokken.rb +6 -6
- metadata +18 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9838e52a3dafe9888e01c141655f444b364ffc9721589a4524cc87286dc4110
|
4
|
+
data.tar.gz: 69f9de9936b22eddb8a71786011fafc9c5be00e487a6316264f46dfdd3d66ecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99ce50d234ff2cb2cee7a68282aa89f52072d598673c227663ea965a060863308637f2a22717c70bc521f56fd590f78b23822803e8c1f35797f07d2e12114d60
|
7
|
+
data.tar.gz: 349f2ecbea46e70af465d2bf0fd87c6b04d24458ed607e28d014993f2230143bb0fda20d7b11a13ce410ddcd3ae6d481dc5399541cd339b1966bf24f98ef67aa
|
@@ -15,9 +15,9 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
require 'digest'
|
18
|
+
require 'digest' unless defined?(Digest)
|
19
19
|
require 'kitchen'
|
20
|
-
require 'tmpdir'
|
20
|
+
require 'tmpdir' unless defined?(Dir.mktmpdir)
|
21
21
|
require 'docker'
|
22
22
|
require 'lockfile'
|
23
23
|
require_relative '../helpers'
|
@@ -61,6 +61,7 @@ module Kitchen
|
|
61
61
|
default_config :userns_host, false
|
62
62
|
default_config :pull_platform_image, true
|
63
63
|
default_config :pull_chef_image, true
|
64
|
+
default_config :memory_limit, 0
|
64
65
|
|
65
66
|
# (see Base#create)
|
66
67
|
def create(state)
|
@@ -300,6 +301,7 @@ module Kitchen
|
|
300
301
|
'NetworkMode' => self[:network_mode],
|
301
302
|
'PortBindings' => port_bindings,
|
302
303
|
'Tmpfs' => dokken_tmpfs,
|
304
|
+
'Memory' => self[:memory_limit],
|
303
305
|
},
|
304
306
|
'NetworkingConfig' => {
|
305
307
|
'EndpointsConfig' => {
|
data/lib/kitchen/helpers.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Dokken
|
2
2
|
module Helpers
|
3
3
|
# https://stackoverflow.com/questions/517219/ruby-see-if-a-port-is-open
|
4
|
-
require 'socket'
|
5
|
-
require 'timeout'
|
4
|
+
require 'socket' unless defined?(Socket)
|
5
|
+
require 'timeout' unless defined?(Timeout)
|
6
6
|
|
7
7
|
def port_open?(ip, port)
|
8
8
|
begin
|
@@ -243,7 +243,7 @@ VOLUME /opt/verifier
|
|
243
243
|
|
244
244
|
def remote_docker_host?
|
245
245
|
return false if config[:docker_info]['OperatingSystem'].include?('Boot2Docker')
|
246
|
-
return true if config[:docker_host_url]
|
246
|
+
return true if /^tcp:/.match?(config[:docker_host_url])
|
247
247
|
false
|
248
248
|
end
|
249
249
|
|
@@ -30,7 +30,7 @@ module Kitchen
|
|
30
30
|
plugin_version Kitchen::VERSION
|
31
31
|
|
32
32
|
default_config :root_path, '/opt/kitchen'
|
33
|
-
default_config :chef_binary, '/opt/chef/
|
33
|
+
default_config :chef_binary, '/opt/chef/bin/chef-client'
|
34
34
|
default_config :chef_options, ' -z'
|
35
35
|
default_config :chef_log_level, 'warn'
|
36
36
|
default_config :chef_output_format, 'doc'
|
@@ -50,10 +50,12 @@ module Kitchen
|
|
50
50
|
driver = provisioner.instance.driver
|
51
51
|
driver[:chef_version]
|
52
52
|
end
|
53
|
+
default_config :clean_dokken_sandbox, true
|
53
54
|
|
54
55
|
# (see Base#call)
|
55
56
|
def call(state)
|
56
57
|
create_sandbox
|
58
|
+
write_run_command(run_command)
|
57
59
|
instance.transport.connection(state) do |conn|
|
58
60
|
if remote_docker_host?
|
59
61
|
info("Transferring files to #{instance.to_str}")
|
@@ -62,7 +64,7 @@ module Kitchen
|
|
62
64
|
|
63
65
|
conn.execute(prepare_command)
|
64
66
|
conn.execute_with_retry(
|
65
|
-
run_command,
|
67
|
+
"sh #{config[:root_path]}/run_command",
|
66
68
|
config[:retry_on_exit_code],
|
67
69
|
config[:max_retries],
|
68
70
|
config[:wait_for_retry]
|
@@ -71,6 +73,7 @@ module Kitchen
|
|
71
73
|
rescue Kitchen::Transport::TransportFailed => ex
|
72
74
|
raise ActionFailed, ex.message
|
73
75
|
ensure
|
76
|
+
return unless config[:clean_dokken_sandbox]
|
74
77
|
cleanup_dokken_sandbox
|
75
78
|
end
|
76
79
|
|
@@ -103,6 +106,12 @@ module Kitchen
|
|
103
106
|
cmd << " -F #{config[:chef_output_format]}"
|
104
107
|
cmd << ' -c /opt/kitchen/client.rb'
|
105
108
|
cmd << ' -j /opt/kitchen/dna.json'
|
109
|
+
|
110
|
+
chef_cmd(cmd)
|
111
|
+
end
|
112
|
+
|
113
|
+
def write_run_command(command)
|
114
|
+
File.write("#{dokken_kitchen_sandbox}/run_command", command)
|
106
115
|
end
|
107
116
|
|
108
117
|
def runner_container_name
|
@@ -17,8 +17,8 @@
|
|
17
17
|
|
18
18
|
require 'kitchen'
|
19
19
|
require 'net/scp'
|
20
|
-
require 'tmpdir'
|
21
|
-
require 'digest/sha1'
|
20
|
+
require 'tmpdir' unless defined?(Dir.mktmpdir)
|
21
|
+
require 'digest/sha1' unless defined?(Digest::SHA1)
|
22
22
|
require_relative '../helpers'
|
23
23
|
|
24
24
|
include Dokken::Helpers
|
@@ -82,7 +82,7 @@ module Kitchen
|
|
82
82
|
ssh_ip = options[:host_ip_override]
|
83
83
|
ssh_port = options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostPort]
|
84
84
|
|
85
|
-
elsif options[:docker_host_url]
|
85
|
+
elsif /unix:/.match?(options[:docker_host_url])
|
86
86
|
if options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostIp] == '0.0.0.0'
|
87
87
|
ssh_ip = options[:data_container][:NetworkSettings][:IPAddress]
|
88
88
|
ssh_port = '22'
|
@@ -92,16 +92,16 @@ module Kitchen
|
|
92
92
|
ssh_port = options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostPort]
|
93
93
|
end
|
94
94
|
|
95
|
-
elsif options[:docker_host_url]
|
95
|
+
elsif /tcp:/.match?(options[:docker_host_url])
|
96
96
|
name = options[:data_container][:Name]
|
97
97
|
|
98
98
|
# DOCKER_HOST
|
99
99
|
docker_host_url_ip = options[:docker_host_url].split('tcp://')[1].split(':')[0]
|
100
100
|
|
101
101
|
# mapped IP of data container
|
102
|
-
candidate_ip = ::Docker::Container.all.
|
102
|
+
candidate_ip = ::Docker::Container.all.find do |x|
|
103
103
|
x.info['Names'][0].eql?(name)
|
104
|
-
end.
|
104
|
+
end.info['NetworkSettings']['Networks']['dokken']['IPAddress']
|
105
105
|
|
106
106
|
# mapped port
|
107
107
|
candidate_ssh_port = options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostPort]
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-dokken
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean OMeara
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.33'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.33'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: lockfile
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,7 +64,8 @@ dependencies:
|
|
58
64
|
- - "<"
|
59
65
|
- !ruby/object:Gem::Version
|
60
66
|
version: '3'
|
61
|
-
description: A Test Kitchen Driver for
|
67
|
+
description: A Test Kitchen Driver for Docker & Chef Infra optimized for rapid testing
|
68
|
+
using Chef Infra docker images
|
62
69
|
email:
|
63
70
|
- sean@sean.io
|
64
71
|
executables: []
|
@@ -75,7 +82,7 @@ homepage: https://github.com/someara/kitchen-dokken
|
|
75
82
|
licenses:
|
76
83
|
- Apache-2.0
|
77
84
|
metadata: {}
|
78
|
-
post_install_message:
|
85
|
+
post_install_message:
|
79
86
|
rdoc_options: []
|
80
87
|
require_paths:
|
81
88
|
- lib
|
@@ -90,9 +97,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
97
|
- !ruby/object:Gem::Version
|
91
98
|
version: '0'
|
92
99
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
94
|
-
signing_key:
|
100
|
+
rubygems_version: 3.1.2
|
101
|
+
signing_key:
|
95
102
|
specification_version: 4
|
96
|
-
summary: A Test Kitchen Driver
|
97
|
-
|
103
|
+
summary: A Test Kitchen Driver for Docker & Chef Infra optimized for rapid testing
|
104
|
+
using Chef Infra docker images
|
98
105
|
test_files: []
|