kitchen-docker_cli 0.18.0 → 0.19.0
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/.circleci/config.yml +19 -0
- data/CHANGELOG.md +19 -0
- data/README.md +22 -0
- data/lib/kitchen/driver/docker_cli.rb +14 -1
- data/lib/kitchen/driver/docker_cli_version.rb +1 -1
- data/lib/kitchen/transport/docker_cli.rb +1 -1
- data/spec/kitchen/driver/docker_cli_spec.rb +10 -2
- metadata +4 -4
- data/circle.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bae98699d7d3b34bef27eacb29a366356767d345
|
4
|
+
data.tar.gz: 7f96358226626d63b6108aaa48f7c65712dde248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6339eddfa1d6b6e2029a1ca9b8affcea89fbf8ccf14995c8b22fdf338113a9f107419e81eb5e3062d29e678e0f56e6f52125a41620bb45fafb8b47c838375476
|
7
|
+
data.tar.gz: d5d0895c3d944bd6484436ac455944a991932666b81d9c973b2522911c6e9958e6c37ec51d2810e269f4962ed73d15cb05aabedbfa2dbb60fe63017f81b6af75
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
version: 2
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
services:
|
6
|
+
- docker
|
7
|
+
docker:
|
8
|
+
- image: circleci/ruby:2.5
|
9
|
+
steps:
|
10
|
+
- checkout
|
11
|
+
- setup_remote_docker
|
12
|
+
- run: bundle install --path=vendor/bundle
|
13
|
+
- run: bundle exec kitchen test
|
14
|
+
|
15
|
+
workflows:
|
16
|
+
version: 2
|
17
|
+
test:
|
18
|
+
jobs:
|
19
|
+
- test
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.19.0
|
2
|
+
|
3
|
+
* Pull request [#43][]: Add pre_create_command to driver ([@ysgard][])
|
4
|
+
* Pull request [#42][] [#44][]: Quote environments value to support spaces ([@ahelal][])
|
5
|
+
* Pull request [#41][]: Add `build_pull` opt to pull the latest docker image ([@s-bernard][])
|
6
|
+
* Pull request [#38][]: Never force tty when opening transport ([@bdellegrazie][])
|
7
|
+
|
1
8
|
## 0.18.0
|
2
9
|
|
3
10
|
* Pull request [#33][]: Strengthen destroy ([@s-bernard][])
|
@@ -133,9 +140,21 @@
|
|
133
140
|
[#23]: https://github.com/marcy-terui/kitchen-docker_cli/issues/23
|
134
141
|
[#29]: https://github.com/marcy-terui/kitchen-docker_cli/issues/29
|
135
142
|
[#30]: https://github.com/marcy-terui/kitchen-docker_cli/issues/30
|
143
|
+
[#31]: https://github.com/marcy-terui/kitchen-docker_cli/issues/31
|
144
|
+
[#32]: https://github.com/marcy-terui/kitchen-docker_cli/issues/32
|
145
|
+
[#33]: https://github.com/marcy-terui/kitchen-docker_cli/issues/33
|
146
|
+
[#38]: https://github.com/marcy-terui/kitchen-docker_cli/issues/38
|
147
|
+
[#41]: https://github.com/marcy-terui/kitchen-docker_cli/issues/41
|
148
|
+
[#42]: https://github.com/marcy-terui/kitchen-docker_cli/issues/42
|
149
|
+
[#43]: https://github.com/marcy-terui/kitchen-docker_cli/issues/43
|
150
|
+
[#44]: https://github.com/marcy-terui/kitchen-docker_cli/issues/44
|
151
|
+
[@ahelal]: https://github.com/ahelal
|
152
|
+
[@bdellegrazie]: https://github.com/bdellegrazie
|
153
|
+
[@fphilippon]: https://github.com/fphilippon
|
136
154
|
[@grubernaut]: https://github.com/grubernaut
|
137
155
|
[@hd-deman]: https://github.com/hd-deman
|
138
156
|
[@nrvale0]: https://github.com/nrvale0
|
139
157
|
[@s-bernard]: https://github.com/s-bernard
|
140
158
|
[@sawanoboly]: https://github.com/sawanoboly
|
141
159
|
[@yewton]: https://github.com/yewton
|
160
|
+
[@ysgard]: https://github.com/ysgard
|
data/README.md
CHANGED
@@ -129,6 +129,16 @@ environment:
|
|
129
129
|
|
130
130
|
Pass the basedir as the Docker build context: 'docker build <options> .' Default is 'false'.
|
131
131
|
|
132
|
+
### build_pull
|
133
|
+
|
134
|
+
Set option `--pull` to the defined value on `docker build`.
|
135
|
+
|
136
|
+
The default value is nil which is currently interpreted as `false` by Docker.
|
137
|
+
|
138
|
+
```yml
|
139
|
+
build_pull: true
|
140
|
+
```
|
141
|
+
|
132
142
|
### no_cache
|
133
143
|
|
134
144
|
Not use the cached image on `docker build`.
|
@@ -497,6 +507,18 @@ Example:
|
|
497
507
|
docker_base: sudo /path/to/lxc-console
|
498
508
|
```
|
499
509
|
|
510
|
+
### pre_create_command
|
511
|
+
|
512
|
+
A script or shell command to run locally prior to creating the
|
513
|
+
container. Used to prep the build environment, e.g. performing a login
|
514
|
+
to a private docker repository where the test images are housed.
|
515
|
+
|
516
|
+
Example:
|
517
|
+
|
518
|
+
```yml
|
519
|
+
pre_create_command: ./path/to/script.sh
|
520
|
+
```
|
521
|
+
|
500
522
|
## <a name="development"></a> Development
|
501
523
|
|
502
524
|
* Source hosted at [GitHub][repo]
|
@@ -60,10 +60,22 @@ module Kitchen
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def create(state)
|
63
|
+
pre_create_command
|
63
64
|
state[:image] = build(state) unless state[:image]
|
64
65
|
state[:container_id] = run(state) unless state[:container_id]
|
65
66
|
end
|
66
67
|
|
68
|
+
def pre_create_command
|
69
|
+
if config[:pre_create_command]
|
70
|
+
system(config[:pre_create_command])
|
71
|
+
if $?.exitstatus.nonzero?
|
72
|
+
raise ActionFailed,
|
73
|
+
"pre_create_command '#{config[:pre_create_command]}' failed to execute \
|
74
|
+
(exit status #{$?.exitstatus})"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
67
79
|
def destroy(state)
|
68
80
|
instance.transport.connection(state) do |conn|
|
69
81
|
begin
|
@@ -99,6 +111,7 @@ module Kitchen
|
|
99
111
|
|
100
112
|
def docker_build_command
|
101
113
|
cmd = String.new('build')
|
114
|
+
cmd << " --pull=#{config[:build_pull]}" if config[:build_pull]
|
102
115
|
cmd << ' --no-cache' if config[:no_cache]
|
103
116
|
if config[:build_context]
|
104
117
|
cmd << ' .'
|
@@ -174,7 +187,7 @@ module Kitchen
|
|
174
187
|
# TODO: Support other distribution
|
175
188
|
end
|
176
189
|
end
|
177
|
-
Array(config[:environment]).each { |env, value| file << "ENV #{env}
|
190
|
+
Array(config[:environment]).each { |env, value| file << "ENV #{env}=\"#{value}\"" }
|
178
191
|
Array(config[:run_command]).each { |cmd| file << "RUN #{cmd}" }
|
179
192
|
file.join("\n")
|
180
193
|
end
|
@@ -73,7 +73,7 @@ module Kitchen
|
|
73
73
|
if @options[:lxc_driver]
|
74
74
|
run_lxc(lxc_exec_command(@options[:container_id], cmd))
|
75
75
|
else
|
76
|
-
run_docker(docker_exec_command(@options[:container_id], cmd, :tty =>
|
76
|
+
run_docker(docker_exec_command(@options[:container_id], cmd, :tty => false))
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -75,13 +75,21 @@ describe Kitchen::Driver::DockerCli, "#docker_build_command" do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
context 'build_context' do
|
78
|
-
let(:config)
|
78
|
+
let(:config) { {:build_context => true} }
|
79
79
|
|
80
80
|
example do
|
81
81
|
expect(@docker_cli.docker_build_command).to eq 'build .'
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
+
context 'build_pull set to true' do
|
86
|
+
let(:config) { {:build_pull => true} }
|
87
|
+
|
88
|
+
example do
|
89
|
+
expect(@docker_cli.docker_build_command).to include '--pull=true'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
85
93
|
context 'default' do
|
86
94
|
let(:config) { {:no_cache => true} }
|
87
95
|
|
@@ -241,7 +249,7 @@ describe Kitchen::Driver::DockerCli, "#docker_file" do
|
|
241
249
|
ret = "FROM ubuntu/12.04\n"
|
242
250
|
ret << "RUN apt-get update\n"
|
243
251
|
ret << "RUN apt-get -y install sudo curl tar\n"
|
244
|
-
ret << "ENV test
|
252
|
+
ret << "ENV test=\"hoge\"\n"
|
245
253
|
ret << "RUN test\n"
|
246
254
|
ret << "RUN test2"
|
247
255
|
expect(@docker_cli.send(:docker_file)).to eq ret
|
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.
|
4
|
+
version: 0.19.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:
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -101,6 +101,7 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".circleci/config.yml"
|
104
105
|
- ".coveralls.yml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".kitchen.yml"
|
@@ -110,7 +111,6 @@ files:
|
|
110
111
|
- LICENSE
|
111
112
|
- README.md
|
112
113
|
- Rakefile
|
113
|
-
- circle.yml
|
114
114
|
- integration-test/.gitignore
|
115
115
|
- integration-test/.kitchen.yml
|
116
116
|
- integration-test/Gemfile
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
153
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.5.2
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: A Test Kitchen Driver(and Transport) for Docker native CLI
|
data/circle.yml
DELETED