kitchen-dokken 2.23.0 → 2.23.2

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: e4e69686630703b779bc03b578cdcf803d91ea59545aa541f11b6862eccef3ce
4
- data.tar.gz: 30bc3ebd0d513f4a2db27a1c56fb7e6499be7af651b4362c4f8af7027b14b59b
3
+ metadata.gz: ebf42d942da144ac9b40727946def687e433837647312a8a5630baa12b13f4d5
4
+ data.tar.gz: 2f4eb3fa40101fd4902e347b564d5413f2d5f1cb29ed3e7b88f9458c19d5bfa4
5
5
  SHA512:
6
- metadata.gz: 181657bd8d4f7dacd20be693f0e3766da18c2bc0af5917deb58214aeeb2209386383e2972e1502db76ec37881db65aeeb79ed44ad72f929c2498da7b8f211cdc
7
- data.tar.gz: 990b272f876dde5d523cf71768c0c3c60a4c70466d7efc2b219c039cac99e73ef3c22dfd106a4970fb99fca6b5287829460226390571a03a43d061959165fad9
6
+ metadata.gz: 2cf19819e20390978be348f7be9894a823b253d2f80de82465bdf17aa15c4b855d0638c03005e7507835a03dce4a72e01e1dee7577529042377f346b746eba18
7
+ data.tar.gz: 9d155abf81ca36c82fa446bb7e5b84b15dd7e7677b434a95e1f42285c025f039486d1fac2dbbba1e973c001b121287e80f825ae0001e8c4c4b4e475448ec89a0
@@ -16,6 +16,7 @@
16
16
  # limitations under the License.
17
17
 
18
18
  require "digest" unless defined?(Digest)
19
+ require "json" unless defined?(JSON)
19
20
  require "kitchen"
20
21
  require "tmpdir" unless defined?(Dir.mktmpdir)
21
22
  require "docker"
@@ -370,7 +371,7 @@ module Kitchen
370
371
  config["HostConfig"]["UsernsMode"] = "host"
371
372
  end
372
373
 
373
- runner_container = run_container(config)
374
+ runner_container = run_container(config, platform: self[:platform])
374
375
  state[:runner_container] = runner_container.json
375
376
  end
376
377
 
@@ -397,6 +398,12 @@ module Kitchen
397
398
  },
398
399
  }
399
400
  end
401
+ # Deliberately not pinned to config[:platform]: this container only
402
+ # serves kitchen's files over ssh, so its architecture is irrelevant to
403
+ # the system under test. The data image is built locally from
404
+ # almalinux:9 (see Helpers#create_data_image) and is therefore always
405
+ # host-architecture -- pinning it fails outright whenever the platform
406
+ # under test differs from the host.
400
407
  data_container = run_container(config)
401
408
  state[:data_container] = data_container.json
402
409
  end
@@ -443,7 +450,9 @@ module Kitchen
443
450
  "NetworkMode" => self[:network_mode],
444
451
  },
445
452
  }
446
- chef_container = create_container(config)
453
+ # /opt/chef from this container is mounted into the runner, so it
454
+ # has to be built for the same architecture as the runner.
455
+ chef_container = create_container(config, platform: self[:platform])
447
456
  state[:chef_container] = chef_container.json
448
457
  rescue ::Docker::Error, StandardError => e
449
458
  raise "driver - #{chef_container_name} failed to create #{e}"
@@ -596,18 +605,17 @@ module Kitchen
596
605
  end
597
606
  end
598
607
 
599
- def create_container(args)
608
+ def create_container(args, platform: nil)
600
609
  with_retries { @container = ::Docker::Container.get(args["name"], {}, docker_connection) }
601
610
  rescue
602
611
  with_retries do
603
612
  args["Env"] = [] if args["Env"].nil?
604
613
  args["Env"] << "TEST_KITCHEN=1"
605
614
  args["Env"] << "CI=#{ENV["CI"]}" if ENV.include? "CI"
606
- args["Platform"] = config[:platform]
607
615
  info "Creating container #{args["name"]}"
608
616
  debug "driver - create_container args #{args}"
609
617
  with_retries do
610
- @container = ::Docker::Container.create(args.clone, docker_connection)
618
+ @container = create_container_for_platform(args.clone, platform)
611
619
  rescue ::Docker::Error::ConflictError
612
620
  debug "driver - rescue ConflictError: #{args["name"]}"
613
621
  with_retries { @container = ::Docker::Container.get(args["name"], {}, docker_connection) }
@@ -618,8 +626,25 @@ module Kitchen
618
626
  end
619
627
  end
620
628
 
621
- def run_container(args)
622
- create_container(args)
629
+ # Create a container, optionally pinned to an OCI platform.
630
+ #
631
+ # /containers/create takes `platform` as a *query* parameter, but
632
+ # Docker::Container.create only ever forwards `name` to the query string
633
+ # and dumps everything else into the request body. A "Platform" body key
634
+ # is therefore accepted and silently ignored by the daemon, which is why
635
+ # the platform config had no effect on container creation. Post directly
636
+ # when a platform is wanted; otherwise use the gem as before.
637
+ def create_container_for_platform(args, platform)
638
+ return ::Docker::Container.create(args, docker_connection) if platform.to_s.empty?
639
+
640
+ query = { "name" => args["name"], "platform" => platform }
641
+ body = args.reject { |k, _| k == "name" }
642
+ docker_connection.post("/containers/create", query, body: JSON.dump(body))
643
+ ::Docker::Container.get(args["name"], {}, docker_connection)
644
+ end
645
+
646
+ def run_container(args, platform: nil)
647
+ create_container(args, platform: platform)
623
648
  with_retries do
624
649
  @container.start
625
650
  @container = ::Docker::Container.get(args["name"], {}, docker_connection)
@@ -664,7 +689,7 @@ module Kitchen
664
689
 
665
690
  def chef_container_name
666
691
  prefix = instance.provisioner[:product_name] == "cinc" ? "cinc" : "chef"
667
- config[:platform] != "" ? "#{prefix}-#{chef_version}-" + config[:platform].sub("/", "-") : "#{prefix}-#{chef_version}"
692
+ config[:platform] != "" ? "#{prefix}-#{chef_version}-" + config[:platform].tr("/", "-") : "#{prefix}-#{chef_version}"
668
693
  end
669
694
 
670
695
  def chef_image
@@ -739,12 +764,18 @@ module Kitchen
739
764
  end
740
765
  end
741
766
 
767
+ # Convert an "os/arch[/variant]" platform string into the JSON OCI
768
+ # platform spec the Docker API expects as an image filter. The variant
769
+ # matters: the daemon will not match a filter of
770
+ # {"os":"linux","architecture":"amd64"} against a linux/amd64/v2 image,
771
+ # so dropping it makes every image lookup for a variant image miss.
742
772
  def oci_platform(platform)
743
- if !platform.nil? && platform.include?("/")
744
- os, arch = platform.split("/")
745
- platform = { os: os, architecture: arch }.to_json
746
- end
747
- platform
773
+ return platform if platform.nil? || !platform.include?("/")
774
+
775
+ os, architecture, variant = platform.split("/")
776
+ spec = { os: os, architecture: architecture }
777
+ spec[:variant] = variant unless variant.nil? || variant.empty?
778
+ spec.to_json
748
779
  end
749
780
 
750
781
  def runner_container_name
@@ -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.0".freeze
21
+ DOKKEN_VERSION = "2.23.2".freeze
22
22
  end
23
23
  end
@@ -204,9 +204,7 @@ module Dokken
204
204
  else
205
205
  x = Array(v).map { |a| parse_port(a) }
206
206
  x.flatten!
207
- x.each_with_object({}) do |y, h|
208
- h[y["container_port"]] = {}
209
- end
207
+ x.to_h { |y| [y["container_port"], {}] }
210
208
  end
211
209
  end
212
210
 
@@ -90,7 +90,17 @@ module Kitchen
90
90
  # deprecation warning. That warning concerns the omnibus *download*
91
91
  # mechanism, which dokken does not use — the chef/cinc binary is
92
92
  # mounted from a volume container, not downloaded via omnitruck.
93
+ #
94
+ # When the resolved parent is kitchen-cinc's CincInfra (which rebinds
95
+ # Kitchen::Provisioner::ChefInfra in Cinc Workstation 26+), there is no
96
+ # omnibus warning to suppress, license_acceptance_id is not defined,
97
+ # and the LicenseAcceptance constant is not autoloaded — delegate to
98
+ # super in that case so the parent's own check_license runs. We test
99
+ # for both because a partial drop-in shim may define
100
+ # license_acceptance_id without pulling in license-acceptance.
93
101
  def check_license
102
+ return super unless respond_to?(:license_acceptance_id, true) && defined?(LicenseAcceptance)
103
+
94
104
  name = license_acceptance_id
95
105
  version = product_version
96
106
  debug("Checking if we need to prompt for license acceptance on product: #{name} version: #{version}.")
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.23.0
4
+ version: 2.23.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean OMeara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-19 00:00:00.000000000 Z
11
+ date: 2026-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api