kitchen-docker 2.8.0 → 2.12.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 +2 -0
- data/.kitchen.windows.yml +33 -0
- data/.kitchen.yml +26 -17
- data/.travis.yml +54 -14
- data/CHANGELOG.md +75 -60
- data/README.md +135 -20
- data/docker.ps1 +9 -0
- data/kitchen-docker.gemspec +4 -5
- data/lib/docker/version.rb +25 -0
- data/lib/kitchen/docker/container/linux.rb +136 -0
- data/lib/kitchen/docker/container/windows.rb +85 -0
- data/lib/kitchen/docker/container.rb +75 -0
- data/lib/kitchen/{driver → docker}/docker_version.rb +2 -5
- data/lib/kitchen/{driver/docker/erb.rb → docker/erb_context.rb} +2 -5
- data/lib/kitchen/docker/helpers/cli_helper.rb +172 -0
- data/lib/kitchen/docker/helpers/container_helper.rb +172 -0
- data/lib/kitchen/docker/helpers/dockerfile_helper.rb +136 -0
- data/lib/kitchen/docker/helpers/file_helper.rb +40 -0
- data/lib/kitchen/docker/helpers/image_helper.rb +76 -0
- data/lib/kitchen/docker/helpers/inspec_helper.rb +40 -0
- data/lib/kitchen/driver/docker.rb +77 -361
- data/lib/kitchen/transport/docker.rb +111 -0
- data/lib/train/docker.rb +125 -0
- data/test/Dockerfile +1 -1
- data/test/integration/default/serverspec/default_spec.rb +1 -1
- data/test/integration/default/serverspec/spec_helper.rb +21 -0
- data/test/integration/inspec/inspec_spec.rb +8 -2
- metadata +47 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfc2ec595062530ef1a860930cb80cbdfd1f2d9b0f23f1bd7d261e769679b3a1
|
|
4
|
+
data.tar.gz: 51b9b8e5f65991cd5dfb26d719301ae55e90d94b2591671617396b993d0c614b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2149ff5a8af75c70e88b93d03f5431e1586d7e0d69d117d742ec591e76fb9aca96b9d8c76e4e9d937c8c398daa4a641d0089c608a6bea9762a0c48b5b9708590
|
|
7
|
+
data.tar.gz: 6e235534cf2f6ec24dc9cc3e59c10048fe874684c0488dcd15c5ffe0c9409491b27c40683a5945ad5cd857b6c03c72d8d0b90b0446069a0583068aebb5ae5cce
|
data/.gitignore
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<% # Make sure the local copy of the driver is loaded %>
|
|
2
|
+
<% lib = File.expand_path('../lib', __FILE__) %>
|
|
3
|
+
<% $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) %>
|
|
4
|
+
---
|
|
5
|
+
driver:
|
|
6
|
+
name: docker
|
|
7
|
+
provision_command:
|
|
8
|
+
- powershell -ExecutionPolicy Bypass -NoLogo -Command . { iwr -useb https://omnitruck.chef.io/install.ps1 } ^| iex; install
|
|
9
|
+
- powershell -Command $path=$env:Path + ';c:\opscode\chef\embedded\bin'; Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $path
|
|
10
|
+
|
|
11
|
+
transport:
|
|
12
|
+
name: docker
|
|
13
|
+
socket: tcp://localhost:2375
|
|
14
|
+
|
|
15
|
+
provisioner:
|
|
16
|
+
name: dummy
|
|
17
|
+
|
|
18
|
+
platforms:
|
|
19
|
+
- name: windows
|
|
20
|
+
driver_config:
|
|
21
|
+
image: mcr.microsoft.com/windows/servercore:1809
|
|
22
|
+
platform: windows
|
|
23
|
+
|
|
24
|
+
suites:
|
|
25
|
+
- name: default
|
|
26
|
+
- name: context
|
|
27
|
+
driver:
|
|
28
|
+
build_context: false
|
|
29
|
+
- name: inspec
|
|
30
|
+
driver:
|
|
31
|
+
provision_command: echo 1
|
|
32
|
+
verifier:
|
|
33
|
+
name: inspec
|
data/.kitchen.yml
CHANGED
|
@@ -6,28 +6,30 @@ driver:
|
|
|
6
6
|
name: docker
|
|
7
7
|
provision_command: curl -L https://www.chef.io/chef/install.sh | bash
|
|
8
8
|
|
|
9
|
+
transport:
|
|
10
|
+
name: docker
|
|
11
|
+
|
|
9
12
|
provisioner:
|
|
10
13
|
name: dummy
|
|
11
14
|
|
|
12
15
|
platforms:
|
|
13
|
-
- name:
|
|
14
|
-
- name: ubuntu-
|
|
15
|
-
- name:
|
|
16
|
+
- name: amazonlinux-2
|
|
17
|
+
- name: ubuntu-18.04
|
|
18
|
+
- name: ubuntu-20.04
|
|
19
|
+
- name: fedora-latest
|
|
20
|
+
driver:
|
|
21
|
+
provision_command:
|
|
22
|
+
- yum install libxcrypt-compat -y
|
|
23
|
+
- curl -L https://www.chef.io/chef/install.sh | bash
|
|
16
24
|
- name: centos-7
|
|
17
|
-
- name:
|
|
25
|
+
- name: centos-8
|
|
18
26
|
- name: oraclelinux-7
|
|
19
|
-
- name:
|
|
20
|
-
- name:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# image: base/archlinux
|
|
26
|
-
# provision_command: true
|
|
27
|
-
- name: unknown
|
|
28
|
-
driver:
|
|
29
|
-
image: ubuntu:16.04
|
|
30
|
-
platform: ubuntu
|
|
27
|
+
- name: rockylinux-8
|
|
28
|
+
- name: debian-9
|
|
29
|
+
- name: debian-10
|
|
30
|
+
- name: opensuse-15
|
|
31
|
+
driver:
|
|
32
|
+
image: opensuse/leap:15
|
|
31
33
|
- name: dockerfile
|
|
32
34
|
driver:
|
|
33
35
|
username: dockerfile
|
|
@@ -43,13 +45,20 @@ suites:
|
|
|
43
45
|
driver:
|
|
44
46
|
build_context: false
|
|
45
47
|
- name: capabilities
|
|
46
|
-
|
|
48
|
+
includes: [debian-9,debian-10,ubuntu-18.04,ubuntu-20.04]
|
|
47
49
|
driver:
|
|
48
50
|
provision_command:
|
|
49
51
|
- curl -L https://www.chef.io/chef/install.sh | bash
|
|
50
52
|
- apt-get install -y net-tools
|
|
51
53
|
cap_drop:
|
|
52
54
|
- NET_ADMIN
|
|
55
|
+
- name: arm64
|
|
56
|
+
excludes: [debian-9]
|
|
57
|
+
driver:
|
|
58
|
+
docker_platform: linux/arm64
|
|
59
|
+
- name: amd64
|
|
60
|
+
driver:
|
|
61
|
+
docker_platform: linux/amd64
|
|
53
62
|
- name: inspec
|
|
54
63
|
driver:
|
|
55
64
|
provision_command: true
|
data/.travis.yml
CHANGED
|
@@ -1,17 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
matrix:
|
|
2
|
+
include:
|
|
3
|
+
- os: linux
|
|
4
|
+
rvm: 2.4.9
|
|
5
|
+
dist: xenial
|
|
6
|
+
language: ruby
|
|
7
|
+
cache: bundler
|
|
8
|
+
script:
|
|
9
|
+
- bundle exec docker version
|
|
10
|
+
- bundle exec kitchen --version
|
|
11
|
+
- bundle exec rake spec
|
|
12
|
+
- bundle exec kitchen test -d always
|
|
13
|
+
- os: linux
|
|
14
|
+
rvm: 2.5.7
|
|
15
|
+
dist: xenial
|
|
16
|
+
language: ruby
|
|
17
|
+
cache: bundler
|
|
18
|
+
script:
|
|
19
|
+
- bundle exec docker version
|
|
20
|
+
- bundle exec kitchen --version
|
|
21
|
+
- bundle exec rake spec
|
|
22
|
+
- bundle exec kitchen test -d always
|
|
23
|
+
- os: linux
|
|
24
|
+
rvm: 2.6.5
|
|
25
|
+
dist: xenial
|
|
26
|
+
language: ruby
|
|
27
|
+
cache: bundler
|
|
28
|
+
script:
|
|
29
|
+
- bundle exec docker version
|
|
30
|
+
- bundle exec kitchen --version
|
|
31
|
+
- bundle exec rake spec
|
|
32
|
+
- bundle exec kitchen test -d always
|
|
33
|
+
- os: windows
|
|
34
|
+
language: bash
|
|
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
|
|
40
|
+
- choco install mingw
|
|
41
|
+
- choco install msys2
|
|
42
|
+
- ridk.cmd exec pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-libxslt
|
|
43
|
+
script:
|
|
44
|
+
- if [[ $(tasklist | grep "gpg-agent") ]]; then taskkill -IM "gpg-agent.exe" -F; else echo "Process gpg-agent not found. Skipping."; fi
|
|
45
|
+
- powershell -ExecutionPolicy Bypass -NoLogo -File docker.ps1
|
|
46
|
+
- export KITCHEN_YAML=.kitchen.windows.yml
|
|
47
|
+
- ruby -v
|
|
48
|
+
- gem install bundler
|
|
49
|
+
- bundle config build.nokogiri --use-system-libraries
|
|
50
|
+
- bundle install
|
|
51
|
+
- bundle exec docker version
|
|
52
|
+
- bundle exec kitchen --version
|
|
53
|
+
- bundle exec rake spec
|
|
54
|
+
- bundle exec kitchen test -d always
|
|
9
55
|
|
|
10
56
|
services:
|
|
11
57
|
- docker
|
|
12
|
-
|
|
13
|
-
script:
|
|
14
|
-
- bundle exec docker version
|
|
15
|
-
- bundle exec kitchen --version
|
|
16
|
-
- bundle exec rake spec
|
|
17
|
-
- bundle exec kitchen test -d always
|
data/CHANGELOG.md
CHANGED
|
@@ -1,99 +1,114 @@
|
|
|
1
1
|
# Kitchen-Docker Changelog
|
|
2
2
|
|
|
3
|
+
## 2.12.0 - December 22, 2021
|
|
4
|
+
|
|
5
|
+
- Support Docker BuildKit - [@RulerOf](https://github.com/RulerOf)
|
|
6
|
+
- Add new `docker_platform` config to allow specifying architectures - [@RulerOf](https://github.com/RulerOf)
|
|
7
|
+
|
|
8
|
+
## 2.11.0 - July 2, 2021
|
|
9
|
+
|
|
10
|
+
- Update the development dependency on kitchen-inspec to 2.x
|
|
11
|
+
- Retrieve hostname state data after container is launched to avoid failures when `use_internal_docker_network` is set
|
|
12
|
+
- Add a new option for setting container isolation. See the readme for additional details
|
|
13
|
+
- Support GPUs in containers with a new `gpus` option that takes the same arguments that would be passed to `docker run --gpus`
|
|
14
|
+
- suse platform: use system script for ssh key initialization
|
|
15
|
+
- Add support for the `--mount` docker CLI option. See the readme for additional details
|
|
16
|
+
- Use sudo.d files instead of directly editing the sudoers file
|
|
17
|
+
- Allow passing `--tmpfs` entries to the docker run command. See the readme for additional details
|
|
18
|
+
- Use less verbose and quicker setup on Gentoo
|
|
19
|
+
- Lowercase the instance-name to avoid issues since docker does not allow instance with capital cases
|
|
20
|
+
- Fix the error "Could not parse Docker build output for image ID" by improving the output line matching
|
|
21
|
+
- Add support for `almalinux` & `rockylinux`
|
|
22
|
+
|
|
23
|
+
## 2.10.0 - Mar 28, 2020
|
|
24
|
+
|
|
25
|
+
- Switched from require to require_relative to slightly improve load time performance
|
|
26
|
+
- Allow for train gem 3.x
|
|
27
|
+
- Refactor driver to include Windows support (includes new transport for all supported platforms)
|
|
28
|
+
|
|
29
|
+
## 2.9.0 - Mar 15, 2019
|
|
30
|
+
|
|
31
|
+
- Add automatic OS detection for amazonlinux, opensuse/leap, and opensuse/tumbleweed
|
|
32
|
+
- On Fedora containers uses dnf to setup the OS not yum
|
|
33
|
+
|
|
3
34
|
## 2.8.0 - Jan 18, 2019
|
|
4
35
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
36
|
+
- Add new config option `use_internal_docker_network`, which allows running Docker within Docker. See readme for usage details.
|
|
37
|
+
- Resolve errors while loading libraries on archlinux
|
|
38
|
+
- Fix failures on Ubuntu 18.04
|
|
39
|
+
- Check if image exists before attempting to remove it so we don't fail
|
|
40
|
+
- Add oraclelinux platform support
|
|
41
|
+
- Prevent `uninitialized constant Kitchen::Driver::Docker::Base64` error by requiring `base64`
|
|
11
42
|
|
|
12
43
|
## 2.7.0
|
|
13
44
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
45
|
+
- Support for SUSE-based container images.
|
|
46
|
+
- Improved support for build context shipping.
|
|
47
|
+
- Changed `use_sudo` to default to `false` in keeping with modern Docker usage.
|
|
17
48
|
|
|
18
49
|
## 2.6.0
|
|
19
50
|
|
|
20
|
-
|
|
51
|
+
- Set container name with information from the run so you can identify them
|
|
21
52
|
later on.
|
|
22
|
-
|
|
53
|
+
- Upgrade to new driver base class structure.
|
|
23
54
|
|
|
24
55
|
## 2.5.0
|
|
25
56
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
57
|
+
- [#209](https://github.com/portertech/kitchen-docker/pulls/209) Fix usage with Kitchen rake tasks.
|
|
58
|
+
- Add `run_options` and `build_options` configuration.
|
|
59
|
+
- [#195](https://github.com/portertech/kitchen-docker/pulls/195) Fix Arch Linux support.
|
|
60
|
+
- Fix shell escaping for build paths and SSH keys.
|
|
30
61
|
|
|
31
62
|
## 2.4.0
|
|
32
63
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
64
|
+
- [#148](https://github.com/portertech/kitchen-docker/issues/148) Restored support for older versions of Ruby.
|
|
65
|
+
- [#149](https://github.com/portertech/kitchen-docker/pulls/149) Handle connecting to a container directly as root.
|
|
66
|
+
- [#154](https://github.com/portertech/kitchen-docker/pulls/154) Improve container caching by reordering the build steps.
|
|
67
|
+
- [#176](https://github.com/portertech/kitchen-docker/pulls/176) Expose proxy environment variables to the container automatically.
|
|
68
|
+
- [#192](https://github.com/portertech/kitchen-docker/pulls/192) Set `$container=docker` for CentOS images.
|
|
69
|
+
- [#196](https://github.com/portertech/kitchen-docker/pulls/196) Mutex SSH key generation for use with `kitchen -c`.
|
|
70
|
+
- [#192](https://github.com/portertech/kitchen-docker/pulls/192) Don't wait when stopping a container.
|
|
40
71
|
|
|
41
72
|
## 2.3.0
|
|
42
73
|
|
|
43
|
-
|
|
74
|
+
- `build_context` option (boolean) to enable/disable sending the build
|
|
44
75
|
context to Docker.
|
|
45
76
|
|
|
46
77
|
## 2.2.0
|
|
47
78
|
|
|
48
|
-
|
|
79
|
+
- Use a temporary file for each suite instance Docker container
|
|
49
80
|
Dockerfile, instead of passing their contents via STDIN. This allows for
|
|
50
81
|
the use of commands like ADD and COPY. **Users must now use Docker >= 1.5.0**
|
|
51
|
-
|
|
52
|
-
* Passwordless suite instance Docker container login (SSH), using a
|
|
82
|
+
- Passwordless suite instance Docker container login (SSH), using a
|
|
53
83
|
generated key pair.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* README YAML highlighting.
|
|
84
|
+
- Support for sharing a host device with suite instance Docker containers.
|
|
85
|
+
- README YAML highlighting.
|
|
58
86
|
|
|
59
87
|
## 2.1.0
|
|
60
88
|
|
|
61
|
-
|
|
89
|
+
- Use `NUL` instead of `/dev/null` on Windows for output redirection
|
|
62
90
|
|
|
63
91
|
## 2.0.0
|
|
64
92
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
* wait_for_sshd option (boolean)
|
|
74
|
-
|
|
75
|
-
* Create `/etc/sudoers.d` if missing
|
|
76
|
-
|
|
77
|
-
* Fixed option deprecation warnings, require Docker >= 1.2
|
|
93
|
+
- Use Docker `top` and `port` instead of `inspect`
|
|
94
|
+
- Don't create the kitchen user if it already exists
|
|
95
|
+
- Docker container capabilities options: cap_add, cap_drop
|
|
96
|
+
- Docker security profile option (SELinux/AppArmor): security_opt
|
|
97
|
+
- wait_for_sshd option (boolean)
|
|
98
|
+
- Create `/etc/sudoers.d` if missing
|
|
99
|
+
- Fixed option deprecation warnings, require Docker >= 1.2
|
|
78
100
|
|
|
79
101
|
## 1.7.0
|
|
80
102
|
|
|
81
|
-
|
|
103
|
+
- Ensure a container id is set before attempting to inspect a container
|
|
82
104
|
|
|
83
105
|
## 1.6.0
|
|
84
106
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
* Fixed verify dependencies output redirection
|
|
94
|
-
|
|
95
|
-
* Added `fedora` to platform names
|
|
96
|
-
|
|
97
|
-
* Support for `gentoo` and `gentoo-paludis` platforms
|
|
98
|
-
|
|
99
|
-
* Adding sudo rule to `/etc/sudoers.d/#{username}` in addition to `/etc/sudoers`
|
|
107
|
+
- `publish_all` option to publish all ports to the host interface
|
|
108
|
+
- `instance_name` option to name the Docker container
|
|
109
|
+
- `links` option to link suite instance Docker containers
|
|
110
|
+
- `socket` option will now default to ENV `DOCKER_HOST` if set
|
|
111
|
+
- Fixed verify dependencies output redirection
|
|
112
|
+
- Added `fedora` to platform names
|
|
113
|
+
- Support for `gentoo` and `gentoo-paludis` platforms
|
|
114
|
+
- Adding sudo rule to `/etc/sudoers.d/#{username}` in addition to `/etc/sudoers`
|
data/README.md
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
[](https://codecov.io/github/test-kitchen/kitchen-docker)
|
|
6
6
|
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
7
7
|
|
|
8
|
-
A Test Kitchen Driver for Docker.
|
|
8
|
+
A Test Kitchen Driver and Transport for Docker.
|
|
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.
|
|
9
11
|
|
|
10
12
|
## Requirements
|
|
11
13
|
|
|
@@ -15,12 +17,14 @@ A Test Kitchen Driver for Docker.
|
|
|
15
17
|
|
|
16
18
|
Please read the Test Kitchen [docs][test_kitchen_docs] for more details.
|
|
17
19
|
|
|
18
|
-
Example `.kitchen.local.yml`:
|
|
20
|
+
Example (Linux) `.kitchen.local.yml`:
|
|
19
21
|
|
|
20
22
|
```yaml
|
|
21
23
|
---
|
|
22
24
|
driver:
|
|
23
25
|
name: docker
|
|
26
|
+
env_variables:
|
|
27
|
+
TEST_KEY: TEST_VALUE
|
|
24
28
|
|
|
25
29
|
platforms:
|
|
26
30
|
- name: ubuntu
|
|
@@ -32,6 +36,30 @@ platforms:
|
|
|
32
36
|
platform: rhel
|
|
33
37
|
run_list:
|
|
34
38
|
- recipe[yum]
|
|
39
|
+
|
|
40
|
+
transport:
|
|
41
|
+
name: docker
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Example (Windows) `.kitchen.local.yml`:
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
---
|
|
48
|
+
driver:
|
|
49
|
+
name: docker
|
|
50
|
+
|
|
51
|
+
platforms:
|
|
52
|
+
- name: windows
|
|
53
|
+
driver_config:
|
|
54
|
+
image: mcr.microsoft.com/windows/servercore:1607
|
|
55
|
+
platform: windows
|
|
56
|
+
run_list:
|
|
57
|
+
- recipe[chef_client]
|
|
58
|
+
|
|
59
|
+
transport:
|
|
60
|
+
name: docker
|
|
61
|
+
env_variables:
|
|
62
|
+
TEST_KEY: TEST_VALUE
|
|
35
63
|
```
|
|
36
64
|
|
|
37
65
|
## Default Configuration
|
|
@@ -44,8 +72,8 @@ Examples:
|
|
|
44
72
|
```yaml
|
|
45
73
|
---
|
|
46
74
|
platforms:
|
|
47
|
-
- name: ubuntu-
|
|
48
|
-
- name: centos-
|
|
75
|
+
- name: ubuntu-18.04
|
|
76
|
+
- name: centos-7
|
|
49
77
|
```
|
|
50
78
|
|
|
51
79
|
This will effectively generate a configuration similar to:
|
|
@@ -53,13 +81,13 @@ This will effectively generate a configuration similar to:
|
|
|
53
81
|
```yaml
|
|
54
82
|
---
|
|
55
83
|
platforms:
|
|
56
|
-
- name: ubuntu-
|
|
84
|
+
- name: ubuntu-18.04
|
|
57
85
|
driver_config:
|
|
58
|
-
image: ubuntu:
|
|
86
|
+
image: ubuntu:18.04
|
|
59
87
|
platform: ubuntu
|
|
60
|
-
- name: centos-
|
|
88
|
+
- name: centos-7
|
|
61
89
|
driver_config:
|
|
62
|
-
image: centos:
|
|
90
|
+
image: centos:7
|
|
63
91
|
platform: centos
|
|
64
92
|
```
|
|
65
93
|
|
|
@@ -83,11 +111,9 @@ Examples:
|
|
|
83
111
|
|
|
84
112
|
### socket
|
|
85
113
|
|
|
86
|
-
The Docker daemon socket to use. By default, Docker will listen on
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this option. If a TCP socket is set, its host will be used for SSH access
|
|
90
|
-
to suite containers.
|
|
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.
|
|
116
|
+
If a TCP socket is set, its host will be used for SSH access to suite containers.
|
|
91
117
|
|
|
92
118
|
Examples:
|
|
93
119
|
|
|
@@ -99,10 +125,27 @@ Examples:
|
|
|
99
125
|
socket: tcp://docker.example.com:4242
|
|
100
126
|
```
|
|
101
127
|
|
|
102
|
-
If you
|
|
103
|
-
|
|
128
|
+
If you are using the InSpec verifier on Windows, using named pipes for the Docker engine will not work with the Docker transport.
|
|
129
|
+
Set the socket option with the TCP socket address of the Docker engine as shown below:
|
|
104
130
|
```yaml
|
|
105
|
-
socket:
|
|
131
|
+
socket: tcp://localhost:2375
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The Docker engine must be configured to listen on a TCP port (default port is 2375). This can be configured by editing the configuration file
|
|
135
|
+
(usually located in `C:\ProgramData\docker\config\daemon.json`) and adding the hosts value:
|
|
136
|
+
```
|
|
137
|
+
"hosts": ["tcp://0.0.0.0:2375"]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Example configuration is shown below:
|
|
141
|
+
```
|
|
142
|
+
{
|
|
143
|
+
"registry-mirrors": [],
|
|
144
|
+
"insecure-registries": [],
|
|
145
|
+
"debug": true,
|
|
146
|
+
"experimental": false,
|
|
147
|
+
"hosts": ["tcp://0.0.0.0:2375"]
|
|
148
|
+
}
|
|
106
149
|
```
|
|
107
150
|
|
|
108
151
|
If you use [Boot2Docker](https://github.com/boot2docker/boot2docker)
|
|
@@ -115,7 +158,6 @@ $MACHINE)"` then use the following:
|
|
|
115
158
|
socket: tcp://192.168.59.103:2375
|
|
116
159
|
```
|
|
117
160
|
|
|
118
|
-
|
|
119
161
|
### image
|
|
120
162
|
|
|
121
163
|
The Docker image to use as the base for the suite containers. You can find
|
|
@@ -124,15 +166,30 @@ images using the [Docker Index][docker_index].
|
|
|
124
166
|
The default will be computed, using the platform name (see the Default
|
|
125
167
|
Configuration section for more details).
|
|
126
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
|
+
|
|
127
182
|
### platform
|
|
128
183
|
|
|
129
184
|
The platform of the chosen image. This is used to properly bootstrap the
|
|
130
185
|
suite container for Test Kitchen. Kitchen Docker currently supports:
|
|
131
186
|
|
|
187
|
+
* `arch`
|
|
132
188
|
* `debian` or `ubuntu`
|
|
133
|
-
* `rhel` or `
|
|
189
|
+
* `amazonlinux`, `rhel`, `centos`, `fedora`, `oraclelinux`, `almalinux` or `rockylinux`
|
|
134
190
|
* `gentoo` or `gentoo-paludis`
|
|
135
|
-
* `opensuse` or `sles`
|
|
191
|
+
* `opensuse/tumbleweed`, `opensuse/leap`, `opensuse` or `sles`
|
|
192
|
+
* `windows`
|
|
136
193
|
|
|
137
194
|
The default will be computed, using the platform name (see the Default
|
|
138
195
|
Configuration section for more details).
|
|
@@ -181,6 +238,17 @@ driver_config:
|
|
|
181
238
|
provision_command: curl -L https://www.opscode.com/chef/install.sh | bash
|
|
182
239
|
require_chef_omnibus: false
|
|
183
240
|
```
|
|
241
|
+
### env_variables
|
|
242
|
+
|
|
243
|
+
Adds environment variables to Docker container
|
|
244
|
+
|
|
245
|
+
Examples:
|
|
246
|
+
|
|
247
|
+
```yaml
|
|
248
|
+
env_variables:
|
|
249
|
+
TEST_KEY_1: TEST_VALUE
|
|
250
|
+
SOME_VAR: SOME_VALUE
|
|
251
|
+
```
|
|
184
252
|
|
|
185
253
|
### use\_cache
|
|
186
254
|
|
|
@@ -259,6 +327,39 @@ Examples:
|
|
|
259
327
|
- rvm
|
|
260
328
|
```
|
|
261
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
|
+
|
|
262
363
|
### dns
|
|
263
364
|
|
|
264
365
|
Adjusts `resolv.conf` to use the dns servers specified. Otherwise use
|
|
@@ -495,6 +596,20 @@ Examples:
|
|
|
495
596
|
use_internal_docker_network: true
|
|
496
597
|
```
|
|
497
598
|
|
|
599
|
+
### docker_platform
|
|
600
|
+
|
|
601
|
+
Configure the CPU platform (architecture) used by docker to build the image.
|
|
602
|
+
|
|
603
|
+
Examples:
|
|
604
|
+
|
|
605
|
+
```yaml
|
|
606
|
+
docker_platform: linux/arm64
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
```yaml
|
|
610
|
+
docker_platform: linux/amd64
|
|
611
|
+
```
|
|
612
|
+
|
|
498
613
|
## Development
|
|
499
614
|
|
|
500
615
|
* Source hosted at [GitHub][repo]
|
|
@@ -534,7 +649,7 @@ limitations under the License.
|
|
|
534
649
|
[docker_upstart_issue]: https://github.com/dotcloud/docker/issues/223
|
|
535
650
|
[docker_index]: https://index.docker.io/
|
|
536
651
|
[docker_default_image]: https://index.docker.io/_/base/
|
|
537
|
-
[test_kitchen_docs]:
|
|
652
|
+
[test_kitchen_docs]: https://kitchen.ci/docs/getting-started/introduction/
|
|
538
653
|
[chef_omnibus_dl]: https://downloads.chef.io/chef-client/
|
|
539
654
|
[cpu_shares]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html
|
|
540
655
|
[memory_limit]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-memory.html
|
data/docker.ps1
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# This script is used to configure the Docker service for Windows builds in Travis CI
|
|
2
|
+
Write-Host "Configuring Docker service to listen on TCP port 2375..."
|
|
3
|
+
$dockerSvcArgs = (Get-WmiObject Win32_Service | ?{$_.Name -eq 'docker'} | Select PathName).PathName
|
|
4
|
+
$dockerSvcArgs = "$dockerSvcArgs -H tcp://0.0.0.0:2375 -H npipe:////./pipe/docker_engine"
|
|
5
|
+
Write-Host "Docker Service Args: $dockerSvcArgs"
|
|
6
|
+
|
|
7
|
+
Get-WmiObject Win32_Service -Filter "Name='docker'" | Invoke-WmiMethod -Name Change -ArgumentList @($null,$null,$null,$null,$null, $dockerSvcArgs) | Out-Null
|
|
8
|
+
|
|
9
|
+
Restart-Service docker -Force -Verbose
|
data/kitchen-docker.gemspec
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'kitchen/
|
|
3
|
+
require 'kitchen/docker/docker_version'
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |spec|
|
|
7
6
|
spec.name = 'kitchen-docker'
|
|
8
|
-
spec.version = Kitchen::
|
|
7
|
+
spec.version = Kitchen::Docker::DOCKER_VERSION
|
|
9
8
|
spec.authors = ['Sean Porter']
|
|
10
9
|
spec.email = ['portertech@gmail.com']
|
|
11
10
|
spec.description = %q{A Docker Driver for Test Kitchen}
|
|
@@ -14,7 +13,6 @@ Gem::Specification.new do |spec|
|
|
|
14
13
|
spec.license = 'Apache 2.0'
|
|
15
14
|
|
|
16
15
|
spec.files = `git ls-files`.split($/)
|
|
17
|
-
spec.executables = []
|
|
18
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
17
|
spec.require_paths = ['lib']
|
|
20
18
|
|
|
@@ -36,5 +34,6 @@ Gem::Specification.new do |spec|
|
|
|
36
34
|
spec.add_development_dependency 'codecov', '~> 0.0', '>= 0.0.2'
|
|
37
35
|
|
|
38
36
|
# Integration testing gems.
|
|
39
|
-
spec.add_development_dependency 'kitchen-inspec', '~> 0
|
|
37
|
+
spec.add_development_dependency 'kitchen-inspec', '~> 2.0'
|
|
38
|
+
spec.add_development_dependency 'train', '>= 2.1', '< 4.0' # validate 4.x when it's released
|
|
40
39
|
end
|