kitchen-dokken 2.13.0 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eea74ed725f969f5c886cfa3779e4b3a9094709f70e18bfe6793b913ce56c23
4
- data.tar.gz: dc4492c20b777baa7d2063156bd37c31db378545af392f49895878e9e1523b91
3
+ metadata.gz: 0b2d590af89b1fde3cb1a0d5a5d681abbd377462aaa0cde0b2b7809802db21e1
4
+ data.tar.gz: 92983e5510abd9b522fc7a046d62d56637f56c321504ad5d0691f21e8e2db4dd
5
5
  SHA512:
6
- metadata.gz: d3020a6b005734959245fcc28401fed70d80755d05f807f22933478a6f58bf481333284959cdb2a5b533e5f56db98174a0aaca2a0d5d015767062ac081e2e2e3
7
- data.tar.gz: e62c1cb7e25243ede096137079403302162d550aa7fc076ad8dcfaefda26b230a12baac451b3bd788754099c0fb55bc4b4d033acd719b4049d18652214514434
6
+ metadata.gz: fa71281c52fc0e3004fd5a243e9c595a76648a5038d0fa8f2bb842a05d4b9ea34c2c7666b48d297882243241687d837eeae04fc8a75f33a98dfa50971e252f41
7
+ data.tar.gz: 722f40d25fc652b26c353a81262d769ebfff3159317b38b7f7c1f8111fd8585d335970261646dd4092fad3aa6d860698f116ca5f71946f2ebaa1b97700bbffbc
@@ -50,6 +50,8 @@ module Kitchen
50
50
  default_config :hostname, "dokken"
51
51
  default_config :hostname_aliases, nil
52
52
  default_config :image_prefix, nil
53
+ default_config :ipv6, false
54
+ default_config :ipv6_subnet, "2001:db8:1::/64" # "2001:db8::/32 Range reserved for documentation"
53
55
  default_config :links, nil
54
56
  default_config :memory_limit, 0
55
57
  default_config :network_mode, "dokken"
@@ -64,9 +66,13 @@ module Kitchen
64
66
  default_config :userns_host, false
65
67
  default_config :volumes, nil
66
68
  default_config :write_timeout, 3600
69
+ default_config :creds_file, nil
67
70
 
68
71
  # (see Base#create)
69
72
  def create(state)
73
+ # Authenticate the private registry
74
+ authenticate!
75
+
70
76
  # image to config
71
77
  pull_platform_image
72
78
 
@@ -359,7 +365,7 @@ module Kitchen
359
365
  with_retries { ::Docker::Network.get("dokken", {}, docker_connection) }
360
366
  rescue ::Docker::Error::NotFoundError
361
367
  begin
362
- with_retries { ::Docker::Network.create("dokken", {}) }
368
+ with_retries { ::Docker::Network.create("dokken", network_settings) }
363
369
  rescue ::Docker::Error => e
364
370
  debug "driver - error :#{e}:"
365
371
  end
@@ -408,6 +414,21 @@ module Kitchen
408
414
  end
409
415
  end
410
416
 
417
+ def authenticate!
418
+ # No need to authenticate if the credentials are empty
419
+ return if docker_creds.empty?
420
+
421
+ ::Docker.authenticate! docker_creds
422
+ end
423
+
424
+ def docker_creds
425
+ @docker_creds ||= if config[:creds_file]
426
+ JSON.parse(IO.read(config[:creds_file]))
427
+ else
428
+ {}
429
+ end
430
+ end
431
+
411
432
  def pull_platform_image
412
433
  debug "driver - pulling #{short_image_path(platform_image)}"
413
434
  config[:pull_platform_image] ? pull_image(platform_image) : pull_if_missing(platform_image)
@@ -600,7 +621,7 @@ module Kitchen
600
621
  original_image = Docker::Image.get(path, {}, docker_connection)
601
622
  end
602
623
 
603
- new_image = Docker::Image.create({ "fromImage" => path }, {}, docker_connection)
624
+ new_image = Docker::Image.create({ "fromImage" => path }, docker_creds, docker_connection)
604
625
 
605
626
  !(original_image && original_image.id.start_with?(new_image.id))
606
627
  end
@@ -18,6 +18,6 @@
18
18
  module Kitchen
19
19
  module Driver
20
20
  # Version string for Dokken Kitchen driver
21
- DOKKEN_VERSION = "2.13.0".freeze
21
+ DOKKEN_VERSION = "2.17.0".freeze
22
22
  end
23
23
  end
@@ -177,6 +177,21 @@ VOLUME /opt/verifier
177
177
  coerce_exposed_ports(config[:ports])
178
178
  end
179
179
 
180
+ def network_settings
181
+ if self[:ipv6]
182
+ {
183
+ "EnableIPv6" => true,
184
+ "IPAM" => {
185
+ "Config" => [{
186
+ "Subnet" => self[:ipv6_subnet],
187
+ }],
188
+ },
189
+ }
190
+ else
191
+ {}
192
+ end
193
+ end
194
+
180
195
  def port_bindings
181
196
  coerce_port_bindings(config[:ports])
182
197
  end
@@ -246,6 +261,7 @@ VOLUME /opt/verifier
246
261
  end
247
262
 
248
263
  def remote_docker_host?
264
+ return false if config[:docker_info]["OperatingSystem"].include?("Docker Desktop")
249
265
  return false if config[:docker_info]["OperatingSystem"].include?("Boot2Docker")
250
266
  return true if /^tcp:/.match?(config[:docker_host_url])
251
267
 
@@ -69,7 +69,9 @@ module Kitchen
69
69
 
70
70
  with_retries { @runner = ::Docker::Container.get(instance_name, {}, docker_connection) }
71
71
  with_retries do
72
- o = @runner.exec(Shellwords.shellwords(command), wait: options[:timeout], "e" => { "TERM" => "xterm" }) { |_stream, chunk| print chunk.to_s }
72
+ o = @runner.exec(Shellwords.shellwords(command), wait: options[:timeout], "e" => { "TERM" => "xterm" }) do |_stream, chunk|
73
+ logger << chunk
74
+ end
73
75
  @exit_code = o[2]
74
76
  end
75
77
 
@@ -224,6 +226,7 @@ module Kitchen
224
226
  # @api private
225
227
  def connection_options(data)
226
228
  opts = {}
229
+ opts[:logger] = logger
227
230
  opts[:host_ip_override] = config[:host_ip_override]
228
231
  opts[:docker_host_url] = config[:docker_host_url]
229
232
  opts[:docker_host_options] = ::Docker.options
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-dokken
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean OMeara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-11 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: '1.15'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '3'
56
+ version: '4'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: '1.15'
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: '3'
66
+ version: '4'
67
67
  description: A Test Kitchen Driver for Docker & Chef Infra optimized for rapid testing
68
68
  using Chef Infra docker images
69
69
  email:
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubygems_version: 3.2.15
100
+ rubygems_version: 3.2.32
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: A Test Kitchen Driver for Docker & Chef Infra optimized for rapid testing