kitchen-dokken 2.20.0 → 2.20.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen/driver/dokken.rb +38 -28
- data/lib/kitchen/driver/dokken_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac52c253c019253b9fe2cffdbf603ce33647e51aacb8376ae775b2158ed0ca5e
|
4
|
+
data.tar.gz: be18132016e30bae541416a33e88846d2e1a9cb72849fe3fb80d9a0b1c0941a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01f86365eecc3ad220c0ac09e561b76fd85d47de80447ef60234ab21e0ca00549fc88b13771a1328398953c47a87cab2ee5cfddcca32b0fb1e8186ee34ba1d7e
|
7
|
+
data.tar.gz: dab5b5621092142df080ed34ad3d73449964c067ed65600cc45efed62b527da41e40da3e13c20915d07d0e0cf7c96a4a602b3cfd6efaf2b06e47b100841f67be
|
@@ -236,22 +236,10 @@ module Kitchen
|
|
236
236
|
[image_prefix, instance_name].compact.join("/").downcase
|
237
237
|
end
|
238
238
|
|
239
|
-
def dokken_binds
|
240
|
-
ret = []
|
241
|
-
ret << "#{dokken_kitchen_sandbox}:/opt/kitchen" unless dokken_kitchen_sandbox.nil? || remote_docker_host? || running_inside_docker?
|
242
|
-
ret << "#{dokken_verifier_sandbox}:/opt/verifier" unless dokken_verifier_sandbox.nil? || remote_docker_host? || running_inside_docker?
|
243
|
-
ret << Array(config[:binds]) unless config[:binds].nil?
|
244
|
-
ret.flatten
|
245
|
-
end
|
246
|
-
|
247
239
|
def dokken_tmpfs
|
248
240
|
coerce_tmpfs(config[:tmpfs])
|
249
241
|
end
|
250
242
|
|
251
|
-
def dokken_volumes
|
252
|
-
coerce_volumes(config[:volumes])
|
253
|
-
end
|
254
|
-
|
255
243
|
def coerce_tmpfs(v)
|
256
244
|
case v
|
257
245
|
when Hash, nil
|
@@ -264,7 +252,14 @@ module Kitchen
|
|
264
252
|
end
|
265
253
|
end
|
266
254
|
|
267
|
-
def
|
255
|
+
def dokken_volumes_from
|
256
|
+
ret = []
|
257
|
+
ret << chef_container_name
|
258
|
+
ret << data_container_name if remote_docker_host? || running_inside_docker?
|
259
|
+
ret
|
260
|
+
end
|
261
|
+
|
262
|
+
def coerce_volumes(v, binds)
|
268
263
|
case v
|
269
264
|
when PartialHash, nil
|
270
265
|
v
|
@@ -272,29 +267,38 @@ module Kitchen
|
|
272
267
|
PartialHash[v]
|
273
268
|
else
|
274
269
|
b = []
|
275
|
-
v = Array(v).to_a # in case v.is_A?(Chef::Node::ImmutableArray)
|
276
270
|
v.delete_if do |x|
|
277
271
|
parts = x.split(":")
|
278
272
|
b << x if parts.length > 1
|
279
273
|
end
|
280
274
|
b = nil if b.empty?
|
281
|
-
|
275
|
+
binds.push(b) unless binds.include?(b) || b.nil?
|
282
276
|
return PartialHash.new if v.empty?
|
283
277
|
|
284
278
|
v.each_with_object(PartialHash.new) { |volume, h| h[volume] = {} }
|
285
279
|
end
|
286
280
|
end
|
287
281
|
|
288
|
-
def
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
282
|
+
def calc_volumes_binds
|
283
|
+
volumes = Array.new(Array(config[:volumes]))
|
284
|
+
binds = Array.new(Array(config[:binds]))
|
285
|
+
|
286
|
+
# Binds is mutated in-place, volumes *may* be.
|
287
|
+
volumes = coerce_volumes(volumes, binds)
|
288
|
+
|
289
|
+
binds_ret = []
|
290
|
+
binds_ret << "#{dokken_kitchen_sandbox}:/opt/kitchen" unless dokken_kitchen_sandbox.nil? || remote_docker_host? || running_inside_docker?
|
291
|
+
binds_ret << "#{dokken_verifier_sandbox}:/opt/verifier" unless dokken_verifier_sandbox.nil? || remote_docker_host? || running_inside_docker?
|
292
|
+
binds_ret << binds unless binds.nil?
|
293
|
+
|
294
|
+
[volumes, binds_ret.flatten]
|
293
295
|
end
|
294
296
|
|
295
297
|
def start_runner_container(state)
|
296
298
|
debug "driver - starting #{runner_container_name}"
|
297
299
|
|
300
|
+
volumes, binds = calc_volumes_binds
|
301
|
+
|
298
302
|
config = {
|
299
303
|
"name" => runner_container_name,
|
300
304
|
"Cmd" => Shellwords.shellwords(self[:pid_one_command]),
|
@@ -303,11 +307,11 @@ module Kitchen
|
|
303
307
|
"Hostname" => self[:hostname],
|
304
308
|
"Env" => self[:env],
|
305
309
|
"ExposedPorts" => exposed_ports,
|
306
|
-
"Volumes" =>
|
310
|
+
"Volumes" => volumes,
|
307
311
|
"HostConfig" => {
|
308
312
|
"Privileged" => self[:privileged],
|
309
313
|
"VolumesFrom" => dokken_volumes_from,
|
310
|
-
"Binds" =>
|
314
|
+
"Binds" => binds,
|
311
315
|
"Dns" => self[:dns],
|
312
316
|
"DnsSearch" => self[:dns_search],
|
313
317
|
"Links" => Array(self[:links]),
|
@@ -319,14 +323,16 @@ module Kitchen
|
|
319
323
|
"Tmpfs" => dokken_tmpfs,
|
320
324
|
"Memory" => self[:memory_limit],
|
321
325
|
},
|
322
|
-
|
326
|
+
}
|
327
|
+
unless %w{host bridge}.include?(self[:network_mode])
|
328
|
+
config["NetworkingConfig"] = {
|
323
329
|
"EndpointsConfig" => {
|
324
330
|
self[:network_mode] => {
|
325
331
|
"Aliases" => Array(self[:hostname]).concat(Array(self[:hostname_aliases])),
|
326
332
|
},
|
327
333
|
},
|
328
|
-
}
|
329
|
-
|
334
|
+
}
|
335
|
+
end
|
330
336
|
unless self[:entrypoint].to_s.empty?
|
331
337
|
config["Entrypoint"] = self[:entrypoint]
|
332
338
|
end
|
@@ -360,19 +366,23 @@ module Kitchen
|
|
360
366
|
"PublishAllPorts" => true,
|
361
367
|
"NetworkMode" => "bridge",
|
362
368
|
},
|
363
|
-
|
369
|
+
}
|
370
|
+
unless %w{host bridge}.include?(self[:network_mode])
|
371
|
+
config["NetworkingConfig"] = {
|
364
372
|
"EndpointsConfig" => {
|
365
373
|
self[:network_mode] => {
|
366
374
|
"Aliases" => Array(self[:hostname]),
|
367
375
|
},
|
368
376
|
},
|
369
|
-
}
|
370
|
-
|
377
|
+
}
|
378
|
+
end
|
371
379
|
data_container = run_container(config)
|
372
380
|
state[:data_container] = data_container.json
|
373
381
|
end
|
374
382
|
|
375
383
|
def make_dokken_network
|
384
|
+
return unless self[:network_mode] == "dokken"
|
385
|
+
|
376
386
|
lockfile = Lockfile.new "#{home_dir}/.dokken-network.lock"
|
377
387
|
begin
|
378
388
|
lockfile.lock
|