dapp 0.23.2 → 0.23.3

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
- SHA256:
3
- metadata.gz: b824d82111173d42881d595fa087ea22e0f631c4cfd41f679779dd54dd08e5eb
4
- data.tar.gz: 65b7d687aed97303a38a64bba5941a97014306fb9cda93e05ca823d40b2ac1bc
2
+ SHA1:
3
+ metadata.gz: bae0c6892f439eeb2733d7c3767b70769c94a492
4
+ data.tar.gz: 63a6652f3b687bc044c6a0312b9def251ba8f130
5
5
  SHA512:
6
- metadata.gz: 738498c3f2f7cbea60cbe147069c7e834b8ea60fa63051afd82899c330f075b5b7b9cead2b219e4eec2be4d38bc085b9f5538f36e18841bd482f66176114a77a
7
- data.tar.gz: 05dc719a00c3203e62b03aeac743e0c0bbaa2e7db90c59c38f5cebda1d638f1747ae72606cde6f3c376f725823e1086133e0ab594d674b3341911bbfca26d62f
6
+ metadata.gz: 0332c89d8ea89a0611f4cb10abcdd6af84ae81c0c5b75d8635f85e0880ad89ab2e0ac59e9ecff9e085c8334839924b42f8943c89dd2a0e640e2cab15dac4bcab
7
+ data.tar.gz: 8ae4bd3b958a1853d22e2424452dc8a9af548ff52443dc04972e0e799be4271d5302eb9f26196eebcb43fce2ec4f07958692e30cdddbabbc4705cfcaa07956f6
@@ -39,7 +39,6 @@ en:
39
39
  values_file_not_found: "Values file `%{path}` not found!"
40
40
  secret_file_not_found: "Secret file `%{path}` not found!"
41
41
  secret_file_empty: "Secret file `%{path}` can't be empty!"
42
- user_containers_detected: "User containers are using these images:\n%{ids}"
43
42
  incorrect_yaml_structure: "Incorrect YAML structure in `%{path}`!"
44
43
  editor_not_found: "Editor not found!"
45
44
  expected_only_one_tag: 'Expected only one tag (`%{tags}`)!'
@@ -54,7 +54,7 @@ module Dapp
54
54
  end
55
55
 
56
56
  def update_project_images_cache(project_images)
57
- dapp_project_images.delete_if { |image| project_images.include?(image) }
57
+ dapp_project_images.delete_if { |image| project_images.map { |i| i[:id] }.include?(image[:id]) }
58
58
  end
59
59
 
60
60
  def project_images_to_delete(project_images)
@@ -74,15 +74,19 @@ module Dapp
74
74
  end
75
75
 
76
76
  def remove_images(images_ids_or_names)
77
- images_ids_or_names.uniq!
78
- check_user_containers!(images_ids_or_names)
77
+ images_ids_or_names = ignore_used_images(images_ids_or_names.uniq)
79
78
  remove_base("#{host_docker} rmi%{force_option} %{ids}", images_ids_or_names, force: false)
80
79
  end
81
80
 
82
- def check_user_containers!(images_ids)
83
- return if images_ids.empty?
84
- run_command(%(#{host_docker} ps -a -q #{images_ids.uniq.map { |image_id| "--filter=ancestor=#{image_id}" }.join(' ')} --no-trunc)).tap do |res|
85
- raise ::Dapp::Error::Command, code: :user_containers_detected, data: { ids: res.stdout.strip } if res && !res.stdout.strip.empty? && !dry_run?
81
+ def ignore_used_images(images_ids_or_names)
82
+ images_ids_or_names.select do |image_id_or_name|
83
+ res = run_command(%(#{host_docker} ps -a -q --filter=ancestor=#{image_id_or_name}))
84
+ if res && !res.stdout.strip.empty? && !dry_run?
85
+ log_info("Skip `#{image_id_or_name}` (used by containers: #{res.stdout.strip.split.join(' ')})")
86
+ false
87
+ else
88
+ true
89
+ end
86
90
  end
87
91
  end
88
92
 
@@ -19,7 +19,11 @@ module Dapp
19
19
  def proper_cache
20
20
  log_proper_cache do
21
21
  lock("#{name}.images") do
22
- remove_project_images(dapp_project_dimgstages - actual_cache_project_dimgstages)
22
+ remove_project_images begin
23
+ dapp_project_dimgstages.select do |image|
24
+ !actual_cache_project_dimgstages.map { |dimgstage| dimgstage[:id] }.include?(image[:id])
25
+ end
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -39,8 +43,8 @@ module Dapp
39
43
 
40
44
  # Удаление только образов старше 2ч
41
45
  dimgstages.delete_if do |dimgstage|
42
- Time.now - dimgstage[:created_at] < 2*60*60
43
- end
46
+ Time.now - dimgstage[:created_at] < 2 * 60 * 60
47
+ end unless ENV['DAPP_STAGES_CLEANUP_LOCAL_DISABLED_DATE_POLICY']
44
48
 
45
49
  remove_project_images(dimgstages)
46
50
  end
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = '0.23.2'.freeze
2
+ VERSION = '0.23.3'.freeze
3
3
  BUILD_CACHE_VERSION = 26
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.2
4
+ version: 0.23.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
@@ -721,7 +721,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
721
721
  version: 2.5.0
722
722
  requirements: []
723
723
  rubyforge_project:
724
- rubygems_version: 2.7.4
724
+ rubygems_version: 2.5.1
725
725
  signing_key:
726
726
  specification_version: 4
727
727
  summary: Build docker packaged apps using chef or shell