kitchen-docker 2.7.0 → 2.8.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
  SHA256:
3
- metadata.gz: e6def5c4cbdeb612e67180f08dc4126705ed5f118ef4b4a3f4c29dd93e6ee847
4
- data.tar.gz: 5d89415858f3744241fe6287bca0f0a7c489e9a1d21317f4ef4549c4c9e29933
3
+ metadata.gz: bf681b90a724609efd7b56203766d1e09c50fbab909b041e1e9cd6c0e4d6e07d
4
+ data.tar.gz: 0b101baa332d10c1fdcb47619cd088cb874819c203713ca661241f955bd7a4b0
5
5
  SHA512:
6
- metadata.gz: 9123862cd9ff7e5f6c72aca64019cd3a046592829cfcb69bbf38ab56457c1ee5a4549e09050ae3eb9a701645f59e71d29c17834dfa9c599faf0b7782d60cdda2
7
- data.tar.gz: 7c0d27e35a005a1c015228d906ebe538e9e782040d1167d1f3bbf2354ea49e88813266a9b2272ec6111c32b3f88dde8328af2ffc961f13e3895ec1331eb53de5
6
+ metadata.gz: 70314bfc54ff2077b098022aa850b93081010e7e11681492dc274506378659c8010986220703d6db38d8b8f6e64fa82833922beca01080918f16ad9f90a4b65b
7
+ data.tar.gz: a279ed751961077df27590671e64215ceddf43210fc0ffe6b1283a9308e4f99dd24b8e576fb3d4fc8e8471fc8fa01c569715d2e1df39f2f6379c0bd44942baea
@@ -14,6 +14,8 @@ platforms:
14
14
  - name: ubuntu-16.04
15
15
  - name: centos-6
16
16
  - name: centos-7
17
+ - name: oraclelinux-6
18
+ - name: oraclelinux-7
17
19
  - name: debian-8
18
20
  - name: opensuse-42.2
19
21
  driver:
@@ -41,7 +43,7 @@ suites:
41
43
  driver:
42
44
  build_context: false
43
45
  - name: capabilities
44
- excludes: [arch,unknown,centos-7,centos-6,dockerfile,opensuse-42.2]
46
+ excludes: [arch,unknown,centos-7,centos-6,oraclelinux-6,oraclelinux-7,dockerfile,opensuse-42.2]
45
47
  driver:
46
48
  provision_command:
47
49
  - curl -L https://www.chef.io/chef/install.sh | bash
@@ -10,11 +10,6 @@ rvm:
10
10
  services:
11
11
  - docker
12
12
 
13
- cache:
14
- bundler: true
15
- directories:
16
- - /var/lib/docker
17
-
18
13
  script:
19
14
  - bundle exec docker version
20
15
  - bundle exec kitchen --version
@@ -1,5 +1,14 @@
1
1
  # Kitchen-Docker Changelog
2
2
 
3
+ ## 2.8.0 - Jan 18, 2019
4
+
5
+ * Add new config option `use_internal_docker_network`, which allows running Docker within Docker. See readme for usage details.
6
+ * Resolve errors while loading libraries on archlinux
7
+ * Fix failures on Ubuntu 18.04
8
+ * Check if image exists before attempting to remove it so we don't fail
9
+ * Add oraclelinux platform support
10
+ * Prevent `uninitialized constant Kitchen::Driver::Docker::Base64` error by requiring `base64`
11
+
3
12
  ## 2.7.0
4
13
 
5
14
  * Support for SUSE-based container images.
data/README.md CHANGED
@@ -1,6 +1,6 @@
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
6
  [![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -482,6 +482,19 @@ Examples:
482
482
  net: br3
483
483
  ```
484
484
 
485
+ ### use_internal_docker_network
486
+
487
+ If you want to use kitchen-docker from within another Docker container you'll
488
+ need to set this to true. When set to true uses port 22 as the SSH port and
489
+ the IP of the container that chef is going to run in as the hostname so that
490
+ you can connect to it over SSH from within another Docker container.
491
+
492
+ Examples:
493
+
494
+ ```yaml
495
+ use_internal_docker_network: true
496
+ ```
497
+
485
498
  ## Development
486
499
 
487
500
  * Source hosted at [GitHub][repo]
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['portertech@gmail.com']
11
11
  spec.description = %q{A Docker Driver for Test Kitchen}
12
12
  spec.summary = spec.description
13
- spec.homepage = 'https://github.com/portertech/kitchen-docker'
13
+ spec.homepage = 'https://github.com/test-kitchen/kitchen-docker'
14
14
  spec.license = 'Apache 2.0'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -21,6 +21,7 @@ require 'uri'
21
21
  require 'net/ssh'
22
22
  require 'tempfile'
23
23
  require 'shellwords'
24
+ require 'base64'
24
25
 
25
26
  require 'kitchen/driver/base'
26
27
 
@@ -56,6 +57,7 @@ module Kitchen
56
57
  default_config :public_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa.pub')
57
58
  default_config :build_options, nil
58
59
  default_config :run_options, nil
60
+ default_config :use_internal_docker_network, false
59
61
 
60
62
  default_config :use_sudo, false
61
63
 
@@ -119,7 +121,12 @@ module Kitchen
119
121
  state[:ssh_key] = config[:private_key]
120
122
  state[:image_id] = build_image(state) unless state[:image_id]
121
123
  state[:container_id] = run_container(state) unless state[:container_id]
122
- state[:hostname] = remote_socket? ? socket_uri.host : 'localhost'
124
+ state[:hostname] = 'localhost'
125
+ if remote_socket?
126
+ state[:hostname] = socket_uri.host
127
+ elsif config[:use_internal_docker_network]
128
+ state[:hostname] = container_ip(state)
129
+ end
123
130
  state[:port] = container_ssh_port(state)
124
131
  if config[:wait_for_sshd]
125
132
  instance.transport.connection(state) do |conn|
@@ -131,7 +138,7 @@ module Kitchen
131
138
  def destroy(state)
132
139
  rm_container(state) if container_exists?(state)
133
140
  if config[:remove_images] && state[:image_id]
134
- rm_image(state)
141
+ rm_image(state) if image_exists?(state)
135
142
  end
136
143
  end
137
144
 
@@ -209,7 +216,7 @@ module Kitchen
209
216
  RUN apt-get install -y sudo openssh-server curl lsb-release
210
217
  eos
211
218
  config[:disable_upstart] ? disable_upstart + packages : packages
212
- when 'rhel', 'centos', 'fedora'
219
+ when 'rhel', 'centos', 'fedora', 'oraclelinux'
213
220
  <<-eos
214
221
  ENV container docker
215
222
  RUN yum clean all
@@ -230,7 +237,7 @@ module Kitchen
230
237
  <<-eos
231
238
  RUN pacman --noconfirm -Sy archlinux-keyring
232
239
  RUN pacman-db-upgrade
233
- RUN pacman --noconfirm -Sy openssl openssh sudo curl
240
+ RUN pacman --noconfirm -Syu openssl openssh sudo curl
234
241
  RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
235
242
  RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
236
243
  RUN echo >/etc/security/limits.conf
@@ -270,6 +277,7 @@ module Kitchen
270
277
  RUN touch #{homedir}/.ssh/authorized_keys
271
278
  RUN chown #{username} #{homedir}/.ssh/authorized_keys
272
279
  RUN chmod 0600 #{homedir}/.ssh/authorized_keys
280
+ RUN mkdir -p /run/sshd
273
281
  eos
274
282
  custom = ''
275
283
  Array(config[:provision_command]).each do |cmd|
@@ -364,6 +372,10 @@ module Kitchen
364
372
  state[:container_id] && !!docker_command("top #{state[:container_id]}") rescue false
365
373
  end
366
374
 
375
+ def image_exists?(state)
376
+ state[:image_id] && !!docker_command("docker inspect --type=image #{state[:image_id]}") rescue false
377
+ end
378
+
367
379
  def parse_container_ssh_port(output)
368
380
  begin
369
381
  _host, port = output.split(':')
@@ -376,6 +388,9 @@ module Kitchen
376
388
 
377
389
  def container_ssh_port(state)
378
390
  begin
391
+ if config[:use_internal_docker_network]
392
+ return 22
393
+ end
379
394
  output = docker_command("port #{state[:container_id]} 22/tcp")
380
395
  parse_container_ssh_port(output)
381
396
  rescue
@@ -384,6 +399,17 @@ module Kitchen
384
399
  end
385
400
  end
386
401
 
402
+ def container_ip(state)
403
+ begin
404
+ cmd = "inspect --format '{{ .NetworkSettings.IPAddress }}'"
405
+ cmd << " #{state[:container_id]}"
406
+ docker_command(cmd).strip
407
+ rescue
408
+ raise ActionFailed,
409
+ 'Error getting internal IP of Docker container'
410
+ end
411
+ end
412
+
387
413
  def rm_container(state)
388
414
  container_id = state[:container_id]
389
415
  docker_command("stop -t 0 #{container_id}")
@@ -19,6 +19,6 @@ module Kitchen
19
19
  module Driver
20
20
 
21
21
  # Version string for Docker Kitchen driver
22
- DOCKER_VERSION = "2.7.0"
22
+ DOCKER_VERSION = "2.8.0"
23
23
  end
24
24
  end
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.7.0
4
+ version: 2.8.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: 2018-07-12 00:00:00.000000000 Z
11
+ date: 2019-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -211,7 +211,7 @@ files:
211
211
  - test/integration/inspec/inspec_spec.rb
212
212
  - test/spec/docker_spec.rb
213
213
  - test/spec/spec_helper.rb
214
- homepage: https://github.com/portertech/kitchen-docker
214
+ homepage: https://github.com/test-kitchen/kitchen-docker
215
215
  licenses:
216
216
  - Apache 2.0
217
217
  metadata: {}
@@ -230,8 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  - !ruby/object:Gem::Version
231
231
  version: '0'
232
232
  requirements: []
233
- rubyforge_project:
234
- rubygems_version: 2.7.6
233
+ rubygems_version: 3.0.1
235
234
  signing_key:
236
235
  specification_version: 4
237
236
  summary: A Docker Driver for Test Kitchen