dapp 0.21.10 → 0.21.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 84d84e0532287de87c019d7510a9c335bc9c18cb
4
- data.tar.gz: f94268cbc49f418b377608ee1a83c884ce7fc56a
2
+ SHA256:
3
+ metadata.gz: 0d56d3d9730f62e742ea9b2921c3d0685db05f5155e585f187853a06a8e0d9f5
4
+ data.tar.gz: 779054e20a4a4646b68c32e9211358e62c298464e43508e8cfe4af535528a373
5
5
  SHA512:
6
- metadata.gz: f6fa6536f7c36ea9d73785cb35255e2e76efeabf53675d4f00ec8c62c7f1b6f7dcbe4d7f6dd640a6cff7ffda06f52b2a1bb1ba4013a7b5d89d4521ecf2c0700d
7
- data.tar.gz: f8fa38c9a247fb2796c2328823e0d8b0d24e2111a75f6688702b980a068f5991bf4d729400803fbe2e1ea3bced53f315f0032902c15dfab60b320f4e78107d56
6
+ metadata.gz: 3b25dfee5043a773e558e6cb7eb7dc126dc9628032414cb1b3377589c3fa761b11d1ca676ca1ef5bdebe59ae9bb8c462acadae1739e444f21e877660c507573b
7
+ data.tar.gz: 61af6b702fbd0fd83f250b5f781cc8e8707011f1735d8c863c5c3c2a568b0c1067b31d9d3110777da784c474e332284f9e34f884a0588e0b755c4fcfcf419928
data/lib/dapp/dapp.rb CHANGED
@@ -139,24 +139,28 @@ module Dapp
139
139
 
140
140
  def host_docker
141
141
  @host_docker ||= begin
142
- raise Error::Dapp, code: :docker_not_found if (res = shellout('which docker')).exitstatus.nonzero?
143
- docker_bin = res.stdout.strip
144
-
145
- current_docker_version = Gem::Version.new(shellout!("#{docker_bin} --version").stdout.strip[/(\d+\.)+\d+(?=\.\d+)/])
146
- required_min_docker_version = Gem::Version.new('1.10')
147
-
148
- if required_min_docker_version >= current_docker_version
149
- raise Error::Dapp, code: :docker_version, data: { min_version: required_min_docker_version.to_s,
150
- version: current_docker_version.to_s }
142
+ min_docker_minor_version = Gem::Version.new('1.10')
143
+ unless host_docker_minor_version > min_docker_minor_version
144
+ raise Error::Dapp, code: :docker_version, data: { min_version: min_docker_minor_version.to_s,
145
+ version: host_docker_minor_version.to_s }
151
146
  end
152
147
 
153
148
  [].tap do |cmd|
154
- cmd << docker_bin
149
+ cmd << host_docker_bin
155
150
  cmd << "--config #{host_docker_config_dir}"
156
151
  end.join(' ')
157
152
  end
158
153
  end
159
154
 
155
+ def host_docker_bin
156
+ raise Error::Dapp, code: :docker_not_found if (res = shellout('which docker')).exitstatus.nonzero?
157
+ res.stdout.strip
158
+ end
159
+
160
+ def host_docker_minor_version
161
+ Gem::Version.new(shellout!("#{host_docker_bin} --version").stdout.strip[/\d+\.\d+/])
162
+ end
163
+
160
164
  def host_docker_config_dir
161
165
  if options_with_docker_credentials? && !options[:repo].nil?
162
166
  host_docker_tmp_config_dir
@@ -95,10 +95,8 @@ module Dapp
95
95
 
96
96
  def check_user_containers!(images_ids)
97
97
  return if images_ids.empty?
98
- log_step_with_indent(:'check user containers') do
99
- run_command(%(#{host_docker} ps -a -q #{images_ids.uniq.map { |image_id| "--filter=ancestor=#{image_id}" }.join(' ')} --no-trunc)).tap do |res|
100
- raise Error::Command, code: :user_containers_detected, data: { ids: res.stdout.strip } if res && !res.stdout.strip.empty? && !dry_run?
101
- end
98
+ run_command(%(#{host_docker} ps -a -q #{images_ids.uniq.map { |image_id| "--filter=ancestor=#{image_id}" }.join(' ')} --no-trunc)).tap do |res|
99
+ raise Error::Command, code: :user_containers_detected, data: { ids: res.stdout.strip } if res && !res.stdout.strip.empty? && !dry_run?
102
100
  end
103
101
  end
104
102
 
@@ -150,6 +148,10 @@ module Dapp
150
148
  log_step_with_indent(:'proper cache', &blk)
151
149
  end
152
150
 
151
+ def log_proper_repo_cache(&blk)
152
+ log_step_with_indent(:'proper repo cache', &blk)
153
+ end
154
+
153
155
  def one_dimg!
154
156
  return if build_configs.one?
155
157
  raise Error::Command, code: :command_unexpected_dimgs_number, data: { dimgs_names: build_configs.map(&:_name).join(' ') }
@@ -21,9 +21,7 @@ module Dapp
21
21
  def proper_cache
22
22
  log_proper_cache do
23
23
  lock("#{name}.images") do
24
- log_step_with_indent(name) do
25
- remove_project_images(dapp_project_images_ids.select { |image_id| !actual_cache_project_images_ids.include?(image_id) })
26
- end
24
+ remove_project_images(dapp_project_images_ids.select { |image_id| !actual_cache_project_images_ids.include?(image_id) })
27
25
  end
28
26
  end
29
27
  end
@@ -38,15 +36,15 @@ module Dapp
38
36
  end
39
37
 
40
38
  def stages_cleanup_by_repo
41
- registry = registry(option_repo)
42
- repo_dimgs = repo_dimgs_images(registry)
39
+ log_proper_repo_cache do
40
+ lock("#{name}.images") do
41
+ registry = dimg_registry(option_repo)
42
+ repo_dimgs = repo_detailed_dimgs_images(registry)
43
43
 
44
- lock("#{name}.images") do
45
- log_step_with_indent(name) do
46
44
  dapp_project_dangling_images_flush
47
45
 
48
- dimgs, dimgstages = dapp_project_images.partition { |image| repo_dimgs.any? { |dimg| dimg[:id] == image[:id] } }
49
- dimgs.each { |dimg_image| except_dapp_project_image_with_parents(dimg_image[:id], dimgstages) }
46
+ _, dimgstages = dapp_project_images.partition { |image| repo_dimgs.any? { |dimg| dimg[:id] == image[:id] } }
47
+ repo_dimgs.each { |repo_dimg| except_dapp_project_image_with_parents(repo_dimg[:parent], dimgstages) }
50
48
 
51
49
  # Удаление только образов старше 2ч
52
50
  dimgstages.delete_if do |dimgstage|
@@ -6,11 +6,9 @@ module Dapp
6
6
  module FlushLocal
7
7
  def stages_flush_local
8
8
  lock("#{name}.images") do
9
- log_step_with_indent(name) do
10
- dapp_project_containers_flush
11
- dapp_project_dangling_images_flush
12
- remove_project_images(dapp_project_images_ids)
13
- end
9
+ dapp_project_containers_flush
10
+ dapp_project_dangling_images_flush
11
+ remove_project_images(dapp_project_images_ids)
14
12
  end
15
13
  end
16
14
  end
@@ -66,7 +66,7 @@ module Dapp
66
66
  options.map do |key, vals|
67
67
  case key
68
68
  when :cmd, :entrypoint
69
- vals = [''] if vals == []
69
+ vals = [''] if vals == [] && ::Dapp::Dapp.host_docker_minor_version >= Gem::Version.new('17.10')
70
70
  [vals]
71
71
  when :env, :label then vals.map(&method(:options_to_args)).flatten
72
72
  else vals
data/lib/dapp/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = '0.21.10'.freeze
2
+ VERSION = '0.21.11'.freeze
3
3
  BUILD_CACHE_VERSION = 24.1
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.21.10
4
+ version: 0.21.11
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-12-24 00:00:00.000000000 Z
11
+ date: 2017-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -711,7 +711,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
711
711
  version: 2.5.0
712
712
  requirements: []
713
713
  rubyforge_project:
714
- rubygems_version: 2.5.1
714
+ rubygems_version: 2.7.4
715
715
  signing_key:
716
716
  specification_version: 4
717
717
  summary: Build docker packaged apps using chef or shell