dapp 0.28.9 → 0.28.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dapp/dimg/dapp/command/cleanup_repo.rb +6 -15
- data/lib/dapp/dimg/dapp/command/common.rb +7 -7
- data/lib/dapp/dimg/dapp/command/flush_local.rb +1 -1
- data/lib/dapp/dimg/dapp/command/mrproper.rb +2 -2
- data/lib/dapp/dimg/dapp/command/stages/cleanup_local.rb +1 -1
- data/lib/dapp/dimg/dapp/command/stages/common.rb +4 -2
- data/lib/dapp/dimg/dapp/command/stages/flush_local.rb +1 -1
- data/lib/dapp/dimg/git_repo/base.rb +1 -10
- data/lib/dapp/dimg/image/stage.rb +1 -1
- data/lib/dapp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 435bfad980694c0766403ee37dc76a22df40f9d1
|
4
|
+
data.tar.gz: 547eb74b7dfcd6da66ac0198ee88c4481238f7d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80568b12b3424f0d2565d0c0f3314ebca37b19d941af313ee5debbd5a871e55084effc0cee35fcd379867329f30a2b0714569e4ae8a19a832bcc95bfd2bcc05c
|
7
|
+
data.tar.gz: 1003e256b226c28f2742e92b8847cbf0181fca828530f7f36b342f3294896d7e054b846c4f121a878e1c2775374c88df76f0386754f704ae825a68fd45afd52d
|
@@ -77,27 +77,18 @@ module Dapp
|
|
77
77
|
def cleanup_repo_by_policies(registry, detailed_dimgs_images_by_scheme)
|
78
78
|
%w(git_tag git_commit).each_with_object([]) do |scheme, dimgs_images|
|
79
79
|
dimgs_images.concat begin
|
80
|
-
detailed_dimgs_images_by_scheme[scheme].
|
81
|
-
|
80
|
+
detailed_dimgs_images_by_scheme[scheme].select do |dimg|
|
81
|
+
!dry_run? && begin
|
82
82
|
if scheme == 'git_tag'
|
83
|
-
|
83
|
+
consistent_git_tags.include?(dimg[:tag])
|
84
84
|
elsif scheme == 'git_commit'
|
85
|
-
|
85
|
+
git_own_repo.commit_exists?(dimg[:tag])
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
89
|
-
dimg[:created_at] = begin
|
90
|
-
if scheme == 'git_tag'
|
91
|
-
git_own_repo.tag_at(git_tag_by_consistent_git_tag(dimg[:tag]))
|
92
|
-
elsif scheme == 'git_commit'
|
93
|
-
git_own_repo.commit_at(dimg[:tag])
|
94
|
-
end
|
95
|
-
end
|
96
|
-
dimg
|
97
|
-
end.compact
|
88
|
+
end
|
98
89
|
end
|
99
90
|
end.tap do |detailed_dimgs_images|
|
100
|
-
sorted_detailed_dimgs_images = detailed_dimgs_images.sort_by { |dimg| dimg[:created_at] }
|
91
|
+
sorted_detailed_dimgs_images = detailed_dimgs_images.sort_by { |dimg| dimg[:created_at] }.reverse
|
101
92
|
expired_dimgs_images, not_expired_dimgs_images = sorted_detailed_dimgs_images.partition do |dimg_image|
|
102
93
|
dimg_image[:created_at] < DATE_POLICY
|
103
94
|
end
|
@@ -48,14 +48,14 @@ module Dapp
|
|
48
48
|
.reject(&:empty?)
|
49
49
|
.each do |l|
|
50
50
|
id, name, created_at = l.split(';')
|
51
|
-
images << { id: id, name: name, created_at: Time.parse(created_at), **extra_fields }
|
51
|
+
images << { id: id, name: name, created_at: Time.parse(created_at).to_i, **extra_fields }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def remove_project_images(project_images)
|
56
|
+
def remove_project_images(project_images, force: false)
|
57
57
|
update_project_images_cache(project_images)
|
58
|
-
remove_images(project_images_to_delete(project_images))
|
58
|
+
remove_images(project_images_to_delete(project_images), force: force)
|
59
59
|
end
|
60
60
|
|
61
61
|
def update_project_images_cache(project_images)
|
@@ -72,7 +72,7 @@ module Dapp
|
|
72
72
|
|
73
73
|
def dapp_containers_flush_by_label(label)
|
74
74
|
log_proper_containers do
|
75
|
-
remove_containers_by_query(%(#{host_docker} ps -a -f "label=#{label}" -q --no-trunc))
|
75
|
+
remove_containers_by_query(%(#{host_docker} ps -a -f "label=#{label}" -f "name=dapp.build." -q --no-trunc))
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -90,10 +90,10 @@ module Dapp
|
|
90
90
|
with_subquery(images_query) { |ids| remove_images(ids) }
|
91
91
|
end
|
92
92
|
|
93
|
-
def remove_images(images_ids_or_names)
|
93
|
+
def remove_images(images_ids_or_names, force: false)
|
94
94
|
ids_chunks(images_ids_or_names) do |chunk|
|
95
|
-
chunk = ignore_used_images(chunk)
|
96
|
-
remove_base("#{host_docker} rmi%{force_option} %{ids}", chunk, force:
|
95
|
+
chunk = ignore_used_images(chunk) unless force
|
96
|
+
remove_base("#{host_docker} rmi%{force_option} %{ids}", chunk, force: force)
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -58,14 +58,14 @@ module Dapp
|
|
58
58
|
|
59
59
|
def dapp_images_flush_by_label(label)
|
60
60
|
log_step_with_indent('proper images') do
|
61
|
-
remove_images(dapp_images_names_by_label(label))
|
61
|
+
remove_images(dapp_images_names_by_label(label), force: true)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
def proper_cache_version
|
66
66
|
log_proper_cache do
|
67
67
|
proper_cache_all_images_names.tap do |proper_cache_images|
|
68
|
-
remove_images(dapp_images_names_by_label('dapp').select { |image_name| !proper_cache_images.include?(image_name) })
|
68
|
+
remove_images(dapp_images_names_by_label('dapp').select { |image_name| !proper_cache_images.include?(image_name) }, force: true)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -46,7 +46,7 @@ module Dapp
|
|
46
46
|
|
47
47
|
# Удаление только образов старше 2ч
|
48
48
|
dimgstages.delete_if do |dimgstage|
|
49
|
-
Time.now - dimgstage[:created_at] < 2 * 60 * 60
|
49
|
+
Time.now.to_i - dimgstage[:created_at] < 2 * 60 * 60
|
50
50
|
end unless ENV['DAPP_STAGES_CLEANUP_LOCAL_DISABLED_DATE_POLICY']
|
51
51
|
|
52
52
|
remove_project_images(dimgstages)
|
@@ -7,10 +7,12 @@ module Dapp
|
|
7
7
|
protected
|
8
8
|
|
9
9
|
def repo_detailed_dimgs_images(registry)
|
10
|
-
repo_dimgs_images(registry).
|
10
|
+
repo_dimgs_images(registry).select do |dimg|
|
11
11
|
image_history = registry.image_history(dimg[:tag], dimg[:dimg])
|
12
|
+
dimg[:created_at] = Time.parse(image_history['created']).to_i
|
12
13
|
dimg[:parent] = image_history['container_config']['Image']
|
13
|
-
dimg[:labels] = image_history['config']['Labels']
|
14
|
+
dimg[:labels] = image_history['config']['Labels'] || {}
|
15
|
+
dimg[:labels]['dapp'] == name
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -6,7 +6,7 @@ module Dapp
|
|
6
6
|
module FlushLocal
|
7
7
|
def stages_flush_local
|
8
8
|
lock("#{name}.images") do
|
9
|
-
log_step_with_indent('flush stages') { remove_project_images(dapp_project_dimgstages) }
|
9
|
+
log_step_with_indent('flush stages') { remove_project_images(dapp_project_dimgstages, force: true) }
|
10
10
|
end
|
11
11
|
|
12
12
|
dapp_containers_flush_by_label("dapp=#{name}")
|
@@ -146,11 +146,6 @@ module Dapp
|
|
146
146
|
raise Error::Rugged, code: :git_repository_reference_error, data: { name: name, message: e.message.downcase }
|
147
147
|
end
|
148
148
|
|
149
|
-
def tag_at(name)
|
150
|
-
tag = git.tags.find { |t| t.name == name }
|
151
|
-
tag.target.time.to_i
|
152
|
-
end
|
153
|
-
|
154
149
|
def tags
|
155
150
|
git.tags.map(&:name)
|
156
151
|
end
|
@@ -161,11 +156,7 @@ module Dapp
|
|
161
156
|
.select { |b| b.start_with?('origin/') }
|
162
157
|
.map { |b| b.reverse.chomp('origin/'.reverse).reverse }
|
163
158
|
end
|
164
|
-
|
165
|
-
def commit_at(commit)
|
166
|
-
lookup_commit(commit).time.to_i
|
167
|
-
end
|
168
|
-
|
159
|
+
|
169
160
|
def find_commit_id_by_message(regex)
|
170
161
|
walker.each do |commit|
|
171
162
|
msg = commit.message.encode('UTF-8', invalid: :replace, undef: :replace)
|
data/lib/dapp/version.rb
CHANGED
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.28.
|
4
|
+
version: 0.28.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|