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
@@ -119,11 +119,11 @@ module Dapp
|
|
119
119
|
err_data[:request_parameters] = request_parameters
|
120
120
|
|
121
121
|
if response.status.to_s.start_with? '5'
|
122
|
-
raise Error::
|
122
|
+
raise Error::Default, code: :server_error, data: err_data
|
123
123
|
elsif response.status.to_s == '404'
|
124
124
|
raise Error::NotFound, data: err_data
|
125
125
|
else not response.status.to_s.start_with? '2'
|
126
|
-
raise Error::
|
126
|
+
raise Error::Default, code: :bad_request, data: err_data
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
@@ -165,7 +165,7 @@ module Dapp
|
|
165
165
|
if File.exist?((kube_config_path = File.join(ENV['HOME'], '.kube/config')))
|
166
166
|
yaml_load_file(kube_config_path)
|
167
167
|
else
|
168
|
-
raise Error::
|
168
|
+
raise Error::Default, code: :kube_config_not_found, data: { path: kube_config_path }
|
169
169
|
end
|
170
170
|
end
|
171
171
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
module Dapp
|
2
2
|
module Deployment
|
3
3
|
module Kubernetes::Error
|
4
|
-
class
|
4
|
+
class Default < ::Dapp::Deployment::Error::Kubernetes
|
5
5
|
def initialize(**net_status)
|
6
6
|
super(**net_status, context: :kubernetes)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
class NotFound <
|
10
|
+
class NotFound < Default
|
11
11
|
def initialize(**net_status)
|
12
12
|
super({code: :not_found}.merge(net_status))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
class Timeout <
|
17
|
-
class ConnectionRefused <
|
16
|
+
class Timeout < Default; end
|
17
|
+
class ConnectionRefused < Default; end
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Dapp::Dimg::CLI
|
2
2
|
module Command
|
3
3
|
class Dimg < ::Dapp::CLI
|
4
|
-
SUBCOMMANDS = ['build', 'push', 'spush', 'list', 'run', 'stages', 'cleanup', 'bp', 'mrproper', 'stage image', 'tag', 'build-context', 'cleanup repo', 'flush repo'].freeze
|
4
|
+
SUBCOMMANDS = ['build', 'push', 'spush', 'list', 'run', 'stages', 'cleanup', 'bp', 'mrproper', 'stage image', 'tag', 'build-context', 'cleanup repo', 'flush local', 'flush repo'].freeze
|
5
5
|
|
6
6
|
banner <<BANNER.freeze
|
7
7
|
Usage: dapp dimg [options] subcommand [subcommand options]
|
@@ -16,6 +16,7 @@ Available subcommands: (for details, dapp dimg SUB-COMMAND --help)
|
|
16
16
|
dapp dimg list [options] [DIMG ...]
|
17
17
|
dapp dimg run [options] [DIMG] [DOCKER ARGS]
|
18
18
|
dapp dimg cleanup repo [options] [DIMG ...] REPO
|
19
|
+
dapp dimg flush local [options] [DIMG ...]
|
19
20
|
dapp dimg flush repo [options] [DIMG ...] REPO
|
20
21
|
dapp dimg cleanup [options]
|
21
22
|
dapp dimg mrproper [options]
|
@@ -16,6 +16,11 @@ BANNER
|
|
16
16
|
long: '--build-context-directory DIR_PATH',
|
17
17
|
description: 'Path to the directory with context'
|
18
18
|
|
19
|
+
option :use_system_tar,
|
20
|
+
long: '--use-system-tar',
|
21
|
+
boolean: true,
|
22
|
+
default: false
|
23
|
+
|
19
24
|
def run_method
|
20
25
|
:"build_context_#{class_to_lowercase}"
|
21
26
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Dapp::Dimg::CLI
|
2
|
+
module Command
|
3
|
+
class Dimg < ::Dapp::CLI
|
4
|
+
class FlushLocal < Base
|
5
|
+
banner <<BANNER.freeze
|
6
|
+
Usage:
|
7
|
+
|
8
|
+
dapp dimg flush local [options] [DIMG ...]
|
9
|
+
|
10
|
+
Options:
|
11
|
+
BANNER
|
12
|
+
|
13
|
+
option :with_stages,
|
14
|
+
long: '--with-stages',
|
15
|
+
boolean: true
|
16
|
+
|
17
|
+
def run(argv = ARGV)
|
18
|
+
self.class.parse_options(self, argv)
|
19
|
+
run_dapp_command(run_method, options: cli_options(dimgs_patterns: cli_arguments))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -11,6 +11,8 @@ Usage:
|
|
11
11
|
|
12
12
|
Options:
|
13
13
|
BANNER
|
14
|
+
extend ::Dapp::CLI::Command::Options::Tag
|
15
|
+
|
14
16
|
option :lock_timeout,
|
15
17
|
long: '--lock-timeout TIMEOUT',
|
16
18
|
description: 'Redefine resource locking timeout (in seconds)',
|
@@ -20,32 +22,6 @@ BANNER
|
|
20
22
|
long: '--git-artifact-branch BRANCH',
|
21
23
|
description: 'Default branch to archive artifacts from'
|
22
24
|
|
23
|
-
option :tag,
|
24
|
-
long: '--tag TAG',
|
25
|
-
description: 'Add tag (can be used one or more times)',
|
26
|
-
default: [],
|
27
|
-
proc: proc { |v| composite_options(:tags) << v }
|
28
|
-
|
29
|
-
option :tag_branch,
|
30
|
-
long: '--tag-branch',
|
31
|
-
description: 'Tag by git branch',
|
32
|
-
boolean: true
|
33
|
-
|
34
|
-
option :tag_build_id,
|
35
|
-
long: '--tag-build-id',
|
36
|
-
description: 'Tag by CI build id',
|
37
|
-
boolean: true
|
38
|
-
|
39
|
-
option :tag_ci,
|
40
|
-
long: '--tag-ci',
|
41
|
-
description: 'Tag by CI branch and tag',
|
42
|
-
boolean: true
|
43
|
-
|
44
|
-
option :tag_commit,
|
45
|
-
long: '--tag-commit',
|
46
|
-
description: 'Tag by git commit',
|
47
|
-
boolean: true
|
48
|
-
|
49
25
|
option :with_stages,
|
50
26
|
long: '--with-stages',
|
51
27
|
boolean: true
|
@@ -3,8 +3,8 @@ module Dapp::Dimg::CLI
|
|
3
3
|
class Dimg < ::Dapp::CLI
|
4
4
|
class Stages < ::Dapp::CLI
|
5
5
|
class Base < Base
|
6
|
-
def run_dapp_command(run_command, options: {}, log_running_time: true)
|
7
|
-
super(run_command, options: options.merge(verbose: true), log_running_time: log_running_time)
|
6
|
+
def run_dapp_command(run_command, options: {}, log_running_time: true, **extra_options)
|
7
|
+
super(run_command, options: options.merge(verbose: true), log_running_time: log_running_time, **extra_options)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -5,19 +5,26 @@ module Dapp::Dimg::CLI
|
|
5
5
|
banner <<BANNER.freeze
|
6
6
|
Usage:
|
7
7
|
|
8
|
-
dapp dimg tag [options] [DIMG]
|
8
|
+
dapp dimg tag [options] [DIMG ...] [REPO]
|
9
9
|
|
10
10
|
DIMG Dapp image to process [default: *].
|
11
|
-
REPO Pushed image name.
|
12
11
|
|
13
12
|
Options:
|
14
13
|
BANNER
|
14
|
+
extend ::Dapp::CLI::Command::Options::Tag
|
15
15
|
|
16
16
|
def run(argv = ARGV)
|
17
17
|
self.class.parse_options(self, argv)
|
18
|
-
tag = self.class.required_argument(self, 'tag')
|
19
18
|
run_dapp_command(nil, options: cli_options(dimgs_patterns: cli_arguments)) do |dapp|
|
20
|
-
|
19
|
+
repo = if not cli_arguments[0].nil?
|
20
|
+
self.class.required_argument(self, 'repo')
|
21
|
+
else
|
22
|
+
dapp.name
|
23
|
+
end
|
24
|
+
|
25
|
+
dapp.options[:repo] = repo
|
26
|
+
|
27
|
+
dapp.public_send(run_method)
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
@@ -13,7 +13,7 @@ module Dapp
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def dimg_config_validate!
|
16
|
-
raise Error::Config, code: :dimg_name_required if _dimg.any? { |dimg| dimg._name.nil? } && _dimg.size > 1
|
16
|
+
raise ::Dapp::Error::Config, code: :dimg_name_required if _dimg.any? { |dimg| dimg._name.nil? } && _dimg.size > 1
|
17
17
|
_dimg.each(&:validate!)
|
18
18
|
end
|
19
19
|
end
|
@@ -48,12 +48,12 @@ module Dapp
|
|
48
48
|
conflict_type = [:before, :after].find { |t| t != type }
|
49
49
|
conflict_stage = public_send("_#{conflict_type}")
|
50
50
|
|
51
|
-
raise Error::Config, code: :stage_artifact_not_supported_associated_stage,
|
52
|
-
|
51
|
+
raise ::Dapp::Error::Config, code: :stage_artifact_not_supported_associated_stage,
|
52
|
+
data: { stage: "#{type} #{stage.inspect}" } unless [:install, :setup].include? stage
|
53
53
|
|
54
|
-
raise Error::Config, code: :stage_artifact_double_associate,
|
55
|
-
|
56
|
-
|
54
|
+
raise ::Dapp::Error::Config, code: :stage_artifact_double_associate,
|
55
|
+
data: { stage: "#{type} #{stage.inspect}",
|
56
|
+
conflict_stage: "#{conflict_type} #{conflict_stage.inspect}" } if conflict_stage
|
57
57
|
|
58
58
|
defined_stage = public_send("_#{type}")
|
59
59
|
dapp.log_config_warning(
|
@@ -61,13 +61,13 @@ module Dapp
|
|
61
61
|
|
62
62
|
def _cwd=(value)
|
63
63
|
return if value.nil?
|
64
|
-
raise Error::Config, code: :export_cwd_absolute_path_required unless Pathname(value).absolute?
|
64
|
+
raise ::Dapp::Error::Config, code: :export_cwd_absolute_path_required unless Pathname(value).absolute?
|
65
65
|
@_cwd = path_format(value)
|
66
66
|
end
|
67
67
|
|
68
68
|
def to(absolute_path)
|
69
69
|
sub_directive_eval do
|
70
|
-
raise Error::Config, code: :export_to_absolute_path_required unless Pathname(absolute_path).absolute?
|
70
|
+
raise ::Dapp::Error::Config, code: :export_to_absolute_path_required unless Pathname(absolute_path).absolute?
|
71
71
|
@_to = path_format(absolute_path)
|
72
72
|
end
|
73
73
|
end
|
@@ -75,7 +75,7 @@ module Dapp
|
|
75
75
|
def include_paths(*relative_paths)
|
76
76
|
sub_directive_eval do
|
77
77
|
unless relative_paths.all? { |path| Pathname(path).relative? }
|
78
|
-
raise Error::Config, code: :export_include_paths_relative_path_required
|
78
|
+
raise ::Dapp::Error::Config, code: :export_include_paths_relative_path_required
|
79
79
|
end
|
80
80
|
_include_paths.concat(relative_paths.map(&method(:path_format)))
|
81
81
|
end
|
@@ -84,7 +84,7 @@ module Dapp
|
|
84
84
|
def exclude_paths(*relative_paths)
|
85
85
|
sub_directive_eval do
|
86
86
|
unless relative_paths.all? { |path| Pathname(path).relative? }
|
87
|
-
raise Error::Config, code: :export_exclude_paths_relative_path_required
|
87
|
+
raise ::Dapp::Error::Config, code: :export_exclude_paths_relative_path_required
|
88
88
|
end
|
89
89
|
_exclude_paths.concat(relative_paths.map(&method(:path_format)))
|
90
90
|
end
|
@@ -99,7 +99,7 @@ module Dapp
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def validate!
|
102
|
-
raise Error::Config, code: :export_to_required if _to.nil?
|
102
|
+
raise ::Dapp::Error::Config, code: :export_to_required if _to.nil?
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -142,7 +142,7 @@ module Dapp
|
|
142
142
|
|
143
143
|
def builder(type)
|
144
144
|
@_builder = type if _builder == :none
|
145
|
-
raise Error::Config, code: :builder_type_conflict unless @_builder == type
|
145
|
+
raise ::Dapp::Error::Config, code: :builder_type_conflict unless @_builder == type
|
146
146
|
end
|
147
147
|
|
148
148
|
def passed_directives
|
@@ -18,7 +18,7 @@ module Dapp
|
|
18
18
|
validate_scratch_directives!
|
19
19
|
validate_scratch_artifacts!
|
20
20
|
else
|
21
|
-
raise Error::Config, code: :stage_artifact_not_associated unless _import_artifact.empty?
|
21
|
+
raise ::Dapp::Error::Config, code: :stage_artifact_not_associated unless _import_artifact.empty?
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -31,7 +31,7 @@ module Dapp
|
|
31
31
|
end
|
32
32
|
_mount.map(&:_to).tap do |mounts_points|
|
33
33
|
mounts_points.each do |path|
|
34
|
-
raise Error::Config, code: :mount_duplicate_to, data: { path: path } if mounts_points.count(path) > 1
|
34
|
+
raise ::Dapp::Error::Config, code: :mount_duplicate_to, data: { path: path } if mounts_points.count(path) > 1
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -40,25 +40,23 @@ module Dapp
|
|
40
40
|
directives = [[:_shell, :shell], [:_chef, :chef], [:_git_artifact, :git],
|
41
41
|
[:_tmp_dir_mount, :mount], [:_build_dir_mount, :mount], [:_custom_dir_mount, :mount]]
|
42
42
|
directives.each do |name, user_name|
|
43
|
-
raise Error::Config,
|
44
|
-
|
45
|
-
data: { directive: user_name } unless public_send(name).empty?
|
43
|
+
raise ::Dapp::Error::Config, code: :scratch_unsupported_directive,
|
44
|
+
data: { directive: user_name } unless public_send(name).empty?
|
46
45
|
end
|
47
46
|
|
48
47
|
docker_directives = [:_expose, :_env, :_cmd, :_onbuild, :_workdir, :_user, :_entrypoint]
|
49
48
|
docker_directives.each do |directive|
|
50
49
|
value = _docker.public_send(directive)
|
51
|
-
raise Error::Config,
|
52
|
-
|
53
|
-
data: { directive: "docker.#{directive}" } unless value.nil? || value.empty?
|
50
|
+
raise ::Dapp::Error::Config, code: :scratch_unsupported_directive,
|
51
|
+
data: { directive: "docker.#{directive}" } unless value.nil? || value.empty?
|
54
52
|
end
|
55
53
|
end
|
56
54
|
|
57
55
|
def validate_scratch_artifacts!
|
58
|
-
raise Error::Config, code: :scratch_artifact_associated unless _associated_artifacts.empty?
|
59
|
-
raise Error::Config, code: :scratch_artifact_required if _import_artifact.empty?
|
56
|
+
raise ::Dapp::Error::Config, code: :scratch_artifact_associated unless _associated_artifacts.empty?
|
57
|
+
raise ::Dapp::Error::Config, code: :scratch_artifact_required if _import_artifact.empty?
|
60
58
|
_import_artifact.each do |artifact|
|
61
|
-
raise Error::Config, code: :scratch_artifact_docker_from if artifact._config._docker._from.nil?
|
59
|
+
raise ::Dapp::Error::Config, code: :scratch_artifact_docker_from if artifact._config._docker._from.nil?
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
@@ -115,7 +113,7 @@ module Dapp
|
|
115
113
|
verifiable_artifact[:include_paths].each do |verifiable_path|
|
116
114
|
potential_conflicts = artifact[:include_paths].select { |path| path.start_with?(verifiable_path) }
|
117
115
|
validate_artifact_path!(verifiable_artifact, potential_conflicts)
|
118
|
-
end.empty? && verifiable_artifact[:exclude_paths].empty? && raise(Error::Config, code: :artifact_conflict)
|
116
|
+
end.empty? && verifiable_artifact[:exclude_paths].empty? && raise(::Dapp::Error::Config, code: :artifact_conflict)
|
119
117
|
validate_artifact_path!(verifiable_artifact, artifact[:include_paths]) if verifiable_artifact[:include_paths].empty?
|
120
118
|
end
|
121
119
|
|
@@ -125,7 +123,7 @@ module Dapp
|
|
125
123
|
break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
|
126
124
|
end
|
127
125
|
verifiable_artifact[:exclude_paths].include?(path)
|
128
|
-
end.tap { |res| res || raise(Error::Config, code: :artifact_conflict) }
|
126
|
+
end.tap { |res| res || raise(::Dapp::Error::Config, code: :artifact_conflict) }
|
129
127
|
end
|
130
128
|
|
131
129
|
def _associated_artifacts
|
@@ -5,7 +5,7 @@ module Dapp
|
|
5
5
|
module Docker
|
6
6
|
class Artifact < Base
|
7
7
|
def method_missing(m, *args)
|
8
|
-
raise Error::Config, code: :docker_artifact_unsupported_directive if Dimg.instance_methods.include?(m)
|
8
|
+
raise ::Dapp::Error::Config, code: :docker_artifact_unsupported_directive if Dimg.instance_methods.include?(m)
|
9
9
|
super
|
10
10
|
end
|
11
11
|
|
@@ -9,7 +9,7 @@ module Dapp
|
|
9
9
|
def from(image, cache_version: nil)
|
10
10
|
sub_directive_eval do
|
11
11
|
image = image.to_s
|
12
|
-
raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless ::Dapp::Dimg::Image::Docker.image_name?(image)
|
12
|
+
raise(::Dapp::Error::Config, code: :docker_from_incorrect, data: { name: image }) unless ::Dapp::Dimg::Image::Docker.image_name?(image)
|
13
13
|
@_from = image.include?(':') ? image : [image, 'latest'].join(':')
|
14
14
|
@_from_cache_version = cache_version
|
15
15
|
end
|
@@ -3,23 +3,39 @@ module Dapp
|
|
3
3
|
module Config
|
4
4
|
module Directive
|
5
5
|
class GitArtifactLocal < ArtifactBase
|
6
|
+
attr_reader :_as
|
7
|
+
|
8
|
+
def as(value)
|
9
|
+
@_as = value
|
10
|
+
end
|
11
|
+
|
6
12
|
def export(absolute_dir_path = '/', &blk)
|
7
13
|
super
|
8
14
|
end
|
9
15
|
alias add export
|
10
16
|
undef_method :export
|
11
17
|
|
18
|
+
def _export
|
19
|
+
super do |export|
|
20
|
+
export._as = @_as
|
21
|
+
|
22
|
+
yield(export) if block_given?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
12
26
|
class Export < ArtifactBase::Export
|
27
|
+
attr_accessor :_as
|
28
|
+
|
13
29
|
def stage_dependencies(&blk)
|
14
30
|
@stage_dependencies ||= StageDependencies.new(&blk)
|
15
31
|
end
|
16
32
|
|
17
33
|
def validate!
|
18
|
-
raise Error::Config, code: :add_to_required if _to.nil?
|
34
|
+
raise ::Dapp::Error::Config, code: :add_to_required if _to.nil?
|
19
35
|
end
|
20
36
|
|
21
37
|
def _artifact_options
|
22
|
-
super.merge(stages_dependencies: stage_dependencies.to_h)
|
38
|
+
super.merge(stages_dependencies: stage_dependencies.to_h, as: _as)
|
23
39
|
end
|
24
40
|
|
25
41
|
class StageDependencies < Directive::Base
|
@@ -29,7 +45,7 @@ module Dapp
|
|
29
45
|
define_method(stage) do |*glob|
|
30
46
|
sub_directive_eval do
|
31
47
|
if (globs = glob.flatten.map { |g| path_format(g) }).any? { |g| Pathname(g).absolute? }
|
32
|
-
raise Error::Config, code: :stages_dependencies_paths_relative_path_required, data: { stage: stage }
|
48
|
+
raise ::Dapp::Error::Config, code: :stages_dependencies_paths_relative_path_required, data: { stage: stage }
|
33
49
|
end
|
34
50
|
instance_variable_set(:"@#{stage}", public_send("_#{stage}") + globs)
|
35
51
|
end
|
@@ -29,6 +29,8 @@ module Dapp
|
|
29
29
|
export._name = @_name
|
30
30
|
export._branch ||= @_branch
|
31
31
|
export._commit ||= @_commit
|
32
|
+
|
33
|
+
yield(export) if block_given?
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
@@ -49,7 +51,7 @@ module Dapp
|
|
49
51
|
|
50
52
|
def validate!
|
51
53
|
super
|
52
|
-
raise Error::Config, code: :git_artifact_remote_branch_with_commit if !_branch.nil? && !_commit.nil?
|
54
|
+
raise ::Dapp::Error::Config, code: :git_artifact_remote_branch_with_commit if !_branch.nil? && !_commit.nil?
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
@@ -8,7 +8,7 @@ module Dapp
|
|
8
8
|
attr_reader :_type
|
9
9
|
|
10
10
|
def initialize(to, **kwargs, &blk)
|
11
|
-
raise Error::Config, code: :mount_to_absolute_path_required unless Pathname((to = to.to_s)).absolute?
|
11
|
+
raise ::Dapp::Error::Config, code: :mount_to_absolute_path_required unless Pathname((to = to.to_s)).absolute?
|
12
12
|
@_to = path_format(to)
|
13
13
|
|
14
14
|
super(**kwargs, &blk)
|
@@ -17,7 +17,7 @@ module Dapp
|
|
17
17
|
def from(type)
|
18
18
|
sub_directive_eval do
|
19
19
|
type = type.to_sym
|
20
|
-
raise Error::Config, code: :mount_from_type_required unless [:tmp_dir, :build_dir].include? type
|
20
|
+
raise ::Dapp::Error::Config, code: :mount_from_type_required unless [:tmp_dir, :build_dir].include? type
|
21
21
|
@_type = type
|
22
22
|
end
|
23
23
|
end
|
@@ -30,7 +30,7 @@ module Dapp
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def validate!
|
33
|
-
raise Error::Config, code: :mount_from_or_from_path_required if _type.nil?
|
33
|
+
raise ::Dapp::Error::Config, code: :mount_from_or_from_path_required if _type.nil?
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|