dapp 0.35.11 → 0.35.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dapp/dapp/option_tags.rb +5 -5
- data/lib/dapp/dapp/slug.rb +65 -18
- data/lib/dapp/dimg/build/stage/base.rb +20 -6
- data/lib/dapp/dimg/build/stage/from.rb +4 -7
- 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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0adb4bf08173793c4f4375818281b923c2e52fdea88fbfda96588477769f3db1
|
4
|
+
data.tar.gz: c544df40040b7030ded5800bd1ac05950fcd0648af0077d7a8a1681356e843d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c5c13d95cf94a69c7c24cf9baeff7600b2adf4d90b4382083b16f39ab9e19d13be9a13d12ed68eb881bd8c294d38f3e1395d27de0e117661f97300dfdd6b263
|
7
|
+
data.tar.gz: b87cf2e5d650993e26739b18e950b6b4c06ecd0bcdae4bec714729aa2d82a45a775029606d9059813cbc6bd98e393cf8c55689a785a9a02ab04dc8f1f6f604da
|
@@ -60,7 +60,7 @@ module Dapp
|
|
60
60
|
return {} unless options[:tag_build_id]
|
61
61
|
|
62
62
|
if ENV['GITLAB_CI']
|
63
|
-
build_id = ENV['CI_BUILD_ID']
|
63
|
+
build_id = ENV['CI_BUILD_ID'] || ENV['CI_JOB_ID']
|
64
64
|
elsif ENV['TRAVIS']
|
65
65
|
build_id = ENV['TRAVIS_BUILD_NUMBER']
|
66
66
|
else
|
@@ -75,10 +75,10 @@ module Dapp
|
|
75
75
|
|
76
76
|
{}.tap do |tags_by_scheme|
|
77
77
|
if ENV['GITLAB_CI']
|
78
|
-
if ENV['CI_BUILD_TAG']
|
79
|
-
tags_by_scheme[:git_tag] = [ENV['CI_BUILD_TAG']]
|
80
|
-
elsif ENV['CI_BUILD_REF_NAME']
|
81
|
-
tags_by_scheme[:git_branch] = [ENV['CI_BUILD_REF_NAME']]
|
78
|
+
if ENV['CI_BUILD_TAG'] || ENV['CI_COMMIT_TAG']
|
79
|
+
tags_by_scheme[:git_tag] = [ENV['CI_BUILD_TAG'] || ENV['CI_COMMIT_TAG']]
|
80
|
+
elsif ENV['CI_BUILD_REF_NAME'] || ENV['CI_COMMIT_REF_NAME']
|
81
|
+
tags_by_scheme[:git_branch] = [ENV['CI_BUILD_REF_NAME'] || ENV['CI_COMMIT_REF_NAME']]
|
82
82
|
end
|
83
83
|
elsif ENV['TRAVIS']
|
84
84
|
if ENV['TRAVIS_TAG']
|
data/lib/dapp/dapp/slug.rb
CHANGED
@@ -4,28 +4,75 @@ module Dapp
|
|
4
4
|
SLUG_SEPARATOR = '-'.freeze
|
5
5
|
SLUG_V2_LIMIT_LENGTH = 53
|
6
6
|
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
slug << begin
|
14
|
-
unless consistent_uniq_slug.nil?
|
15
|
-
index = ENV['DAPP_SLUG_V2'] ? SLUG_V2_LIMIT_LENGTH - murmur_hash.length - SLUG_SEPARATOR.length - 1 : -1
|
16
|
-
consistent_uniq_slug[0..index]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
slug << murmur_hash
|
20
|
-
end.compact.join(SLUG_SEPARATOR)
|
7
|
+
def self.included(base)
|
8
|
+
if ENV['DAPP_SLUG_V3']
|
9
|
+
base.include(V3)
|
10
|
+
else
|
11
|
+
base.include(V1V2)
|
12
|
+
end
|
21
13
|
end
|
22
14
|
|
23
|
-
|
24
|
-
|
15
|
+
module V1V2
|
16
|
+
def consistent_uniq_slugify(s)
|
17
|
+
return s unless should_be_slugged?(s)
|
18
|
+
consistent_uniq_slug_reg =~ s.tr('/', '-').slugify.squeeze('--')
|
19
|
+
consistent_uniq_slug = Regexp.last_match(1)
|
20
|
+
murmur_hash = MurmurHash3::V32.str_hexdigest(s)
|
21
|
+
[].tap do |slug|
|
22
|
+
slug << begin
|
23
|
+
unless consistent_uniq_slug.nil?
|
24
|
+
index = ENV['DAPP_SLUG_V2'] ? SLUG_V2_LIMIT_LENGTH - murmur_hash.length - SLUG_SEPARATOR.length - 1 : -1
|
25
|
+
consistent_uniq_slug[0..index]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
slug << murmur_hash
|
29
|
+
end.compact.join(SLUG_SEPARATOR)
|
30
|
+
end
|
31
|
+
|
32
|
+
def should_be_slugged?(s)
|
33
|
+
!(/^#{consistent_uniq_slug_reg}$/ =~ s)
|
34
|
+
end
|
35
|
+
|
36
|
+
def consistent_uniq_slug_reg
|
37
|
+
/(?!-)((-?[a-z0-9]+)+)(?<!-)/
|
38
|
+
end
|
25
39
|
end
|
26
40
|
|
27
|
-
|
28
|
-
|
41
|
+
module V3
|
42
|
+
def consistent_uniq_slugify(s)
|
43
|
+
return s unless should_be_slugged?(s)
|
44
|
+
slug = consistent_uniq_slug(s)
|
45
|
+
murmur_hash = MurmurHash3::V32.str_hexdigest(s)
|
46
|
+
[].tap do |res|
|
47
|
+
res << begin
|
48
|
+
unless slug.empty?
|
49
|
+
index = SLUG_V2_LIMIT_LENGTH - murmur_hash.length - SLUG_SEPARATOR.length - 1
|
50
|
+
slug[0..index]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
res << murmur_hash
|
54
|
+
end.compact.join(SLUG_SEPARATOR)
|
55
|
+
end
|
56
|
+
|
57
|
+
def should_be_slugged?(s)
|
58
|
+
consistent_uniq_slug(s) != s || s.length > SLUG_V2_LIMIT_LENGTH
|
59
|
+
end
|
60
|
+
|
61
|
+
def consistent_uniq_slug(s)
|
62
|
+
''.tap do |res|
|
63
|
+
status = :empty
|
64
|
+
s.to_s.chars.each do |ch|
|
65
|
+
next if (s_ch = ch.slugify).empty?
|
66
|
+
|
67
|
+
if s_ch !~ /[[:punct:]|[:blank:]]/
|
68
|
+
res << s_ch
|
69
|
+
status = :non_empty if status == :empty
|
70
|
+
elsif status == :non_empty && res[-1] != '-'
|
71
|
+
res << '-'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end.chomp('-')
|
75
|
+
end
|
29
76
|
end
|
30
77
|
end # Slug
|
31
78
|
end # Dapp
|
@@ -125,29 +125,43 @@ module Dapp
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def image_add_mounts
|
128
|
+
image_add_service_mounts
|
129
|
+
image_add_custom_mounts
|
130
|
+
|
131
|
+
image_add_mounts_labels
|
132
|
+
end
|
133
|
+
|
134
|
+
def image_add_service_mounts
|
128
135
|
[:tmp_dir, :build_dir].each do |type|
|
129
136
|
next if (mounts = adding_mounts_by_type(type)).empty?
|
130
137
|
|
131
138
|
mounts.each do |path|
|
132
139
|
absolute_path = File.expand_path(File.join('/', path))
|
133
|
-
tmp_path = dimg.send(type, 'mount', absolute_path
|
140
|
+
tmp_path = dimg.send(type, 'mount', dimg.dapp.consistent_uniq_slugify(absolute_path)).tap(&:mkpath)
|
134
141
|
image.add_volume "#{tmp_path}:#{absolute_path}"
|
135
142
|
end
|
136
|
-
|
137
|
-
image.add_service_change_label :"dapp-mount-#{type.to_s.tr('_', '-')}" => mounts.join(';')
|
138
143
|
end
|
139
|
-
|
140
|
-
image_add_custom_mounts
|
141
144
|
end
|
142
145
|
|
143
146
|
def image_add_custom_mounts
|
144
147
|
adding_custom_dir_mounts.each do |from, to_pathes|
|
145
|
-
FileUtils.mkdir_p(from)
|
148
|
+
FileUtils.mkdir_p(from) unless File.exist?(from)
|
146
149
|
to_pathes.tap(&:uniq!).map { |to_path| image.add_volume "#{from}:#{to_path}" }
|
147
150
|
image.add_service_change_label :"dapp-mount-custom-dir-#{from.gsub('/', '--')}" => to_pathes.join(';')
|
148
151
|
end
|
149
152
|
end
|
150
153
|
|
154
|
+
def image_add_mounts_labels
|
155
|
+
[:tmp_dir, :build_dir].each do |type|
|
156
|
+
next if (mounts = adding_mounts_by_type(type)).empty?
|
157
|
+
image.add_service_change_label :"dapp-mount-#{type.to_s.tr('_', '-')}" => mounts.join(';')
|
158
|
+
end
|
159
|
+
|
160
|
+
adding_custom_dir_mounts.each do |from, to_pathes|
|
161
|
+
image.add_service_change_label :"dapp-mount-custom-dir-#{from.gsub('/', '--')}" => to_pathes.join(';')
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
151
165
|
def adding_mounts_by_type(type)
|
152
166
|
(config_mounts_by_type(type) + labels_mounts_by_type(type)).uniq
|
153
167
|
end
|
@@ -45,7 +45,8 @@ module Dapp
|
|
45
45
|
def add_cleanup_mounts_dirs_command
|
46
46
|
return if config_mounts_dirs.empty?
|
47
47
|
image.add_service_command ["#{dimg.dapp.rm_bin} -rf %s",
|
48
|
-
"#{dimg.dapp.mkdir_bin} -p %s"
|
48
|
+
"#{dimg.dapp.mkdir_bin} -p %s",
|
49
|
+
"#{dimg.dapp.rm_bin} -rf %s"].map { |c| format(c, config_mounts_dirs.join(' ')) }
|
49
50
|
end
|
50
51
|
|
51
52
|
def config_mounts
|
@@ -59,12 +60,8 @@ module Dapp
|
|
59
60
|
config_mounts.values.flatten.uniq
|
60
61
|
end
|
61
62
|
|
62
|
-
def
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
def adding_custom_dir_mounts
|
67
|
-
[]
|
63
|
+
def image_add_mounts
|
64
|
+
image_add_mounts_labels
|
68
65
|
end
|
69
66
|
|
70
67
|
def image_should_be_untagged_condition
|
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.35.
|
4
|
+
version: 0.35.12
|
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-10-
|
11
|
+
date: 2018-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|