kitchen-docker 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.kitchen.yml +3 -1
- data/.travis.yml +0 -5
- data/CHANGELOG.md +9 -0
- data/README.md +14 -1
- data/kitchen-docker.gemspec +1 -1
- data/lib/kitchen/driver/docker.rb +30 -4
- data/lib/kitchen/driver/docker_version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf681b90a724609efd7b56203766d1e09c50fbab909b041e1e9cd6c0e4d6e07d
|
4
|
+
data.tar.gz: 0b101baa332d10c1fdcb47619cd088cb874819c203713ca661241f955bd7a4b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70314bfc54ff2077b098022aa850b93081010e7e11681492dc274506378659c8010986220703d6db38d8b8f6e64fa82833922beca01080918f16ad9f90a4b65b
|
7
|
+
data.tar.gz: a279ed751961077df27590671e64215ceddf43210fc0ffe6b1283a9308e4f99dd24b8e576fb3d4fc8e8471fc8fa01c569715d2e1df39f2f6379c0bd44942baea
|
data/.kitchen.yml
CHANGED
@@ -14,6 +14,8 @@ platforms:
|
|
14
14
|
- name: ubuntu-16.04
|
15
15
|
- name: centos-6
|
16
16
|
- name: centos-7
|
17
|
+
- name: oraclelinux-6
|
18
|
+
- name: oraclelinux-7
|
17
19
|
- name: debian-8
|
18
20
|
- name: opensuse-42.2
|
19
21
|
driver:
|
@@ -41,7 +43,7 @@ suites:
|
|
41
43
|
driver:
|
42
44
|
build_context: false
|
43
45
|
- name: capabilities
|
44
|
-
excludes: [arch,unknown,centos-7,centos-6,dockerfile,opensuse-42.2]
|
46
|
+
excludes: [arch,unknown,centos-7,centos-6,oraclelinux-6,oraclelinux-7,dockerfile,opensuse-42.2]
|
45
47
|
driver:
|
46
48
|
provision_command:
|
47
49
|
- curl -L https://www.chef.io/chef/install.sh | bash
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Kitchen-Docker Changelog
|
2
2
|
|
3
|
+
## 2.8.0 - Jan 18, 2019
|
4
|
+
|
5
|
+
* Add new config option `use_internal_docker_network`, which allows running Docker within Docker. See readme for usage details.
|
6
|
+
* Resolve errors while loading libraries on archlinux
|
7
|
+
* Fix failures on Ubuntu 18.04
|
8
|
+
* Check if image exists before attempting to remove it so we don't fail
|
9
|
+
* Add oraclelinux platform support
|
10
|
+
* Prevent `uninitialized constant Kitchen::Driver::Docker::Base64` error by requiring `base64`
|
11
|
+
|
3
12
|
## 2.7.0
|
4
13
|
|
5
14
|
* Support for SUSE-based container images.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Kitchen-Docker
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://travis-ci.org/test-kitchen/kitchen-docker.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-docker)
|
4
4
|
[![Gem Version](https://img.shields.io/gem/v/kitchen-docker.svg)](https://rubygems.org/gems/kitchen-docker)
|
5
5
|
[![Coverage](https://img.shields.io/codecov/c/github/test-kitchen/kitchen-docker.svg)](https://codecov.io/github/test-kitchen/kitchen-docker)
|
6
6
|
[![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
|
@@ -482,6 +482,19 @@ Examples:
|
|
482
482
|
net: br3
|
483
483
|
```
|
484
484
|
|
485
|
+
### use_internal_docker_network
|
486
|
+
|
487
|
+
If you want to use kitchen-docker from within another Docker container you'll
|
488
|
+
need to set this to true. When set to true uses port 22 as the SSH port and
|
489
|
+
the IP of the container that chef is going to run in as the hostname so that
|
490
|
+
you can connect to it over SSH from within another Docker container.
|
491
|
+
|
492
|
+
Examples:
|
493
|
+
|
494
|
+
```yaml
|
495
|
+
use_internal_docker_network: true
|
496
|
+
```
|
497
|
+
|
485
498
|
## Development
|
486
499
|
|
487
500
|
* Source hosted at [GitHub][repo]
|
data/kitchen-docker.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['portertech@gmail.com']
|
11
11
|
spec.description = %q{A Docker Driver for Test Kitchen}
|
12
12
|
spec.summary = spec.description
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/test-kitchen/kitchen-docker'
|
14
14
|
spec.license = 'Apache 2.0'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -21,6 +21,7 @@ require 'uri'
|
|
21
21
|
require 'net/ssh'
|
22
22
|
require 'tempfile'
|
23
23
|
require 'shellwords'
|
24
|
+
require 'base64'
|
24
25
|
|
25
26
|
require 'kitchen/driver/base'
|
26
27
|
|
@@ -56,6 +57,7 @@ module Kitchen
|
|
56
57
|
default_config :public_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa.pub')
|
57
58
|
default_config :build_options, nil
|
58
59
|
default_config :run_options, nil
|
60
|
+
default_config :use_internal_docker_network, false
|
59
61
|
|
60
62
|
default_config :use_sudo, false
|
61
63
|
|
@@ -119,7 +121,12 @@ module Kitchen
|
|
119
121
|
state[:ssh_key] = config[:private_key]
|
120
122
|
state[:image_id] = build_image(state) unless state[:image_id]
|
121
123
|
state[:container_id] = run_container(state) unless state[:container_id]
|
122
|
-
state[:hostname] =
|
124
|
+
state[:hostname] = 'localhost'
|
125
|
+
if remote_socket?
|
126
|
+
state[:hostname] = socket_uri.host
|
127
|
+
elsif config[:use_internal_docker_network]
|
128
|
+
state[:hostname] = container_ip(state)
|
129
|
+
end
|
123
130
|
state[:port] = container_ssh_port(state)
|
124
131
|
if config[:wait_for_sshd]
|
125
132
|
instance.transport.connection(state) do |conn|
|
@@ -131,7 +138,7 @@ module Kitchen
|
|
131
138
|
def destroy(state)
|
132
139
|
rm_container(state) if container_exists?(state)
|
133
140
|
if config[:remove_images] && state[:image_id]
|
134
|
-
rm_image(state)
|
141
|
+
rm_image(state) if image_exists?(state)
|
135
142
|
end
|
136
143
|
end
|
137
144
|
|
@@ -209,7 +216,7 @@ module Kitchen
|
|
209
216
|
RUN apt-get install -y sudo openssh-server curl lsb-release
|
210
217
|
eos
|
211
218
|
config[:disable_upstart] ? disable_upstart + packages : packages
|
212
|
-
when 'rhel', 'centos', 'fedora'
|
219
|
+
when 'rhel', 'centos', 'fedora', 'oraclelinux'
|
213
220
|
<<-eos
|
214
221
|
ENV container docker
|
215
222
|
RUN yum clean all
|
@@ -230,7 +237,7 @@ module Kitchen
|
|
230
237
|
<<-eos
|
231
238
|
RUN pacman --noconfirm -Sy archlinux-keyring
|
232
239
|
RUN pacman-db-upgrade
|
233
|
-
RUN pacman --noconfirm -
|
240
|
+
RUN pacman --noconfirm -Syu openssl openssh sudo curl
|
234
241
|
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
|
235
242
|
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
|
236
243
|
RUN echo >/etc/security/limits.conf
|
@@ -270,6 +277,7 @@ module Kitchen
|
|
270
277
|
RUN touch #{homedir}/.ssh/authorized_keys
|
271
278
|
RUN chown #{username} #{homedir}/.ssh/authorized_keys
|
272
279
|
RUN chmod 0600 #{homedir}/.ssh/authorized_keys
|
280
|
+
RUN mkdir -p /run/sshd
|
273
281
|
eos
|
274
282
|
custom = ''
|
275
283
|
Array(config[:provision_command]).each do |cmd|
|
@@ -364,6 +372,10 @@ module Kitchen
|
|
364
372
|
state[:container_id] && !!docker_command("top #{state[:container_id]}") rescue false
|
365
373
|
end
|
366
374
|
|
375
|
+
def image_exists?(state)
|
376
|
+
state[:image_id] && !!docker_command("docker inspect --type=image #{state[:image_id]}") rescue false
|
377
|
+
end
|
378
|
+
|
367
379
|
def parse_container_ssh_port(output)
|
368
380
|
begin
|
369
381
|
_host, port = output.split(':')
|
@@ -376,6 +388,9 @@ module Kitchen
|
|
376
388
|
|
377
389
|
def container_ssh_port(state)
|
378
390
|
begin
|
391
|
+
if config[:use_internal_docker_network]
|
392
|
+
return 22
|
393
|
+
end
|
379
394
|
output = docker_command("port #{state[:container_id]} 22/tcp")
|
380
395
|
parse_container_ssh_port(output)
|
381
396
|
rescue
|
@@ -384,6 +399,17 @@ module Kitchen
|
|
384
399
|
end
|
385
400
|
end
|
386
401
|
|
402
|
+
def container_ip(state)
|
403
|
+
begin
|
404
|
+
cmd = "inspect --format '{{ .NetworkSettings.IPAddress }}'"
|
405
|
+
cmd << " #{state[:container_id]}"
|
406
|
+
docker_command(cmd).strip
|
407
|
+
rescue
|
408
|
+
raise ActionFailed,
|
409
|
+
'Error getting internal IP of Docker container'
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
387
413
|
def rm_container(state)
|
388
414
|
container_id = state[:container_id]
|
389
415
|
docker_command("stop -t 0 #{container_id}")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-docker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -211,7 +211,7 @@ files:
|
|
211
211
|
- test/integration/inspec/inspec_spec.rb
|
212
212
|
- test/spec/docker_spec.rb
|
213
213
|
- test/spec/spec_helper.rb
|
214
|
-
homepage: https://github.com/
|
214
|
+
homepage: https://github.com/test-kitchen/kitchen-docker
|
215
215
|
licenses:
|
216
216
|
- Apache 2.0
|
217
217
|
metadata: {}
|
@@ -230,8 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
230
|
- !ruby/object:Gem::Version
|
231
231
|
version: '0'
|
232
232
|
requirements: []
|
233
|
-
|
234
|
-
rubygems_version: 2.7.6
|
233
|
+
rubygems_version: 3.0.1
|
235
234
|
signing_key:
|
236
235
|
specification_version: 4
|
237
236
|
summary: A Docker Driver for Test Kitchen
|