dapp 0.26.2 → 0.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/en/net_status.yml +2 -0
- data/lib/dapp.rb +1 -0
- data/lib/dapp/dimg/build/stage/artifact_base.rb +1 -1
- data/lib/dapp/dimg/config/directive/artifact.rb +8 -0
- data/lib/dapp/dimg/config/directive/artifact_base.rb +0 -4
- data/lib/dapp/dimg/config/directive/artifact_group.rb +16 -1
- data/lib/dapp/dimg/config/directive/dimg/instance_methods.rb +10 -2
- data/lib/dapp/dimg/config/directive/dimg/validation.rb +1 -0
- data/lib/dapp/dimg/config/directive/dimg_group.rb +1 -1
- data/lib/dapp/dimg/dapp/config_artifact_group.rb +20 -0
- data/lib/dapp/dimg/dapp/dapp.rb +1 -0
- data/lib/dapp/dimg/dimg.rb +2 -0
- data/lib/dapp/dimg/dimg/path.rb +4 -0
- data/lib/dapp/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1223a0b22f91c564551e09f54d54c02b253d4a84
|
4
|
+
data.tar.gz: cb646a75d24b8f3b045940d9c5dfeea1497e6188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a49317f02f402ad669021275646da2792c8ea7ec3abd3f4eae3487b5a375869812d86186ba2c91af411ca09a682055f167f99c37059a90c4b0a20c94882d59f9
|
7
|
+
data.tar.gz: cc1034b50a63384ca0535d16f34dfe591b674864db78201bdb56e3f0efc8a3d8382113e86b4bb8de9f325e8d6051ce61c63156cd3c889e7ddf8c86fc55547fad
|
data/config/en/net_status.yml
CHANGED
@@ -83,6 +83,8 @@ en:
|
|
83
83
|
stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
|
84
84
|
git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
|
85
85
|
artifact_conflict: "Conflict between artifacts!\n\n%{dappfile_context}"
|
86
|
+
artifact_not_found: "Invalid Dappfile: artifact `%{name}` should be defined before import directive!"
|
87
|
+
artifact_already_exists: "Invalid Dappfile: artifact `%{name}` already exists!"
|
86
88
|
scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
|
87
89
|
scratch_artifact_required: "Scratch dimg without artifacts!"
|
88
90
|
scratch_artifact_associated: "Scratch artifact can't be associated: not expected `before`/`after` attribute!"
|
data/lib/dapp.rb
CHANGED
@@ -235,6 +235,7 @@ require 'dapp/dimg/dapp/command/build_context/import'
|
|
235
235
|
require 'dapp/dimg/dapp/command/build_context/common'
|
236
236
|
require 'dapp/dimg/dapp/dappfile'
|
237
237
|
require 'dapp/dimg/dapp/dimg'
|
238
|
+
require 'dapp/dimg/dapp/config_artifact_group'
|
238
239
|
require 'dapp/dimg/dapp/dapp'
|
239
240
|
require 'dapp/dimg/docker_registry'
|
240
241
|
require 'dapp/dimg/docker_registry/base/request'
|
@@ -48,7 +48,7 @@ module Dapp
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def artifacts_dimgs_build!
|
51
|
-
artifacts.each do |artifact|
|
51
|
+
artifacts.uniq { |artifact| artifact[:dimg] }.each do |artifact|
|
52
52
|
process = dimg.dapp.t(code: 'process.artifact_building', data: { name: artifact[:name] })
|
53
53
|
dimg.dapp.log_secondary_process(process) { artifact[:dimg].build! }
|
54
54
|
end
|
@@ -3,8 +3,23 @@ module Dapp
|
|
3
3
|
module Config
|
4
4
|
module Directive
|
5
5
|
class ArtifactGroup < DimgGroup
|
6
|
+
attr_reader :_name
|
7
|
+
|
8
|
+
def initialize(name = nil, dapp:)
|
9
|
+
super(dapp: dapp)
|
10
|
+
@_name = name
|
11
|
+
end
|
12
|
+
|
6
13
|
def export(*args, &blk)
|
7
|
-
|
14
|
+
_artifact_export(_artifact_config, *args, &blk)
|
15
|
+
end
|
16
|
+
|
17
|
+
def _artifact_config
|
18
|
+
artifact_config_name = "artifact-#{[_name, SecureRandom.hex(2)].compact.join('-')}"
|
19
|
+
pass_to(ArtifactDimg.new(artifact_config_name, dapp: dapp))
|
20
|
+
end
|
21
|
+
|
22
|
+
def _artifact_export(artifact_config, *args, &blk)
|
8
23
|
artifact = Artifact.new(dapp: dapp, config: artifact_config)
|
9
24
|
artifact.export(*args, &blk).tap do
|
10
25
|
_export.concat artifact._export
|
@@ -22,9 +22,17 @@ module Dapp
|
|
22
22
|
directive_eval(_docker, &blk)
|
23
23
|
end
|
24
24
|
|
25
|
-
def artifact(&blk)
|
26
|
-
pass_to(ArtifactGroup.new(dapp: dapp), :clone_to_artifact).tap do |artifact_group|
|
25
|
+
def artifact(name = nil, &blk)
|
26
|
+
pass_to(ArtifactGroup.new(name, dapp: dapp), :clone_to_artifact).tap do |artifact_group|
|
27
27
|
_context_artifact_groups << directive_eval(artifact_group, &blk)
|
28
|
+
dapp.artifact_config(name, artifact_group._artifact_config) unless name.nil?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def import(name, from = nil, &blk)
|
33
|
+
ArtifactGroup.new(dapp: dapp).tap do |artifact_group|
|
34
|
+
artifact_group._artifact_export(dapp.artifact_config_by_name(name), from, &blk)
|
35
|
+
_context_artifact_groups << artifact_group
|
28
36
|
end
|
29
37
|
end
|
30
38
|
|
@@ -29,6 +29,7 @@ module Dapp
|
|
29
29
|
elm.validate! if elm.respond_to?(:validate!)
|
30
30
|
end
|
31
31
|
end
|
32
|
+
_context_artifact_groups.each(&:validate!)
|
32
33
|
_mount.map(&:_to).tap do |mounts_points|
|
33
34
|
mounts_points.each do |path|
|
34
35
|
raise ::Dapp::Error::Config, code: :mount_duplicate_to, data: { path: path } if mounts_points.count(path) > 1
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Dapp
|
2
|
+
module Dimg
|
3
|
+
module Dapp
|
4
|
+
module ConfigArtifactGroup
|
5
|
+
def artifact_config_by_name(name)
|
6
|
+
artifacts_configs[name] || raise(::Dapp::Error::Config, code: :artifact_not_found, data: { name: name })
|
7
|
+
end
|
8
|
+
|
9
|
+
def artifact_config(name, artifact_config)
|
10
|
+
raise(::Dapp::Error::Config, code: :artifact_already_exists, data: { name: name }) if artifacts_configs.key?(name)
|
11
|
+
artifacts_configs[name] = artifact_config
|
12
|
+
end
|
13
|
+
|
14
|
+
def artifacts_configs
|
15
|
+
@artifacts_configs ||= {}
|
16
|
+
end
|
17
|
+
end # Dimg
|
18
|
+
end # Dapp
|
19
|
+
end # Dimg
|
20
|
+
end # Dapp
|
data/lib/dapp/dimg/dapp/dapp.rb
CHANGED
data/lib/dapp/dimg/dimg.rb
CHANGED
@@ -189,6 +189,8 @@ module Dapp
|
|
189
189
|
end
|
190
190
|
|
191
191
|
def cleanup_tmp
|
192
|
+
return unless tmp_dir_exists?
|
193
|
+
|
192
194
|
# В tmp-директории могли остаться файлы, владельцами которых мы не являемся.
|
193
195
|
# Такие файлы могут попасть туда при экспорте файлов артефакта.
|
194
196
|
# Чтобы от них избавиться — запускаем docker-контейнер под root-пользователем
|
data/lib/dapp/dimg/dimg/path.rb
CHANGED
data/lib/dapp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
@@ -612,6 +612,7 @@ files:
|
|
612
612
|
- lib/dapp/dimg/dapp/command/stages/pull.rb
|
613
613
|
- lib/dapp/dimg/dapp/command/stages/push.rb
|
614
614
|
- lib/dapp/dimg/dapp/command/tag.rb
|
615
|
+
- lib/dapp/dimg/dapp/config_artifact_group.rb
|
615
616
|
- lib/dapp/dimg/dapp/dapp.rb
|
616
617
|
- lib/dapp/dimg/dapp/dappfile.rb
|
617
618
|
- lib/dapp/dimg/dapp/dimg.rb
|