kitchen-docker 2.6.0 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ac3e853fa14d2d248cd9f28c81dc1cdfd4e246c8
4
- data.tar.gz: 55abcccf7441c4fca218443ffecae6170579fd62
2
+ SHA256:
3
+ metadata.gz: 5cb2a57e3f7074c1f3b07505f6931d9d742a2ff70d8908b97d9c69d27bb6b34b
4
+ data.tar.gz: 863c64c9dac8d43c0db30bb5b83cb6eaf3448ae0b988f9809abbd882b8b12ac1
5
5
  SHA512:
6
- metadata.gz: 3d43e2069a3ebdaef65ec576f7414c53a04f4a75fbdf63d88461d2260a6880e7bbd3d4fbda01e4b96c6eb247885a1aa4bbe1dbbe3c9d73c9b7f37bf41769d8ce
7
- data.tar.gz: bde163aebd028bf17af0a75dcbcb42ba5742a9449e340880793d7458ab662c98066cd881834adf5291dc6a908e0078ea4d205373b887062cd177dfc2081753b4
6
+ metadata.gz: b8639ed71230580894bc7daedd7c7efcaf09458e2e6c1cbf45e0617e16844a28d4c0015c251009e1e0fa0c741daf15715eed2a2bc6f1eada903a04fdb73a620a
7
+ data.tar.gz: 779683f5e429eff27d8d68c3a19f8d01b1247d9699f283bde06f902ed6a8a0f03330e534568cac05114676f27434ba0aacb443ad57705b0bb6e0c5a77409aba0
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
data/.gitignore CHANGED
@@ -17,3 +17,5 @@ test/version_tmp
17
17
  tmp
18
18
  .kitchen/
19
19
  .kitchen.local.yml
20
+ Dockerfile
21
+ .DS_Store
@@ -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,23 +6,35 @@ 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: ubuntu-12.04
14
- - name: ubuntu-14.04
16
+ - name: amazonlinux-2
15
17
  - name: ubuntu-16.04
18
+ - name: ubuntu-18.04
19
+ - name: fedora-latest
20
+ driver:
21
+ provision_command:
22
+ - yum install libxcrypt-compat.x86_64 -y
23
+ - curl -L https://www.chef.io/chef/install.sh | bash
16
24
  - name: centos-6
17
25
  - name: centos-7
18
- - name: debian
19
- - name: arch
20
- driver:
21
- image: base/archlinux
22
- provision_command: true
26
+ - name: oraclelinux-6
27
+ - name: oraclelinux-7
28
+ - name: debian-8
29
+ - name: debian-9
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
23
35
  - name: unknown
24
36
  driver:
25
- image: ubuntu:12.04
37
+ image: ubuntu:16.04
26
38
  platform: ubuntu
27
39
  - name: dockerfile
28
40
  driver:
@@ -39,7 +51,7 @@ suites:
39
51
  driver:
40
52
  build_context: false
41
53
  - name: capabilities
42
- excludes: [arch,unknown,centos-7,centos-6,dockerfile]
54
+ includes: [debian-8,debian-9,ubuntu-16.04,ubuntu-18.04]
43
55
  driver:
44
56
  provision_command:
45
57
  - curl -L https://www.chef.io/chef/install.sh | bash
data/.travis.yml CHANGED
@@ -1,22 +1,57 @@
1
- sudo: required
2
- dist: trusty
3
- language: ruby
4
-
5
- rvm:
6
- - "2.1.9"
7
- - "2.2.5"
8
- - "2.3.1"
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
- cache:
14
- bundler: true
15
- directories:
16
- - /var/lib/docker
17
-
18
- script:
19
- - bundle exec docker version
20
- - bundle exec kitchen --version
21
- - bundle exec rake spec
22
- - bundle exec kitchen test -d always
data/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
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
+
18
+ ## 2.10.0 - Mar 28, 2020
19
+
20
+ * Switched from require to require_relative to slightly improve load time performance
21
+ * Allow for train gem 3.x
22
+ * Refactor driver to include Windows support (includes new transport for all supported platforms)
23
+
24
+ ## 2.9.0 - Mar 15, 2019
25
+
26
+ * Add automatic OS detection for amazonlinux, opensuse/leap, and opensuse/tumbleweed
27
+ * On Fedora containers uses dnf to setup the OS not yum
28
+
29
+ ## 2.8.0 - Jan 18, 2019
30
+
31
+ * Add new config option `use_internal_docker_network`, which allows running Docker within Docker. See readme for usage details.
32
+ * Resolve errors while loading libraries on archlinux
33
+ * Fix failures on Ubuntu 18.04
34
+ * Check if image exists before attempting to remove it so we don't fail
35
+ * Add oraclelinux platform support
36
+ * Prevent `uninitialized constant Kitchen::Driver::Docker::Base64` error by requiring `base64`
37
+
38
+ ## 2.7.0
39
+
40
+ * Support for SUSE-based container images.
41
+ * Improved support for build context shipping.
42
+ * Changed `use_sudo` to default to `false` in keeping with modern Docker usage.
43
+
3
44
  ## 2.6.0
4
45
 
5
46
  * Set container name with information from the run so you can identify them
data/README.md CHANGED
@@ -1,12 +1,13 @@
1
1
  # Kitchen-Docker
2
2
 
3
- [![Build Status](https://img.shields.io/travis/test-kitchen/kitchen-docker.svg)](https://travis-ci.org/test-kitchen/kitchen-docker)
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
- [![Gemnasium](https://img.shields.io/gemnasium/test-kitchen/kitchen-docker.svg)](https://gemnasium.com/test-kitchen/kitchen-docker)
7
6
  [![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
8
7
 
9
- 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.
10
11
 
11
12
  ## Requirements
12
13
 
@@ -16,12 +17,14 @@ A Test Kitchen Driver for Docker.
16
17
 
17
18
  Please read the Test Kitchen [docs][test_kitchen_docs] for more details.
18
19
 
19
- Example `.kitchen.local.yml`:
20
+ Example (Linux) `.kitchen.local.yml`:
20
21
 
21
22
  ```yaml
22
23
  ---
23
24
  driver:
24
25
  name: docker
26
+ env_variables:
27
+ TEST_KEY: TEST_VALUE
25
28
 
26
29
  platforms:
27
30
  - name: ubuntu
@@ -33,6 +36,30 @@ platforms:
33
36
  platform: rhel
34
37
  run_list:
35
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
36
63
  ```
37
64
 
38
65
  ## Default Configuration
@@ -45,8 +72,8 @@ Examples:
45
72
  ```yaml
46
73
  ---
47
74
  platforms:
48
- - name: ubuntu-12.04
49
- - name: centos-6.4
75
+ - name: ubuntu-18.04
76
+ - name: centos-7
50
77
  ```
51
78
 
52
79
  This will effectively generate a configuration similar to:
@@ -54,13 +81,13 @@ This will effectively generate a configuration similar to:
54
81
  ```yaml
55
82
  ---
56
83
  platforms:
57
- - name: ubuntu-12.04
84
+ - name: ubuntu-18.04
58
85
  driver_config:
59
- image: ubuntu:12.04
86
+ image: ubuntu:18.04
60
87
  platform: ubuntu
61
- - name: centos-6.4
88
+ - name: centos-7
62
89
  driver_config:
63
- image: centos:6.4
90
+ image: centos:7
64
91
  platform: centos
65
92
  ```
66
93
 
@@ -84,11 +111,9 @@ Examples:
84
111
 
85
112
  ### socket
86
113
 
87
- The Docker daemon socket to use. By default, Docker will listen on
88
- `unix:///var/run/docker.sock`, and no configuration here is required. If
89
- Docker is binding to another host/port or Unix socket, you will need to set
90
- this option. If a TCP socket is set, its host will be used for SSH access
91
- 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.
92
117
 
93
118
  Examples:
94
119
 
@@ -100,6 +125,29 @@ Examples:
100
125
  socket: tcp://docker.example.com:4242
101
126
  ```
102
127
 
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:
130
+ ```yaml
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
+ }
149
+ ```
150
+
103
151
  If you use [Boot2Docker](https://github.com/boot2docker/boot2docker)
104
152
  or [docker-machine](https://docs.docker.com/machine/get-started/) set
105
153
  your `DOCKER_HOST` environment variable properly with `export
@@ -110,7 +158,6 @@ $MACHINE)"` then use the following:
110
158
  socket: tcp://192.168.59.103:2375
111
159
  ```
112
160
 
113
-
114
161
  ### image
115
162
 
116
163
  The Docker image to use as the base for the suite containers. You can find
@@ -119,14 +166,30 @@ images using the [Docker Index][docker_index].
119
166
  The default will be computed, using the platform name (see the Default
120
167
  Configuration section for more details).
121
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
+
122
182
  ### platform
123
183
 
124
184
  The platform of the chosen image. This is used to properly bootstrap the
125
185
  suite container for Test Kitchen. Kitchen Docker currently supports:
126
186
 
187
+ * `arch`
127
188
  * `debian` or `ubuntu`
128
- * `rhel` or `centos`
189
+ * `amazonlinux`, `rhel`, `centos`, `fedora`, `oraclelinux`, `almalinux` or `rockylinux`
129
190
  * `gentoo` or `gentoo-paludis`
191
+ * `opensuse/tumbleweed`, `opensuse/leap`, `opensuse` or `sles`
192
+ * `windows`
130
193
 
131
194
  The default will be computed, using the platform name (see the Default
132
195
  Configuration section for more details).
@@ -175,6 +238,17 @@ driver_config:
175
238
  provision_command: curl -L https://www.opscode.com/chef/install.sh | bash
176
239
  require_chef_omnibus: false
177
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
+ ```
178
252
 
179
253
  ### use\_cache
180
254
 
@@ -253,6 +327,39 @@ Examples:
253
327
  - rvm
254
328
  ```
255
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
+
256
363
  ### dns
257
364
 
258
365
  Adjusts `resolv.conf` to use the dns servers specified. Otherwise use
@@ -476,6 +583,19 @@ Examples:
476
583
  net: br3
477
584
  ```
478
585
 
586
+ ### use_internal_docker_network
587
+
588
+ If you want to use kitchen-docker from within another Docker container you'll
589
+ need to set this to true. When set to true uses port 22 as the SSH port and
590
+ the IP of the container that chef is going to run in as the hostname so that
591
+ you can connect to it over SSH from within another Docker container.
592
+
593
+ Examples:
594
+
595
+ ```yaml
596
+ use_internal_docker_network: true
597
+ ```
598
+
479
599
  ## Development
480
600
 
481
601
  * Source hosted at [GitHub][repo]
@@ -515,7 +635,7 @@ limitations under the License.
515
635
  [docker_upstart_issue]: https://github.com/dotcloud/docker/issues/223
516
636
  [docker_index]: https://index.docker.io/
517
637
  [docker_default_image]: https://index.docker.io/_/base/
518
- [test_kitchen_docs]: http://kitchen.ci/docs/getting-started/
638
+ [test_kitchen_docs]: https://kitchen.ci/docs/getting-started/introduction/
519
639
  [chef_omnibus_dl]: https://downloads.chef.io/chef-client/
520
640
  [cpu_shares]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html
521
641
  [memory_limit]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-memory.html