kitchen-dokken 2.23.6 → 2.23.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c7f5b5652cdde267df1ead2dad29ea1c7e3f642cec4b86f3c5ef4c13612a3f3
4
- data.tar.gz: 8b94c596b93899da42069d35faed37d4be565c9af5617839ee84f9e44fcc9a86
3
+ metadata.gz: c9cac8cad07f229a018567a935e33aaa71edaa04c65dd05a38afbcd10bc839e4
4
+ data.tar.gz: 971a897b24f4a00f224d995f18ae7177712110ed4048d2a9d02fb03fcd8948a4
5
5
  SHA512:
6
- metadata.gz: d48c19a4bdbed503978b68451cded18f2437d2aa0c048d8285344447c4a27503b48937eaf29d93d2fd429316f9c8db240942f09a3333616c939a5cd58555f26d
7
- data.tar.gz: 305e81615cc269fdfc685436bbd19b47de69c465006c8ac7b55b42eb8911e4dbfd3e2b36759417347e109c56418176dfa69b5f5136f33669ff2b3e5ffbed4f62
6
+ metadata.gz: 578aca5a5d479624c15313d7d6695d8ea42f75e5822ed55f3c083bb9b561b5b0e1378fa0e27964b0444cfd93f1db63eb5d6fc3b124ac977683b792735bfae7d2
7
+ data.tar.gz: 2bf35be1a50b68a4de9ac5e0d8ac674904165a65f730b472b30c488b9c786890d740586fc7189bf21f22d95fe49cb1bcb2be33456ae37bb43b25d144f3c02854
@@ -805,7 +805,11 @@ module Kitchen
805
805
  with_retries { @image = ::Docker::Image.get(name, { "platform" => oci_platform(config[:platform]) }, docker_connection) }
806
806
  with_retries { @image.remove(force: true) }
807
807
  rescue ::Docker::Error::DockerError
808
- puts "Image #{name} not found. Nothing to delete."
808
+ # `debug`, not `puts`: this is routine during destroy, and writing
809
+ # straight to stdout puts it outside kitchen's logging entirely --
810
+ # it bypasses the log level, never reaches `.kitchen/logs`, and
811
+ # interleaves with kitchen's own output.
812
+ debug "Image #{name} not found. Nothing to delete."
809
813
  end
810
814
 
811
815
  # Whether the daemon knows about a container.
@@ -879,7 +883,7 @@ module Kitchen
879
883
  # @raise [RuntimeError] if the container could not be created
880
884
  def create_container(args, platform: nil)
881
885
  with_retries { @container = ::Docker::Container.get(args["name"], {}, docker_connection) }
882
- rescue
886
+ rescue ::Docker::Error::NotFoundError
883
887
  with_retries do
884
888
  # Merge rather than append: start_runner_container passes config[:env]
885
889
  # straight through, so mutating args["Env"] would edit the driver's
@@ -18,6 +18,6 @@
18
18
  module Kitchen
19
19
  module Driver
20
20
  # Version string for Dokken Kitchen driver
21
- DOKKEN_VERSION = "2.23.6".freeze
21
+ DOKKEN_VERSION = "2.23.7".freeze
22
22
  end
23
23
  end
@@ -253,17 +253,30 @@ module Dokken
253
253
  "#{home_dir}/.dokken/verifier_sandbox/#{instance_name}"
254
254
  end
255
255
 
256
- # A container-safe, collision-free name for this kitchen instance.
256
+ # A container-safe, collision-free name for a kitchen instance.
257
257
  #
258
258
  # The working directory is hashed into the prefix so that the same suite
259
259
  # in two checkouts does not fight over one set of containers.
260
260
  #
261
+ # Defined on the module itself because Kitchen's Provisioner and Verifier
262
+ # base classes need the same answer but do not mix this module in -- they
263
+ # used to carry their own copies of these two lines, and three copies of
264
+ # a container-naming rule is three chances for them to drift apart.
265
+ #
266
+ # @param instance [Object] the kitchen instance
261
267
  # @return [String] the instance name
262
- def instance_name
268
+ def self.instance_name_for(instance)
263
269
  prefix = (Digest::SHA2.hexdigest FileUtils.pwd)[0, 10]
264
270
  "#{prefix}-#{instance.name}".downcase
265
271
  end
266
272
 
273
+ # (see Dokken::Helpers.instance_name_for)
274
+ #
275
+ # @return [String] the instance name
276
+ def instance_name
277
+ ::Dokken::Helpers.instance_name_for(instance)
278
+ end
279
+
267
280
  # The `ExposedPorts` value for the runner container.
268
281
  #
269
282
  # @return [Hash, nil] a Docker API ExposedPorts hash
@@ -453,7 +466,12 @@ module Dokken
453
466
  def running_inside_docker_desktop?
454
467
  Resolv.getaddress "host.docker.internal."
455
468
  true
456
- rescue
469
+ # Deliberately every StandardError, spelled out rather than bare. This is
470
+ # a probe: "can I resolve host.docker.internal" has exactly two useful
471
+ # answers, and a DNS timeout or a SocketError must be "no" rather than
472
+ # something that aborts a converge. Listing Resolv::ResolvError as well
473
+ # would be redundant -- it is a StandardError already.
474
+ rescue ::StandardError
457
475
  false
458
476
  end
459
477
 
@@ -521,8 +539,7 @@ module Kitchen
521
539
  # @return [String] the instance name
522
540
  # @see Dokken::Helpers#instance_name
523
541
  def instance_name
524
- prefix = (Digest::SHA2.hexdigest FileUtils.pwd)[0, 10]
525
- "#{prefix}-#{instance.name}".downcase
542
+ ::Dokken::Helpers.instance_name_for(instance)
526
543
  end
527
544
  end
528
545
  end
@@ -557,8 +574,7 @@ module Kitchen
557
574
  # @return [String] the instance name
558
575
  # @see Dokken::Helpers#instance_name
559
576
  def instance_name
560
- prefix = (Digest::SHA2.hexdigest FileUtils.pwd)[0, 10]
561
- "#{prefix}-#{instance.name}".downcase
577
+ ::Dokken::Helpers.instance_name_for(instance)
562
578
  end
563
579
 
564
580
  # Run the verifier against the instance.
@@ -79,7 +79,17 @@ module Kitchen
79
79
  create_sandbox
80
80
  write_run_command(run_command)
81
81
  instance.transport.connection(state) do |conn|
82
- if remote_docker_host? || running_inside_docker?
82
+ # Gate on what the driver recorded, not on a fresh probe. The driver
83
+ # already answered this at create time -- it built a data container
84
+ # or it did not -- and re-deriving the answer here means the two can
85
+ # disagree. Point DOCKER_HOST somewhere else between `kitchen
86
+ # create` and `kitchen converge` and they do: this side decides to
87
+ # upload, the container it would upload through was never created,
88
+ # and the transport dies on nil several frames down.
89
+ #
90
+ # Kitchen::Verifier::Base#call has always gated on the recorded
91
+ # state; this is the provisioner agreeing with it.
92
+ unless state[:data_container].nil?
83
93
  info("Transferring files to #{instance.to_str}")
84
94
  conn.upload(sandbox_dirs, config[:root_path])
85
95
  end
@@ -204,7 +214,7 @@ module Kitchen
204
214
  # @return [String] the container name
205
215
  # @api private
206
216
  def runner_container_name
207
- instance.name.to_s
217
+ instance_name.to_s
208
218
  end
209
219
 
210
220
  # Empty the sandbox after a converge, keeping the directory itself.
@@ -121,6 +121,17 @@ module Kitchen
121
121
  # @raise [Kitchen::UserError] if docker_host_url is not tcp:// or unix://
122
122
  # @raise [Kitchen::Transport::TransportFailed] if the copy fails
123
123
  def upload(locals, remote)
124
+ # Every route through ssh_endpoint reads the data container out of
125
+ # state, so being handed none is not a transfer that fails -- it is
126
+ # a caller that should not have asked. Said plainly here rather than
127
+ # as `undefined method '[]' for nil` from three frames down.
128
+ if options[:data_container].nil?
129
+ raise Kitchen::Transport::TransportFailed,
130
+ "Cannot upload to #{options[:instance_name]}: no data container was created " \
131
+ "for this instance. Files are only shipped over ssh when the docker daemon " \
132
+ "cannot read the local filesystem; otherwise the sandbox is bind-mounted."
133
+ end
134
+
124
135
  ssh_ip, ssh_port = ssh_endpoint
125
136
 
126
137
  debug "ssh_ip : #{ssh_ip}"
@@ -477,7 +488,11 @@ module Kitchen
477
488
  # @return [TrueClass,FalseClass]
478
489
  def docker_for_mac_or_win?
479
490
  ::Docker.info(::Docker::Connection.new(config[:docker_host_url], {}))["Name"] == "docker-desktop"
480
- rescue
491
+ # `::StandardError`, spelled out. This method lives inside module
492
+ # Kitchen, where a bare `StandardError` resolves to
493
+ # Kitchen::StandardError -- which Excon::Error::Socket is not, so an
494
+ # unreachable daemon would escape instead of answering "no".
495
+ rescue ::StandardError
481
496
  false
482
497
  end
483
498
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-dokken
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.23.6
4
+ version: 2.23.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean OMeara