kitchen-dokken 2.23.8 → 2.25.0
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 +4 -4
- data/Gemfile +1 -2
- data/kitchen-dokken.gemspec +1 -1
- data/lib/kitchen/driver/dokken.rb +112 -0
- data/lib/kitchen/driver/dokken_version.rb +1 -1
- data/lib/kitchen/helpers.rb +33 -2
- data/lib/kitchen/provisioner/dokken.rb +5 -1
- data/lib/kitchen/transport/dokken.rb +5 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c712b6533f76b28643283d228dad566b0cecc7ad856b0b2e8c0a37a7577f28ee
|
|
4
|
+
data.tar.gz: 7c84488e75a2d2c05029eea1d2d935d235d266742a0539456a28590bdd512a4b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0ee27961e74995e48eff9725effcc2c47405bd02136a2adf1d58ab69cce9bf2109cecd12ecef71889a59db6a59845427ee2bc4b5c8d289cde5cf78a81bb9461
|
|
7
|
+
data.tar.gz: 767e8b79c3e2431605faa15a801a7e14d2507573b80483be4c46283bb29cd7818a80ca9c534acd8208d1ce1a0b0bcab5fe44c04df615de5d8bcda673b3ed3147
|
data/Gemfile
CHANGED
data/kitchen-dokken.gemspec
CHANGED
|
@@ -23,6 +23,7 @@ require "docker"
|
|
|
23
23
|
require "shellwords" unless defined?(Shellwords)
|
|
24
24
|
require "base64" unless defined?(Base64)
|
|
25
25
|
require_relative "../helpers"
|
|
26
|
+
require_relative "dokken_version"
|
|
26
27
|
|
|
27
28
|
include Dokken::Helpers
|
|
28
29
|
|
|
@@ -42,6 +43,14 @@ module Kitchen
|
|
|
42
43
|
#
|
|
43
44
|
# @author Sean OMeara <sean@sean.io>
|
|
44
45
|
class Dokken < Kitchen::Driver::Base
|
|
46
|
+
kitchen_driver_api_version 2
|
|
47
|
+
|
|
48
|
+
# kitchen-dokken's own version, not test-kitchen's. `kitchen diagnose`
|
|
49
|
+
# is the first thing a bug report carries, and it used to report the
|
|
50
|
+
# test-kitchen version here -- which says nothing about the plugin the
|
|
51
|
+
# report is actually about.
|
|
52
|
+
plugin_version Kitchen::Driver::DOKKEN_VERSION
|
|
53
|
+
|
|
45
54
|
default_config :api_retries, 20
|
|
46
55
|
default_config :binds, []
|
|
47
56
|
default_config :cap_add, nil
|
|
@@ -143,8 +152,111 @@ module Kitchen
|
|
|
143
152
|
dokken_delete_sandbox
|
|
144
153
|
end
|
|
145
154
|
|
|
155
|
+
# (see Base#status)
|
|
156
|
+
#
|
|
157
|
+
# `kitchen list --live` asks the driver whether the instance is really
|
|
158
|
+
# there rather than trusting the last recorded action, which is exactly
|
|
159
|
+
# the question a docker daemon can answer precisely. Without this the
|
|
160
|
+
# driver inherited Base's "unknown", so a container that was plainly
|
|
161
|
+
# `Up` still listed as `unknown`.
|
|
162
|
+
#
|
|
163
|
+
# The runner *is* the instance. The chef container is a shared volume
|
|
164
|
+
# and the data container only exists on the remote-daemon path, so
|
|
165
|
+
# neither says anything about whether this instance is up.
|
|
166
|
+
#
|
|
167
|
+
# Deliberately not wrapped in {#with_retries}: this backs a listing, and
|
|
168
|
+
# a slow answer is worse than an honest "unknown".
|
|
169
|
+
#
|
|
170
|
+
# @param _state [Hash] mutable instance state
|
|
171
|
+
# @return [Hash] normalized status data
|
|
172
|
+
def status(_state)
|
|
173
|
+
container_status(::Docker::Container.get(runner_container_name, {}, docker_connection))
|
|
174
|
+
rescue ::Docker::Error::NotFoundError
|
|
175
|
+
{ live: false, state: "not created", source: "driver" }
|
|
176
|
+
# Every other failure -- an unreachable daemon most of all -- is an
|
|
177
|
+
# unknown rather than an exception. Kitchen would catch it either way,
|
|
178
|
+
# but it would then report the exception class instead of the daemon
|
|
179
|
+
# url that could not be reached.
|
|
180
|
+
rescue ::StandardError => e
|
|
181
|
+
{
|
|
182
|
+
live: nil,
|
|
183
|
+
state: "unknown",
|
|
184
|
+
source: "driver",
|
|
185
|
+
message: "could not ask the docker daemon at #{config[:docker_host_url]}: #{e.message}",
|
|
186
|
+
}
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Checks the two things that stop a dokken run before it starts.
|
|
190
|
+
#
|
|
191
|
+
# @param state [Hash] mutable instance and driver state
|
|
192
|
+
# @return [Boolean] true when a problem was reported
|
|
193
|
+
def doctor(state) # rubocop:disable Lint/UnusedMethodArgument
|
|
194
|
+
problems = daemon_problems + creds_file_problems
|
|
195
|
+
|
|
196
|
+
problems.each { |problem| warn(problem) }
|
|
197
|
+
!problems.empty?
|
|
198
|
+
end
|
|
199
|
+
|
|
146
200
|
private
|
|
147
201
|
|
|
202
|
+
# Confirms the docker daemon is actually reachable, which is the single
|
|
203
|
+
# most common reason a dokken run fails, and reports the version when it
|
|
204
|
+
# is so the answer is useful rather than merely green.
|
|
205
|
+
#
|
|
206
|
+
# @return [Array<String>] a connectivity problem, or an empty array
|
|
207
|
+
def daemon_problems
|
|
208
|
+
version = ::Docker.version(docker_connection)
|
|
209
|
+
info("docker daemon at #{config[:docker_host_url]} is reachable " \
|
|
210
|
+
"(version #{version["Version"]}, API #{version["ApiVersion"]})")
|
|
211
|
+
[]
|
|
212
|
+
rescue ::StandardError => e
|
|
213
|
+
["Could not reach the docker daemon at #{config[:docker_host_url]}: " \
|
|
214
|
+
"#{e.message}"]
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# A configured creds_file that cannot be read or parsed fails inside
|
|
218
|
+
# +authenticate!+ on the first line of +create+, before anything is
|
|
219
|
+
# built, so it is worth catching here.
|
|
220
|
+
#
|
|
221
|
+
# @return [Array<String>] a credentials problem, or an empty array
|
|
222
|
+
def creds_file_problems
|
|
223
|
+
return [] if config[:creds_file].nil?
|
|
224
|
+
|
|
225
|
+
unless File.exist?(config[:creds_file])
|
|
226
|
+
return ["creds_file #{config[:creds_file]} does not exist."]
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
JSON.parse(IO.read(config[:creds_file]))
|
|
230
|
+
[]
|
|
231
|
+
rescue JSON::ParserError => e
|
|
232
|
+
["creds_file #{config[:creds_file]} is not valid JSON: #{e.message}"]
|
|
233
|
+
rescue ::StandardError => e
|
|
234
|
+
["creds_file #{config[:creds_file]} could not be read: #{e.message}"]
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Translate a container's `State` into kitchen's status shape.
|
|
238
|
+
#
|
|
239
|
+
# @param container [::Docker::Container] the runner container
|
|
240
|
+
# @return [Hash] normalized status data
|
|
241
|
+
def container_status(container)
|
|
242
|
+
state = container.info["State"] || {}
|
|
243
|
+
running = state["Running"] == true
|
|
244
|
+
|
|
245
|
+
status = {
|
|
246
|
+
# Docker's own vocabulary -- created, running, paused, exited,
|
|
247
|
+
# restarting, dead -- says more than a boolean, and `kitchen list`
|
|
248
|
+
# prints it verbatim.
|
|
249
|
+
live: running,
|
|
250
|
+
state: state["Status"] || (running ? "running" : "stopped"),
|
|
251
|
+
source: "driver",
|
|
252
|
+
resource_id: container.info["Id"],
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
error = state["Error"].to_s
|
|
256
|
+
status[:message] = error unless error.empty?
|
|
257
|
+
status
|
|
258
|
+
end
|
|
259
|
+
|
|
148
260
|
# Attach DNS settings to a network endpoint configuration, in place.
|
|
149
261
|
#
|
|
150
262
|
# @param endpoint_config [Hash] the EndpointsConfig entry to extend
|
data/lib/kitchen/helpers.rb
CHANGED
|
@@ -629,8 +629,39 @@ module Kitchen
|
|
|
629
629
|
|
|
630
630
|
# Run the verifier against the instance.
|
|
631
631
|
#
|
|
632
|
-
#
|
|
633
|
-
#
|
|
632
|
+
# This replaces Kitchen::Verifier::Base#call outright, so it has to be
|
|
633
|
+
# read against the upstream version it stands in for. It diverges in
|
|
634
|
+
# three places, and each divergence is deliberate:
|
|
635
|
+
#
|
|
636
|
+
# 1. *The upload is gated on the data container.* Files are only shipped
|
|
637
|
+
# when the driver built one, which it does exactly when the daemon
|
|
638
|
+
# cannot read the host filesystem. Otherwise the sandboxes are
|
|
639
|
+
# bind-mounted and are already in place. `init_command` is gated with
|
|
640
|
+
# it because for Busser it clears the verifier root, which in
|
|
641
|
+
# bind-mount mode is the host sandbox that was just populated.
|
|
642
|
+
#
|
|
643
|
+
# 2. *`cleanup_sandbox` is not called*, and must not be. Upstream can
|
|
644
|
+
# `rmtree` its sandbox because a stock one is a throwaway
|
|
645
|
+
# `Dir.mktmpdir`. Dokken's is a stable per-instance directory that
|
|
646
|
+
# the driver bind-mounts into a long-lived container, and a bind
|
|
647
|
+
# mount is bound to an inode rather than to a path: removing the
|
|
648
|
+
# directory severs it permanently, and the `mkdir_p` in the next
|
|
649
|
+
# `create_sandbox` does not restore it. Verified against Docker --
|
|
650
|
+
# after an rmtree and a recreate, the host has the file and the
|
|
651
|
+
# container cannot see it, until the container itself is replaced.
|
|
652
|
+
# Kitchen::Provisioner::Dokken#cleanup_dokken_sandbox is the shape
|
|
653
|
+
# that is safe here: empty the directory, keep the inode.
|
|
654
|
+
#
|
|
655
|
+
# 3. *`config[:downloads]` is not honoured.* Upstream downloads files
|
|
656
|
+
# off the instance after the run command. That cannot work here yet
|
|
657
|
+
# for a second reason as well: Transport::Dokken::Connection does not
|
|
658
|
+
# implement `download`, so the base class would raise. Wiring both up
|
|
659
|
+
# is worth doing, and is the one divergence here that is a gap rather
|
|
660
|
+
# than a decision.
|
|
661
|
+
#
|
|
662
|
+
# spec/kitchen/verifier_override_contract_spec.rb pins the upstream
|
|
663
|
+
# facts this reasoning rests on, so that a test-kitchen release which
|
|
664
|
+
# invalidates any of them fails loudly rather than silently.
|
|
634
665
|
#
|
|
635
666
|
# @param state [Hash] mutable instance state
|
|
636
667
|
# @return [void]
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
require "kitchen"
|
|
19
19
|
require "kitchen/provisioner/chef_infra"
|
|
20
20
|
require_relative "../helpers"
|
|
21
|
+
require_relative "../driver/dokken_version"
|
|
21
22
|
|
|
22
23
|
include Dokken::Helpers
|
|
23
24
|
|
|
@@ -35,7 +36,10 @@ module Kitchen
|
|
|
35
36
|
class Dokken < Kitchen::Provisioner::ChefInfra
|
|
36
37
|
kitchen_provisioner_api_version 2
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
# kitchen-dokken's own version. Kitchen::VERSION is test-kitchen's,
|
|
40
|
+
# so `kitchen diagnose` reported the framework version as the
|
|
41
|
+
# plugin version for every dokken plugin.
|
|
42
|
+
plugin_version Kitchen::Driver::DOKKEN_VERSION
|
|
39
43
|
|
|
40
44
|
default_config :root_path, "/opt/kitchen"
|
|
41
45
|
default_config :chef_binary do |provisioner|
|
|
@@ -22,6 +22,7 @@ require "digest/sha1" unless defined?(Digest::SHA1)
|
|
|
22
22
|
require "open3" unless defined?(Open3)
|
|
23
23
|
require "shellwords" unless defined?(Shellwords)
|
|
24
24
|
require_relative "../helpers"
|
|
25
|
+
require_relative "../driver/dokken_version"
|
|
25
26
|
|
|
26
27
|
include Dokken::Helpers
|
|
27
28
|
|
|
@@ -45,7 +46,10 @@ module Kitchen
|
|
|
45
46
|
class Dokken < Kitchen::Transport::Base
|
|
46
47
|
kitchen_transport_api_version 2
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
# kitchen-dokken's own version. Kitchen::VERSION is test-kitchen's,
|
|
50
|
+
# so `kitchen diagnose` reported the framework version as the
|
|
51
|
+
# plugin version for every dokken plugin.
|
|
52
|
+
plugin_version Kitchen::Driver::DOKKEN_VERSION
|
|
49
53
|
|
|
50
54
|
default_config :docker_info do |transport|
|
|
51
55
|
docker_info(transport[:docker_host_url])
|
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.
|
|
4
|
+
version: 2.25.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: 2026-
|
|
11
|
+
date: 2026-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: docker-api
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
53
|
+
version: '3.0'
|
|
54
54
|
- - "<"
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
56
|
version: '5'
|
|
@@ -60,7 +60,7 @@ dependencies:
|
|
|
60
60
|
requirements:
|
|
61
61
|
- - ">="
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: '
|
|
63
|
+
version: '3.0'
|
|
64
64
|
- - "<"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
66
|
version: '5'
|