kitchen-docker 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +5 -1
- data/lib/kitchen/driver/docker.rb +54 -23
- data/lib/kitchen/driver/docker_version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49be9eaec81f6c9277c620d4c99e7a50b99f930f
|
4
|
+
data.tar.gz: 1daa96d8e99245bec677921425fe125a21266544
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed5cc8b3f3cd1d8300969bb4fe51c7dcd288dcc79a9744dcdd37150cd73231111ca3dec9ce1ff3f9797e40cbd55a809e97c38da69613ef47abfd872c95b722f6
|
7
|
+
data.tar.gz: a21bf725b1eb0082d32a8e6dd4e955f0847b667a8e015a08ba1a04a2c2e5abe1ebbe6241810ed3cffe7d9e8ee13e6b05032c9d04f0d4b8c1daf095a112ead259
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 2.4.0
|
2
|
+
|
3
|
+
* [#148](https://github.com/portertech/kitchen-docker/issues/148) Restored support for older versions of Ruby.
|
4
|
+
* [#149](https://github.com/portertech/kitchen-docker/pulls/149) Handle connecting to a container directly as root.
|
5
|
+
* [#154](https://github.com/portertech/kitchen-docker/pulls/154) Improve container caching by reordering the build steps.
|
6
|
+
* [#176](https://github.com/portertech/kitchen-docker/pulls/176) Expose proxy environment variables to the container automatically.
|
7
|
+
* [#192](https://github.com/portertech/kitchen-docker/pulls/192) Set `$container=docker` for CentOS images.
|
8
|
+
* [#196](https://github.com/portertech/kitchen-docker/pulls/196) Mutex SSH key generation for use with `kitchen -c`.
|
9
|
+
* [#192](https://github.com/portertech/kitchen-docker/pulls/192) Don't wait when stopping a container.
|
10
|
+
|
1
11
|
## 2.3.0
|
2
12
|
|
3
13
|
* `build_context` option (boolean) to enable/disable sending the build
|
data/README.md
CHANGED
@@ -94,7 +94,11 @@ Examples:
|
|
94
94
|
socket: tcp://docker.example.com:4242
|
95
95
|
```
|
96
96
|
|
97
|
-
If you use [Boot2Docker](https://github.com/boot2docker/boot2docker)
|
97
|
+
If you use [Boot2Docker](https://github.com/boot2docker/boot2docker)
|
98
|
+
or [docker-machine](https://docs.docker.com/machine/get-started/) set
|
99
|
+
your `DOCKER_HOST` environment variable properly with `export
|
100
|
+
DOCKER_HOST=tcp://192.168.59.103:2375` or `eval "$(docker-machine env
|
101
|
+
$MACHINE)"` then use the following:
|
98
102
|
|
99
103
|
```yaml
|
100
104
|
socket: tcp://192.168.59.103:2375
|
@@ -70,6 +70,8 @@ module Kitchen
|
|
70
70
|
!driver.remote_socket?
|
71
71
|
end
|
72
72
|
|
73
|
+
MUTEX_FOR_SSH_KEYS = Mutex.new
|
74
|
+
|
73
75
|
def verify_dependencies
|
74
76
|
run_command("#{config[:binary]} >> #{dev_null} 2>&1", :quiet => true)
|
75
77
|
rescue
|
@@ -137,23 +139,42 @@ module Kitchen
|
|
137
139
|
end
|
138
140
|
|
139
141
|
def generate_keys
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
142
|
+
MUTEX_FOR_SSH_KEYS.synchronize do
|
143
|
+
if !File.exist?(config[:public_key]) || !File.exist?(config[:private_key])
|
144
|
+
private_key = OpenSSL::PKey::RSA.new(2048)
|
145
|
+
blobbed_key = Base64.encode64(private_key.to_blob).gsub("\n", '')
|
146
|
+
public_key = "ssh-rsa #{blobbed_key} kitchen_docker_key"
|
147
|
+
File.open(config[:private_key], 'w') do |file|
|
148
|
+
file.write(private_key)
|
149
|
+
file.chmod(0600)
|
150
|
+
end
|
151
|
+
File.open(config[:public_key], 'w') do |file|
|
152
|
+
file.write(public_key)
|
153
|
+
file.chmod(0600)
|
154
|
+
end
|
151
155
|
end
|
152
156
|
end
|
153
157
|
end
|
154
158
|
|
155
159
|
def build_dockerfile
|
156
160
|
from = "FROM #{config[:image]}"
|
161
|
+
|
162
|
+
env_variables = ''
|
163
|
+
if config[:http_proxy]
|
164
|
+
env_variables << "ENV http_proxy #{config[:http_proxy]}\n"
|
165
|
+
env_variables << "ENV HTTP_PROXY #{config[:http_proxy]}\n"
|
166
|
+
end
|
167
|
+
|
168
|
+
if config[:https_proxy]
|
169
|
+
env_variables << "ENV https_proxy #{config[:https_proxy]}\n"
|
170
|
+
env_variables << "ENV HTTPS_PROXY #{config[:https_proxy]}\n"
|
171
|
+
end
|
172
|
+
|
173
|
+
if config[:no_proxy]
|
174
|
+
env_variables << "ENV no_proxy #{config[:no_proxy]}\n"
|
175
|
+
env_variables << "ENV NO_PROXY #{config[:no_proxy]}\n"
|
176
|
+
end
|
177
|
+
|
157
178
|
platform = case config[:platform]
|
158
179
|
when 'debian', 'ubuntu'
|
159
180
|
disable_upstart = <<-eos
|
@@ -168,6 +189,7 @@ module Kitchen
|
|
168
189
|
config[:disable_upstart] ? disable_upstart + packages : packages
|
169
190
|
when 'rhel', 'centos', 'fedora'
|
170
191
|
<<-eos
|
192
|
+
ENV container docker
|
171
193
|
RUN yum clean all
|
172
194
|
RUN yum install -y sudo openssh-server openssh-clients which curl
|
173
195
|
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
|
@@ -201,27 +223,32 @@ module Kitchen
|
|
201
223
|
|
202
224
|
username = config[:username]
|
203
225
|
password = config[:password]
|
204
|
-
public_key = IO.read(config[:public_key])
|
226
|
+
public_key = IO.read(config[:public_key]).strip
|
227
|
+
homedir = username == 'root' ? '/root' : "/home/#{username}"
|
205
228
|
|
206
229
|
base = <<-eos
|
207
|
-
RUN if ! getent passwd #{username}; then
|
230
|
+
RUN if ! getent passwd #{username}; then \
|
231
|
+
useradd -d #{homedir} -m -s /bin/bash #{username}; \
|
232
|
+
fi
|
208
233
|
RUN echo #{username}:#{password} | chpasswd
|
209
234
|
RUN echo '#{username} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
210
235
|
RUN mkdir -p /etc/sudoers.d
|
211
236
|
RUN echo '#{username} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/#{username}
|
212
237
|
RUN chmod 0440 /etc/sudoers.d/#{username}
|
213
|
-
RUN
|
214
|
-
RUN chown -R #{username}
|
215
|
-
RUN chmod 0700
|
216
|
-
RUN
|
217
|
-
RUN chown #{username}
|
218
|
-
RUN chmod 0600
|
238
|
+
RUN mkdir -p #{homedir}/.ssh
|
239
|
+
RUN chown -R #{username} #{homedir}/.ssh
|
240
|
+
RUN chmod 0700 #{homedir}/.ssh
|
241
|
+
RUN touch #{homedir}/.ssh/authorized_keys
|
242
|
+
RUN chown #{username} #{homedir}/.ssh/authorized_keys
|
243
|
+
RUN chmod 0600 #{homedir}/.ssh/authorized_keys
|
219
244
|
eos
|
220
245
|
custom = ''
|
221
246
|
Array(config[:provision_command]).each do |cmd|
|
222
247
|
custom << "RUN #{cmd}\n"
|
223
248
|
end
|
224
|
-
|
249
|
+
ssh_key = "RUN echo '#{public_key}' >> #{homedir}/.ssh/authorized_keys"
|
250
|
+
# Empty string to ensure the file ends with a newline.
|
251
|
+
[from, env_variables, platform, base, custom, ssh_key, ''].join("\n")
|
225
252
|
end
|
226
253
|
|
227
254
|
def dockerfile
|
@@ -249,10 +276,14 @@ module Kitchen
|
|
249
276
|
cmd << " --no-cache" unless config[:use_cache]
|
250
277
|
dockerfile_contents = dockerfile
|
251
278
|
build_context = config[:build_context] ? '.' : '-'
|
252
|
-
|
253
|
-
|
279
|
+
file = Tempfile.new('Dockerfile-kitchen', Dir.pwd)
|
280
|
+
output = begin
|
281
|
+
file.write(dockerfile)
|
254
282
|
file.close
|
255
283
|
docker_command("#{cmd} -f #{file.path} #{build_context}", :input => dockerfile_contents)
|
284
|
+
ensure
|
285
|
+
file.close unless file.closed?
|
286
|
+
file.unlink
|
256
287
|
end
|
257
288
|
parse_image_id(output)
|
258
289
|
end
|
@@ -322,7 +353,7 @@ module Kitchen
|
|
322
353
|
|
323
354
|
def rm_container(state)
|
324
355
|
container_id = state[:container_id]
|
325
|
-
docker_command("stop #{container_id}")
|
356
|
+
docker_command("stop -t 0 #{container_id}")
|
326
357
|
docker_command("rm #{container_id}")
|
327
358
|
end
|
328
359
|
|
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: 2.
|
4
|
+
version: 2.4.0
|
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: 2016-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.6.2
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: A Docker Driver for Test Kitchen
|