kitchen-docker_ssh 0.0.14

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ddd149538f6af055f566a3eab03a673151eae8d8
4
+ data.tar.gz: e48dbe0c1378db07a39bbf57d323e1ee08c599d5
5
+ SHA512:
6
+ metadata.gz: 54c88adcd45e6950798d023828466147503a31049b134f26b2e7324e1864fdf95b9875b7beb7f8e4b0941e574b723a28cb3c0e9b9821d49334dbace88fbd7d2a
7
+ data.tar.gz: 92a7ff0f3b2fdb469befd1d42d4c5fb552f2baaf318b986f7ad116e90c65dee210acfe122468eee47fa57c56dd90051d5036d74d16be57ce6d4c4cb04e10117a
data/.cane ADDED
@@ -0,0 +1,2 @@
1
+ --style-measure 100
2
+ --max-violations 13
data/.tailor ADDED
@@ -0,0 +1,16 @@
1
+ Tailor.config do |config|
2
+ config.formatters "text"
3
+ config.file_set 'lib/**/*.rb' do |style|
4
+ style.max_line_length 100, level: :warn
5
+ style.spaces_before_lbrace true, level: :warn
6
+ style.indentation_spaces 2, level: :warn
7
+ style.spaces_after_lbrace 1, level: :warn
8
+ style.spaces_before_rbrace 1, level: :warn
9
+
10
+ #this one because it makes it easier to read code
11
+ style.spaces_after_comma 1, level: :info
12
+
13
+ #don't understand this one
14
+ style.max_code_lines_in_method 30, level: :warn
15
+ end
16
+ end
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - ruby-head
7
+
8
+ env:
9
+
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: ruby-head
13
+
14
+ branches:
15
+ except:
16
+ - /^v[0-9]/
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 / Unreleased
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'serverspec'
6
+
7
+ group :ci do
8
+ gem 'thor-scmversion'
9
+ end
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Author:: peter.abbott (<peter.abbott@akqa.com>)
2
+
3
+ Copyright (C) 2015, peter.abbott
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,486 @@
1
+ # Kitchen::Docker
2
+
3
+
4
+
5
+ A Test Kitchen Driver for Docker. This is a fork of http://github.com/portertech/kitchen-docker because the original driver is only sparodically updated.
6
+
7
+
8
+
9
+ ## Requirements
10
+
11
+ * [Docker][docker_getting_started]
12
+
13
+
14
+
15
+ ## Installation and Setup
16
+
17
+ ### Gemfile
18
+
19
+ Add an entry to your Gemfile.
20
+
21
+ ```
22
+ gem 'kitchen-docker_ssh'
23
+ ```
24
+
25
+
26
+ To point to the latest development version, you can also point to the git repo
27
+ ```
28
+ gem 'kitchen-docker_ssh', :git => 'https://github.com/peterabbott/kitchen-docker_ssh.git'
29
+ ```
30
+
31
+
32
+ ### Test Kitchen
33
+
34
+
35
+ Please read the Test Kitchen [docs][test_kitchen_docs] for more details.
36
+
37
+ Example `.kitchen.local.yml`:
38
+
39
+ ```
40
+ ---
41
+ driver:
42
+ name: docker
43
+
44
+ platforms:
45
+ - name: ubuntu
46
+ run_list:
47
+ - recipe[apt]
48
+ - name: centos
49
+ driver_config:
50
+ image: centos
51
+ platform: rhel
52
+ run_list:
53
+ - recipe[yum]
54
+ ```
55
+
56
+ ## Default Configuration
57
+
58
+ This driver can determine an image and platform type for a select number of
59
+ platforms.
60
+
61
+ Examples:
62
+
63
+ ```
64
+ ---
65
+ platforms:
66
+ - name: ubuntu-12.04
67
+ - name: centos-6.4
68
+ ```
69
+
70
+ This will effectively generate a configuration similar to:
71
+
72
+ ```
73
+ ---
74
+ platforms:
75
+ - name: ubuntu-12.04
76
+ driver_config:
77
+ image: ubuntu:12.04
78
+ platform: ubuntu
79
+ - name: centos-6.4
80
+ driver_config:
81
+ image: centos:6.4
82
+ platform: centos
83
+ ```
84
+
85
+ ## Configuration
86
+
87
+ ### binary
88
+
89
+ The Docker binary to use.
90
+
91
+ The default value is `docker`.
92
+
93
+ Examples:
94
+
95
+ ```
96
+ binary: docker.io
97
+ ```
98
+
99
+ ```
100
+ binary: /opt/docker
101
+ ```
102
+
103
+ Windows, requires docker cli to be on the path, otherwise use absolute path:
104
+
105
+ ```
106
+ binary: docker.exe
107
+ ```
108
+
109
+
110
+ ### socket
111
+
112
+ The Docker daemon socket to use. By default, Docker will listen on
113
+ `unix:///var/run/docker.sock`, and no configuration here is required. If
114
+ Docker is binding to another host/port or Unix socket, you will need to set
115
+ this option. If a TCP socket is set, its host will be used for SSH access
116
+ to suite containers.
117
+
118
+ Examples:
119
+
120
+ ```
121
+ socket: unix:///tmp/docker.sock
122
+ ```
123
+
124
+ ```
125
+ socket: tcp://docker.example.com:4242
126
+ ```
127
+
128
+ If you use [Boot2Docker](https://github.com/boot2docker/boot2docker), set your `DOCKER_HOST` environment variable properly (e.g. `export DOCKER_HOST=tcp://192.168.59.103:2375`) or you have to use the following:
129
+
130
+ ```
131
+ socket: tcp://192.168.59.103:2375
132
+ ```
133
+
134
+ ### use_sudo
135
+
136
+ Flags whether commands should be run as sudo, default true.
137
+
138
+ ```
139
+ use_sudo: false
140
+ ```
141
+
142
+ When a remote socket used then use_sudo is set to false.
143
+
144
+ ### image
145
+
146
+ The Docker image to use as the base for the suite containers. You can find
147
+ images using the [Docker Index][docker_index].
148
+
149
+ The default will be computed, using the platform name (see the Default
150
+ Configuration section for more details).
151
+
152
+ ### platform
153
+
154
+ The platform of the chosen image. This is used to properly bootstrap the
155
+ suite container for Test Kitchen. Kitchen Docker currently supports:
156
+
157
+ * `debian` or `ubuntu`
158
+ * `rhel` or `centos`
159
+ * `gentoo` or `gentoo-paludis`
160
+
161
+ The default will be computed, using the platform name (see the Default
162
+ Configuration section for more details).
163
+
164
+ ### require\_chef\_omnibus
165
+
166
+ Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
167
+ installed. There are several different behaviors available:
168
+
169
+ * `true` - the latest release will be installed. Subsequent converges
170
+ will skip re-installing if chef is present.
171
+ * `latest` - the latest release will be installed. Subsequent converges
172
+ will always re-install even if chef is present.
173
+ * `<VERSION_STRING>` (ex: `10.24.0`) - the desired version string will
174
+ be passed the the install.sh script. Subsequent converges will skip if
175
+ the installed version and the desired version match.
176
+ * `false` or `nil` - no chef is installed.
177
+
178
+ The default value is `true`.
179
+
180
+ ### disable\_upstart
181
+
182
+ Disables upstart on Debian/Ubuntu containers, as many images do not support a
183
+ working upstart.
184
+
185
+ The default value is `true`.
186
+
187
+ ### provision\_command
188
+
189
+ Custom command(s) to be run when provisioning the base for the suite containers.
190
+
191
+ Examples:
192
+
193
+ ```
194
+ provision_command: curl -L https://www.opscode.com/chef/install.sh | bash
195
+ ```
196
+
197
+ ```
198
+ provision_command:
199
+ - apt-get install dnsutils
200
+ - apt-get install telnet
201
+ ```
202
+
203
+ ```
204
+ driver_config:
205
+ provision_command: curl -L https://www.opscode.com/chef/install.sh | bash
206
+ require_chef_omnibus: false
207
+ ```
208
+
209
+ ### use\_cache
210
+
211
+ This determines if the Docker cache is used when provisioning the base for suite
212
+ containers.
213
+
214
+ The default value is `true`.
215
+
216
+ ### use\_sudo
217
+
218
+ This determines if Docker commands are run with `sudo`.
219
+
220
+ The default value depends on the type of socket being used. For local sockets, the default value is `true`. For remote sockets, the default value is `false`.
221
+
222
+ This should be set to `false` if you're using boot2docker, as every command passed into the VM runs as root by default.
223
+
224
+ ### remove\_images
225
+
226
+ This determines if images are automatically removed when the suite container is
227
+ destroyed.
228
+
229
+ The default value is `false`.
230
+
231
+ ### run_command
232
+
233
+ Sets the command used to run the suite container.
234
+
235
+ The default value is `/usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no -o PasswordAuthentication=yes`.
236
+
237
+ Examples:
238
+
239
+ ```
240
+ run_command: /sbin/init
241
+ ```
242
+
243
+ ### memory
244
+
245
+ Sets the memory limit for the suite container in bytes. Otherwise use Dockers
246
+ default. You can read more about `memory.limit_in_bytes` [here][memory_limit].
247
+
248
+ ### cpu
249
+
250
+ Sets the CPU shares (relative weight) for the suite container. Otherwise use
251
+ Dockers defaults. You can read more about cpu.shares [here][cpu_shares].
252
+
253
+ ### cpuset
254
+
255
+ Sets the CPU affinities (i.e. the CPUs on which to allow execution) for the
256
+ suite container. Otherwise use Dockers defaults. You can read more in the
257
+ [docker-run man page][docker_man].
258
+
259
+ Examples:
260
+
261
+ ```
262
+ cpuset: 0-3
263
+ ```
264
+
265
+ ```
266
+ cpuset: '0,1'
267
+ ```
268
+ Notice that when using commas in the `cpuset` value you **must** quote them as
269
+ a string.
270
+
271
+ **Note:** This feature is only available in docker versions >= 1.1.0.
272
+
273
+ ### volume
274
+
275
+ Adds a data volume(s) to the suite container.
276
+
277
+ Examples:
278
+
279
+ ```
280
+ volume: /ftp
281
+ ```
282
+
283
+ ```
284
+ volume:
285
+ - /ftp
286
+ - /srv
287
+ ```
288
+
289
+ ### volumes_from
290
+
291
+ Mount volumes managed by other containers.
292
+
293
+ Examples:
294
+
295
+ ```
296
+ volumes_from: repos
297
+ ```
298
+
299
+ ```
300
+ volumes_from:
301
+ - repos
302
+ - logging
303
+ - rvm
304
+ ```
305
+
306
+ ### dns
307
+
308
+ Adjusts `resolv.conf` to use the dns servers specified. Otherwise use
309
+ Dockers defaults.
310
+
311
+ Examples:
312
+
313
+ ```
314
+ dns: 8.8.8.8
315
+ ```
316
+
317
+ ```
318
+ dns:
319
+ - 8.8.8.8
320
+ - 8.8.4.4
321
+ ```
322
+ ### http\_proxy
323
+
324
+ Sets an http proxy for the suite container using the `http_proxy` environment variable.
325
+
326
+ Examples:
327
+
328
+ ```
329
+ http_proxy: http://proxy.host.com:8080
330
+ ```
331
+ ### https\_proxy
332
+
333
+ Sets an https proxy for the suite container using the `https_proxy` environment variable.
334
+
335
+ Examples:
336
+
337
+ ```
338
+ https_proxy: http://proxy.host.com:8080
339
+ ```
340
+ ### forward
341
+
342
+ Set suite container port(s) to forward to the host machine. You may specify
343
+ the host (public) port in the mappings, if not, Docker chooses for you.
344
+
345
+ Examples:
346
+
347
+ ```
348
+ forward: 80
349
+ ```
350
+
351
+ ```
352
+ forward:
353
+ - 22:2222
354
+ - 80:8080
355
+ ```
356
+
357
+ ### hostname
358
+
359
+ Set the suite container hostname. Otherwise use Dockers default.
360
+
361
+ Examples:
362
+
363
+ ```
364
+ hostname: foobar.local
365
+ ```
366
+
367
+ ### privileged
368
+
369
+ Run the suite container in privileged mode. This allows certain functionality
370
+ inside the Docker container which is not otherwise permitted.
371
+
372
+ The default value is `false`.
373
+
374
+ Examples:
375
+
376
+ ```
377
+ privileged: true
378
+ ```
379
+
380
+ ## dockerfile
381
+
382
+ Use a custom Dockerfile, instead of having Kitchen-Docker build one for you.
383
+
384
+ Examples:
385
+
386
+ ```
387
+ dockerfile: test/Dockerfile
388
+ ```
389
+
390
+ ### instance_name
391
+
392
+ Set the name of container to link to other container(s).
393
+
394
+ Examples:
395
+
396
+ ```
397
+ instance_name: web
398
+ ```
399
+
400
+ ### links
401
+
402
+ Set ```instance_name```(and alias) of other container(s) that connect from the suite container.
403
+
404
+ Examples:
405
+
406
+ ```
407
+ links: db:db
408
+ ```
409
+
410
+ Examples:
411
+
412
+ ```
413
+ links:
414
+ - db:db
415
+ - kvs:kvs
416
+ ```
417
+
418
+ ### publish_all
419
+
420
+ Publish all exposed ports to the host interfaces.
421
+ This option used to communicate between some containers.
422
+
423
+ The default value is `false`.
424
+
425
+ Examples:
426
+
427
+ ```
428
+ publish_all: true
429
+ ```
430
+
431
+ ### cap_add
432
+ Adds a capability to the running container, for example SYS_PTRACE
433
+
434
+ ````
435
+ cap_add:
436
+ - SYS_PTRACE
437
+
438
+ ````
439
+
440
+ ### cap_drop
441
+ Drops a capability to the running container, for example CHOWN
442
+
443
+ ````
444
+ cap_drop:
445
+ - CHOWN
446
+
447
+ ````
448
+
449
+
450
+ ## Development
451
+
452
+ * Source hosted at [GitHub][repo]
453
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
454
+
455
+ Pull requests are very welcome! Make sure your patches are well tested.
456
+ Ideally create a topic branch for every separate change you make. For
457
+ example:
458
+
459
+ 1. Fork the repo
460
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
461
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
462
+ 4. Push to the branch (`git push origin my-new-feature`)
463
+ 5. Create new Pull Request
464
+
465
+ ## Authors
466
+
467
+ Created and maintained by
468
+
469
+ - [Peter Abbott](peter@piemanpete.com)
470
+
471
+ Based on original work from:
472
+ - [Sean Porter][author] (<portertech@gmail.com>) http://github.com/portertech/kitchen-docker/
473
+
474
+
475
+ ## License
476
+
477
+ Apache 2.0 (see [LICENSE][license])
478
+
479
+
480
+
481
+ [author]: https://github.com/peterabbott
482
+ [issues]: https://github.com/peterabbott/kitchen-docker_ssh/issues
483
+ [license]: https://github.com/peterabbott/kitchen-docker_ssh/blob/master/LICENSE
484
+ [repo]: https://github.com/peterabbott/kitchen-docker_ssh
485
+ [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
486
+ [chef_omnibus_dl]: http://www.getchef.com/chef/install/
data/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ require "bundler/gem_tasks"
2
+ require 'cane/rake_task'
3
+ require 'tailor/rake_task'
4
+ require "kitchen"
5
+
6
+ desc "Run cane to check quality metrics"
7
+ Cane::RakeTask.new do |cane|
8
+ cane.canefile = './.cane'
9
+ end
10
+
11
+ Tailor::RakeTask.new
12
+
13
+ desc "Display LOC stats"
14
+ task :stats do
15
+ puts "\n## Production Code Stats"
16
+ sh "countloc -r lib"
17
+ end
18
+
19
+ task :ci => ['ci:kitchen:all']
20
+ namespace :ci do
21
+ namespace :kitchen do
22
+
23
+ config = nil
24
+ begin
25
+ config = Kitchen::Config.new({:loader => Kitchen::Loader::YAML.new({:project_config => 'test/.kitchen.yml'}) })
26
+
27
+ config.instances.each do |instance|
28
+ desc "Run #{instance.name} test instance"
29
+ task instance.name do
30
+ instance.test(:always)
31
+ end
32
+ end
33
+ rescue LoadError
34
+ puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
35
+ end
36
+
37
+
38
+ desc "Run all test instances"
39
+ task "all" => config.instances.map(&:name)
40
+ end
41
+ end
42
+
43
+ desc "Run all quality tasks"
44
+ task :quality => [:cane, :tailor, :stats]
45
+ task :test => [:quality, :ci]
46
+ task :default => [:quality]
47
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.14
data/circle.yml ADDED
@@ -0,0 +1,21 @@
1
+ machine:
2
+ services:
3
+ - docker
4
+
5
+ # Version of ruby to use
6
+ ruby:
7
+ version:
8
+ 2.1.5
9
+ dependencies:
10
+ bundler:
11
+ without: [ ]
12
+
13
+ test:
14
+ override:
15
+ - bundle exec rake
16
+
17
+ deployment:
18
+ release:
19
+ branch: feature/versioning
20
+ commands:
21
+ - git status
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kitchen/driver/docker_ssh_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kitchen-docker_ssh'
8
+ spec.version = Kitchen::Driver::DOCKER_SSH_VERSION
9
+ spec.authors = ['Peter Abbott']
10
+ spec.email = ['peter@piemanpete.com']
11
+ spec.description = %q{A Test Kitchen Driver for DockerSsh}
12
+ spec.summary = spec.description
13
+ spec.homepage = 'http://github.com/peterabbott/kitchen-docker_ssh/'
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files`.split($/) - %w( .gitignore support ) + %w( VERSION )
17
+ spec.executables = []
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'test-kitchen', '~> 1.3.1'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+
26
+ spec.add_development_dependency 'cane'
27
+ spec.add_development_dependency 'tailor'
28
+ spec.add_development_dependency 'countloc'
29
+
30
+ spec.add_development_dependency "rspec","~> 3.2"
31
+ end
@@ -0,0 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2014, Sean Porter
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'erb'
18
+
19
+ module Kitchen
20
+ module Driver
21
+ # ERB Context
22
+ class DockerERBContext
23
+ def initialize(config={})
24
+ config.each do |key, value|
25
+ instance_variable_set('@' + key.to_s, value)
26
+ end
27
+ end
28
+
29
+ def get_binding
30
+ binding
31
+ end
32
+ end
33
+ end
34
+ end