dapp 0.28.15 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/dapp +1 -23
- data/config/en/net_status.yml +2 -1
- data/lib/dapp/dapp/dappfile.rb +7 -5
- data/lib/dapp/dapp/sentry.rb +0 -1
- data/lib/dapp/dimg/build/stage/artifact_default.rb +2 -0
- data/lib/dapp/dimg/cli/command/dimg/bp.rb +0 -5
- data/lib/dapp/dimg/cli/command/dimg/build.rb +0 -5
- data/lib/dapp/dimg/config/directive/artifact.rb +0 -10
- data/lib/dapp/dimg/config/directive/dimg/validation.rb +86 -33
- data/lib/dapp/dimg/dapp/command/build_context/export.rb +1 -1
- data/lib/dapp/dimg/dimg.rb +2 -9
- data/lib/dapp/dimg/dimg/git_artifact.rb +2 -2
- data/lib/dapp/dimg/dimg/stages.rb +12 -12
- data/lib/dapp/dimg/docker_registry/base/authorization.rb +1 -16
- data/lib/dapp/dimg/git_artifact.rb +19 -9
- data/lib/dapp/dimg/git_repo/base.rb +28 -2
- data/lib/dapp/kube/dapp/command/chart_create.rb +4 -5
- data/lib/dapp/kube/helm/values.rb +2 -1
- data/lib/dapp/kube/kubernetes/client.rb +0 -6
- data/lib/dapp/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 72950bf823bbccdb2980f7977ab08c52a8a3b6ed
|
4
|
+
data.tar.gz: 282cac11557cd2ba2d74c3c4a9ebaa14e0a180f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b8c11386bed98342ae40225a804295715d62e1eeb00ad26efe4aeb14eadc52bda5594f941219f0984a2fdb0da8aaac61ac3d730d487d494a7ffee04a4084f7b
|
7
|
+
data.tar.gz: 090755be90e39618a416b7a6cc4d106649bbcf4e3efead35e2293f20fabed3f003eaaadbd265d5acb9351940dddf8ba0571c9abf3cd32b7a1e2462596883e651
|
data/bin/dapp
CHANGED
@@ -10,29 +10,7 @@ Thread.abort_on_exception = true
|
|
10
10
|
begin
|
11
11
|
begin
|
12
12
|
begin
|
13
|
-
|
14
|
-
Dapp::CLI.new.run
|
15
|
-
ensure
|
16
|
-
if Time.now.to_date < Date.parse("2019-11-01")
|
17
|
-
STDERR.puts
|
18
|
-
STDERR.puts ::Paint["###################################################################", :red, :bold]
|
19
|
-
STDERR.puts ::Paint["### DEPRECATION WARNING! ###", :red, :bold]
|
20
|
-
STDERR.puts ::Paint["### Dapp will be deprecated for use starting with 01.11.2019! ###", :red, :bold]
|
21
|
-
STDERR.puts ::Paint["### Please port your project to werf: ###", :red, :bold]
|
22
|
-
STDERR.puts ::Paint["### https://werf.io ###", :red, :bold]
|
23
|
-
STDERR.puts ::Paint["###################################################################", :red, :bold]
|
24
|
-
STDERR.puts
|
25
|
-
else
|
26
|
-
STDERR.puts
|
27
|
-
STDERR.puts ::Paint["######################################################################", :red, :bold]
|
28
|
-
STDERR.puts ::Paint["### DEPRECATION WARNING! ###", :red, :bold]
|
29
|
-
STDERR.puts ::Paint["### Dapp is deprecated for use and will not receive any support! ###", :red, :bold]
|
30
|
-
STDERR.puts ::Paint["### Please port your project to werf: ###", :red, :bold]
|
31
|
-
STDERR.puts ::Paint["### https://werf.io ###", :red, :bold]
|
32
|
-
STDERR.puts ::Paint["######################################################################", :red, :bold]
|
33
|
-
STDERR.puts
|
34
|
-
end
|
35
|
-
end
|
13
|
+
Dapp::CLI.new.run
|
36
14
|
rescue Dapp::Error::Base => e
|
37
15
|
unless (message = Dapp::Helper::NetStatus.before_error_message(e)).empty?
|
38
16
|
$stderr.puts(message)
|
data/config/en/net_status.yml
CHANGED
@@ -126,7 +126,8 @@ en:
|
|
126
126
|
commit_not_found_in_remote_git_repository: "Remote git repo `%{url}`: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
|
127
127
|
branch_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: branch `%{branch}` not exist!"
|
128
128
|
rugged_protocol_not_supported: "Rugged has been compiled without support for `%{protocol}`.\nGit repositories will not be reachable via `%{protocol}` (`%{url}`).\nRugged.features should include `%{protocol}`."
|
129
|
-
|
129
|
+
git_local_incorrect_gitmodules_params: "Local git repo with invalid `.gitmodules` file: %{error}"
|
130
|
+
incorrect_gitmodules_file: "Git repo `%{name}` with invalid `.gitmodules` file: %{error}\n\n%{content}"
|
130
131
|
git_repository_without_remote_url: "Git repo `%{name}`: remote url cannot be detected!\nYou should check `remote origin url` in `%{path}` repository."
|
131
132
|
git_repository_not_found: "Git repository `%{path}` not found!\nYou should check `remote origin url` in `%{parent_git_path}` repository."
|
132
133
|
lock:
|
data/lib/dapp/dapp/dappfile.rb
CHANGED
@@ -61,7 +61,10 @@ module Dapp
|
|
61
61
|
puts "-- DAPP_DUMP_CONFIG END"
|
62
62
|
end
|
63
63
|
|
64
|
-
config
|
64
|
+
config.tap do
|
65
|
+
config.after_parsing!
|
66
|
+
config.validate!
|
67
|
+
end
|
65
68
|
end # begin
|
66
69
|
end
|
67
70
|
|
@@ -69,8 +72,6 @@ module Dapp
|
|
69
72
|
::Dapp::Config::Config.new(dapp: self).tap do |config|
|
70
73
|
begin
|
71
74
|
config.instance_eval File.read(dappfile_path), dappfile_path
|
72
|
-
config.after_parsing!
|
73
|
-
config.validate!
|
74
75
|
rescue SyntaxError, StandardError => e
|
75
76
|
backtrace = e.backtrace.find { |line| line.start_with?(dappfile_path) }
|
76
77
|
message = begin
|
@@ -114,6 +115,7 @@ module Dapp
|
|
114
115
|
|
115
116
|
response = JSON.parse(raw_json_response)
|
116
117
|
|
118
|
+
log_warning(response["warning"]) unless response["warning"].empty?
|
117
119
|
raise ::Dapp::Dapp::Error::DappfileYmlErrorResponse.new(response["error"], response) if response["error"]
|
118
120
|
|
119
121
|
YAML.load response["dappConfig"]
|
@@ -124,12 +126,12 @@ module Dapp
|
|
124
126
|
return if File.exists? dappfile_yml_bin_path
|
125
127
|
|
126
128
|
log_process("Downloading dappfile-yml dapp dependency") do
|
127
|
-
location = URI("https://dl.bintray.com/dapp
|
129
|
+
location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/dappfile-yml")
|
128
130
|
|
129
131
|
tmp_bin_path = File.join(self.class.tmp_base_dir, "dappfile-yml-#{SecureRandom.uuid}")
|
130
132
|
::Dapp::Downloader.download(location, tmp_bin_path, show_progress: true, progress_titile: dappfile_yml_bin_path)
|
131
133
|
|
132
|
-
checksum_location = URI("https://dl.bintray.com/dapp
|
134
|
+
checksum_location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/dappfile-yml.sha")
|
133
135
|
tmp_bin_checksum_path = tmp_bin_path + ".checksum"
|
134
136
|
::Dapp::Downloader.download(checksum_location, tmp_bin_checksum_path)
|
135
137
|
|
data/lib/dapp/dapp/sentry.rb
CHANGED
@@ -50,7 +50,6 @@ module Dapp
|
|
50
50
|
"build-dir" => self.build_dir,
|
51
51
|
"options" => self.options,
|
52
52
|
"env-options" => {
|
53
|
-
"DAPP_FORCE_SAVE_CACHE" => ENV["DAPP_FORCE_SAVE_CACHE"],
|
54
53
|
"DAPP_BIN_DAPPFILE_YML" => ENV["DAPP_BIN_DAPPFILE_YML"],
|
55
54
|
"ANSIBLE_ARGS" => ENV["ANSIBLE_ARGS"],
|
56
55
|
"DAPP_CHEF_DEBUG" => ENV["DAPP_CHEF_DEBUG"],
|
@@ -32,6 +32,8 @@ module Dapp
|
|
32
32
|
# rubocop:disable Metrics/ParameterLists
|
33
33
|
def safe_cp(from, to, owner, group, include_paths = [], exclude_paths = [])
|
34
34
|
''.tap do |cmd|
|
35
|
+
cmd << "#{dimg.dapp.mkdir_bin} -p #{File.dirname(to)}"
|
36
|
+
cmd << ' && '
|
35
37
|
cmd << dimg.dapp.rsync_bin
|
36
38
|
cmd << ' --archive --links --inplace'
|
37
39
|
cmd << " --chown=#{owner}:#{group}" if owner or group
|
@@ -62,16 +62,6 @@ module Dapp
|
|
62
62
|
raise ::Dapp::Error::Config, code: :stage_artifact_double_associate,
|
63
63
|
data: { stage: "#{type} #{stage.inspect}",
|
64
64
|
conflict_stage: "#{conflict_type} #{conflict_stage.inspect}" } if conflict_stage
|
65
|
-
|
66
|
-
defined_stage = public_send("_#{type}")
|
67
|
-
dapp.log_config_warning(
|
68
|
-
desc: {
|
69
|
-
code: :stage_artifact_rewritten,
|
70
|
-
context: :warning,
|
71
|
-
data: { stage: "#{type} #{stage.inspect}",
|
72
|
-
conflict_stage: "#{type} #{defined_stage.inspect}" }
|
73
|
-
}
|
74
|
-
) if defined_stage
|
75
65
|
end
|
76
66
|
end
|
77
67
|
end
|
@@ -72,7 +72,7 @@ module Dapp
|
|
72
72
|
loop do
|
73
73
|
break if artifacts.empty?
|
74
74
|
verifiable_artifact = artifacts.shift
|
75
|
-
artifacts.
|
75
|
+
artifacts.each do |artifact|
|
76
76
|
next if verifiable_artifact[:index] == artifact[:index]
|
77
77
|
begin
|
78
78
|
validate_artifact!(verifiable_artifact, artifact)
|
@@ -87,54 +87,107 @@ module Dapp
|
|
87
87
|
|
88
88
|
def conflict_between_artifacts!(*formatted_artifacts)
|
89
89
|
artifacts = formatted_artifacts.flatten.map { |formatted_artifact| formatted_artifact[:related_artifact] }
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
artifact_imports = []
|
91
|
+
git_artifacts = []
|
92
|
+
artifacts.map do |artifact|
|
93
|
+
(artifact.is_a?(Artifact::Export) ? artifact_imports : git_artifacts) << artifact
|
94
|
+
end
|
95
|
+
|
96
|
+
common_artifact_dsl = proc do |a|
|
97
|
+
[].tap do |context|
|
98
|
+
context << " to '#{a._to}'"
|
99
|
+
[:include_paths, :exclude_paths].each do |directive|
|
100
|
+
next if (paths = a.send("_#{directive}")).empty?
|
101
|
+
context << " #{directive} '#{paths.join("', '")}'"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
import_dsl = proc do |ga|
|
107
|
+
[].tap do |context|
|
108
|
+
context << "artifact.export('#{ga._cwd}') do"
|
109
|
+
context.concat(common_artifact_dsl.call(ga))
|
110
|
+
context << 'end'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
git_artifact_dsl = proc do |ga|
|
115
|
+
[].tap do |context|
|
116
|
+
context << "git#{"('#{ga._url}')" if ga.respond_to?(:_url)}.add('#{ga._cwd}') do"
|
117
|
+
context.concat(common_artifact_dsl.call(ga))
|
118
|
+
context << 'end'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
common_artifact_yaml = proc do |a|
|
123
|
+
[].tap do |context|
|
124
|
+
context << " to: #{a._to}"
|
125
|
+
{
|
126
|
+
include_paths: 'includePaths',
|
127
|
+
exclude_paths: 'excludePaths',
|
128
|
+
}.each do |directive, yamlDirective|
|
129
|
+
next if (paths = a.send("_#{directive}")).empty?
|
130
|
+
context << " #{yamlDirective}: [#{paths.join(", ")}]"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
import_yaml = proc do |a|
|
136
|
+
[].tap do |context|
|
137
|
+
context << "- artifact: #{a._config._name}"
|
138
|
+
context << " add: #{a._cwd}"
|
139
|
+
context.concat(common_artifact_yaml.call(a))
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
git_artifact_yaml = proc do |ga|
|
144
|
+
[].tap do |context|
|
145
|
+
if ga.respond_to?(:_url)
|
146
|
+
context << "- url: #{ga._url}"
|
147
|
+
context << " add: #{ga._cwd}"
|
95
148
|
else
|
96
|
-
"
|
149
|
+
context << "- add: #{ga._cwd}"
|
97
150
|
end
|
151
|
+
context.concat(common_artifact_yaml.call(ga))
|
98
152
|
end
|
99
|
-
|
100
|
-
|
101
|
-
|
153
|
+
end
|
154
|
+
|
155
|
+
dappfile_context = [].tap do |msg|
|
156
|
+
if artifact_imports.count != 0
|
157
|
+
if dapp
|
158
|
+
artifact_imports.each { |a| msg.concat(import_dsl.call(a)) }
|
159
|
+
else
|
160
|
+
msg << 'import:'
|
161
|
+
artifact_imports.each { |a| msg.concat(import_yaml.call(a)) }
|
162
|
+
end
|
102
163
|
end
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
164
|
+
|
165
|
+
if git_artifacts.count != 0
|
166
|
+
if dapp
|
167
|
+
git_artifacts.each { |a| msg.concat(git_artifact_dsl.call(a)) }
|
168
|
+
else
|
169
|
+
msg << 'git:'
|
170
|
+
git_artifacts.each { |a| msg.concat(git_artifact_yaml.call(a)) }
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end.join("\n")
|
107
174
|
raise ::Dapp::Error::Config, code: :artifact_conflict, data: { dappfile_context: dappfile_context }
|
108
175
|
end
|
109
176
|
|
110
177
|
def validate_artifact_format(artifacts)
|
111
178
|
artifacts.map do |a|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
to = Regexp.last_match(1)
|
116
|
-
include_exclude_path_format = proc do |path|
|
117
|
-
paths = [].tap do |arr|
|
118
|
-
arr << Regexp.last_match(2) unless Regexp.last_match(2).empty?
|
119
|
-
arr << path
|
120
|
-
end
|
121
|
-
path_format.call(File.join(*paths))
|
122
|
-
end
|
123
|
-
|
124
|
-
include_paths = [].tap do |arr|
|
125
|
-
if a._include_paths.empty? && !Regexp.last_match(2).empty?
|
126
|
-
arr << Regexp.last_match(2)
|
179
|
+
include_paths = begin
|
180
|
+
if a._include_paths.empty?
|
181
|
+
[a._to]
|
127
182
|
else
|
128
|
-
|
183
|
+
a._include_paths.dup.map { |p| File.join(a._to, p) }
|
129
184
|
end
|
130
185
|
end
|
131
|
-
exclude_paths = a._exclude_paths.dup.map(&include_exclude_path_format)
|
132
186
|
|
133
187
|
{
|
134
188
|
index: artifacts.index(a),
|
135
|
-
to: to,
|
136
189
|
include_paths: include_paths,
|
137
|
-
exclude_paths:
|
190
|
+
exclude_paths: a._exclude_paths.dup.map { |p| File.join(a._to, p) },
|
138
191
|
related_artifact: a
|
139
192
|
}
|
140
193
|
end
|
@@ -14,7 +14,7 @@ module Dapp
|
|
14
14
|
def export_build_context_image_tar
|
15
15
|
lock("#{name}.images", readonly: true) do
|
16
16
|
context_images_names = build_configs.map do |config|
|
17
|
-
dimg(config: config, ignore_git_fetch: true).
|
17
|
+
dimg(config: config, ignore_git_fetch: true).all_tagged_images.map(&:name)
|
18
18
|
end.flatten
|
19
19
|
|
20
20
|
log_secondary_process(:images, short: true) do
|
data/lib/dapp/dimg/dimg.rb
CHANGED
@@ -59,7 +59,6 @@ module Dapp
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def after_stages_build!
|
62
|
-
return unless last_stage.image.built? || dev_mode? || force_save_cache?
|
63
62
|
last_stage.save_in_cache!
|
64
63
|
artifacts.each { |artifact| artifact.last_stage.save_in_cache! }
|
65
64
|
end
|
@@ -87,6 +86,7 @@ module Dapp
|
|
87
86
|
stage_image.export!(image_name)
|
88
87
|
end
|
89
88
|
end
|
89
|
+
artifacts.each { |artifact| artifact.export_stages!(repo, format: format) }
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -184,6 +184,7 @@ module Dapp
|
|
184
184
|
end
|
185
185
|
break unless !!dapp.options[:pull_all_stages]
|
186
186
|
end
|
187
|
+
artifacts.each { |artifact| artifact.import_stages!(repo, format: format) }
|
187
188
|
end
|
188
189
|
end
|
189
190
|
|
@@ -241,14 +242,6 @@ module Dapp
|
|
241
242
|
dapp.dev_mode?
|
242
243
|
end
|
243
244
|
|
244
|
-
def force_save_cache?
|
245
|
-
if ENV.key? "DAPP_FORCE_SAVE_CACHE"
|
246
|
-
%w(yes 1 true).include? ENV["DAPP_FORCE_SAVE_CACHE"].to_s
|
247
|
-
else
|
248
|
-
!!dapp.options[:force_save_cache]
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
245
|
def build_cache_version
|
253
246
|
[::Dapp::BUILD_CACHE_VERSION, dev_mode? ? 1 : 0]
|
254
247
|
end
|
@@ -12,7 +12,7 @@ module Dapp
|
|
12
12
|
repo = GitRepo::Own.new(dapp)
|
13
13
|
local_git_artifacts.map do |ga_config|
|
14
14
|
artifacts.concat(generate_git_artifacts(repo, **ga_config._artifact_options))
|
15
|
-
end
|
15
|
+
end unless repo.empty?
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -23,7 +23,7 @@ module Dapp
|
|
23
23
|
url: ga_config._url,
|
24
24
|
branch: ga_config._branch,
|
25
25
|
ignore_git_fetch: ignore_git_fetch)
|
26
|
-
artifacts.concat(generate_git_artifacts(repo, **ga_config._artifact_options))
|
26
|
+
artifacts.concat(generate_git_artifacts(repo, **ga_config._artifact_options)) unless repo.empty?
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -18,17 +18,8 @@ module Dapp
|
|
18
18
|
dapp.stage_dapp_label
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
|
23
|
-
end
|
24
|
-
alias export_images tagged_images
|
25
|
-
|
26
|
-
def all_images
|
27
|
-
@all_images ||= all_stages.map(&:image).uniq!(&:name)
|
28
|
-
end
|
29
|
-
|
30
|
-
def all_stages
|
31
|
-
stages + artifacts.map(&:all_stages).flatten
|
21
|
+
def all_tagged_images
|
22
|
+
tagged_images.concat(artifacts.map(&:all_tagged_images).flatten).uniq(&:name)
|
32
23
|
end
|
33
24
|
|
34
25
|
def last_stage
|
@@ -53,8 +44,13 @@ module Dapp
|
|
53
44
|
end
|
54
45
|
end
|
55
46
|
|
47
|
+
def tagged_images
|
48
|
+
images.select(&:tagged?)
|
49
|
+
end
|
50
|
+
alias export_images tagged_images
|
51
|
+
|
56
52
|
def import_images
|
57
|
-
|
53
|
+
images.select { |image| !image.tagged? }
|
58
54
|
end
|
59
55
|
|
60
56
|
def artifacts_stages
|
@@ -70,6 +66,10 @@ module Dapp
|
|
70
66
|
end
|
71
67
|
end
|
72
68
|
end
|
69
|
+
|
70
|
+
def images
|
71
|
+
stages.map(&:image).uniq(&:name)
|
72
|
+
end
|
73
73
|
end # Stages
|
74
74
|
end # Mod
|
75
75
|
end # Dimg
|
@@ -29,25 +29,10 @@ module Dapp
|
|
29
29
|
[:realm, :service, :scope].map do |option|
|
30
30
|
/#{option}="([[^"].]*)/ =~ header
|
31
31
|
next unless Regexp.last_match(1)
|
32
|
-
|
33
|
-
option_value = begin
|
34
|
-
if option == :scope
|
35
|
-
handle_scope_option(Regexp.last_match(1))
|
36
|
-
else
|
37
|
-
Regexp.last_match(1)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
[option, option_value]
|
32
|
+
[option, Regexp.last_match(1)]
|
42
33
|
end.compact.to_h
|
43
34
|
end
|
44
35
|
|
45
|
-
def handle_scope_option(resourcescope)
|
46
|
-
resource_type, resource_name, actions = resourcescope.split(":")
|
47
|
-
actions = actions.split(",").map { |action| action == "delete" ? "*" : action }.join(",")
|
48
|
-
[resource_type, resource_name, actions].join(":")
|
49
|
-
end
|
50
|
-
|
51
36
|
def authorization_auth
|
52
37
|
@authorization_auth ||= begin
|
53
38
|
if ::Dapp::Dapp.options_with_docker_credentials?
|
@@ -48,7 +48,7 @@ module Dapp
|
|
48
48
|
def submodule_artifact(submodule_params)
|
49
49
|
embedded_artifact(submodule_params)
|
50
50
|
rescue Rugged::InvalidError => e
|
51
|
-
raise Error::Rugged, code: :
|
51
|
+
raise Error::Rugged, code: :git_local_incorrect_gitmodules_params, data: { error: e.message }
|
52
52
|
end
|
53
53
|
|
54
54
|
def nested_git_directory_artifacts
|
@@ -90,7 +90,11 @@ module Dapp
|
|
90
90
|
|
91
91
|
{}.tap do |options|
|
92
92
|
options[:name] = repo.dapp.consistent_uniq_slugify("embedded-#{embedded_rel_path}")
|
93
|
-
options[:cwd] =
|
93
|
+
options[:cwd] = begin
|
94
|
+
subpath = Pathname(cwd).subpath_of(embedded_rel_path)
|
95
|
+
subpath = '' if subpath == '.'
|
96
|
+
subpath
|
97
|
+
end
|
94
98
|
options[:to] = Pathname(cwd).subpath_of?(embedded_rel_path) ? to : File.join(to, embedded_rel_path)
|
95
99
|
options[:include_paths] = embedded_inherit_paths(include_paths, embedded_rel_path)
|
96
100
|
options[:exclude_paths] = embedded_inherit_paths(exclude_paths, embedded_rel_path)
|
@@ -117,16 +121,22 @@ module Dapp
|
|
117
121
|
path_parts = path.split('/')
|
118
122
|
test_path = nil
|
119
123
|
inherited_paths = []
|
124
|
+
|
120
125
|
until path_parts.empty?
|
121
|
-
|
122
|
-
test_path
|
126
|
+
current_path_part = path_parts.shift
|
127
|
+
test_path = [test_path, current_path_part].compact.join('/')
|
128
|
+
|
129
|
+
match = File.fnmatch(test_path, embedded_rel_path, File::FNM_PATHNAME|File::FNM_DOTMATCH)
|
130
|
+
break unless match || File.fnmatch(File.join(test_path, '**'), embedded_rel_path, File::FNM_PATHNAME|File::FNM_DOTMATCH)
|
123
131
|
|
124
|
-
|
125
|
-
part_for_all = (last_part_path == '**')
|
132
|
+
any = (current_path_part == '**')
|
126
133
|
|
127
|
-
if
|
128
|
-
inherited_paths << [
|
129
|
-
|
134
|
+
if any
|
135
|
+
inherited_paths << [current_path_part, path_parts].flatten.join('/')
|
136
|
+
inherited_paths << path_parts.join('/') unless path_parts.empty?
|
137
|
+
elsif match
|
138
|
+
inherited_paths << (path_parts.empty? ? '**' : path_parts.join('/'))
|
139
|
+
break
|
130
140
|
end
|
131
141
|
end
|
132
142
|
|
@@ -61,8 +61,7 @@ module Dapp
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def submodules_params_base(gitsubmodule_content, paths: [], exclude_paths: [])
|
64
|
-
|
65
|
-
.to_h
|
64
|
+
submodules_file_parse!(gitsubmodule_content)
|
66
65
|
.select { |_, params| !ignore_directory?(params['path'], paths: paths, exclude_paths: exclude_paths) }
|
67
66
|
.map do |_, params|
|
68
67
|
params = params.symbolize_keys
|
@@ -73,6 +72,29 @@ module Dapp
|
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
75
|
+
def submodules_file_parse!(gitsubmodule_content)
|
76
|
+
raise_error = proc do |error_message|
|
77
|
+
raise Error::Rugged, code: :incorrect_gitmodules_file, data: { name: self.name,
|
78
|
+
error: error_message,
|
79
|
+
content: gitsubmodule_content.strip }
|
80
|
+
end
|
81
|
+
|
82
|
+
begin
|
83
|
+
IniFile.new.parse(gitsubmodule_content).to_h.tap do |submodules_params|
|
84
|
+
submodules_params.each do |name, params|
|
85
|
+
%w(path url).each do |field|
|
86
|
+
next unless params[field].nil? || params[field].empty?
|
87
|
+
raise_error.call("field `#{field}` required (#{name})")
|
88
|
+
end
|
89
|
+
|
90
|
+
raise_error.call("path should be relative (#{name})") unless Pathname(params['path']).relative?
|
91
|
+
end
|
92
|
+
end
|
93
|
+
rescue IniFile::Error => e
|
94
|
+
raise_error.call(e.message)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
76
98
|
def submodule_url(gitsubmodule_url)
|
77
99
|
if gitsubmodule_url.start_with?('../')
|
78
100
|
case remote_origin_url_protocol
|
@@ -178,6 +200,10 @@ module Dapp
|
|
178
200
|
git.lookup(commit)
|
179
201
|
end
|
180
202
|
|
203
|
+
def empty?
|
204
|
+
git.empty?
|
205
|
+
end
|
206
|
+
|
181
207
|
protected
|
182
208
|
|
183
209
|
def git(**kwargs)
|
@@ -30,7 +30,7 @@ module Dapp
|
|
30
30
|
{{- else }}
|
31
31
|
- name: B
|
32
32
|
value: value2
|
33
|
-
{{- if or (eq .Values.global.env "
|
33
|
+
{{- if or (eq .Values.global.env "stage") (eq .Values.global.env "test") }}
|
34
34
|
- name: C
|
35
35
|
value: value3
|
36
36
|
{{- end }}
|
@@ -64,8 +64,7 @@ spec:
|
|
64
64
|
secretName: {{ .Chart.Name }}-backend
|
65
65
|
containers:
|
66
66
|
- command: [ '/bin/bash', '-l', '-c', 'bundle exec ctl start' ]
|
67
|
-
|
68
|
-
imagePullPolicy: Always
|
67
|
+
{{ tuple "dimg-name" . | include "dapp_container_image" | indent 8 }} # or nameless dimg {{ tuple . | include "dapp_container_image" }}
|
69
68
|
name: {{ .Chart.Name }}-backend
|
70
69
|
livenessProbe:
|
71
70
|
httpGet:
|
@@ -79,7 +78,7 @@ spec:
|
|
79
78
|
name: http
|
80
79
|
protocol: TCP
|
81
80
|
env:
|
82
|
-
{{
|
81
|
+
{{ tuple "dimg-name" . | include "dapp_container_env" | indent 10 }}
|
83
82
|
---
|
84
83
|
apiVersion: v1
|
85
84
|
kind: Service
|
@@ -101,4 +100,4 @@ spec:
|
|
101
100
|
end
|
102
101
|
end
|
103
102
|
end
|
104
|
-
end
|
103
|
+
end
|
@@ -35,12 +35,6 @@ module Dapp
|
|
35
35
|
'/apis/batch/v1' => [:job, ],
|
36
36
|
'/apis/batch/v1beta1' => [:cronjob, ],
|
37
37
|
},
|
38
|
-
'1.11' => {
|
39
|
-
'/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
|
40
|
-
'/apis/apps/v1' => [:daemonset, :deployment, :replicaset, :statefulset, ],
|
41
|
-
'/apis/batch/v1' => [:job, ],
|
42
|
-
'/apis/batch/v1beta1' => [:cronjob, ],
|
43
|
-
},
|
44
38
|
'stable' => {
|
45
39
|
'/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
|
46
40
|
'/apis/batch/v1' => [:job, ],
|
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.
|
4
|
+
version: 0.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -234,14 +234,14 @@ dependencies:
|
|
234
234
|
requirements:
|
235
235
|
- - "~>"
|
236
236
|
- !ruby/object:Gem::Version
|
237
|
-
version: '
|
237
|
+
version: '1.7'
|
238
238
|
type: :development
|
239
239
|
prerelease: false
|
240
240
|
version_requirements: !ruby/object:Gem::Requirement
|
241
241
|
requirements:
|
242
242
|
- - "~>"
|
243
243
|
- !ruby/object:Gem::Version
|
244
|
-
version: '
|
244
|
+
version: '1.7'
|
245
245
|
- !ruby/object:Gem::Dependency
|
246
246
|
name: rake
|
247
247
|
requirement: !ruby/object:Gem::Requirement
|
@@ -773,7 +773,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
773
773
|
version: 2.5.0
|
774
774
|
requirements: []
|
775
775
|
rubyforge_project:
|
776
|
-
rubygems_version: 2.
|
776
|
+
rubygems_version: 2.5.1
|
777
777
|
signing_key:
|
778
778
|
specification_version: 4
|
779
779
|
summary: Build docker packaged apps using chef or shell
|