kitchen-docker 2.10.0 → 2.11.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/.github/dependabot.yml +7 -0
- data/.gitignore +1 -1
- data/.kitchen.windows.yml +1 -1
- data/.kitchen.yml +5 -8
- data/.travis.yml +7 -2
- data/CHANGELOG.md +15 -0
- data/README.md +53 -5
- data/kitchen-docker.gemspec +1 -1
- data/lib/kitchen/docker/container.rb +18 -13
- data/lib/kitchen/docker/container/linux.rb +6 -81
- data/lib/kitchen/docker/container/windows.rb +1 -0
- data/lib/kitchen/docker/docker_version.rb +1 -1
- data/lib/kitchen/docker/helpers/cli_helper.rb +4 -0
- data/lib/kitchen/docker/helpers/dockerfile_helper.rb +136 -0
- data/lib/kitchen/docker/helpers/image_helper.rb +5 -3
- data/lib/kitchen/driver/docker.rb +165 -164
- metadata +10 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5cb2a57e3f7074c1f3b07505f6931d9d742a2ff70d8908b97d9c69d27bb6b34b
|
|
4
|
+
data.tar.gz: 863c64c9dac8d43c0db30bb5b83cb6eaf3448ae0b988f9809abbd882b8b12ac1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8639ed71230580894bc7daedd7c7efcaf09458e2e6c1cbf45e0617e16844a28d4c0015c251009e1e0fa0c741daf15715eed2a2bc6f1eada903a04fdb73a620a
|
|
7
|
+
data.tar.gz: 779683f5e429eff27d8d68c3a19f8d01b1247d9699f283bde06f902ed6a8a0f03330e534568cac05114676f27434ba0aacb443ad57705b0bb6e0c5a77409aba0
|
data/.gitignore
CHANGED
data/.kitchen.windows.yml
CHANGED
data/.kitchen.yml
CHANGED
|
@@ -27,14 +27,11 @@ platforms:
|
|
|
27
27
|
- name: oraclelinux-7
|
|
28
28
|
- name: debian-8
|
|
29
29
|
- name: debian-9
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
#
|
|
35
|
-
# driver:
|
|
36
|
-
# image: base/archlinux
|
|
37
|
-
# provision_command: true
|
|
30
|
+
# Removing opensuse CI tests temporarily due to an issue with the Chef install script not providing
|
|
31
|
+
# the correct platform name for opensuse resulting in consistent failures for this platform
|
|
32
|
+
#- name: opensuse-42.3
|
|
33
|
+
# driver:
|
|
34
|
+
# image: opensuse/leap:42.3
|
|
38
35
|
- name: unknown
|
|
39
36
|
driver:
|
|
40
37
|
image: ubuntu:16.04
|
data/.travis.yml
CHANGED
|
@@ -33,15 +33,20 @@ matrix:
|
|
|
33
33
|
- os: windows
|
|
34
34
|
language: bash
|
|
35
35
|
install:
|
|
36
|
+
- choco uninstall ruby
|
|
37
|
+
- choco install ruby --version=2.6.5.1
|
|
38
|
+
- export PATH=$(echo "$PATH" | sed -e 's/:\/c\/tools\/ruby27\/bin//')
|
|
39
|
+
- export PATH=$PATH:/c/tools/ruby26/bin
|
|
36
40
|
- choco install mingw
|
|
37
41
|
- choco install msys2
|
|
38
|
-
- ridk.cmd exec pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain
|
|
42
|
+
- ridk.cmd exec pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-libxslt
|
|
39
43
|
script:
|
|
40
|
-
- taskkill -IM "gpg-agent.exe" -F
|
|
44
|
+
- if [[ $(tasklist | grep "gpg-agent") ]]; then taskkill -IM "gpg-agent.exe" -F; else echo "Process gpg-agent not found. Skipping."; fi
|
|
41
45
|
- powershell -ExecutionPolicy Bypass -NoLogo -File docker.ps1
|
|
42
46
|
- export KITCHEN_YAML=.kitchen.windows.yml
|
|
43
47
|
- ruby -v
|
|
44
48
|
- gem install bundler
|
|
49
|
+
- bundle config build.nokogiri --use-system-libraries
|
|
45
50
|
- bundle install
|
|
46
51
|
- bundle exec docker version
|
|
47
52
|
- bundle exec kitchen --version
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Kitchen-Docker Changelog
|
|
2
2
|
|
|
3
|
+
## 2.11.0 - July 2, 2021
|
|
4
|
+
|
|
5
|
+
* Update the development dependency on kitchen-inspec to 2.x
|
|
6
|
+
* Retrieve hostname state data after container is launched to avoid failures when `use_internal_docker_network` is set
|
|
7
|
+
* Add a new option for setting container isolation. See the readme for additional details
|
|
8
|
+
* Support GPUs in containers with a new `gpus` option that takes the same arguments that would be passed to `docker run --gpus`
|
|
9
|
+
* suse platform: use system script for ssh key initialization
|
|
10
|
+
* Add support for the `--mount` docker CLI option. See the readme for additional details
|
|
11
|
+
* Use sudo.d files instead of directly editing the sudoers file
|
|
12
|
+
* Allow passing `--tmpfs` entries to the docker run command. See the readme for additional details
|
|
13
|
+
* Use less verbose and quicker setup on Gentoo
|
|
14
|
+
* Lowercase the instance-name to avoid issues since docker does not allow instance with capital cases
|
|
15
|
+
* Fix the error "Could not parse Docker build output for image ID" by improving the output line matching
|
|
16
|
+
* Add support for `almalinux` & `rockylinux`
|
|
17
|
+
|
|
3
18
|
## 2.10.0 - Mar 28, 2020
|
|
4
19
|
|
|
5
20
|
* Switched from require to require_relative to slightly improve load time performance
|
data/README.md
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
A Test Kitchen Driver and Transport for Docker.
|
|
9
9
|
|
|
10
|
+
***MAINTAINERS WANTED***: This Test-Kitchen driver is currently without a maintainer and has many known issues. If you're interested in maintaining this driver for the long run including expanding the CI testing please reach out on [Chef Community Slack: #test-kitchen](https://chefcommunity.slack.com/archives/C2B6G1WCQ). Until such a time that this driver is maintained we highly recommend the [kitchen-dokken](https://github.com/test-kitchen/kitchen-dokken) for Chef Infra testing with Docker containers.
|
|
11
|
+
|
|
10
12
|
## Requirements
|
|
11
13
|
|
|
12
14
|
* [Docker][docker_installation] **(>= 1.5)**
|
|
@@ -23,7 +25,7 @@ driver:
|
|
|
23
25
|
name: docker
|
|
24
26
|
env_variables:
|
|
25
27
|
TEST_KEY: TEST_VALUE
|
|
26
|
-
|
|
28
|
+
|
|
27
29
|
platforms:
|
|
28
30
|
- name: ubuntu
|
|
29
31
|
run_list:
|
|
@@ -109,8 +111,8 @@ Examples:
|
|
|
109
111
|
|
|
110
112
|
### socket
|
|
111
113
|
|
|
112
|
-
The Docker daemon socket to use. By default, Docker will listen on `unix:///var/run/docker.sock` (On Windows, `npipe:////./pipe/docker_engine`),
|
|
113
|
-
and no configuration here is required. If Docker is binding to another host/port or Unix socket, you will need to set this option.
|
|
114
|
+
The Docker daemon socket to use. By default, Docker will listen on `unix:///var/run/docker.sock` (On Windows, `npipe:////./pipe/docker_engine`),
|
|
115
|
+
and no configuration here is required. If Docker is binding to another host/port or Unix socket, you will need to set this option.
|
|
114
116
|
If a TCP socket is set, its host will be used for SSH access to suite containers.
|
|
115
117
|
|
|
116
118
|
Examples:
|
|
@@ -164,6 +166,19 @@ images using the [Docker Index][docker_index].
|
|
|
164
166
|
The default will be computed, using the platform name (see the Default
|
|
165
167
|
Configuration section for more details).
|
|
166
168
|
|
|
169
|
+
### isolation
|
|
170
|
+
|
|
171
|
+
The isolation technology for the container. This is not set by default and will use the default container isolation settings.
|
|
172
|
+
|
|
173
|
+
For example, the following driver configuration options can be used to specify the container isolation technology for Windows containers:
|
|
174
|
+
```yaml
|
|
175
|
+
# Hyper-V
|
|
176
|
+
isolation: hyperv
|
|
177
|
+
|
|
178
|
+
# Process
|
|
179
|
+
isolation: process
|
|
180
|
+
```
|
|
181
|
+
|
|
167
182
|
### platform
|
|
168
183
|
|
|
169
184
|
The platform of the chosen image. This is used to properly bootstrap the
|
|
@@ -171,7 +186,7 @@ suite container for Test Kitchen. Kitchen Docker currently supports:
|
|
|
171
186
|
|
|
172
187
|
* `arch`
|
|
173
188
|
* `debian` or `ubuntu`
|
|
174
|
-
* `amazonlinux`, `rhel`, `centos`, `fedora` or `
|
|
189
|
+
* `amazonlinux`, `rhel`, `centos`, `fedora`, `oraclelinux`, `almalinux` or `rockylinux`
|
|
175
190
|
* `gentoo` or `gentoo-paludis`
|
|
176
191
|
* `opensuse/tumbleweed`, `opensuse/leap`, `opensuse` or `sles`
|
|
177
192
|
* `windows`
|
|
@@ -312,6 +327,39 @@ Examples:
|
|
|
312
327
|
- rvm
|
|
313
328
|
```
|
|
314
329
|
|
|
330
|
+
### mount
|
|
331
|
+
|
|
332
|
+
Attach a filesystem mount to the container (**NOTE:** supported only in docker
|
|
333
|
+
17.05 and newer).
|
|
334
|
+
|
|
335
|
+
Examples:
|
|
336
|
+
|
|
337
|
+
```yaml
|
|
338
|
+
mount: type=volume,source=my-volume,destination=/path/in/container
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
```yaml
|
|
342
|
+
mount:
|
|
343
|
+
- type=volume,source=my-volume,destination=/path/in/container
|
|
344
|
+
- type=tmpfs,tmpfs-size=512M,destination=/path/to/tmpdir
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### tmpfs
|
|
348
|
+
|
|
349
|
+
Adds a tmpfs volume(s) to the suite container.
|
|
350
|
+
|
|
351
|
+
Examples:
|
|
352
|
+
|
|
353
|
+
```yaml
|
|
354
|
+
tmpfs: /tmp
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
```yaml
|
|
358
|
+
tmpfs:
|
|
359
|
+
- /tmp:exec
|
|
360
|
+
- /run
|
|
361
|
+
```
|
|
362
|
+
|
|
315
363
|
### dns
|
|
316
364
|
|
|
317
365
|
Adjusts `resolv.conf` to use the dns servers specified. Otherwise use
|
|
@@ -587,7 +635,7 @@ limitations under the License.
|
|
|
587
635
|
[docker_upstart_issue]: https://github.com/dotcloud/docker/issues/223
|
|
588
636
|
[docker_index]: https://index.docker.io/
|
|
589
637
|
[docker_default_image]: https://index.docker.io/_/base/
|
|
590
|
-
[test_kitchen_docs]:
|
|
638
|
+
[test_kitchen_docs]: https://kitchen.ci/docs/getting-started/introduction/
|
|
591
639
|
[chef_omnibus_dl]: https://downloads.chef.io/chef-client/
|
|
592
640
|
[cpu_shares]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html
|
|
593
641
|
[memory_limit]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-memory.html
|
data/kitchen-docker.gemspec
CHANGED
|
@@ -34,6 +34,6 @@ Gem::Specification.new do |spec|
|
|
|
34
34
|
spec.add_development_dependency 'codecov', '~> 0.0', '>= 0.0.2'
|
|
35
35
|
|
|
36
36
|
# Integration testing gems.
|
|
37
|
-
spec.add_development_dependency 'kitchen-inspec', '~>
|
|
37
|
+
spec.add_development_dependency 'kitchen-inspec', '~> 2.0'
|
|
38
38
|
spec.add_development_dependency 'train', '>= 2.1', '< 4.0' # validate 4.x when it's released
|
|
39
39
|
end
|
|
@@ -37,13 +37,27 @@ module Kitchen
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
state[:username] = @config[:username]
|
|
40
|
-
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def destroy(state)
|
|
43
|
+
info("[Docker] Destroying Docker container #{state[:container_id]}") if state[:container_id]
|
|
44
|
+
remove_container(state) if container_exists?(state)
|
|
45
|
+
|
|
46
|
+
if @config[:remove_images] && state[:image_id]
|
|
47
|
+
remove_image(state) if image_exists?(state)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def hostname(state)
|
|
52
|
+
hostname = 'localhost'
|
|
41
53
|
|
|
42
54
|
if remote_socket?
|
|
43
|
-
|
|
44
|
-
elsif config[:use_internal_docker_network]
|
|
45
|
-
|
|
55
|
+
hostname = socket_uri.host
|
|
56
|
+
elsif @config[:use_internal_docker_network]
|
|
57
|
+
hostname = container_ip_address(state)
|
|
46
58
|
end
|
|
59
|
+
|
|
60
|
+
hostname
|
|
47
61
|
end
|
|
48
62
|
|
|
49
63
|
def upload(locals, remote)
|
|
@@ -56,15 +70,6 @@ module Kitchen
|
|
|
56
70
|
|
|
57
71
|
files
|
|
58
72
|
end
|
|
59
|
-
|
|
60
|
-
def destroy(state)
|
|
61
|
-
info("[Docker] Destroying Docker container #{state[:container_id]}") if state[:container_id]
|
|
62
|
-
remove_container(state) if container_exists?(state)
|
|
63
|
-
|
|
64
|
-
if @config[:remove_images] && state[:image_id]
|
|
65
|
-
remove_image(state) if image_exists?(state)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
73
|
end
|
|
69
74
|
end
|
|
70
75
|
end
|
|
@@ -17,11 +17,14 @@ require 'securerandom'
|
|
|
17
17
|
require 'shellwords'
|
|
18
18
|
|
|
19
19
|
require_relative '../container'
|
|
20
|
+
require_relative '../helpers/dockerfile_helper'
|
|
20
21
|
|
|
21
22
|
module Kitchen
|
|
22
23
|
module Docker
|
|
23
24
|
class Container
|
|
24
25
|
class Linux < Kitchen::Docker::Container
|
|
26
|
+
include Kitchen::Docker::Helpers::DockerfileHelper
|
|
27
|
+
|
|
25
28
|
MUTEX_FOR_SSH_KEYS = Mutex.new
|
|
26
29
|
|
|
27
30
|
def initialize(config)
|
|
@@ -37,7 +40,7 @@ module Kitchen
|
|
|
37
40
|
state[:ssh_key] = @config[:private_key]
|
|
38
41
|
state[:image_id] = build_image(state, dockerfile) unless state[:image_id]
|
|
39
42
|
state[:container_id] = run_container(state, 22) unless state[:container_id]
|
|
40
|
-
state[:hostname] =
|
|
43
|
+
state[:hostname] = hostname(state)
|
|
41
44
|
state[:port] = container_ssh_port(state)
|
|
42
45
|
end
|
|
43
46
|
|
|
@@ -107,89 +110,11 @@ module Kitchen
|
|
|
107
110
|
return dockerfile_template if @config[:dockerfile]
|
|
108
111
|
|
|
109
112
|
from = "FROM #{@config[:image]}"
|
|
110
|
-
|
|
111
|
-
platform = case @config[:platform]
|
|
112
|
-
when 'debian', 'ubuntu'
|
|
113
|
-
disable_upstart = <<-CODE
|
|
114
|
-
RUN [ ! -f "/sbin/initctl" ] || dpkg-divert --local --rename --add /sbin/initctl && ln -sf /bin/true /sbin/initctl
|
|
115
|
-
CODE
|
|
116
|
-
packages = <<-CODE
|
|
117
|
-
ENV DEBIAN_FRONTEND noninteractive
|
|
118
|
-
ENV container docker
|
|
119
|
-
RUN apt-get update
|
|
120
|
-
RUN apt-get install -y sudo openssh-server curl lsb-release
|
|
121
|
-
CODE
|
|
122
|
-
@config[:disable_upstart] ? disable_upstart + packages : packages
|
|
123
|
-
when 'rhel', 'centos', 'oraclelinux', 'amazonlinux'
|
|
124
|
-
<<-CODE
|
|
125
|
-
ENV container docker
|
|
126
|
-
RUN yum clean all
|
|
127
|
-
RUN yum install -y sudo openssh-server openssh-clients which curl
|
|
128
|
-
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
|
|
129
|
-
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
|
|
130
|
-
CODE
|
|
131
|
-
when 'fedora'
|
|
132
|
-
<<-CODE
|
|
133
|
-
ENV container docker
|
|
134
|
-
RUN dnf clean all
|
|
135
|
-
RUN dnf install -y sudo openssh-server openssh-clients which curl
|
|
136
|
-
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
|
|
137
|
-
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
|
|
138
|
-
CODE
|
|
139
|
-
when 'opensuse/tumbleweed', 'opensuse/leap', 'opensuse', 'sles'
|
|
140
|
-
<<-CODE
|
|
141
|
-
ENV container docker
|
|
142
|
-
RUN zypper install -y sudo openssh which curl
|
|
143
|
-
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
|
|
144
|
-
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
|
|
145
|
-
CODE
|
|
146
|
-
when 'arch'
|
|
147
|
-
# See https://bugs.archlinux.org/task/47052 for why we
|
|
148
|
-
# blank out limits.conf.
|
|
149
|
-
<<-CODE
|
|
150
|
-
RUN pacman --noconfirm -Sy archlinux-keyring
|
|
151
|
-
RUN pacman-db-upgrade
|
|
152
|
-
RUN pacman --noconfirm -Syu openssl openssh sudo curl
|
|
153
|
-
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
154
|
-
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
|
|
155
|
-
RUN echo >/etc/security/limits.conf
|
|
156
|
-
CODE
|
|
157
|
-
when 'gentoo'
|
|
158
|
-
<<-CODE
|
|
159
|
-
RUN emerge --sync
|
|
160
|
-
RUN emerge net-misc/openssh app-admin/sudo
|
|
161
|
-
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
162
|
-
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
|
|
163
|
-
CODE
|
|
164
|
-
when 'gentoo-paludis'
|
|
165
|
-
<<-CODE
|
|
166
|
-
RUN cave sync
|
|
167
|
-
RUN cave resolve -zx net-misc/openssh app-admin/sudo
|
|
168
|
-
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
169
|
-
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
|
|
170
|
-
CODE
|
|
171
|
-
else
|
|
172
|
-
raise ActionFailed, "Unknown platform '#{@config[:platform]}'"
|
|
173
|
-
end
|
|
174
|
-
|
|
113
|
+
platform = dockerfile_platform
|
|
175
114
|
username = @config[:username]
|
|
176
115
|
public_key = IO.read(@config[:public_key]).strip
|
|
177
116
|
homedir = username == 'root' ? '/root' : "/home/#{username}"
|
|
178
|
-
|
|
179
|
-
base = <<-CODE
|
|
180
|
-
RUN if ! getent passwd #{username}; then \
|
|
181
|
-
useradd -d #{homedir} -m -s /bin/bash -p '*' #{username}; \
|
|
182
|
-
fi
|
|
183
|
-
RUN echo "#{username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
184
|
-
RUN echo "Defaults !requiretty" >> /etc/sudoers
|
|
185
|
-
RUN mkdir -p #{homedir}/.ssh
|
|
186
|
-
RUN chown -R #{username} #{homedir}/.ssh
|
|
187
|
-
RUN chmod 0700 #{homedir}/.ssh
|
|
188
|
-
RUN touch #{homedir}/.ssh/authorized_keys
|
|
189
|
-
RUN chown #{username} #{homedir}/.ssh/authorized_keys
|
|
190
|
-
RUN chmod 0600 #{homedir}/.ssh/authorized_keys
|
|
191
|
-
RUN mkdir -p /run/sshd
|
|
192
|
-
CODE
|
|
117
|
+
base = dockerfile_base_linux(username, homedir)
|
|
193
118
|
|
|
194
119
|
custom = ''
|
|
195
120
|
Array(@config[:provision_command]).each do |cmd|
|
|
@@ -30,6 +30,7 @@ module Kitchen
|
|
|
30
30
|
state[:username] = @config[:username]
|
|
31
31
|
state[:image_id] = build_image(state, dockerfile) unless state[:image_id]
|
|
32
32
|
state[:container_id] = run_container(state) unless state[:container_id]
|
|
33
|
+
state[:hostname] = hostname(state)
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
def execute(command)
|
|
@@ -49,14 +49,18 @@ module Kitchen
|
|
|
49
49
|
Array(config[:volumes_from]).each { |container| cmd << " --volumes-from #{container}" }
|
|
50
50
|
Array(config[:links]).each { |link| cmd << " --link #{link}" }
|
|
51
51
|
Array(config[:devices]).each { |device| cmd << " --device #{device}" }
|
|
52
|
+
Array(config[:mount]).each {|mount| cmd << " --mount #{mount}"}
|
|
53
|
+
Array(config[:tmpfs]).each {|tmpfs| cmd << " --tmpfs #{tmpfs}"}
|
|
52
54
|
cmd << " --name #{config[:instance_name]}" if config[:instance_name]
|
|
53
55
|
cmd << ' -P' if config[:publish_all]
|
|
54
56
|
cmd << " -h #{config[:hostname]}" if config[:hostname]
|
|
55
57
|
cmd << " -m #{config[:memory]}" if config[:memory]
|
|
56
58
|
cmd << " -c #{config[:cpu]}" if config[:cpu]
|
|
59
|
+
cmd << " --gpus #{config[:gpus]}" if config[:gpus]
|
|
57
60
|
cmd << " -e http_proxy=#{config[:http_proxy]}" if config[:http_proxy]
|
|
58
61
|
cmd << " -e https_proxy=#{config[:https_proxy]}" if config[:https_proxy]
|
|
59
62
|
cmd << ' --privileged' if config[:privileged]
|
|
63
|
+
cmd << " --isolation #{config[:isolation]}" if config[:isolation]
|
|
60
64
|
Array(config[:cap_add]).each { |cap| cmd << " --cap-add=#{cap}"} if config[:cap_add]
|
|
61
65
|
Array(config[:cap_drop]).each { |cap| cmd << " --cap-drop=#{cap}"} if config[:cap_drop]
|
|
62
66
|
Array(config[:security_opt]).each { |opt| cmd << " --security-opt=#{opt}"} if config[:security_opt]
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
# you may not use this file except in compliance with the License.
|
|
4
|
+
# You may obtain a copy of the License at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
# See the License for the specific language governing permissions and
|
|
12
|
+
# limitations under the License.
|
|
13
|
+
|
|
14
|
+
require 'kitchen'
|
|
15
|
+
require 'kitchen/configurable'
|
|
16
|
+
|
|
17
|
+
module Kitchen
|
|
18
|
+
module Docker
|
|
19
|
+
module Helpers
|
|
20
|
+
module DockerfileHelper
|
|
21
|
+
include Configurable
|
|
22
|
+
|
|
23
|
+
def dockerfile_platform
|
|
24
|
+
case config[:platform]
|
|
25
|
+
when 'arch'
|
|
26
|
+
arch_platform
|
|
27
|
+
when 'debian', 'ubuntu'
|
|
28
|
+
debian_platform
|
|
29
|
+
when 'fedora'
|
|
30
|
+
fedora_platform
|
|
31
|
+
when 'gentoo'
|
|
32
|
+
gentoo_platform
|
|
33
|
+
when 'gentoo-paludis'
|
|
34
|
+
gentoo_paludis_platform
|
|
35
|
+
when 'opensuse/tumbleweed', 'opensuse/leap', 'opensuse', 'sles'
|
|
36
|
+
opensuse_platform
|
|
37
|
+
when 'rhel', 'centos', 'oraclelinux', 'amazonlinux', 'almalinux', 'rockylinux'
|
|
38
|
+
rhel_platform
|
|
39
|
+
else
|
|
40
|
+
raise ActionFailed, "Unknown platform '#{config[:platform]}'"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def arch_platform
|
|
45
|
+
# See https://bugs.archlinux.org/task/47052 for why we
|
|
46
|
+
# blank out limits.conf.
|
|
47
|
+
<<-CODE
|
|
48
|
+
RUN pacman --noconfirm -Sy archlinux-keyring
|
|
49
|
+
RUN pacman-db-upgrade
|
|
50
|
+
RUN pacman --noconfirm -Syu openssl openssh sudo curl
|
|
51
|
+
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
52
|
+
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
|
|
53
|
+
RUN echo >/etc/security/limits.conf
|
|
54
|
+
CODE
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def debian_platform
|
|
58
|
+
disable_upstart = <<-CODE
|
|
59
|
+
RUN [ ! -f "/sbin/initctl" ] || dpkg-divert --local --rename --add /sbin/initctl \
|
|
60
|
+
&& ln -sf /bin/true /sbin/initctl
|
|
61
|
+
CODE
|
|
62
|
+
packages = <<-CODE
|
|
63
|
+
ENV DEBIAN_FRONTEND noninteractive
|
|
64
|
+
ENV container docker
|
|
65
|
+
RUN apt-get update
|
|
66
|
+
RUN apt-get install -y sudo openssh-server curl lsb-release
|
|
67
|
+
CODE
|
|
68
|
+
config[:disable_upstart] ? disable_upstart + packages : packages
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def fedora_platform
|
|
72
|
+
<<-CODE
|
|
73
|
+
ENV container docker
|
|
74
|
+
RUN dnf clean all
|
|
75
|
+
RUN dnf install -y sudo openssh-server openssh-clients which curl
|
|
76
|
+
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
|
|
77
|
+
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
|
|
78
|
+
CODE
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def gentoo_platform
|
|
82
|
+
<<-CODE
|
|
83
|
+
RUN emerge-webrsync
|
|
84
|
+
RUN emerge --quiet --noreplace net-misc/openssh app-admin/sudo
|
|
85
|
+
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
86
|
+
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
|
|
87
|
+
CODE
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def gentoo_paludis_platform
|
|
91
|
+
<<-CODE
|
|
92
|
+
RUN cave sync
|
|
93
|
+
RUN cave resolve -zx net-misc/openssh app-admin/sudo
|
|
94
|
+
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
95
|
+
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
|
|
96
|
+
CODE
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def opensuse_platform
|
|
100
|
+
<<-CODE
|
|
101
|
+
ENV container docker
|
|
102
|
+
RUN zypper install -y sudo openssh which curl
|
|
103
|
+
RUN /usr/sbin/sshd-gen-keys-start
|
|
104
|
+
CODE
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def rhel_platform
|
|
108
|
+
<<-CODE
|
|
109
|
+
ENV container docker
|
|
110
|
+
RUN yum clean all
|
|
111
|
+
RUN yum install -y sudo openssh-server openssh-clients which curl
|
|
112
|
+
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
|
|
113
|
+
RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
|
|
114
|
+
CODE
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def dockerfile_base_linux(username, homedir)
|
|
118
|
+
<<-CODE
|
|
119
|
+
RUN if ! getent passwd #{username}; then \
|
|
120
|
+
useradd -d #{homedir} -m -s /bin/bash -p '*' #{username}; \
|
|
121
|
+
fi
|
|
122
|
+
RUN echo "#{username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/#{username}
|
|
123
|
+
RUN echo "Defaults !requiretty" >> /etc/sudoers.d/#{username}
|
|
124
|
+
RUN mkdir -p #{homedir}/.ssh
|
|
125
|
+
RUN chown -R #{username} #{homedir}/.ssh
|
|
126
|
+
RUN chmod 0700 #{homedir}/.ssh
|
|
127
|
+
RUN touch #{homedir}/.ssh/authorized_keys
|
|
128
|
+
RUN chown #{username} #{homedir}/.ssh/authorized_keys
|
|
129
|
+
RUN chmod 0600 #{homedir}/.ssh/authorized_keys
|
|
130
|
+
RUN mkdir -p /run/sshd
|
|
131
|
+
CODE
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
@@ -26,8 +26,9 @@ module Kitchen
|
|
|
26
26
|
|
|
27
27
|
def parse_image_id(output)
|
|
28
28
|
output.each_line do |line|
|
|
29
|
-
if line =~ /image id|build successful|successfully built/i
|
|
30
|
-
|
|
29
|
+
if line =~ /image id|build successful|successfully built|writing image/i
|
|
30
|
+
img_id = line.split(/\s+/).last
|
|
31
|
+
return img_id
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
raise ActionFailed, 'Could not parse Docker build output for image ID'
|
|
@@ -50,7 +51,8 @@ module Kitchen
|
|
|
50
51
|
file.write(dockerfile)
|
|
51
52
|
file.close
|
|
52
53
|
docker_command("#{cmd} -f #{Shellwords.escape(dockerfile_path(file))} #{build_context}",
|
|
53
|
-
input: dockerfile_contents
|
|
54
|
+
input: dockerfile_contents,
|
|
55
|
+
environment: { DOCKER_BUILDKIT: '0' })
|
|
54
56
|
ensure
|
|
55
57
|
file.close unless file.closed?
|
|
56
58
|
file.unlink
|
|
@@ -1,164 +1,165 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Copyright (C) 2014, Sean Porter
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
|
|
16
|
-
require 'kitchen'
|
|
17
|
-
require 'json'
|
|
18
|
-
require 'securerandom'
|
|
19
|
-
require 'net/ssh'
|
|
20
|
-
|
|
21
|
-
require 'kitchen/driver/base'
|
|
22
|
-
|
|
23
|
-
require_relative '../docker/container/linux'
|
|
24
|
-
require_relative '../docker/container/windows'
|
|
25
|
-
require_relative '../docker/helpers/cli_helper'
|
|
26
|
-
require_relative '../docker/helpers/container_helper'
|
|
27
|
-
|
|
28
|
-
module Kitchen
|
|
29
|
-
module Driver
|
|
30
|
-
# Docker driver for Kitchen.
|
|
31
|
-
#
|
|
32
|
-
# @author Sean Porter <portertech@gmail.com>
|
|
33
|
-
class Docker < Kitchen::Driver::Base
|
|
34
|
-
include Kitchen::Docker::Helpers::CliHelper
|
|
35
|
-
include Kitchen::Docker::Helpers::ContainerHelper
|
|
36
|
-
include ShellOut
|
|
37
|
-
|
|
38
|
-
default_config :binary, 'docker'
|
|
39
|
-
default_config :build_options, nil
|
|
40
|
-
default_config :cap_add, nil
|
|
41
|
-
default_config :cap_drop, nil
|
|
42
|
-
default_config :disable_upstart, true
|
|
43
|
-
default_config :env_variables, nil
|
|
44
|
-
default_config :
|
|
45
|
-
default_config :
|
|
46
|
-
default_config :
|
|
47
|
-
default_config :
|
|
48
|
-
default_config :
|
|
49
|
-
default_config :
|
|
50
|
-
default_config :
|
|
51
|
-
default_config :
|
|
52
|
-
default_config :
|
|
53
|
-
default_config :
|
|
54
|
-
default_config :
|
|
55
|
-
default_config :
|
|
56
|
-
default_config :
|
|
57
|
-
default_config :
|
|
58
|
-
default_config :
|
|
59
|
-
default_config :
|
|
60
|
-
default_config :
|
|
61
|
-
default_config :
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
'-o
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
socket = '
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
#
|
|
109
|
-
if
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
end
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2014, Sean Porter
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
require 'kitchen'
|
|
17
|
+
require 'json'
|
|
18
|
+
require 'securerandom'
|
|
19
|
+
require 'net/ssh'
|
|
20
|
+
|
|
21
|
+
require 'kitchen/driver/base'
|
|
22
|
+
|
|
23
|
+
require_relative '../docker/container/linux'
|
|
24
|
+
require_relative '../docker/container/windows'
|
|
25
|
+
require_relative '../docker/helpers/cli_helper'
|
|
26
|
+
require_relative '../docker/helpers/container_helper'
|
|
27
|
+
|
|
28
|
+
module Kitchen
|
|
29
|
+
module Driver
|
|
30
|
+
# Docker driver for Kitchen.
|
|
31
|
+
#
|
|
32
|
+
# @author Sean Porter <portertech@gmail.com>
|
|
33
|
+
class Docker < Kitchen::Driver::Base
|
|
34
|
+
include Kitchen::Docker::Helpers::CliHelper
|
|
35
|
+
include Kitchen::Docker::Helpers::ContainerHelper
|
|
36
|
+
include ShellOut
|
|
37
|
+
|
|
38
|
+
default_config :binary, 'docker'
|
|
39
|
+
default_config :build_options, nil
|
|
40
|
+
default_config :cap_add, nil
|
|
41
|
+
default_config :cap_drop, nil
|
|
42
|
+
default_config :disable_upstart, true
|
|
43
|
+
default_config :env_variables, nil
|
|
44
|
+
default_config :isolation, nil
|
|
45
|
+
default_config :interactive, false
|
|
46
|
+
default_config :private_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa')
|
|
47
|
+
default_config :privileged, false
|
|
48
|
+
default_config :public_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa.pub')
|
|
49
|
+
default_config :publish_all, false
|
|
50
|
+
default_config :remove_images, false
|
|
51
|
+
default_config :run_options, nil
|
|
52
|
+
default_config :security_opt, nil
|
|
53
|
+
default_config :tls, false
|
|
54
|
+
default_config :tls_cacert, nil
|
|
55
|
+
default_config :tls_cert, nil
|
|
56
|
+
default_config :tls_key, nil
|
|
57
|
+
default_config :tls_verify, false
|
|
58
|
+
default_config :tty, false
|
|
59
|
+
default_config :use_cache, true
|
|
60
|
+
default_config :use_internal_docker_network, false
|
|
61
|
+
default_config :use_sudo, false
|
|
62
|
+
default_config :wait_for_transport, true
|
|
63
|
+
|
|
64
|
+
default_config :build_context do |driver|
|
|
65
|
+
!driver.remote_socket?
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
default_config :image do |driver|
|
|
69
|
+
driver.default_image
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
default_config :instance_name do |driver|
|
|
73
|
+
# Borrowed from kitchen-rackspace
|
|
74
|
+
[
|
|
75
|
+
driver.instance.name.gsub(/\W/, ''),
|
|
76
|
+
(Etc.getlogin || 'nologin').gsub(/\W/, ''),
|
|
77
|
+
Socket.gethostname.gsub(/\W/, '')[0..20],
|
|
78
|
+
Array.new(8) { rand(36).to_s(36) }.join
|
|
79
|
+
].join('-').downcase
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
default_config :platform do |driver|
|
|
83
|
+
driver.default_platform
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
default_config :run_command do |driver|
|
|
87
|
+
if driver.windows_os?
|
|
88
|
+
# Launch arbitrary process to keep the Windows container alive
|
|
89
|
+
# If running in interactive mode, launch powershell.exe instead
|
|
90
|
+
if driver[:interactive]
|
|
91
|
+
'powershell.exe'
|
|
92
|
+
else
|
|
93
|
+
'ping -t localhost'
|
|
94
|
+
end
|
|
95
|
+
else
|
|
96
|
+
'/usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no -o PasswordAuthentication=yes '\
|
|
97
|
+
'-o UsePrivilegeSeparation=no -o PidFile=/tmp/sshd.pid'
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
default_config :socket do |driver|
|
|
102
|
+
socket = 'unix:///var/run/docker.sock'
|
|
103
|
+
socket = 'npipe:////./pipe/docker_engine' if driver.windows_os?
|
|
104
|
+
ENV['DOCKER_HOST'] || socket
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
default_config :username do |driver|
|
|
108
|
+
# Return nil to prevent username from being added to Docker
|
|
109
|
+
# command line args for Windows if a username was not specified
|
|
110
|
+
if driver.windows_os?
|
|
111
|
+
nil
|
|
112
|
+
else
|
|
113
|
+
'kitchen'
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def verify_dependencies
|
|
118
|
+
run_command("#{config[:binary]} >> #{dev_null} 2>&1", quiet: true, use_sudo: config[:use_sudo])
|
|
119
|
+
rescue
|
|
120
|
+
raise UserError, 'You must first install the Docker CLI tool https://www.docker.com/get-started'
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def create(state)
|
|
124
|
+
container.create(state)
|
|
125
|
+
|
|
126
|
+
wait_for_transport(state)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def destroy(state)
|
|
130
|
+
container.destroy(state)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def wait_for_transport(state)
|
|
134
|
+
if config[:wait_for_transport]
|
|
135
|
+
instance.transport.connection(state) do |conn|
|
|
136
|
+
conn.wait_until_ready
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def default_image
|
|
142
|
+
platform, release = instance.platform.name.split('-')
|
|
143
|
+
if platform == 'centos' && release
|
|
144
|
+
release = 'centos' + release.split('.').first
|
|
145
|
+
end
|
|
146
|
+
release ? [platform, release].join(':') : platform
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def default_platform
|
|
150
|
+
instance.platform.name.split('-').first
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
protected
|
|
154
|
+
|
|
155
|
+
def container
|
|
156
|
+
@container ||= if windows_os?
|
|
157
|
+
Kitchen::Docker::Container::Windows.new(config)
|
|
158
|
+
else
|
|
159
|
+
Kitchen::Docker::Container::Linux.new(config)
|
|
160
|
+
end
|
|
161
|
+
@container
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
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.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Porter
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|
|
@@ -176,14 +176,14 @@ dependencies:
|
|
|
176
176
|
requirements:
|
|
177
177
|
- - "~>"
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: '
|
|
179
|
+
version: '2.0'
|
|
180
180
|
type: :development
|
|
181
181
|
prerelease: false
|
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
|
183
183
|
requirements:
|
|
184
184
|
- - "~>"
|
|
185
185
|
- !ruby/object:Gem::Version
|
|
186
|
-
version: '
|
|
186
|
+
version: '2.0'
|
|
187
187
|
- !ruby/object:Gem::Dependency
|
|
188
188
|
name: train
|
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -212,6 +212,7 @@ extensions: []
|
|
|
212
212
|
extra_rdoc_files: []
|
|
213
213
|
files:
|
|
214
214
|
- ".cane"
|
|
215
|
+
- ".github/dependabot.yml"
|
|
215
216
|
- ".gitignore"
|
|
216
217
|
- ".kitchen.windows.yml"
|
|
217
218
|
- ".kitchen.yml"
|
|
@@ -232,6 +233,7 @@ files:
|
|
|
232
233
|
- lib/kitchen/docker/erb_context.rb
|
|
233
234
|
- lib/kitchen/docker/helpers/cli_helper.rb
|
|
234
235
|
- lib/kitchen/docker/helpers/container_helper.rb
|
|
236
|
+
- lib/kitchen/docker/helpers/dockerfile_helper.rb
|
|
235
237
|
- lib/kitchen/docker/helpers/file_helper.rb
|
|
236
238
|
- lib/kitchen/docker/helpers/image_helper.rb
|
|
237
239
|
- lib/kitchen/docker/helpers/inspec_helper.rb
|
|
@@ -249,7 +251,7 @@ homepage: https://github.com/test-kitchen/kitchen-docker
|
|
|
249
251
|
licenses:
|
|
250
252
|
- Apache 2.0
|
|
251
253
|
metadata: {}
|
|
252
|
-
post_install_message:
|
|
254
|
+
post_install_message:
|
|
253
255
|
rdoc_options: []
|
|
254
256
|
require_paths:
|
|
255
257
|
- lib
|
|
@@ -264,8 +266,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
264
266
|
- !ruby/object:Gem::Version
|
|
265
267
|
version: '0'
|
|
266
268
|
requirements: []
|
|
267
|
-
rubygems_version: 3.
|
|
268
|
-
signing_key:
|
|
269
|
+
rubygems_version: 3.2.15
|
|
270
|
+
signing_key:
|
|
269
271
|
specification_version: 4
|
|
270
272
|
summary: A Docker Driver for Test Kitchen
|
|
271
273
|
test_files:
|