kitchen-docker_cli 0.5.0 → 0.6.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
2
  SHA1:
3
- metadata.gz: 542121f429ecd37ef1d476965ab303b0328d29ab
4
- data.tar.gz: b01101c45a35091e275e93bde71c04dd101984f1
3
+ metadata.gz: c7483d1dbadf7606fd954e80bf8b819bcf44b663
4
+ data.tar.gz: 0369d2399ac693f3526cfad5cd92c93542b8b93e
5
5
  SHA512:
6
- metadata.gz: a124b04c5e9474e78c744948542653e867fbb9f49622e666d8fa47cf3636408f6e5334dc58d058b9050b0cc66e71b2bee0f839071f6f456e73238f1679f17c9c
7
- data.tar.gz: 1ae8f6d48a4c270e1a1ebc25ee674266b15496a724e179ad9472b34a5552854dc8d5be66721a9ed7dd210ba7e26f1c6d849d0f81e14cd12169d5277266c85b5e
6
+ metadata.gz: 1bdc553437c67875343bea2405825be1394fc7687f11e1219575c44864ae849afb0524be1d9675ff1ef4daf6b82484823a64d5a58f93020b5de75d332890dfaa
7
+ data.tar.gz: 93444fbd34ea23487d1e2245e706a953db86906258ffe2c9e15700aa6fe423e8dd379397b060d286c2982fee70410550ac50e2e092ebfb82baaa7712ab3001c7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.6.0
2
+
3
+ * Pull request [#4][]: allow setup environment variables(add environment option) ([@hd-deman][])
4
+ * Add `network` option
5
+
1
6
  ## 0.5.0
2
7
 
3
8
  * Add `memory_limit` option
@@ -17,11 +22,11 @@
17
22
 
18
23
  ## 0.2.0.beta
19
24
 
20
- * Add ```privileged``` option
25
+ * Add `privileged` option
21
26
 
22
27
  ## 0.1.1.alpha
23
28
 
24
- * Change ```no_cache``` option's default value to ```false```
29
+ * Change `no_cache` option's default value to `false`
25
30
 
26
31
  ## 0.1.0.alpha
27
32
 
@@ -29,4 +34,6 @@
29
34
 
30
35
  <!--- The following link definition list is generated by PimpMyChangelog --->
31
36
  [#2]: https://github.com/marcy-terui/kitchen-docker_cli/issues/2
37
+ [#4]: https://github.com/marcy-terui/kitchen-docker_cli/issues/4
32
38
  [@grubernaut]: https://github.com/grubernaut
39
+ [@hd-deman]: https://github.com/hd-deman
data/README.md CHANGED
@@ -9,7 +9,7 @@ Therefore, we can test with an environment that has no extra software such as ``
9
9
  - Test-Kitchen (>= 1.3)
10
10
 
11
11
  - Docker (>= 1.3)
12
- This driver uses ```docker exec``` command.
12
+ This driver uses `docker exec` command.
13
13
 
14
14
  - tar (GNU Tar)
15
15
 
@@ -19,7 +19,7 @@ This driver uses ```docker exec``` command.
19
19
  gem install kitchen-docker_cli
20
20
  ```
21
21
 
22
- or put ```Gemfile``` in your project directory.
22
+ or put `Gemfile` in your project directory.
23
23
 
24
24
  ```ruby
25
25
  source 'https://rubygems.org'
@@ -35,7 +35,7 @@ bundle install
35
35
 
36
36
  ## <a name="config"></a> Configuration
37
37
 
38
- At first, put your ```.kithcen(.local).yml``` like this.
38
+ At first, put your `.kithcen(.local).yml` like this.
39
39
 
40
40
  ```yml
41
41
  ---
@@ -56,7 +56,7 @@ suites:
56
56
 
57
57
  The Docker image's path.
58
58
 
59
- The default value get from ```platform.name```.
59
+ The default value get from `platform.name`.
60
60
 
61
61
  Examples:
62
62
 
@@ -68,7 +68,7 @@ Examples:
68
68
 
69
69
  The Docker image's platform.
70
70
 
71
- The default value get from ```platform.name```.
71
+ The default value get from `platform.name`.
72
72
 
73
73
  Examples:
74
74
 
@@ -78,9 +78,9 @@ Examples:
78
78
 
79
79
  ### command
80
80
 
81
- The command to be executed at ```docker run```.
81
+ The command to be executed at `docker run`.
82
82
 
83
- The default value is ```sh -c 'while true; do sleep 1d; done;'```.
83
+ The default value is `sh -c 'while true; do sleep 1d; done;'`.
84
84
 
85
85
  Examples:
86
86
 
@@ -90,9 +90,9 @@ Examples:
90
90
 
91
91
  ### run_command
92
92
 
93
- Adds ```RUN``` command(s) to ```Dockerfile```.
93
+ Adds `RUN` command(s) to `Dockerfile`.
94
94
 
95
- The default value is ```nil```.
95
+ The default value is `nil`.
96
96
 
97
97
  Examples:
98
98
 
@@ -102,11 +102,25 @@ Examples:
102
102
  - service httpd start
103
103
  ```
104
104
 
105
+ ### environment
106
+
107
+ Adds `ENV` command(s) to `Dockerfile`.
108
+
109
+ The default value is `nil`.
110
+
111
+ Examples:
112
+
113
+ ```yml
114
+ environment:
115
+ http_proxy: http://proxy.example.com:8080/
116
+ LANG: ja_JP.UTF-8
117
+ ```
118
+
105
119
  ### no_cache
106
120
 
107
- Not use the cached image on ```docker build```.
121
+ Not use the cached image on `docker build`.
108
122
 
109
- The default value is ```false```.
123
+ The default value is `false`.
110
124
 
111
125
  Examples:
112
126
 
@@ -118,7 +132,7 @@ Examples:
118
132
 
119
133
  Give extended privileges to the suite container.
120
134
 
121
- The default value is ```false```.
135
+ The default value is `false`.
122
136
 
123
137
  Examples:
124
138
 
@@ -136,9 +150,23 @@ Examples:
136
150
  container_name: web
137
151
  ```
138
152
 
153
+ ### network
154
+
155
+ Set the Network mode for the container.
156
+ - `bridge`: creates a new network stack for the container on the docker bridge
157
+ - `none`: no networking for this container
158
+ - `container:<name|id>`: reuses another container network stack
159
+ - `host`: use the host network stack inside the container
160
+
161
+ Examples:
162
+
163
+ ```yml
164
+ network: host
165
+ ```
166
+
139
167
  ### link
140
168
 
141
- Set ```container_name```(and alias) of other container(s) that connect from the suite container.
169
+ Set `container_name`(and alias) of other container(s) that connect from the suite container.
142
170
 
143
171
  Examples:
144
172
 
@@ -152,6 +180,24 @@ Examples:
152
180
  - redis:kvs
153
181
  ```
154
182
 
183
+ ### publish
184
+
185
+ Publish a container's port or a range of ports to the host.
186
+
187
+ The default value is `nil`.
188
+
189
+ Examples:
190
+
191
+ ```yml
192
+ publish: 80
193
+ ```
194
+
195
+ ```yml
196
+ publish:
197
+ - 80:8080
198
+ - 22:2222
199
+ ```
200
+
155
201
  ### publish_all
156
202
 
157
203
  Publish all exposed ports to the host interfaces.
@@ -131,6 +131,7 @@ module Kitchen
131
131
  cmd << " -m #{config[:memory_limit]}" if config[:memory_limit]
132
132
  cmd << " -c #{config[:cpu_shares]}" if config[:cpu_shares]
133
133
  cmd << ' --privileged' if config[:privileged]
134
+ cmd << " --net #{config[:network]}" if config[:network]
134
135
  Array(config[:publish]).each { |pub| cmd << " -p #{pub}" }
135
136
  Array(config[:volume]).each { |vol| cmd << " -v #{vol}" }
136
137
  Array(config[:link]).each { |link| cmd << " --link #{link}" }
@@ -187,6 +188,7 @@ module Kitchen
187
188
  # TODO: Support other distribution
188
189
  end
189
190
  Array(config[:run_command]).each { |cmd| file << "RUN #{cmd}" }
191
+ Array(config[:environment]).each { |env, value| file << "ENV #{env}=#{value}" }
190
192
  file.join("\n")
191
193
  end
192
194
  end
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for DockerCli Kitchen driver
24
- DOCKER_CLI_VERSION = '0.5.0'
24
+ DOCKER_CLI_VERSION = '0.6.0'
25
25
  end
26
26
  end
@@ -240,12 +240,13 @@ describe Kitchen::Driver::DockerCli, "docker_run_command" do
240
240
  :volume => '/dev:/dev',
241
241
  :link => 'mysql:db',
242
242
  :memory_limit => '256m',
243
- :cpu_shares => 512
243
+ :cpu_shares => 512,
244
+ :network => 'none'
244
245
  }
245
246
  end
246
247
 
247
248
  example do
248
- cmd = "run -d --name web -P -m 256m -c 512 --privileged -p 80:8080 -p 22:2222 -v /dev:/dev --link mysql:db test /bin/bash"
249
+ cmd = "run -d --name web -P -m 256m -c 512 --privileged --net none -p 80:8080 -p 22:2222 -v /dev:/dev --link mysql:db test /bin/bash"
249
250
  expect(@docker_cli.docker_run_command('test')).to eq cmd
250
251
  end
251
252
  end
@@ -322,7 +323,8 @@ describe Kitchen::Driver::DockerCli, "docker_file" do
322
323
  {
323
324
  image: "ubuntu/12.04",
324
325
  platform: "ubuntu",
325
- run_command: ["test", "test2"]
326
+ run_command: ["test", "test2"],
327
+ environment: {"test" => "hoge"}
326
328
  }
327
329
  }
328
330
  example do
@@ -330,7 +332,9 @@ describe Kitchen::Driver::DockerCli, "docker_file" do
330
332
  ret = "FROM ubuntu/12.04\n"
331
333
  ret << "RUN apt-get update\n"
332
334
  ret << "RUN apt-get -y install sudo curl tar\n"
333
- ret << "RUN test\nRUN test2"
335
+ ret << "RUN test\n"
336
+ ret << "RUN test2\n"
337
+ ret << "ENV test=hoge"
334
338
  expect(@docker_cli.send(:docker_file)).to eq ret
335
339
  end
336
340
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-docker_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masashi Terui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen