kitchen-docker 3.0.0 → 3.2.3
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/CODEOWNERS +1 -0
- data/.github/workflows/lint.yml +99 -0
- data/.github/workflows/publish.yaml +32 -0
- data/.gitignore +1 -0
- data/.markdownlint.yaml +6 -0
- data/.release-please-manifest.json +3 -0
- data/.rubocop.yml +2 -3
- data/CHANGELOG.md +40 -0
- data/Gemfile +20 -1
- data/README.md +16 -9
- data/Rakefile +13 -36
- data/cookbooks +1 -0
- data/kitchen-docker.gemspec +9 -30
- data/kitchen.windows.yml +2 -4
- data/kitchen.yml +58 -26
- data/lib/kitchen/docker/container/linux.rb +17 -17
- data/lib/kitchen/docker/container/windows.rb +11 -11
- data/lib/kitchen/docker/container.rb +7 -7
- data/lib/kitchen/docker/docker_version.rb +1 -1
- data/lib/kitchen/docker/erb_context.rb +3 -3
- data/lib/kitchen/docker/helpers/cli_helper.rb +33 -33
- data/lib/kitchen/docker/helpers/container_helper.rb +30 -28
- data/lib/kitchen/docker/helpers/dockerfile_helper.rb +34 -34
- data/lib/kitchen/docker/helpers/file_helper.rb +4 -4
- data/lib/kitchen/docker/helpers/image_helper.rb +28 -14
- data/lib/kitchen/docker/helpers/inspec_helper.rb +62 -40
- data/lib/kitchen/driver/docker.rb +34 -40
- data/lib/kitchen/transport/docker.rb +15 -16
- data/release-please-config.json +12 -0
- data/renovate.json +8 -0
- data/spec/docker_spec.rb +108 -0
- data/spec/dockerfile_helper_spec.rb +109 -0
- data/spec/inspec_helper_spec.rb +58 -0
- data/{test/spec → spec}/spec_helper.rb +5 -26
- data/test/Dockerfile +4 -5
- data/test/cookbooks/cinc_test/metadata.rb +2 -0
- data/test/cookbooks/cinc_test/recipes/default.rb +10 -0
- data/test/cookbooks/docker_test/attributes/default.rb +1 -0
- data/test/cookbooks/docker_test/metadata.rb +3 -0
- data/test/cookbooks/docker_test/recipes/default.rb +94 -0
- data/test/integration/cinc/inspec/cinc_spec.rb +21 -0
- data/test/integration/default/disabled/default_spec.rb +6 -6
- data/test/integration/inspec/inspec_spec.rb +3 -3
- metadata +26 -211
- data/.cane +0 -0
- data/.github/dependabot.yml +0 -7
- data/.github/workflows/ci.yml +0 -124
- data/.tailor +0 -4
- data/lib/docker/version.rb +0 -25
- data/lib/train/docker.rb +0 -125
- data/test/spec/docker_spec.rb +0 -64
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: 3.
|
|
4
|
+
version: 3.2.3
|
|
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: 2026-06-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|
|
@@ -17,207 +17,19 @@ dependencies:
|
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: 1.0.0
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.0.0
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: bundler
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rake
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: cane
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - ">="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: tailor
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: countloc
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
|
-
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: rspec
|
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
|
100
|
-
requirements:
|
|
101
|
-
- - "~>"
|
|
102
|
-
- !ruby/object:Gem::Version
|
|
103
|
-
version: '3.2'
|
|
104
|
-
type: :development
|
|
105
|
-
prerelease: false
|
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - "~>"
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: '3.2'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: rspec-its
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - "~>"
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '1.2'
|
|
118
|
-
type: :development
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - "~>"
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '1.2'
|
|
125
|
-
- !ruby/object:Gem::Dependency
|
|
126
|
-
name: fuubar
|
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
|
128
|
-
requirements:
|
|
129
|
-
- - "~>"
|
|
130
|
-
- !ruby/object:Gem::Version
|
|
131
|
-
version: '2.0'
|
|
132
|
-
type: :development
|
|
133
|
-
prerelease: false
|
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
-
requirements:
|
|
136
|
-
- - "~>"
|
|
137
|
-
- !ruby/object:Gem::Version
|
|
138
|
-
version: '2.0'
|
|
139
|
-
- !ruby/object:Gem::Dependency
|
|
140
|
-
name: simplecov
|
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
|
142
|
-
requirements:
|
|
143
|
-
- - "~>"
|
|
144
|
-
- !ruby/object:Gem::Version
|
|
145
|
-
version: '0.9'
|
|
146
|
-
type: :development
|
|
147
|
-
prerelease: false
|
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
-
requirements:
|
|
150
|
-
- - "~>"
|
|
151
|
-
- !ruby/object:Gem::Version
|
|
152
|
-
version: '0.9'
|
|
153
|
-
- !ruby/object:Gem::Dependency
|
|
154
|
-
name: codecov
|
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
|
156
|
-
requirements:
|
|
157
|
-
- - "~>"
|
|
158
|
-
- !ruby/object:Gem::Version
|
|
159
|
-
version: '0.0'
|
|
160
|
-
- - ">="
|
|
161
|
-
- !ruby/object:Gem::Version
|
|
162
|
-
version: 0.0.2
|
|
163
|
-
type: :development
|
|
164
|
-
prerelease: false
|
|
165
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
166
|
-
requirements:
|
|
167
|
-
- - "~>"
|
|
168
|
-
- !ruby/object:Gem::Version
|
|
169
|
-
version: '0.0'
|
|
170
|
-
- - ">="
|
|
171
|
-
- !ruby/object:Gem::Version
|
|
172
|
-
version: 0.0.2
|
|
173
|
-
- !ruby/object:Gem::Dependency
|
|
174
|
-
name: chefstyle
|
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
|
176
|
-
requirements:
|
|
177
|
-
- - ">="
|
|
178
|
-
- !ruby/object:Gem::Version
|
|
179
|
-
version: '0'
|
|
180
|
-
type: :development
|
|
181
|
-
prerelease: false
|
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
183
|
-
requirements:
|
|
184
|
-
- - ">="
|
|
185
|
-
- !ruby/object:Gem::Version
|
|
186
|
-
version: '0'
|
|
187
|
-
- !ruby/object:Gem::Dependency
|
|
188
|
-
name: kitchen-inspec
|
|
189
|
-
requirement: !ruby/object:Gem::Requirement
|
|
190
|
-
requirements:
|
|
191
|
-
- - "~>"
|
|
192
|
-
- !ruby/object:Gem::Version
|
|
193
|
-
version: '2.0'
|
|
194
|
-
type: :development
|
|
195
|
-
prerelease: false
|
|
196
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
197
|
-
requirements:
|
|
198
|
-
- - "~>"
|
|
199
|
-
- !ruby/object:Gem::Version
|
|
200
|
-
version: '2.0'
|
|
201
|
-
- !ruby/object:Gem::Dependency
|
|
202
|
-
name: train
|
|
203
|
-
requirement: !ruby/object:Gem::Requirement
|
|
204
|
-
requirements:
|
|
205
|
-
- - ">="
|
|
206
|
-
- !ruby/object:Gem::Version
|
|
207
|
-
version: '2.1'
|
|
208
20
|
- - "<"
|
|
209
21
|
- !ruby/object:Gem::Version
|
|
210
|
-
version: '
|
|
211
|
-
type: :
|
|
22
|
+
version: '5.0'
|
|
23
|
+
type: :runtime
|
|
212
24
|
prerelease: false
|
|
213
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
214
26
|
requirements:
|
|
215
27
|
- - ">="
|
|
216
28
|
- !ruby/object:Gem::Version
|
|
217
|
-
version:
|
|
29
|
+
version: 1.0.0
|
|
218
30
|
- - "<"
|
|
219
31
|
- !ruby/object:Gem::Version
|
|
220
|
-
version: '
|
|
32
|
+
version: '5.0'
|
|
221
33
|
description: A Docker Driver for Test Kitchen
|
|
222
34
|
email:
|
|
223
35
|
- portertech@gmail.com
|
|
@@ -225,23 +37,24 @@ executables: []
|
|
|
225
37
|
extensions: []
|
|
226
38
|
extra_rdoc_files: []
|
|
227
39
|
files:
|
|
228
|
-
- ".
|
|
229
|
-
- ".github/
|
|
230
|
-
- ".github/workflows/
|
|
40
|
+
- ".github/CODEOWNERS"
|
|
41
|
+
- ".github/workflows/lint.yml"
|
|
42
|
+
- ".github/workflows/publish.yaml"
|
|
231
43
|
- ".gitignore"
|
|
44
|
+
- ".markdownlint.yaml"
|
|
45
|
+
- ".release-please-manifest.json"
|
|
232
46
|
- ".rubocop.yml"
|
|
233
|
-
- ".tailor"
|
|
234
47
|
- ".yamllint"
|
|
235
48
|
- CHANGELOG.md
|
|
236
49
|
- Gemfile
|
|
237
50
|
- LICENSE
|
|
238
51
|
- README.md
|
|
239
52
|
- Rakefile
|
|
53
|
+
- cookbooks
|
|
240
54
|
- docker.ps1
|
|
241
55
|
- kitchen-docker.gemspec
|
|
242
56
|
- kitchen.windows.yml
|
|
243
57
|
- kitchen.yml
|
|
244
|
-
- lib/docker/version.rb
|
|
245
58
|
- lib/kitchen/docker/container.rb
|
|
246
59
|
- lib/kitchen/docker/container/linux.rb
|
|
247
60
|
- lib/kitchen/docker/container/windows.rb
|
|
@@ -255,14 +68,23 @@ files:
|
|
|
255
68
|
- lib/kitchen/docker/helpers/inspec_helper.rb
|
|
256
69
|
- lib/kitchen/driver/docker.rb
|
|
257
70
|
- lib/kitchen/transport/docker.rb
|
|
258
|
-
-
|
|
71
|
+
- release-please-config.json
|
|
72
|
+
- renovate.json
|
|
73
|
+
- spec/docker_spec.rb
|
|
74
|
+
- spec/dockerfile_helper_spec.rb
|
|
75
|
+
- spec/inspec_helper_spec.rb
|
|
76
|
+
- spec/spec_helper.rb
|
|
259
77
|
- test/Dockerfile
|
|
78
|
+
- test/cookbooks/cinc_test/metadata.rb
|
|
79
|
+
- test/cookbooks/cinc_test/recipes/default.rb
|
|
80
|
+
- test/cookbooks/docker_test/attributes/default.rb
|
|
81
|
+
- test/cookbooks/docker_test/metadata.rb
|
|
82
|
+
- test/cookbooks/docker_test/recipes/default.rb
|
|
260
83
|
- test/integration/capabilities/disabled/capabilities_drop_spec.rb
|
|
84
|
+
- test/integration/cinc/inspec/cinc_spec.rb
|
|
261
85
|
- test/integration/default/disabled/default_spec.rb
|
|
262
86
|
- test/integration/default/disabled/spec_helper.rb
|
|
263
87
|
- test/integration/inspec/inspec_spec.rb
|
|
264
|
-
- test/spec/docker_spec.rb
|
|
265
|
-
- test/spec/spec_helper.rb
|
|
266
88
|
homepage: https://github.com/test-kitchen/kitchen-docker
|
|
267
89
|
licenses:
|
|
268
90
|
- Apache 2.0
|
|
@@ -282,15 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
282
104
|
- !ruby/object:Gem::Version
|
|
283
105
|
version: '0'
|
|
284
106
|
requirements: []
|
|
285
|
-
rubygems_version: 3.
|
|
107
|
+
rubygems_version: 3.5.9
|
|
286
108
|
signing_key:
|
|
287
109
|
specification_version: 4
|
|
288
110
|
summary: A Docker Driver for Test Kitchen
|
|
289
|
-
test_files:
|
|
290
|
-
- test/Dockerfile
|
|
291
|
-
- test/integration/capabilities/disabled/capabilities_drop_spec.rb
|
|
292
|
-
- test/integration/default/disabled/default_spec.rb
|
|
293
|
-
- test/integration/default/disabled/spec_helper.rb
|
|
294
|
-
- test/integration/inspec/inspec_spec.rb
|
|
295
|
-
- test/spec/docker_spec.rb
|
|
296
|
-
- test/spec/spec_helper.rb
|
|
111
|
+
test_files: []
|
data/.cane
DELETED
|
File without changes
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/ci.yml
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Lint & Unit
|
|
3
|
-
|
|
4
|
-
"on":
|
|
5
|
-
pull_request:
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- main
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
yamllint:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- name: Check out code
|
|
15
|
-
uses: actions/checkout@v4
|
|
16
|
-
- name: Run yaml Lint
|
|
17
|
-
uses: actionshub/yamllint@main
|
|
18
|
-
|
|
19
|
-
chefstyle:
|
|
20
|
-
runs-on: ubuntu-latest
|
|
21
|
-
continue-on-error: true
|
|
22
|
-
strategy:
|
|
23
|
-
matrix:
|
|
24
|
-
ruby: ["3.1"]
|
|
25
|
-
name: Chefstyle on Ruby ${{ matrix.ruby }}
|
|
26
|
-
steps:
|
|
27
|
-
- uses: actions/checkout@v4
|
|
28
|
-
- uses: ruby/setup-ruby@v1
|
|
29
|
-
with:
|
|
30
|
-
ruby-version: ${{ matrix.ruby }}
|
|
31
|
-
bundler-cache: true
|
|
32
|
-
- uses: r7kamura/rubocop-problem-matchers-action@v1
|
|
33
|
-
- run: bundle exec chefstyle
|
|
34
|
-
|
|
35
|
-
unit:
|
|
36
|
-
name: Unit test on Ruby ${{ matrix.ruby }}
|
|
37
|
-
needs: [yamllint, chefstyle]
|
|
38
|
-
runs-on: ubuntu-latest
|
|
39
|
-
strategy:
|
|
40
|
-
matrix:
|
|
41
|
-
ruby: ["2.7", "3.0", "3.1"]
|
|
42
|
-
steps:
|
|
43
|
-
- uses: actions/checkout@v4
|
|
44
|
-
- uses: ruby/setup-ruby@v1
|
|
45
|
-
with:
|
|
46
|
-
ruby-version: ${{ matrix.ruby }}
|
|
47
|
-
bundler-cache: true
|
|
48
|
-
- run: bundle exec rake spec
|
|
49
|
-
|
|
50
|
-
integration-windows:
|
|
51
|
-
name: Windows ${{matrix.suite}} ${{matrix.os}}
|
|
52
|
-
runs-on: windows-latest
|
|
53
|
-
needs: unit
|
|
54
|
-
strategy:
|
|
55
|
-
fail-fast: false
|
|
56
|
-
matrix:
|
|
57
|
-
suite: [default]
|
|
58
|
-
os: [ubuntu-20.04]
|
|
59
|
-
steps:
|
|
60
|
-
- uses: actions/checkout@v4
|
|
61
|
-
- uses: ruby/setup-ruby@v1
|
|
62
|
-
with:
|
|
63
|
-
ruby-version: "3.1"
|
|
64
|
-
bundler-cache: true
|
|
65
|
-
- name: Set up Docker Buildx
|
|
66
|
-
uses: docker/setup-buildx-action@v3
|
|
67
|
-
- run: bundle exec kitchen test ${{ matrix.suite }}-${{ matrix.os }}
|
|
68
|
-
|
|
69
|
-
integration-linux:
|
|
70
|
-
name: Linux ${{matrix.suite}} ${{matrix.os}}
|
|
71
|
-
runs-on: ubuntu-latest
|
|
72
|
-
needs: unit
|
|
73
|
-
strategy:
|
|
74
|
-
fail-fast: false
|
|
75
|
-
matrix:
|
|
76
|
-
suite:
|
|
77
|
-
- default
|
|
78
|
-
- no-build-context
|
|
79
|
-
- arm64
|
|
80
|
-
- amd64
|
|
81
|
-
- inspec
|
|
82
|
-
os:
|
|
83
|
-
- amazonlinux-2
|
|
84
|
-
- ubuntu-1804
|
|
85
|
-
- ubuntu-2004
|
|
86
|
-
- fedora-latest
|
|
87
|
-
- centos-7
|
|
88
|
-
- oraclelinux-7
|
|
89
|
-
- rockylinux-8
|
|
90
|
-
- debian-11
|
|
91
|
-
- debian-12
|
|
92
|
-
- opensuse-15
|
|
93
|
-
- dockerfile
|
|
94
|
-
steps:
|
|
95
|
-
- uses: actions/checkout@v2
|
|
96
|
-
- uses: ruby/setup-ruby@v1
|
|
97
|
-
with:
|
|
98
|
-
ruby-version: "3.1"
|
|
99
|
-
bundler-cache: true
|
|
100
|
-
- name: Set up QEMU
|
|
101
|
-
uses: docker/setup-qemu-action@v3
|
|
102
|
-
- name: Set up Docker Buildx
|
|
103
|
-
uses: docker/setup-buildx-action@v3
|
|
104
|
-
- run: bundle exec kitchen test ${{ matrix.suite }}-${{ matrix.os }}
|
|
105
|
-
|
|
106
|
-
integration-capabilities:
|
|
107
|
-
name: Linux ${{matrix.suite}} ${{matrix.os}}
|
|
108
|
-
runs-on: ubuntu-latest
|
|
109
|
-
needs: unit
|
|
110
|
-
strategy:
|
|
111
|
-
fail-fast: false
|
|
112
|
-
matrix:
|
|
113
|
-
suite:
|
|
114
|
-
- capabilities
|
|
115
|
-
os: [debian-11, ubuntu-1804, ubuntu-2004]
|
|
116
|
-
steps:
|
|
117
|
-
- uses: actions/checkout@v2
|
|
118
|
-
- uses: ruby/setup-ruby@v1
|
|
119
|
-
with:
|
|
120
|
-
ruby-version: "3.1"
|
|
121
|
-
bundler-cache: true
|
|
122
|
-
- name: Set up Docker Buildx
|
|
123
|
-
uses: docker/setup-buildx-action@v3
|
|
124
|
-
- run: bundle exec kitchen test ${{ matrix.suite }}-${{ matrix.os }}
|
data/.tailor
DELETED
data/lib/docker/version.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
begin
|
|
15
|
-
require 'docker'
|
|
16
|
-
|
|
17
|
-
# Override API_VERSION constant in docker-api gem to use version 1.24 of the Docker API
|
|
18
|
-
# This override is for the docker-api gem to communicate to the Docker engine on Windows
|
|
19
|
-
module Docker
|
|
20
|
-
VERSION = '0.0.0'
|
|
21
|
-
API_VERSION = '1.24'
|
|
22
|
-
end
|
|
23
|
-
rescue LoadError => e
|
|
24
|
-
logger.debug("[Docker] docker-api gem not found for InSpec verifier. #{e}")
|
|
25
|
-
end
|
data/lib/train/docker.rb
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
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
|
-
# Monkey patched Docker train transport to support running the InSpec verifier on Windows
|
|
15
|
-
begin
|
|
16
|
-
# Requires train gem with a minimum version of 2.1.0
|
|
17
|
-
require 'train'
|
|
18
|
-
|
|
19
|
-
module Train::Transports
|
|
20
|
-
# Patched train transport with Windows support for InSpec verifier
|
|
21
|
-
class Docker < Train.plugin(1)
|
|
22
|
-
name 'docker'
|
|
23
|
-
|
|
24
|
-
include_options Train::Extras::CommandWrapper
|
|
25
|
-
option :host, required: true
|
|
26
|
-
|
|
27
|
-
def connection(state = {}, &block)
|
|
28
|
-
opts = merge_options(options, state || {})
|
|
29
|
-
validate_options(opts)
|
|
30
|
-
|
|
31
|
-
if @connection && @connection_options == opts
|
|
32
|
-
reuse_connection(&block)
|
|
33
|
-
else
|
|
34
|
-
create_new_connection(opts, &block)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
# Creates a new Docker connection instance and save it for potential future
|
|
41
|
-
# reuse.
|
|
42
|
-
#
|
|
43
|
-
# @param options [Hash] connection options
|
|
44
|
-
# @return [Docker::Connection] a Docker connection instance
|
|
45
|
-
# @api private
|
|
46
|
-
def create_new_connection(options, &block)
|
|
47
|
-
if @connection
|
|
48
|
-
logger.debug("[Docker] shutting previous connection #{@connection}")
|
|
49
|
-
@connection.close
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
@connection_options = options
|
|
53
|
-
@connection = Connection.new(options, &block)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# Return the last saved Docker connection instance.
|
|
57
|
-
#
|
|
58
|
-
# @return [Docker::Connection] a Docker connection instance
|
|
59
|
-
# @api private
|
|
60
|
-
def reuse_connection
|
|
61
|
-
logger.debug("[Docker] reusing existing connection #{@connection}")
|
|
62
|
-
yield @connection if block_given?
|
|
63
|
-
@connection
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
class Train::Transports::Docker
|
|
69
|
-
class Connection < BaseConnection
|
|
70
|
-
def initialize(conf)
|
|
71
|
-
super(conf)
|
|
72
|
-
@id = options[:host]
|
|
73
|
-
@container = ::Docker::Container.get(@id) ||
|
|
74
|
-
fail("Can't find Docker container #{@id}")
|
|
75
|
-
@cmd_wrapper = nil
|
|
76
|
-
@cmd_wrapper = CommandWrapper.load(self, @options)
|
|
77
|
-
self
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def uri
|
|
81
|
-
if @container.nil?
|
|
82
|
-
"docker://#{@id}"
|
|
83
|
-
else
|
|
84
|
-
"docker://#{@container.id}"
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
private
|
|
89
|
-
|
|
90
|
-
def file_via_connection(path)
|
|
91
|
-
if os.aix?
|
|
92
|
-
Train::File::Remote::Aix.new(self, path)
|
|
93
|
-
elsif os.solaris?
|
|
94
|
-
Train::File::Remote::Unix.new(self, path)
|
|
95
|
-
elsif os.windows?
|
|
96
|
-
Train::File::Remote::Windows.new(self, path)
|
|
97
|
-
else
|
|
98
|
-
Train::File::Remote::Linux.new(self, path)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def platform_specific_cmd(cmd)
|
|
103
|
-
return cmd if @container.info.nil?
|
|
104
|
-
if @container.info['Platform'] == 'windows'
|
|
105
|
-
return ['cmd.exe', '/c', cmd]
|
|
106
|
-
else
|
|
107
|
-
return ['/bin/sh', '-c', cmd]
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def run_command_via_connection(cmd, &_data_handler)
|
|
112
|
-
cmd = @cmd_wrapper.run(cmd) unless @cmd_wrapper.nil?
|
|
113
|
-
stdout, stderr, exit_status = @container.exec(platform_specific_cmd(cmd))
|
|
114
|
-
CommandResult.new(stdout.join, stderr.join, exit_status)
|
|
115
|
-
rescue ::Docker::Error::DockerError => _
|
|
116
|
-
raise
|
|
117
|
-
rescue => _
|
|
118
|
-
# @TODO: differentiate any other error
|
|
119
|
-
raise
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
rescue LoadError => e
|
|
124
|
-
logger.debug("[Docker] train gem not found for InSpec verifier. #{e}")
|
|
125
|
-
end
|
data/test/spec/docker_spec.rb
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Copyright 2016, Noah Kantrowitz
|
|
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
|
-
|
|
17
|
-
require 'spec_helper'
|
|
18
|
-
|
|
19
|
-
describe Kitchen::Driver::Docker do
|
|
20
|
-
describe '#config_to_options' do
|
|
21
|
-
let(:config) { }
|
|
22
|
-
subject { described_class.new.send(:config_to_options, config) }
|
|
23
|
-
|
|
24
|
-
context 'with nil' do
|
|
25
|
-
let(:config) { nil }
|
|
26
|
-
it { is_expected.to eq '' }
|
|
27
|
-
end # /context with nil
|
|
28
|
-
|
|
29
|
-
context 'with a string' do
|
|
30
|
-
let(:config) { '--foo' }
|
|
31
|
-
it { is_expected.to eq '--foo' }
|
|
32
|
-
end # /context with a string
|
|
33
|
-
|
|
34
|
-
context 'with a string with spaces' do
|
|
35
|
-
let(:config) { '--foo bar' }
|
|
36
|
-
it { is_expected.to eq '--foo bar' }
|
|
37
|
-
end # /context with a string with spaces
|
|
38
|
-
|
|
39
|
-
context 'with an array of strings' do
|
|
40
|
-
let(:config) { %w{--foo --bar} }
|
|
41
|
-
it { is_expected.to eq '--foo --bar' }
|
|
42
|
-
end # /context with an array of strings
|
|
43
|
-
|
|
44
|
-
context 'with an array of hashes' do
|
|
45
|
-
let(:config) { [{foo: 'bar'}, {other: 'baz'}] }
|
|
46
|
-
it { is_expected.to eq '--foo=bar --other=baz' }
|
|
47
|
-
end # /context with an array of hashes
|
|
48
|
-
|
|
49
|
-
context 'with a hash of strings' do
|
|
50
|
-
let(:config) { {foo: 'bar', other: 'baz'} }
|
|
51
|
-
it { is_expected.to eq '--foo=bar --other=baz' }
|
|
52
|
-
end # /context with a hash of strings
|
|
53
|
-
|
|
54
|
-
context 'with a hash of arrays' do
|
|
55
|
-
let(:config) { {foo: %w{bar baz}} }
|
|
56
|
-
it { is_expected.to eq '--foo=bar --foo=baz' }
|
|
57
|
-
end # /context with a hash of arrays
|
|
58
|
-
|
|
59
|
-
context 'with a hash of strings with spaces' do
|
|
60
|
-
let(:config) { {foo: 'bar two', other: 'baz'} }
|
|
61
|
-
it { is_expected.to eq '--foo=bar\\ two --other=baz' }
|
|
62
|
-
end # /context with a hash of strings with spaces
|
|
63
|
-
end # /describe #config_to_options
|
|
64
|
-
end
|