dapp 0.22.6 → 0.22.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dapp +9 -5
- data/config/en/common.yml +2 -0
- data/config/en/net_status.yml +9 -12
- data/lib/dapp.rb +12 -47
- data/lib/dapp/cli/command/options/tag.rb +39 -0
- data/lib/dapp/config/directive/base.rb +2 -1
- data/lib/dapp/dapp.rb +6 -9
- data/lib/dapp/dapp/command/common.rb +9 -4
- data/lib/dapp/dapp/logging/i18n.rb +5 -1
- data/lib/dapp/dapp/logging/process.rb +2 -2
- data/lib/dapp/deployment/config/config.rb +5 -5
- data/lib/dapp/deployment/config/directive/expose.rb +1 -1
- data/lib/dapp/deployment/config/directive/namespace/instance_methods.rb +1 -1
- data/lib/dapp/deployment/error/app.rb +1 -1
- data/lib/dapp/deployment/error/{base.rb → default.rb} +1 -1
- data/lib/dapp/deployment/error/deployment.rb +1 -1
- data/lib/dapp/deployment/error/kubernetes.rb +1 -1
- data/lib/dapp/deployment/kubernetes.rb +3 -3
- data/lib/dapp/deployment/kubernetes/error.rb +4 -4
- data/lib/dapp/deployment/secret.rb +1 -1
- data/lib/dapp/dimg/cli/command/dimg.rb +2 -1
- data/lib/dapp/dimg/cli/command/dimg/build_context/export.rb +5 -0
- data/lib/dapp/dimg/cli/command/dimg/flush_local.rb +24 -0
- data/lib/dapp/dimg/cli/command/dimg/push.rb +2 -26
- data/lib/dapp/dimg/cli/command/dimg/stages/base.rb +2 -2
- data/lib/dapp/dimg/cli/command/dimg/tag.rb +11 -4
- data/lib/dapp/dimg/config/config.rb +1 -1
- data/lib/dapp/dimg/config/directive/artifact.rb +5 -5
- data/lib/dapp/dimg/config/directive/artifact_base.rb +5 -5
- data/lib/dapp/dimg/config/directive/dimg/instance_methods.rb +1 -1
- data/lib/dapp/dimg/config/directive/dimg/validation.rb +11 -13
- data/lib/dapp/dimg/config/directive/docker/artifact.rb +1 -1
- data/lib/dapp/dimg/config/directive/docker/base.rb +1 -1
- data/lib/dapp/dimg/config/directive/git_artifact_local.rb +19 -3
- data/lib/dapp/dimg/config/directive/git_artifact_remote.rb +3 -1
- data/lib/dapp/dimg/config/directive/mount.rb +3 -3
- data/lib/dapp/dimg/dapp/command/build.rb +1 -1
- data/lib/dapp/dimg/dapp/command/build_context/export.rb +17 -13
- data/lib/dapp/dimg/dapp/command/build_context/import.rb +24 -17
- data/lib/dapp/dimg/dapp/command/cleanup_repo.rb +26 -33
- data/lib/dapp/dimg/dapp/command/common.rb +53 -56
- data/lib/dapp/dimg/dapp/command/flush_local.rb +18 -0
- data/lib/dapp/dimg/dapp/command/mrproper.rb +1 -1
- data/lib/dapp/dimg/dapp/command/push.rb +2 -8
- data/lib/dapp/dimg/dapp/command/spush.rb +2 -4
- data/lib/dapp/dimg/dapp/command/stages/cleanup_local.rb +41 -46
- data/lib/dapp/dimg/dapp/command/stages/cleanup_repo.rb +35 -39
- data/lib/dapp/dimg/dapp/command/stages/common.rb +13 -3
- data/lib/dapp/dimg/dapp/command/stages/flush_local.rb +1 -3
- data/lib/dapp/dimg/dapp/command/stages/flush_repo.rb +3 -3
- data/lib/dapp/dimg/dapp/command/stages/pull.rb +2 -12
- data/lib/dapp/dimg/dapp/command/stages/push.rb +2 -8
- data/lib/dapp/dimg/dapp/command/tag.rb +3 -6
- data/lib/dapp/dimg/dapp/dapp.rb +1 -0
- data/lib/dapp/dimg/dapp/dappfile.rb +11 -1
- data/lib/dapp/dimg/dimg.rb +39 -31
- data/lib/dapp/dimg/error/build.rb +1 -1
- data/lib/dapp/dimg/error/chef.rb +1 -5
- data/lib/dapp/dimg/error/{command.rb → default.rb} +1 -1
- data/lib/dapp/dimg/error/dimg.rb +1 -1
- data/lib/dapp/dimg/error/lock.rb +1 -1
- data/lib/dapp/dimg/error/registry.rb +1 -1
- data/lib/dapp/dimg/error/rugged.rb +1 -1
- data/lib/dapp/dimg/error/tar_writer.rb +1 -1
- data/lib/dapp/dimg/git_artifact.rb +3 -1
- data/lib/dapp/dimg/image/argument.rb +3 -1
- data/lib/dapp/dimg/image/dimg.rb +15 -0
- data/lib/dapp/dimg/image/stage.rb +0 -9
- data/lib/dapp/error/base.rb +1 -5
- data/lib/dapp/error/command.rb +5 -0
- data/lib/dapp/error/config.rb +5 -0
- data/lib/dapp/error/dapp.rb +1 -1
- data/lib/dapp/error/dappfile.rb +1 -1
- data/lib/dapp/error/default.rb +11 -0
- data/lib/dapp/error/mod/user.rb +11 -0
- data/lib/dapp/error/shellout.rb +1 -1
- data/lib/dapp/exception/base.rb +1 -1
- data/lib/dapp/helper/yaml.rb +3 -2
- data/lib/dapp/kube/cli/command/kube/deploy.rb +2 -26
- data/lib/dapp/kube/cli/command/kube/lint.rb +1 -26
- data/lib/dapp/kube/cli/command/kube/render.rb +2 -26
- data/lib/dapp/kube/cli/command/kube/secret_key_generate.rb +2 -2
- data/lib/dapp/kube/dapp/command/common.rb +19 -23
- data/lib/dapp/kube/dapp/command/deploy.rb +16 -9
- data/lib/dapp/kube/dapp/command/dismiss.rb +1 -1
- data/lib/dapp/kube/dapp/command/lint.rb +4 -10
- data/lib/dapp/kube/dapp/command/minikube_setup.rb +12 -18
- data/lib/dapp/kube/dapp/command/secret_edit.rb +2 -2
- data/lib/dapp/kube/error/{command.rb → default.rb} +1 -1
- data/lib/dapp/kube/error/kubernetes.rb +1 -1
- data/lib/dapp/kube/helm/release.rb +7 -33
- data/lib/dapp/kube/helm/values.rb +140 -0
- data/lib/dapp/kube/kubernetes/client.rb +9 -10
- data/lib/dapp/kube/kubernetes/client/error.rb +14 -8
- data/lib/dapp/kube/kubernetes/error.rb +15 -0
- data/lib/dapp/kube/kubernetes/manager/deployment.rb +2 -2
- data/lib/dapp/kube/secret.rb +1 -1
- data/lib/dapp/version.rb +1 -1
- metadata +15 -11
- data/lib/dapp/config/error/config.rb +0 -7
- data/lib/dapp/deployment/error/command.rb +0 -7
- data/lib/dapp/deployment/error/config.rb +0 -7
- data/lib/dapp/dimg/error/base.rb +0 -7
- data/lib/dapp/dimg/error/config.rb +0 -7
- data/lib/dapp/kube/error/base.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d39108e47246ec97bcdb25fd0464b58772efc23
|
4
|
+
data.tar.gz: 0d0262e3bd5675b69bc988e4c25588523e6881d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e182c079f4848bbf817d2380c1b3dae904eb6c69beebc541fcfaad6d480060608b5d3ecd126faa94cd2146345b57afdd96ba03aca8bd1b954db90b5192b7e7d
|
7
|
+
data.tar.gz: ac6a75467e166fa1a20c360cb2cb82846d8de06e3c3ba187cbcd281010a767309e2eef0ac3fb754d97e701bb80422b8f485703485b7184cfd42422f119cbf31e
|
data/bin/dapp
CHANGED
@@ -16,8 +16,8 @@ begin
|
|
16
16
|
|
17
17
|
raise
|
18
18
|
end
|
19
|
-
rescue ::SystemExit
|
20
|
-
|
19
|
+
rescue ::SystemExit then raise
|
20
|
+
rescue Errno::EPIPE then nil
|
21
21
|
rescue ::Exception => e
|
22
22
|
"/tmp/dapp-stacktrace-#{SecureRandom.uuid}.out".tap do |filename|
|
23
23
|
::File.open(filename, 'w') do |dapp_stacktrace|
|
@@ -31,9 +31,13 @@ begin
|
|
31
31
|
rescue Dapp::Error::Shellout => e
|
32
32
|
$stderr.puts(Dapp::Helper::NetStatus.message(e))
|
33
33
|
exit 1
|
34
|
-
rescue Dapp::Error::Base,
|
35
|
-
|
36
|
-
|
34
|
+
rescue Dapp::Error::Base, Dapp::Dapp::Logging::I18n::I18nError => e
|
35
|
+
if e.respond_to?(:user?) && e.user?
|
36
|
+
$stderr.puts(Dapp::Dapp.paint_string(Dapp::Helper::NetStatus.message(e), :warning))
|
37
|
+
exit 1
|
38
|
+
else
|
39
|
+
raise
|
40
|
+
end
|
37
41
|
rescue Interrupt => _e
|
38
42
|
$stderr.puts(Dapp::Dapp.paint_string('Interrupted', :warning))
|
39
43
|
exit 1
|
data/config/en/common.yml
CHANGED
@@ -27,6 +27,7 @@ en:
|
|
27
27
|
status:
|
28
28
|
process:
|
29
29
|
pushing: '[PUSHING]'
|
30
|
+
exporting: '[EXPORTING]'
|
30
31
|
pulling: '[PULLING]'
|
31
32
|
building: '[BUILDING]'
|
32
33
|
default: '[RUNNING]'
|
@@ -42,6 +43,7 @@ en:
|
|
42
43
|
rebuild: '[REBUILD]'
|
43
44
|
build: '[BUILD]'
|
44
45
|
push: '[PUSH]'
|
46
|
+
export: '[EXPORT]'
|
45
47
|
pull: '[PULL]'
|
46
48
|
tag: '[TAG]'
|
47
49
|
warning:
|
data/config/en/net_status.yml
CHANGED
@@ -6,9 +6,6 @@ en:
|
|
6
6
|
dimg:
|
7
7
|
dimg_not_built: "Dimg hasn't been built yet!"
|
8
8
|
dimg_not_run: "Dimg run failed!"
|
9
|
-
kube:
|
10
|
-
deploy_timeout: "Deploy timeout!"
|
11
|
-
connect_timeout: "Connect timeout when connecting to kube API."
|
12
9
|
dappfile:
|
13
10
|
incorrect: "Dappfile with `%{error}`:\n%{message}"
|
14
11
|
build:
|
@@ -45,6 +42,8 @@ en:
|
|
45
42
|
incorrect_yaml_structure: "Incorrect YAML structure in `%{path}`!"
|
46
43
|
editor_not_found: "Editor not found!"
|
47
44
|
expected_only_one_tag: 'Expected only one tag (`%{tags}`)!'
|
45
|
+
kube_deploy_timeout: "Deploy timeout!"
|
46
|
+
kube_connect_timeout: "Connect timeout when connecting to kube API."
|
48
47
|
dapp:
|
49
48
|
no_such_dimg: "No such dimg: `%{dimgs_patterns}`!"
|
50
49
|
no_such_app: "No such app: `%{apps_patterns}`!"
|
@@ -52,7 +51,7 @@ en:
|
|
52
51
|
cannot_run_ssh_agent: "Can't run ssh-agent!"
|
53
52
|
ssh_key_not_found: "Ssh key `%{path}` doesn't exist!"
|
54
53
|
docker_not_found: "Docker not found!"
|
55
|
-
docker_version: "Required docker version (`%{version}`):
|
54
|
+
docker_version: "Required docker version (`%{version}`): VERSION must be newer than `%{min_version}`!"
|
56
55
|
dapp_config_file_incorrect: "%{message}"
|
57
56
|
yaml_file_incorrect: "Yaml file `%{file}`: `%{message}`"
|
58
57
|
yaml_incorrect: "`%{message}`"
|
@@ -127,15 +126,13 @@ en:
|
|
127
126
|
app:
|
128
127
|
namespace_not_found: "App `%{name}`: namespace `%{namespace}` not found!"
|
129
128
|
namespace_not_defined: "App `%{name}`: namespace not defined!"
|
130
|
-
deployment:
|
131
|
-
namespace_not_found: "Deployment `%{name}`: namespace `%{namespace}` not found!"
|
132
|
-
namespace_not_defined: "Deployment `%{name}`: namespace not defined!"
|
133
|
-
bootstrap_failed: "Bootstrap failed:\n phase: `%{phase}`\n message: `%{message}`"
|
134
|
-
bootstrap_command_failed: "Bootstrap failed:\n reason: `%{reason}`\n message: `%{message}`\n exit_code: `%{exit_code}`"
|
135
|
-
bootstrap_image_not_found: "Bootstrap failed because `%{reason}`: `%{message}`"
|
136
129
|
kubernetes:
|
137
|
-
|
138
|
-
|
130
|
+
config_not_found: "Kube config `%{config_path}` not found!"
|
131
|
+
user_config_not_found: "User's `%{user}` config is not found in config %{config_path}"
|
132
|
+
cluster_config_not_found: "Cluster's `%{cluster}` config is not found in config %{config_path}"
|
133
|
+
config_context_not_found: "Context `%{context_name}` is not found in config %{config_path}"
|
134
|
+
server_connection_refused: "Kube server `%{url}` connection refused: %{error}"
|
135
|
+
server_error: "Kube respond with server error code %{response_http_status}, request parameters: `%{request_parameters}`, response: `%{response_raw_body}`"
|
139
136
|
secret:
|
140
137
|
bad_data: "Data `%{data}` can't be decrypted: check encryption key and data!"
|
141
138
|
key_length_too_short: "Encryption key isn't valid (required size %{required_size} bytes)!"
|
data/lib/dapp.rb
CHANGED
@@ -36,19 +36,23 @@ require 'dapp/helper/net_status'
|
|
36
36
|
require 'dapp/helper/tar'
|
37
37
|
require 'dapp/helper/yaml'
|
38
38
|
require 'dapp/prctl'
|
39
|
+
require 'dapp/error/mod/user'
|
39
40
|
require 'dapp/error/base'
|
41
|
+
require 'dapp/error/default'
|
40
42
|
require 'dapp/error/dapp'
|
41
43
|
require 'dapp/error/dappfile'
|
44
|
+
require 'dapp/error/command'
|
45
|
+
require 'dapp/error/config'
|
42
46
|
require 'dapp/error/shellout'
|
43
47
|
require 'dapp/exception/base'
|
44
48
|
require 'dapp/cli'
|
49
|
+
require 'dapp/cli/command/options/tag'
|
45
50
|
require 'dapp/cli/command/base'
|
46
51
|
require 'dapp/cli/command/update'
|
47
52
|
require 'dapp/cli/command/slug'
|
48
53
|
require 'dapp/cli/cli'
|
49
54
|
require 'dapp/config/directive/base'
|
50
55
|
require 'dapp/config/config'
|
51
|
-
require 'dapp/config/error/config'
|
52
56
|
require 'dapp/dapp/lock'
|
53
57
|
require 'dapp/dapp/ssh_agent'
|
54
58
|
require 'dapp/dapp/git_artifact'
|
@@ -69,53 +73,12 @@ require 'dapp/dapp/shellout/base'
|
|
69
73
|
require 'dapp/dapp/command/common'
|
70
74
|
require 'dapp/dapp/command/slug'
|
71
75
|
require 'dapp/dapp'
|
72
|
-
require 'dapp/deployment'
|
73
|
-
require 'dapp/deployment/config/directive/mod/group'
|
74
|
-
require 'dapp/deployment/config/directive/mod/jobs'
|
75
|
-
require 'dapp/deployment/error/base'
|
76
|
-
require 'dapp/deployment/error/config'
|
77
|
-
require 'dapp/deployment/error/app'
|
78
|
-
require 'dapp/deployment/error/command'
|
79
|
-
require 'dapp/deployment/error/kubernetes'
|
80
|
-
require 'dapp/deployment/error/deployment'
|
81
|
-
require 'dapp/deployment/config/directive/base'
|
82
|
-
require 'dapp/deployment/config/directive/expose'
|
83
|
-
require 'dapp/deployment/config/directive/namespace/instance_methods'
|
84
|
-
require 'dapp/deployment/config/directive/namespace'
|
85
|
-
require 'dapp/deployment/config/directive/app/instance_methods'
|
86
|
-
require 'dapp/deployment/config/directive/app'
|
87
|
-
require 'dapp/deployment/config/directive/group'
|
88
|
-
require 'dapp/deployment/config/directive/deployment'
|
89
|
-
require 'dapp/deployment/config/directive/job'
|
90
|
-
require 'dapp/deployment/config/config'
|
91
|
-
require 'dapp/deployment/core_ext/hash'
|
92
|
-
require 'dapp/deployment/mod/namespace'
|
93
|
-
require 'dapp/deployment/mod/system_environments'
|
94
|
-
require 'dapp/deployment/mod/jobs'
|
95
|
-
require 'dapp/deployment/app'
|
96
|
-
require 'dapp/deployment/deployment'
|
97
|
-
require 'dapp/deployment/kube_base'
|
98
|
-
require 'dapp/deployment/kube_app'
|
99
|
-
require 'dapp/deployment/kube_deployment'
|
100
|
-
require 'dapp/deployment/kubernetes'
|
101
|
-
require 'dapp/deployment/kubernetes/error'
|
102
|
-
require 'dapp/deployment/cli/command/base'
|
103
|
-
require 'dapp/deployment/cli/command/deployment'
|
104
|
-
require 'dapp/deployment/cli/command/deployment/apply'
|
105
|
-
require 'dapp/deployment/cli/command/deployment/mrproper'
|
106
|
-
require 'dapp/deployment/cli/cli'
|
107
|
-
require 'dapp/deployment/dapp/command/mrproper'
|
108
|
-
require 'dapp/deployment/dapp/command/apply'
|
109
|
-
require 'dapp/deployment/dapp/command/common'
|
110
|
-
require 'dapp/deployment/dapp/dappfile'
|
111
|
-
require 'dapp/deployment/dapp/dapp'
|
112
|
-
require 'dapp/deployment/secret'
|
113
76
|
require 'dapp/kube'
|
114
|
-
require 'dapp/kube/error/
|
115
|
-
require 'dapp/kube/error/command'
|
77
|
+
require 'dapp/kube/error/default'
|
116
78
|
require 'dapp/kube/error/kubernetes'
|
117
79
|
require 'dapp/kube/secret'
|
118
80
|
require 'dapp/kube/kubernetes'
|
81
|
+
require 'dapp/kube/kubernetes/error'
|
119
82
|
require 'dapp/kube/kubernetes/client'
|
120
83
|
require 'dapp/kube/kubernetes/client/error'
|
121
84
|
require 'dapp/kube/kubernetes/client/resource/base'
|
@@ -130,6 +93,7 @@ require 'dapp/kube/kubernetes/manager/container'
|
|
130
93
|
require 'dapp/kube/kubernetes/manager/job'
|
131
94
|
require 'dapp/kube/kubernetes/manager/deployment'
|
132
95
|
require 'dapp/kube/helm'
|
96
|
+
require 'dapp/kube/helm/values'
|
133
97
|
require 'dapp/kube/helm/release'
|
134
98
|
require 'dapp/kube/cli/command/base'
|
135
99
|
require 'dapp/kube/cli/command/kube'
|
@@ -213,6 +177,7 @@ require 'dapp/dimg/cli/command/dimg/stages/push'
|
|
213
177
|
require 'dapp/dimg/cli/command/dimg/stages/pull'
|
214
178
|
require 'dapp/dimg/cli/command/dimg/run'
|
215
179
|
require 'dapp/dimg/cli/command/dimg/cleanup_repo'
|
180
|
+
require 'dapp/dimg/cli/command/dimg/flush_local'
|
216
181
|
require 'dapp/dimg/cli/command/dimg/flush_repo'
|
217
182
|
require 'dapp/dimg/cli/command/dimg/cleanup'
|
218
183
|
require 'dapp/dimg/cli/command/dimg/bp'
|
@@ -243,6 +208,7 @@ require 'dapp/dimg/dapp/command/common'
|
|
243
208
|
require 'dapp/dimg/dapp/command/build'
|
244
209
|
require 'dapp/dimg/dapp/command/bp'
|
245
210
|
require 'dapp/dimg/dapp/command/cleanup_repo'
|
211
|
+
require 'dapp/dimg/dapp/command/flush_local'
|
246
212
|
require 'dapp/dimg/dapp/command/flush_repo'
|
247
213
|
require 'dapp/dimg/dapp/command/cleanup'
|
248
214
|
require 'dapp/dimg/dapp/command/mrproper'
|
@@ -270,7 +236,7 @@ require 'dapp/dimg/docker_registry/base/authorization'
|
|
270
236
|
require 'dapp/dimg/docker_registry/base'
|
271
237
|
require 'dapp/dimg/docker_registry/dimg'
|
272
238
|
require 'dapp/dimg/docker_registry/default'
|
273
|
-
require 'dapp/dimg/error/
|
239
|
+
require 'dapp/dimg/error/default'
|
274
240
|
require 'dapp/dimg/error/dimg'
|
275
241
|
require 'dapp/dimg/error/build'
|
276
242
|
require 'dapp/dimg/error/tar_writer'
|
@@ -278,8 +244,6 @@ require 'dapp/dimg/error/rugged'
|
|
278
244
|
require 'dapp/dimg/error/registry'
|
279
245
|
require 'dapp/dimg/error/chef'
|
280
246
|
require 'dapp/dimg/error/lock'
|
281
|
-
require 'dapp/dimg/error/config'
|
282
|
-
require 'dapp/dimg/error/command'
|
283
247
|
require 'dapp/dimg/exception/base'
|
284
248
|
require 'dapp/dimg/exception/introspect_image'
|
285
249
|
require 'dapp/dimg/exception/registry'
|
@@ -293,6 +257,7 @@ require 'dapp/dimg/git_artifact'
|
|
293
257
|
require 'dapp/dimg/image/argument'
|
294
258
|
require 'dapp/dimg/image/docker'
|
295
259
|
require 'dapp/dimg/image/stage'
|
260
|
+
require 'dapp/dimg/image/dimg'
|
296
261
|
require 'dapp/dimg/image/scratch'
|
297
262
|
require 'dapp/dimg/dimg/git_artifact'
|
298
263
|
require 'dapp/dimg/dimg/path'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Dapp
|
2
|
+
class CLI
|
3
|
+
module Command
|
4
|
+
module Options
|
5
|
+
module Tag
|
6
|
+
def self.extended(klass)
|
7
|
+
klass.class_eval do
|
8
|
+
option :tag,
|
9
|
+
long: '--tag TAG',
|
10
|
+
description: 'Add tag (can be used one or more times)',
|
11
|
+
default: [],
|
12
|
+
proc: proc { |v| composite_options(:tags) << v }
|
13
|
+
|
14
|
+
option :tag_branch,
|
15
|
+
long: '--tag-branch',
|
16
|
+
description: 'Tag by git branch',
|
17
|
+
boolean: true
|
18
|
+
|
19
|
+
option :tag_build_id,
|
20
|
+
long: '--tag-build-id',
|
21
|
+
description: 'Tag by CI build id',
|
22
|
+
boolean: true
|
23
|
+
|
24
|
+
option :tag_ci,
|
25
|
+
long: '--tag-ci',
|
26
|
+
description: 'Tag by CI branch and tag',
|
27
|
+
boolean: true
|
28
|
+
|
29
|
+
option :tag_commit,
|
30
|
+
long: '--tag-commit',
|
31
|
+
description: 'Tag by git commit',
|
32
|
+
boolean: true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -23,7 +23,8 @@ module Dapp
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def validate_compliance!(pattern, value, error_code)
|
26
|
-
|
26
|
+
return if /^#{pattern}$/ =~ value
|
27
|
+
raise ::Dapp::Error::Config, code: error_code, data: { value: value, pattern: pattern }
|
27
28
|
end
|
28
29
|
|
29
30
|
def initialize_variables
|
data/lib/dapp/dapp.rb
CHANGED
@@ -152,15 +152,12 @@ module Dapp
|
|
152
152
|
raise Error::Dapp, code: :docker_not_found if (res = shellout('which docker')).exitstatus.nonzero?
|
153
153
|
docker_bin = res.stdout.strip
|
154
154
|
|
155
|
-
current_docker_version = shellout!("#{docker_bin} --version").stdout.strip
|
156
|
-
required_min_docker_version = '1.10
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
raise Error::Dapp, code: :docker_version, data: { min_version: required_min_docker_version,
|
162
|
-
max_version: required_max_docker_version,
|
163
|
-
version: current_docker_version[/(\d+\.)+\d+/] }
|
155
|
+
current_docker_version = Gem::Version.new(shellout!("#{docker_bin} --version").stdout.strip[/(\d+\.)+\d+(?=\.\d+)/])
|
156
|
+
required_min_docker_version = Gem::Version.new('1.10')
|
157
|
+
|
158
|
+
if required_min_docker_version >= current_docker_version
|
159
|
+
raise Error::Dapp, code: :docker_version, data: { min_version: required_min_docker_version.to_s,
|
160
|
+
version: current_docker_version.to_s }
|
164
161
|
end
|
165
162
|
|
166
163
|
[].tap do |cmd|
|
@@ -3,10 +3,15 @@ module Dapp
|
|
3
3
|
module Command
|
4
4
|
module Common
|
5
5
|
def option_repo
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
shortcut_or_key(options[:repo])
|
7
|
+
end
|
8
|
+
|
9
|
+
def shortcut_or_key(key)
|
10
|
+
shortcuts[key] || key
|
11
|
+
end
|
12
|
+
|
13
|
+
def shortcuts
|
14
|
+
{ ':minikube' => "localhost:5000/#{name}" }
|
10
15
|
end
|
11
16
|
|
12
17
|
def dimg_registry(repo)
|
@@ -2,6 +2,10 @@ module Dapp
|
|
2
2
|
class Dapp
|
3
3
|
module Logging
|
4
4
|
module I18n
|
5
|
+
class I18nError < ::NetStatus::Exception
|
6
|
+
include ::Dapp::Error::Mod::User
|
7
|
+
end
|
8
|
+
|
5
9
|
def self.initialize
|
6
10
|
::I18n.load_path << Dir[File.join(::Dapp.root, 'config', '**', '*')].select { |path| File.file?(path) }
|
7
11
|
::I18n.reload!
|
@@ -16,7 +20,7 @@ module Dapp
|
|
16
20
|
paths << [:common, code].join('.')
|
17
21
|
::I18n.t(*paths, **data, raise: true)
|
18
22
|
rescue ::I18n::MissingTranslationData => _e
|
19
|
-
raise
|
23
|
+
raise I18nError, code: :missing_translation, data: { code: code }
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end # Helper
|
@@ -53,7 +53,7 @@ module Dapp
|
|
53
53
|
|
54
54
|
def log_process_quiet(message, style: {}, status: {})
|
55
55
|
yield
|
56
|
-
rescue Error::
|
56
|
+
rescue Error::Default => e
|
57
57
|
info = paint_string(slice(message), style[:message])
|
58
58
|
failed_message = paint_string(rjust(status[:failed], info), style[:failed])
|
59
59
|
before_error_messages = [log_indent + info + failed_message, e.net_status[:data][:before_error_messages]].flatten
|
@@ -81,7 +81,7 @@ module Dapp
|
|
81
81
|
message = success_message
|
82
82
|
start = Time.now
|
83
83
|
with_log_indent { yield }
|
84
|
-
rescue Error::
|
84
|
+
rescue Error::Default, SignalException, StandardError => _e
|
85
85
|
message = failed_message
|
86
86
|
raise
|
87
87
|
ensure
|
@@ -15,11 +15,11 @@ module Dapp
|
|
15
15
|
protected
|
16
16
|
|
17
17
|
def deployment_config_validate!
|
18
|
-
raise Error::Config, code: :app_name_required if _app.any? { |app| app._name.nil? } && _app.size > 1
|
18
|
+
raise ::Dapp::Error::Config, code: :app_name_required if _app.any? { |app| app._name.nil? } && _app.size > 1
|
19
19
|
_app.each do |app|
|
20
|
-
raise Error::Config, code: :app_dimg_not_defined, data: { app: app._name } if app._dimg.nil? && !_dimg.map(&:_name).compact.empty?
|
20
|
+
raise ::Dapp::Error::Config, code: :app_dimg_not_defined, data: { app: app._name } if app._dimg.nil? && !_dimg.map(&:_name).compact.empty?
|
21
21
|
unless _dimg.map(&:_name).include?(app._dimg)
|
22
|
-
raise Error::Config, code: :app_dimg_not_found, data: { app: app._name, dimg: app._dimg }
|
22
|
+
raise ::Dapp::Error::Config, code: :app_dimg_not_found, data: { app: app._name, dimg: app._dimg }
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -29,10 +29,10 @@ module Dapp
|
|
29
29
|
next if (job_config = obj.public_send("_#{job}")).empty?
|
30
30
|
job_dimg = job_config._dimg || obj._dimg
|
31
31
|
if job_dimg.nil? && !_dimg.map(&:_name).compact.empty?
|
32
|
-
raise Error::Config, code: :"#{directive}_#{job}_dimg_not_defined"
|
32
|
+
raise ::Dapp::Error::Config, code: :"#{directive}_#{job}_dimg_not_defined"
|
33
33
|
end
|
34
34
|
unless _dimg.map(&:_name).include?(job_dimg)
|
35
|
-
raise Error::Config, code: :"#{directive}_#{job}_dimg_not_found", data: { dimg: job_dimg }
|
35
|
+
raise ::Dapp::Error::Config, code: :"#{directive}_#{job}_dimg_not_found", data: { dimg: job_dimg }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -57,7 +57,7 @@ module Dapp
|
|
57
57
|
|
58
58
|
def define_number(number, code)
|
59
59
|
number.to_i.tap do |n|
|
60
|
-
raise Error::Config, code: code, data: { number: number } unless (0..65536).cover?(n)
|
60
|
+
raise ::Dapp::Error::Config, code: code, data: { number: number } unless (0..65536).cover?(n)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -17,7 +17,7 @@ module Dapp
|
|
17
17
|
def scale(value)
|
18
18
|
sub_directive_eval do
|
19
19
|
value.to_i.tap do |v|
|
20
|
-
raise Error::Config, code: :unsupported_scale_value, data: { value: value } unless v > 0
|
20
|
+
raise ::Dapp::Error::Config, code: :unsupported_scale_value, data: { value: value } unless v > 0
|
21
21
|
@_scale = v
|
22
22
|
end
|
23
23
|
end
|