kontena-cli 1.2.0.rc3 → 1.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bc00d0ec3050b6dd80e0c193ee9a09499137c06
|
4
|
+
data.tar.gz: 51ba8dd82496286ec9751eb52a83a00d15cd99eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7b5f3297c6f8f7fddcfc10bea2c648f310588ed198ecac836ce1153178c76953d23be9b8e1950aa1d4d780f0d4f7cb5e3638a4044852420fc1a59227a01da78
|
7
|
+
data.tar.gz: a92ebc69b4e0eff2aadccaf1c1cefe54117ddca15dafd7d2a1196e6ede3dcbef0b836bb570e6227df9a3e9f6972be8a7ca644fc71c66ca9c2efe6fc3076a8d8c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.0
|
1
|
+
1.2.0
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module Kontena::Cli::Stacks
|
3
2
|
module StacksHelper
|
4
3
|
|
@@ -52,7 +51,13 @@ module Kontena::Cli::Stacks
|
|
52
51
|
if deployment['state'] == 'error'
|
53
52
|
deployment['service_deploys'].each do |service_deploy|
|
54
53
|
if service_deploy['state'] == 'error'
|
55
|
-
|
54
|
+
$stderr.puts "Deployment of service #{pastel.cyan(service_deploy['service_id'])} failed:"
|
55
|
+
$stderr.puts " - #{service_deploy['reason'].strip}"
|
56
|
+
service_deploy['instance_deploys'].each do |instance_deploy|
|
57
|
+
if instance_deploy['state'] == 'error'
|
58
|
+
$stderr.puts " - " + "#{instance_deploy['error'].strip} (on node #{pastel.cyan(instance_deploy['node'])})"
|
59
|
+
end
|
60
|
+
end
|
56
61
|
end
|
57
62
|
end
|
58
63
|
abort
|
@@ -67,11 +72,12 @@ module Kontena::Cli::Stacks
|
|
67
72
|
def wait_for_service_deploy(service_deploy, states)
|
68
73
|
service_deployed = false
|
69
74
|
name = service_deploy['service_id'].split('/')[-1]
|
70
|
-
spinner "Deploying service #{pastel.cyan(name)}" do
|
75
|
+
spinner "Deploying service #{pastel.cyan(name)}" do |spin|
|
71
76
|
until service_deployed
|
72
77
|
r = client.get("services/#{service_deploy['service_id']}/deploys/#{service_deploy['id']}")
|
73
78
|
if states.include?(r['state'])
|
74
79
|
service_deployed = true
|
80
|
+
spin.fail if r['state'] == 'error'
|
75
81
|
else
|
76
82
|
sleep 1
|
77
83
|
end
|
@@ -67,7 +67,7 @@ module Kontena::Cli::Stacks
|
|
67
67
|
unless mount_point
|
68
68
|
result[:errors] << { 'services' => { service => { 'volumes' => { volume => 'mount point missing' } } } }
|
69
69
|
end
|
70
|
-
if volume_name
|
70
|
+
if volume_name && !volume_name.start_with?('/')
|
71
71
|
if yaml.key?('volumes')
|
72
72
|
unless yaml['volumes'][volume_name]
|
73
73
|
result[:errors] << { 'services' => { service => { 'volumes' => { volume_name => 'not found in top level volumes list' } } } }
|
@@ -304,4 +304,75 @@ describe Kontena::Cli::Stacks::YAML::ValidatorV3 do
|
|
304
304
|
end
|
305
305
|
end
|
306
306
|
end
|
307
|
+
|
308
|
+
describe '#validate' do
|
309
|
+
|
310
|
+
context 'volumes' do
|
311
|
+
let(:stack) do
|
312
|
+
{
|
313
|
+
'stack' => 'a-stack',
|
314
|
+
'services' => {
|
315
|
+
'foo' => {
|
316
|
+
'volumes' => [
|
317
|
+
'foo:/app'
|
318
|
+
]
|
319
|
+
}
|
320
|
+
},
|
321
|
+
'volumes' => {
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
}
|
326
|
+
end
|
327
|
+
it 'fails validation if volumes are not declared' do
|
328
|
+
result = subject.validate(stack)
|
329
|
+
expect(result[:errors]).not_to be_empty
|
330
|
+
end
|
331
|
+
|
332
|
+
it 'validation succeeds if volumes are declared' do
|
333
|
+
stack['volumes'] = {
|
334
|
+
'foo' => {
|
335
|
+
'external' => true
|
336
|
+
}
|
337
|
+
}
|
338
|
+
result = subject.validate(stack)
|
339
|
+
expect(result[:errors]).to be_empty
|
340
|
+
end
|
341
|
+
|
342
|
+
it 'validation fails when external: false' do
|
343
|
+
stack['volumes'] = {
|
344
|
+
'foo' => {
|
345
|
+
'external' => false
|
346
|
+
}
|
347
|
+
}
|
348
|
+
result = subject.validate(stack)
|
349
|
+
expect(result[:errors]).not_to be_empty
|
350
|
+
end
|
351
|
+
|
352
|
+
it 'validation succeeds if volumes are declared' do
|
353
|
+
stack['volumes'] = {
|
354
|
+
'foo' => {
|
355
|
+
'external' => {
|
356
|
+
'name' => 'foobar'
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}
|
360
|
+
result = subject.validate(stack)
|
361
|
+
expect(result[:errors]).to be_empty
|
362
|
+
end
|
363
|
+
|
364
|
+
it 'bind mount do not need ext volumes' do
|
365
|
+
stack['services']['foo']['volumes'] = ['/var/run/docker.sock:/var/run/docker.sock']
|
366
|
+
result = subject.validate(stack)
|
367
|
+
expect(result[:errors]).to be_empty
|
368
|
+
end
|
369
|
+
|
370
|
+
it 'anon vols do not need ext volumes' do
|
371
|
+
stack['services']['foo']['volumes'] = ['/data']
|
372
|
+
result = subject.validate(stack)
|
373
|
+
expect(result[:errors]).to be_empty
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
end
|
307
378
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kontena-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kontena, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -661,9 +661,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
661
661
|
version: 2.1.0
|
662
662
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
663
663
|
requirements:
|
664
|
-
- - "
|
664
|
+
- - ">="
|
665
665
|
- !ruby/object:Gem::Version
|
666
|
-
version:
|
666
|
+
version: '0'
|
667
667
|
requirements: []
|
668
668
|
rubyforge_project:
|
669
669
|
rubygems_version: 2.6.8
|