dapp 0.32.10 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dapp +1 -23
- data/config/en/net_status.yml +7 -0
- data/lib/dapp.rb +3 -3
- data/lib/dapp/dapp.rb +13 -0
- data/lib/dapp/dapp/dappfile.rb +2 -2
- data/lib/dapp/dapp/deps/base.rb +5 -37
- data/lib/dapp/dapp/deps/common.rb +25 -0
- data/lib/dapp/dapp/deps/gitartifact.rb +2 -25
- data/lib/dapp/dapp/deps/toolchain.rb +1 -23
- data/lib/dapp/dapp/logging/base.rb +3 -3
- data/lib/dapp/dapp/ruby2go.rb +96 -0
- data/lib/dapp/dapp/sentry.rb +0 -1
- data/lib/dapp/dapp/shellout/base.rb +4 -2
- data/lib/dapp/dimg/build/stage/artifact_base.rb +7 -6
- data/lib/dapp/dimg/build/stage/base.rb +37 -7
- data/lib/dapp/dimg/build/stage/from.rb +1 -1
- data/lib/dapp/dimg/builder/ansible.rb +1 -209
- data/lib/dapp/dimg/builder/base.rb +0 -5
- data/lib/dapp/dimg/builder/none.rb +1 -34
- data/lib/dapp/dimg/builder/ruby2go.rb +51 -0
- data/lib/dapp/dimg/builder/shell.rb +1 -25
- data/lib/dapp/dimg/cli/command/dimg/bp.rb +10 -15
- data/lib/dapp/dimg/cli/command/dimg/build.rb +0 -5
- data/lib/dapp/dimg/config/directive/docker/base.rb +1 -1
- data/lib/dapp/dimg/dapp/command/build_context/export.rb +1 -1
- data/lib/dapp/dimg/dapp/command/build_context/import.rb +1 -1
- data/lib/dapp/dimg/dapp/command/cleanup_repo.rb +59 -90
- data/lib/dapp/dimg/dapp/command/common.rb +60 -74
- data/lib/dapp/dimg/dapp/command/mrproper.rb +2 -17
- data/lib/dapp/dimg/dapp/command/stages/cleanup_local.rb +9 -6
- data/lib/dapp/dimg/dimg.rb +26 -43
- data/lib/dapp/dimg/docker_registry/base/authorization.rb +1 -16
- data/lib/dapp/dimg/git_artifact.rb +142 -21
- data/lib/dapp/dimg/git_repo/base.rb +11 -0
- data/lib/dapp/dimg/git_repo/local.rb +14 -0
- data/lib/dapp/dimg/git_repo/remote.rb +25 -34
- data/lib/dapp/dimg/image/argument.rb +12 -58
- data/lib/dapp/dimg/image/stage.rb +202 -43
- data/lib/dapp/kube/kubernetes/client.rb +0 -6
- data/lib/dapp/kube/kubernetes/manager/deployment.rb +18 -30
- data/lib/dapp/version.rb +1 -1
- metadata +8 -8
- data/lib/dapp/dimg/builder/ansible/assets.rb +0 -349
- data/lib/dapp/dimg/exception/introspect_image.rb +0 -7
- data/lib/dapp/dimg/image/docker.rb +0 -144
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fc1909cdd095becba425a53927039f907538f09d0edcd3b218555d2baed57c6
|
4
|
+
data.tar.gz: eeee7455c2b3e82ed7b6feba45878880291afaf318a9943412b883cf63063272
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52804dc919d1c0c634e387bfee8ad75d7177da13b7ee47ec831789cc15c90e34db58a789b34eb6fee71131f7b33133745cdf174bec6a9af113a263185bad51ee
|
7
|
+
data.tar.gz: 0380034c4898b6eeeed23426b321a90c54be38398bf985b6aacadfa7d16aae761a2077b483465e399a4632c87251ad3c8802b108102eee0a3ace756580568af1
|
data/bin/dapp
CHANGED
@@ -74,29 +74,7 @@ set_gitlab_cancel_handler if ENV["GITLAB_CI"]
|
|
74
74
|
begin
|
75
75
|
begin
|
76
76
|
begin
|
77
|
-
|
78
|
-
Dapp::CLI.new.run
|
79
|
-
ensure
|
80
|
-
if Time.now.to_date < Date.parse("2019-11-01")
|
81
|
-
STDERR.puts
|
82
|
-
STDERR.puts ::Paint["###################################################################", :red, :bold]
|
83
|
-
STDERR.puts ::Paint["### DEPRECATION WARNING! ###", :red, :bold]
|
84
|
-
STDERR.puts ::Paint["### Dapp will be deprecated for use starting with 01.11.2019! ###", :red, :bold]
|
85
|
-
STDERR.puts ::Paint["### Please port your project to werf: ###", :red, :bold]
|
86
|
-
STDERR.puts ::Paint["### https://werf.io ###", :red, :bold]
|
87
|
-
STDERR.puts ::Paint["###################################################################", :red, :bold]
|
88
|
-
STDERR.puts
|
89
|
-
else
|
90
|
-
STDERR.puts
|
91
|
-
STDERR.puts ::Paint["######################################################################", :red, :bold]
|
92
|
-
STDERR.puts ::Paint["### DEPRECATION WARNING! ###", :red, :bold]
|
93
|
-
STDERR.puts ::Paint["### Dapp is deprecated for use and will not receive any support! ###", :red, :bold]
|
94
|
-
STDERR.puts ::Paint["### Please port your project to werf: ###", :red, :bold]
|
95
|
-
STDERR.puts ::Paint["### https://werf.io ###", :red, :bold]
|
96
|
-
STDERR.puts ::Paint["######################################################################", :red, :bold]
|
97
|
-
STDERR.puts
|
98
|
-
end
|
99
|
-
end
|
77
|
+
Dapp::CLI.new.run
|
100
78
|
rescue Dapp::Error::Base => e
|
101
79
|
unless (message = Dapp::Helper::NetStatus.before_error_message(e)).empty?
|
102
80
|
$stderr.puts(message)
|
data/config/en/net_status.yml
CHANGED
@@ -10,6 +10,10 @@ en:
|
|
10
10
|
dappfile:
|
11
11
|
incorrect: "Dappfile with `%{error}`:\n%{message}"
|
12
12
|
build:
|
13
|
+
ruby2go_image_unexpected_exitstatus: 'ruby2go_image exited with unexpected code `%{status_code}`!'
|
14
|
+
ruby2go_image_command_failed: 'ruby2go_image command `%{command}` failed!'
|
15
|
+
ruby2go_image_command_failed_unexpected_error: 'ruby2go_image command `%{command}` failed: `%{message}`!'
|
16
|
+
ruby2go_builder_command_failed_unexpected_error: 'ruby2go_builder command `%{command}` failed: `%{message}`!'
|
13
17
|
from_image_required: 'Missing from_image!'
|
14
18
|
image_already_untagged: "Image `%{name}` untagged already!"
|
15
19
|
image_not_exist: "Image `%{name}` doesn't exist!"
|
@@ -65,6 +69,9 @@ en:
|
|
65
69
|
ci_environment_required: 'CI environment required (Travis or GitLab CI)!'
|
66
70
|
git_branch_without_name: "Dimg has specific revision that isn't associated with a branch name!"
|
67
71
|
download_failed_bad_dappfile_yml_checksum: "Cannot download dappfile-yml binary dependency from %{url}: checksum validation failed"
|
72
|
+
ruby2go_download_failed_bad_checksum: "Cannot download `%{progname}` binary dependency from %{url}: checksum validation failed"
|
73
|
+
ruby2go_command_unexpected_exitstatus: 'ruby2go `%{progname}` exited with unexpected code `%{status_code}`!'
|
74
|
+
ruby2go_dappdeps_command_failed_unexpected_error: 'ruby2go_dappdeps command `%{dappdeps}`/`%{command}` failed: `%{message}`!'
|
68
75
|
config:
|
69
76
|
dimg_name_required: 'Dimg name required!'
|
70
77
|
dimg_name_incorrect: "Dimg has incorrect name `%{value}`: doesn't match regex `%{pattern}`!"
|
data/lib/dapp.rb
CHANGED
@@ -73,10 +73,12 @@ require 'dapp/dapp/chef'
|
|
73
73
|
require 'dapp/dapp/dapp_config'
|
74
74
|
require 'dapp/dapp/option_tags'
|
75
75
|
require 'dapp/dapp/slug'
|
76
|
+
require 'dapp/dapp/ruby2go'
|
76
77
|
require 'dapp/dapp/logging/base'
|
77
78
|
require 'dapp/dapp/logging/process'
|
78
79
|
require 'dapp/dapp/logging/paint'
|
79
80
|
require 'dapp/dapp/logging/i18n'
|
81
|
+
require 'dapp/dapp/deps/common'
|
80
82
|
require 'dapp/dapp/deps/toolchain'
|
81
83
|
require 'dapp/dapp/deps/base'
|
82
84
|
require 'dapp/dapp/deps/gitartifact'
|
@@ -149,17 +151,16 @@ require 'dapp/dimg/error/registry'
|
|
149
151
|
require 'dapp/dimg/error/chef'
|
150
152
|
require 'dapp/dimg/error/lock'
|
151
153
|
require 'dapp/dimg/exception/base'
|
152
|
-
require 'dapp/dimg/exception/introspect_image'
|
153
154
|
require 'dapp/dimg/exception/registry'
|
154
155
|
require 'dapp/dimg/builder'
|
155
156
|
require 'dapp/dimg/builder/base'
|
157
|
+
require 'dapp/dimg/builder/ruby2go'
|
156
158
|
require 'dapp/dimg/builder/chef'
|
157
159
|
require 'dapp/dimg/builder/chef/cookbook_metadata'
|
158
160
|
require 'dapp/dimg/builder/chef/berksfile'
|
159
161
|
require 'dapp/dimg/builder/chef/cookbook'
|
160
162
|
require 'dapp/dimg/builder/shell'
|
161
163
|
require 'dapp/dimg/builder/ansible'
|
162
|
-
require 'dapp/dimg/builder/ansible/assets'
|
163
164
|
require 'dapp/dimg/builder/none'
|
164
165
|
require 'dapp/dimg/build/stage/mod/logging'
|
165
166
|
require 'dapp/dimg/build/stage/mod/group'
|
@@ -280,7 +281,6 @@ require 'dapp/dimg/git_repo/own'
|
|
280
281
|
require 'dapp/dimg/git_repo/remote'
|
281
282
|
require 'dapp/dimg/git_artifact'
|
282
283
|
require 'dapp/dimg/image/argument'
|
283
|
-
require 'dapp/dimg/image/docker'
|
284
284
|
require 'dapp/dimg/image/stage'
|
285
285
|
require 'dapp/dimg/image/dimg'
|
286
286
|
require 'dapp/dimg/image/scratch'
|
data/lib/dapp/dapp.rb
CHANGED
@@ -21,6 +21,7 @@ module Dapp
|
|
21
21
|
|
22
22
|
include SshAgent
|
23
23
|
include Sentry
|
24
|
+
include Ruby2Go
|
24
25
|
|
25
26
|
include Helper::Sha256
|
26
27
|
extend Helper::Trivia
|
@@ -28,6 +29,7 @@ module Dapp
|
|
28
29
|
include Helper::Tar
|
29
30
|
include Helper::Url
|
30
31
|
|
32
|
+
include Deps::Common
|
31
33
|
include Deps::Toolchain
|
32
34
|
include Deps::Gitartifact
|
33
35
|
include Deps::Base
|
@@ -36,6 +38,13 @@ module Dapp
|
|
36
38
|
|
37
39
|
attr_reader :options
|
38
40
|
|
41
|
+
def get_ruby2go_state_hash
|
42
|
+
{
|
43
|
+
"Name" => name.to_s,
|
44
|
+
"WorkDir" => work_dir.to_s,
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
39
48
|
def initialize(options: {})
|
40
49
|
self.class.options.merge!(options)
|
41
50
|
Logging::I18n.initialize
|
@@ -43,6 +52,9 @@ module Dapp
|
|
43
52
|
Logging::Paint.initialize(option_color)
|
44
53
|
|
45
54
|
@_call_before_terminate = []
|
55
|
+
@_call_after_before_terminate = []
|
56
|
+
|
57
|
+
ruby2go_init
|
46
58
|
end
|
47
59
|
|
48
60
|
def options
|
@@ -148,6 +160,7 @@ module Dapp
|
|
148
160
|
|
149
161
|
def terminate
|
150
162
|
@_call_before_terminate.each {|on_terminate| on_terminate.call(self)}
|
163
|
+
@_call_after_before_terminate.each {|on_terminate| on_terminate.call(self)}
|
151
164
|
FileUtils.rmtree(host_docker_tmp_config_dir)
|
152
165
|
end
|
153
166
|
|
data/lib/dapp/dapp/dappfile.rb
CHANGED
@@ -126,12 +126,12 @@ module Dapp
|
|
126
126
|
return if File.exists? dappfile_yml_bin_path
|
127
127
|
|
128
128
|
log_process("Downloading dappfile-yml dapp dependency") do
|
129
|
-
location = URI("https://dl.bintray.com/dapp
|
129
|
+
location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/dappfile-yml")
|
130
130
|
|
131
131
|
tmp_bin_path = File.join(self.class.tmp_base_dir, "dappfile-yml-#{SecureRandom.uuid}")
|
132
132
|
::Dapp::Downloader.download(location, tmp_bin_path, show_progress: true, progress_titile: dappfile_yml_bin_path)
|
133
133
|
|
134
|
-
checksum_location = URI("https://dl.bintray.com/dapp
|
134
|
+
checksum_location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/dappfile-yml.sha")
|
135
135
|
tmp_bin_checksum_path = tmp_bin_path + ".checksum"
|
136
136
|
::Dapp::Downloader.download(checksum_location, tmp_bin_checksum_path)
|
137
137
|
|
data/lib/dapp/dapp/deps/base.rb
CHANGED
@@ -2,55 +2,23 @@ module Dapp
|
|
2
2
|
class Dapp
|
3
3
|
module Deps
|
4
4
|
module Base
|
5
|
-
BASE_VERSION = "0.2.3"
|
6
|
-
|
7
|
-
def base_container_name # FIXME: hashsum(image) or dockersafe()
|
8
|
-
"dappdeps_base_#{BASE_VERSION}"
|
9
|
-
end
|
10
|
-
|
11
5
|
def base_container
|
12
|
-
|
13
|
-
is_container_exist = proc{shellout("#{host_docker} inspect #{base_container_name}").exitstatus.zero?}
|
14
|
-
if !is_container_exist.call
|
15
|
-
lock("dappdeps.container.#{base_container_name}", default_timeout: 600) do
|
16
|
-
if !is_container_exist.call
|
17
|
-
log_secondary_process(t(code: 'process.base_container_creating', data: {name: base_container_name}), short: true) do
|
18
|
-
shellout!(
|
19
|
-
["#{host_docker} create",
|
20
|
-
"--name #{base_container_name}",
|
21
|
-
"--volume /.dapp/deps/base/#{BASE_VERSION} dappdeps/base:#{BASE_VERSION}"].join(' ')
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
base_container_name
|
28
|
-
end
|
6
|
+
dappdeps_container(:base)
|
29
7
|
end
|
30
8
|
|
31
9
|
def dappdeps_base_path
|
32
|
-
|
10
|
+
ruby2go_dappdeps_command(dappdeps: :base, command: :path)
|
33
11
|
end
|
34
12
|
|
35
13
|
%w(rm rsync diff date cat
|
36
14
|
stat readlink test sleep mkdir
|
37
15
|
install sed cp true find
|
38
|
-
bash tar sudo base64).each do |
|
39
|
-
define_method("#{
|
16
|
+
bash tar sudo base64).each do |bin|
|
17
|
+
define_method("#{bin}_bin") { ruby2go_dappdeps_command(dappdeps: :base, command: :bin, options: { bin: bin }) }
|
40
18
|
end
|
41
19
|
|
42
20
|
def sudo_command(owner: nil, group: nil)
|
43
|
-
|
44
|
-
if owner || group
|
45
|
-
sudo = "#{sudo_bin} -E "
|
46
|
-
sudo += "-u #{sudo_format_user(owner)} " if owner
|
47
|
-
sudo += "-g #{sudo_format_user(group)} " if group
|
48
|
-
end
|
49
|
-
sudo
|
50
|
-
end
|
51
|
-
|
52
|
-
def sudo_format_user(user)
|
53
|
-
user.to_s.to_i.to_s == user.to_s ? "\\\##{user}" : user
|
21
|
+
ruby2go_dappdeps_command(dappdeps: :base, command: :sudo_command, options: { owner: owner, group: group })
|
54
22
|
end
|
55
23
|
end # Base
|
56
24
|
end # Deps
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Dapp
|
2
|
+
class Dapp
|
3
|
+
module Deps
|
4
|
+
module Common
|
5
|
+
def dappdeps_container(dappdeps)
|
6
|
+
dappdeps_containers[dappdeps] ||= ruby2go_dappdeps_command(dappdeps: dappdeps, command: :container)
|
7
|
+
end
|
8
|
+
|
9
|
+
def dappdeps_containers
|
10
|
+
@dappdeps_containers ||= {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def ruby2go_dappdeps_command(dappdeps:, command:, **options)
|
14
|
+
ruby2go_dappdeps(dappdeps: dappdeps, command: command, **options).tap do |res|
|
15
|
+
unless res["error"].nil?
|
16
|
+
raise Error::Dapp, code: :ruby2go_dappdeps_command_failed_unexpected_error,
|
17
|
+
data: { dappdeps: dappdeps, command: command, message: res["error"] }
|
18
|
+
end
|
19
|
+
break res['data']
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end # Base
|
23
|
+
end # Deps
|
24
|
+
end # Dapp
|
25
|
+
end # Dapp
|
@@ -2,35 +2,12 @@ module Dapp
|
|
2
2
|
class Dapp
|
3
3
|
module Deps
|
4
4
|
module Gitartifact
|
5
|
-
GITARTIFACT_VERSION = "0.2.1"
|
6
|
-
|
7
|
-
def gitartifact_container_name # FIXME: hashsum(image) or dockersafe()
|
8
|
-
"dappdeps_gitartifact_#{GITARTIFACT_VERSION}"
|
9
|
-
end
|
10
|
-
|
11
5
|
def gitartifact_container
|
12
|
-
|
13
|
-
is_container_exist = proc{shellout("#{host_docker} inspect #{gitartifact_container_name}").exitstatus.zero?}
|
14
|
-
if !is_container_exist.call
|
15
|
-
lock("dappdeps.container.#{gitartifact_container_name}", default_timeout: 600) do
|
16
|
-
if !is_container_exist.call
|
17
|
-
log_secondary_process(t(code: 'process.gitartifact_container_creating', data: {name: gitartifact_container_name}), short: true) do
|
18
|
-
shellout!(
|
19
|
-
["#{host_docker} create",
|
20
|
-
"--name #{gitartifact_container_name}",
|
21
|
-
"--volume /.dapp/deps/gitartifact/#{GITARTIFACT_VERSION}",
|
22
|
-
"dappdeps/gitartifact:#{GITARTIFACT_VERSION}"].join(' ')
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
gitartifact_container_name
|
29
|
-
end
|
6
|
+
dappdeps_container(:gitartifact)
|
30
7
|
end
|
31
8
|
|
32
9
|
def git_bin
|
33
|
-
|
10
|
+
ruby2go_dappdeps_command(dappdeps: :gitartifact, command: :bin)
|
34
11
|
end
|
35
12
|
end # Gitartifact
|
36
13
|
end # Deps
|
@@ -2,30 +2,8 @@ module Dapp
|
|
2
2
|
class Dapp
|
3
3
|
module Deps
|
4
4
|
module Toolchain
|
5
|
-
TOOLCHAIN_VERSION = "0.1.1"
|
6
|
-
|
7
|
-
def toolchain_container_name # FIXME: hashsum(image) or dockersafe()
|
8
|
-
"dappdeps_toolchain_#{TOOLCHAIN_VERSION}"
|
9
|
-
end
|
10
|
-
|
11
5
|
def toolchain_container
|
12
|
-
|
13
|
-
is_container_exist = proc {shellout("#{host_docker} inspect #{toolchain_container_name}").exitstatus.zero?}
|
14
|
-
if !is_container_exist.call
|
15
|
-
lock("dappdeps.container.#{toolchain_container_name}", default_timeout: 600) do
|
16
|
-
if !is_container_exist.call
|
17
|
-
log_secondary_process(t(code: 'process.toolchain_container_creating', data: {name: toolchain_container_name}), short: true) do
|
18
|
-
shellout!(
|
19
|
-
["#{host_docker} create",
|
20
|
-
"--name #{toolchain_container_name}",
|
21
|
-
"--volume /.dapp/deps/toolchain/#{TOOLCHAIN_VERSION} dappdeps/toolchain:#{TOOLCHAIN_VERSION}"].join(' ')
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
toolchain_container_name
|
28
|
-
end
|
6
|
+
dappdeps_container(:toolchain)
|
29
7
|
end
|
30
8
|
end # Toolchain
|
31
9
|
end # Deps
|
@@ -27,15 +27,15 @@ module Dapp
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def ignore_config_warning?
|
30
|
-
options[:ignore_config_warning]
|
30
|
+
!!options[:ignore_config_warning]
|
31
31
|
end
|
32
32
|
|
33
33
|
def introspect_error?
|
34
|
-
options[:introspect_error]
|
34
|
+
!!options[:introspect_error]
|
35
35
|
end
|
36
36
|
|
37
37
|
def introspect_before_error?
|
38
|
-
options[:introspect_before_error]
|
38
|
+
!!options[:introspect_before_error]
|
39
39
|
end
|
40
40
|
|
41
41
|
def dry_run?
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Dapp
|
2
|
+
class Dapp
|
3
|
+
module Ruby2Go
|
4
|
+
def ruby2go_image(args_hash)
|
5
|
+
_ruby2go("image", args_hash)
|
6
|
+
end
|
7
|
+
|
8
|
+
def ruby2go_builder(args_hash)
|
9
|
+
_ruby2go("builder", args_hash)
|
10
|
+
end
|
11
|
+
|
12
|
+
def ruby2go_git_artifact(args_hash)
|
13
|
+
_ruby2go("git-artifact", args_hash)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ruby2go_dappdeps(args_hash)
|
17
|
+
_ruby2go("dappdeps", args_hash)
|
18
|
+
end
|
19
|
+
|
20
|
+
def ruby2go_git_repo(args_hash)
|
21
|
+
_ruby2go("git-repo", args_hash)
|
22
|
+
end
|
23
|
+
|
24
|
+
def ruby2go_init
|
25
|
+
@_call_after_before_terminate << proc {
|
26
|
+
FileUtils.rmtree(@_ruby2go_tmp_dir) if @_ruby2go_tmp_dir
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def _ruby2go_bin_path_env_var_name(progname)
|
31
|
+
"DAPP_BIN_#{progname.gsub("-", "_").upcase}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def _ruby2go(progname, args_hash)
|
35
|
+
call_id = SecureRandom.uuid
|
36
|
+
|
37
|
+
args_file = File.join(_ruby2go_tmp_dir, "args.#{call_id}.json")
|
38
|
+
File.open(args_file, "w") {|f| f.write JSON.dump(args_hash)}
|
39
|
+
|
40
|
+
res_file = File.join(_ruby2go_tmp_dir, "res.#{call_id}.json")
|
41
|
+
|
42
|
+
if bin_path = ENV[_ruby2go_bin_path_env_var_name(progname)]
|
43
|
+
unless File.exists? bin_path
|
44
|
+
raise ::Dapp::Error::Dapp,
|
45
|
+
code: :ruby2go_bin_path_not_found,
|
46
|
+
data: {env_var_name: _ruby2go_bin_path_env_var_name(progname), path: bin_path}
|
47
|
+
end
|
48
|
+
else
|
49
|
+
bin_path = File.join(::Dapp::Dapp.home_dir, "bin", progname, ::Dapp::VERSION, progname)
|
50
|
+
unless File.exists? bin_path
|
51
|
+
_download_ruby2go_bin(progname, bin_path)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
system("#{bin_path} -args-from-file #{args_file} -result-to-file #{res_file}")
|
56
|
+
status_code = $?.exitstatus
|
57
|
+
if [0, 16].include?(status_code)
|
58
|
+
res = nil
|
59
|
+
File.open(res_file, "r") {|f| res = JSON.load(f.read)}
|
60
|
+
res
|
61
|
+
else
|
62
|
+
raise ::Dapp::Error::Base, code: :ruby2go_command_unexpected_exitstatus, data: { progname: progname, status_code: status_code }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def _ruby2go_tmp_dir
|
67
|
+
@_ruby2go_tmp_dir ||= Dir.mktmpdir('dapp-ruby2go-', tmp_base_dir)
|
68
|
+
end
|
69
|
+
|
70
|
+
def _download_ruby2go_bin(progname, bin_path)
|
71
|
+
lock("downloader.bin.#{progname}", default_timeout: 1800) do
|
72
|
+
return if File.exists? bin_path
|
73
|
+
|
74
|
+
log_process("Downloading #{progname} dapp dependency") do
|
75
|
+
location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/#{progname}")
|
76
|
+
|
77
|
+
tmp_bin_path = File.join(self.class.tmp_base_dir, "#{progname}-#{SecureRandom.uuid}")
|
78
|
+
::Dapp::Downloader.download(location, tmp_bin_path, show_progress: true, progress_titile: bin_path)
|
79
|
+
|
80
|
+
checksum_location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/#{progname}.sha")
|
81
|
+
tmp_bin_checksum_path = tmp_bin_path + ".checksum"
|
82
|
+
::Dapp::Downloader.download(checksum_location, tmp_bin_checksum_path)
|
83
|
+
|
84
|
+
if Digest::SHA256.hexdigest(File.read(tmp_bin_path)) != File.read(tmp_bin_checksum_path).strip
|
85
|
+
raise ::Dapp::Error::Dapp, code: :ruby2go_download_failed_bad_checksum, data: {url: location.to_s, checksum_url: checksum_location.to_s, progname: progname}
|
86
|
+
end
|
87
|
+
|
88
|
+
File.chmod(0755, tmp_bin_path)
|
89
|
+
FileUtils.mkdir_p File.dirname(bin_path)
|
90
|
+
FileUtils.mv tmp_bin_path, bin_path
|
91
|
+
end # log_process
|
92
|
+
end # lock
|
93
|
+
end
|
94
|
+
end # Ruby2Go
|
95
|
+
end # Dapp
|
96
|
+
end # Dapp
|
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"],
|