kitchen-dokken 2.23.8 → 2.24.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/kitchen-dokken.gemspec +1 -1
- data/lib/kitchen/driver/dokken.rb +66 -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 +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1601bf73b8bb5607d0a279d1d06e3cc5779b581616159b320ee6737210b9bd1d
|
|
4
|
+
data.tar.gz: 7e92f8c54e09f5746905496fa9388b2fe49f0ec8d7a33f63ac461a0f53c07618
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6fee7ac1a7586664f3e67047ad994a22c059f6782c99e737a1792dd3758c778f1c8bd3c6f79f6fe1406725dad6f3c1b8d297de1fb9630c4e326d67b23de5d2c
|
|
7
|
+
data.tar.gz: 1604d52bffac5be374ac62f2a509b584ff43303a5b6c98aed2ed0c1fdcdaa8ec9a8fc8ec17c65a8c56679574ff878452e6ee587ca5bf28e12e8a005f6d845d36
|
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,65 @@ 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
|
+
|
|
146
189
|
private
|
|
147
190
|
|
|
191
|
+
# Translate a container's `State` into kitchen's status shape.
|
|
192
|
+
#
|
|
193
|
+
# @param container [::Docker::Container] the runner container
|
|
194
|
+
# @return [Hash] normalized status data
|
|
195
|
+
def container_status(container)
|
|
196
|
+
state = container.info["State"] || {}
|
|
197
|
+
running = state["Running"] == true
|
|
198
|
+
|
|
199
|
+
status = {
|
|
200
|
+
# Docker's own vocabulary -- created, running, paused, exited,
|
|
201
|
+
# restarting, dead -- says more than a boolean, and `kitchen list`
|
|
202
|
+
# prints it verbatim.
|
|
203
|
+
live: running,
|
|
204
|
+
state: state["Status"] || (running ? "running" : "stopped"),
|
|
205
|
+
source: "driver",
|
|
206
|
+
resource_id: container.info["Id"],
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
error = state["Error"].to_s
|
|
210
|
+
status[:message] = error unless error.empty?
|
|
211
|
+
status
|
|
212
|
+
end
|
|
213
|
+
|
|
148
214
|
# Attach DNS settings to a network endpoint configuration, in place.
|
|
149
215
|
#
|
|
150
216
|
# @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,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-dokken
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.24.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean OMeara
|
|
@@ -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'
|