dapp 0.18.0 → 0.18.1

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: d6f675f931b5b79d8637e493f875973f718547a6f77978bd1d8b3e5bc6c606c3
4
- data.tar.gz: fe73c28ca5d6962a19deb01778b420f23c5169bcf5fd1aa31a2e65c460c49bfc
3
+ metadata.gz: b36446e8acb49a7145d9787e3e13e833c1c35cb80ca137210131c9f2bdc8e52c
4
+ data.tar.gz: 57a6b73ee8736d0218a594b7e282b9260a03ef1ed493b92b6696ec2859003032
5
5
  SHA512:
6
- metadata.gz: 2589954a540ca69262a3af36ae7e7532e7830a5b59feafd2dce0b32b66798eef968aad7518610556815fe26654fb332dce94c424865b39461e297d25a82da77e
7
- data.tar.gz: 218644c687bc41cb81977a08ffdf6ebbdc64411e9d4b34bfeb4766f2378eafbb7ffec58a71b19d9e759bbd3c7eea230a0fe5c82d694ae5d601ead60627d9b093
6
+ metadata.gz: 24426a46adede038593a7f2fc2ded64e52ad0520b77b26e3f26db64f6efab92d65992ca19e77e20a21a767865fcd17721fc1a3fc401dc8316100fa4625011452
7
+ data.tar.gz: bcfcf731bf3cf1fc09f8bae99136dc2fcc3a3465cf044eece3a8f05367fbca8de8a871c51d71b0073f1d2b1624a6af6b8f6e2d096f879e5def0a3ff5db495394
@@ -18,7 +18,7 @@ module Dapp
18
18
  end.flatten
19
19
 
20
20
  log_secondary_process(:images, short: true) do
21
- Image::Docker.save!(context_images_names, build_context_images_tar, verbose: true, quiet: log_quiet?)
21
+ Image::Docker.save!(context_images_names, build_context_images_tar, verbose: true, quiet: log_quiet?) unless dry_run?
22
22
  end unless context_images_names.empty?
23
23
  end
24
24
  end
@@ -40,7 +40,7 @@ module Dapp
40
40
  end
41
41
  end
42
42
  end
43
- end
43
+ end unless dry_run?
44
44
  end
45
45
  end
46
46
  end
@@ -19,7 +19,7 @@ module Dapp
19
19
  log_secondary_process(:images, short: true) do
20
20
  lock("#{name}.images") do
21
21
  Image::Docker.load!(build_context_images_tar, verbose: true, quiet: log_quiet?)
22
- end
22
+ end unless dry_run?
23
23
  end
24
24
  else
25
25
  log_warning(desc: { code: :context_archive_not_found, data: { path: build_context_images_tar } })
@@ -44,7 +44,7 @@ module Dapp
44
44
  File.chmod(header.mode, path)
45
45
  end
46
46
  end
47
- end
47
+ end unless dry_run?
48
48
  end
49
49
  else
50
50
  log_warning(desc: { code: :context_archive_not_found, data: { path: build_context_build_tar } })
@@ -60,7 +60,7 @@ module Dapp
60
60
  end
61
61
 
62
62
  def image_labels(image_id)
63
- Image::Stage.image_config_option(image_id: image_id, option: 'labels')
63
+ Image::Stage.image_config_option(image_id: image_id, option: 'Labels') || {}
64
64
  end
65
65
 
66
66
  def run_command(cmd)
@@ -34,6 +34,8 @@ module Dapp
34
34
 
35
35
  def remove_build_dir
36
36
  log_step_with_indent(:build_dir) { FileUtils.rm_rf(build_path) }
37
+ rescue ::Dapp::Error::Dapp => e
38
+ raise unless e.net_status[:code] == :dappfile_not_found
37
39
  end
38
40
 
39
41
  def proper_all?
@@ -92,7 +92,7 @@ module Dapp
92
92
  end
93
93
 
94
94
  def image_dapp_artifacts_label(image_id)
95
- select_dapp_artifacts_ids(::Dapp::Dimg::Image::Docker.image_config_option(image_id: image_id, option: 'labels'))
95
+ select_dapp_artifacts_ids(::Dapp::Dimg::Image::Docker.image_config_option(image_id: image_id, option: 'Labels') || {})
96
96
  end
97
97
 
98
98
  def image_parent(image_id)
@@ -4,10 +4,10 @@ module Dapp
4
4
  module Command
5
5
  module Stages
6
6
  module FlushRepo
7
- def stages_flush_repo(repo)
8
- lock_repo(repo) do
9
- log_step_with_indent(repo) do
10
- registry = registry(repo)
7
+ def stages_flush_repo
8
+ lock_repo(option_repo) do
9
+ log_step_with_indent(option_repo) do
10
+ registry = registry(option_repo)
11
11
  repo_dimgs, repo_stages = repo_dimgs_and_cache(registry)
12
12
  repo_dimgs.merge(repo_stages).keys.each { |image_tag| delete_repo_image(registry, image_tag) }
13
13
  end
@@ -97,7 +97,7 @@ module Dapp
97
97
  def from_change_options
98
98
  return {} if from.nil?
99
99
  [:entrypoint, :cmd].each_with_object({}) do |option, options|
100
- options[option] = self.class.image_config_option(image_id: from.built_id, option: option)
100
+ options[option] = from.config_option(option.to_s.capitalize) || []
101
101
  end
102
102
  end
103
103
 
@@ -23,6 +23,7 @@ module Dapp
23
23
  def untag!
24
24
  raise Error::Build, code: :image_already_untagged, data: { name: name } unless tagged?
25
25
  dapp.shellout!("#{dapp.host_docker} rmi #{name}")
26
+ image_config_delete(id)
26
27
  self.class.cache.delete(name)
27
28
  end
28
29
 
@@ -55,15 +56,36 @@ module Dapp
55
56
  cache[:size]
56
57
  end
57
58
 
58
- def self.image_config_option(image_id:, option:)
59
- output = ::Dapp::Dapp.shellout!("#{::Dapp::Dapp.host_docker} inspect --format='{{json .Config.#{option.to_s.capitalize}}}' #{image_id}").stdout.strip
60
- output == 'null' ? [] : JSON.parse(output)
59
+ def config_option(option)
60
+ raise Error::Build, code: :image_not_exist, data: { name: name } if built_id.nil?
61
+ self.class.image_config_option(image_id: built_id, option: option)
61
62
  end
62
63
 
63
64
  def cache_reset
64
65
  self.class.cache_reset(name)
65
66
  end
66
67
 
68
+ class << self
69
+ def image_config(image_id)
70
+ image_configs[image_id] ||= begin
71
+ output = ::Dapp::Dapp.shellout!("#{::Dapp::Dapp.host_docker} inspect --format='{{json .Config}}' #{image_id}").stdout.strip
72
+ JSON.parse(output)
73
+ end
74
+ end
75
+
76
+ def image_config_option(image_id:, option:)
77
+ image_config(image_id)[option]
78
+ end
79
+
80
+ def image_config_delete(image_id)
81
+ image_configs.delete(image_id)
82
+ end
83
+
84
+ def image_configs
85
+ @image_configs ||= {}
86
+ end
87
+ end
88
+
67
89
  protected
68
90
 
69
91
  def cache
@@ -138,6 +160,7 @@ module Dapp
138
160
  number * (1000**coef)
139
161
  end
140
162
  cache[name] = { id: id, created_at: created_at, size: size }
163
+ image_config_delete(id)
141
164
  end
142
165
  #p [:cache_reset, name, :took, Time.now - t]
143
166
  end
@@ -60,8 +60,7 @@ module Dapp
60
60
  end
61
61
 
62
62
  def labels
63
- raise Error::Build, code: :image_not_exist, data: { name: name } if built_id.nil?
64
- self.class.image_config_option(image_id: built_id, option: 'labels')
63
+ config_option('Labels')
65
64
  end
66
65
 
67
66
  protected
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = '0.18.0'.freeze
2
+ VERSION = '0.18.1'.freeze
3
3
  BUILD_CACHE_VERSION = 20
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-03 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -706,7 +706,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
706
706
  version: 2.5.0
707
707
  requirements: []
708
708
  rubyforge_project:
709
- rubygems_version: 2.7.0
709
+ rubygems_version: 2.7.1
710
710
  signing_key:
711
711
  specification_version: 4
712
712
  summary: Build docker packaged apps using chef or shell