dapp 0.7.18 → 0.7.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/en/common.yml +1 -0
- data/lib/dapp/build/stage/artifact_default.rb +11 -12
- data/lib/dapp/build/stage/import_artifact.rb +1 -5
- data/lib/dapp/builder/base.rb +3 -0
- data/lib/dapp/builder/chef.rb +25 -8
- data/lib/dapp/dimg.rb +1 -0
- data/lib/dapp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fb95faf56ca420cff6868898fb7507b2282f0d0
|
4
|
+
data.tar.gz: bf64455dcb33e447d8044c898d0159f2e5290eb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bd04cc708034bd5bdade09dba0bf77f0d2c0d8c0ed434409b32437fca1ffaa86bd25b3c296fc8eab22b80234caf3eeb0922ae6c834d541d8c60cb6eb0d9bfac
|
7
|
+
data.tar.gz: 2a992ce6691468ac9207592e3cea2011664213768a86189b2def78da5acea80ef5df6cb3116a3038b28268472b4670aeabcb703d4b9bd205866cfebb43d44e13
|
data/config/en/common.yml
CHANGED
@@ -55,6 +55,7 @@ en:
|
|
55
55
|
tag_ignored: "WARNING: tag `%{tag}` ignored."
|
56
56
|
dimg_not_found_in_registry: "WARNING: Dimg not found in registry."
|
57
57
|
stage_artifact_rewritten: "WARNING: Artifact stage rewritten from %{conflict_stage} to %{stage}."
|
58
|
+
recipe_does_not_used: "WARNING: Recipe `%{recipe}` doesn't used in any stage."
|
58
59
|
group:
|
59
60
|
install_group: 'Install group'
|
60
61
|
setup_group: 'Setup group'
|
@@ -18,10 +18,10 @@ module Dapp
|
|
18
18
|
group = artifact[:options][:group]
|
19
19
|
to = artifact[:options][:to]
|
20
20
|
|
21
|
-
command = safe_cp(
|
21
|
+
command = safe_cp(cwd, artifact_dimg.container_tmp_path(artifact_name).to_s, Process.uid, Process.gid, include_paths, exclude_paths)
|
22
22
|
run_artifact_dimg(artifact_dimg, artifact_name, command)
|
23
23
|
|
24
|
-
command = safe_cp(dimg.container_tmp_path('artifact', artifact_name), to, owner, group,
|
24
|
+
command = safe_cp(dimg.container_tmp_path('artifact', artifact_name).to_s, to, owner, group, include_paths, exclude_paths)
|
25
25
|
image.add_command command
|
26
26
|
image.add_volume "#{dimg.tmp_path('artifact', artifact_name)}:#{dimg.container_tmp_path('artifact', artifact_name)}:ro"
|
27
27
|
end
|
@@ -30,33 +30,32 @@ module Dapp
|
|
30
30
|
private
|
31
31
|
|
32
32
|
# rubocop:disable Metrics/ParameterLists, Metrics/AbcSize, Metrics/MethodLength
|
33
|
-
def safe_cp(from, to, owner, group,
|
33
|
+
def safe_cp(from, to, owner, group, include_paths = [], exclude_paths = [])
|
34
34
|
credentials = ''
|
35
35
|
credentials += "-o #{owner} " if owner
|
36
36
|
credentials += "-g #{group} " if group
|
37
|
-
excludes = find_command_excludes(from,
|
37
|
+
excludes = find_command_excludes(from, exclude_paths).join(' ')
|
38
38
|
|
39
|
-
copy_files = proc do |from_,
|
40
|
-
|
41
|
-
"
|
42
|
-
"#{dimg.project.find_bin} #{File.join(from_, cwd_, path_)} #{excludes} -type f -exec " \
|
39
|
+
copy_files = proc do |from_, path_ = ''|
|
40
|
+
"if [[ -d #{File.join(from_, path_)} ]]; then " \
|
41
|
+
"#{dimg.project.find_bin} #{File.join(from_, path_)} #{excludes} -type f -exec " \
|
43
42
|
"#{dimg.project.bash_bin} -ec '#{dimg.project.install_bin} -D #{credentials} {} " \
|
44
43
|
"#{File.join(to, '$(echo {} | ' \
|
45
|
-
"#{dimg.project.sed_bin} -e \"s/#{
|
44
|
+
"#{dimg.project.sed_bin} -e \"s/#{from_.gsub('/', '\\/')}//g\")")}' \\; ;" \
|
46
45
|
'fi'
|
47
46
|
end
|
48
47
|
|
49
48
|
commands = []
|
50
49
|
commands << [dimg.project.install_bin, credentials, '-d', to].join(' ')
|
51
|
-
commands.concat(include_paths.empty? ? Array(copy_files.call(from
|
50
|
+
commands.concat(include_paths.empty? ? Array(copy_files.call(from)) : include_paths.map { |path| copy_files.call(from, path) })
|
52
51
|
commands << "#{dimg.project.find_bin} #{to} -type d -exec " \
|
53
52
|
"#{dimg.project.bash_bin} -ec '#{dimg.project.install_bin} -d #{credentials} {}' \\;"
|
54
53
|
commands.join(' && ')
|
55
54
|
end
|
56
55
|
# rubocop:enable Metrics/ParameterLists, Metrics/AbcSize, Metrics/MethodLength
|
57
56
|
|
58
|
-
def find_command_excludes(from,
|
59
|
-
exclude_paths.map { |path| "-not \\( -path #{File.join(from,
|
57
|
+
def find_command_excludes(from, exclude_paths)
|
58
|
+
exclude_paths.map { |path| "-not \\( -path #{File.join(from, path)} -prune \\)" }
|
60
59
|
end
|
61
60
|
end # ArtifactDefault
|
62
61
|
end # Stage
|
@@ -50,11 +50,7 @@ module Dapp
|
|
50
50
|
container_archive_path = File.join(artifact_dimg.container_tmp_path(artifact_name), 'archive.tar.gz')
|
51
51
|
|
52
52
|
exclude_paths = artifact[:options][:exclude_paths].map { |path| "--exclude=#{path}" }.join(' ')
|
53
|
-
include_paths =
|
54
|
-
[File.join(to, cwd, '*')]
|
55
|
-
else
|
56
|
-
include_paths.map { |path| File.join(to, cwd, path, '*') }
|
57
|
-
end
|
53
|
+
include_paths = include_paths.empty? ? [File.join(cwd, '*')] : include_paths.map { |path| File.join(cwd, path, '*') }
|
58
54
|
include_paths.map! { |path| path[1..-1] } # relative path
|
59
55
|
|
60
56
|
command = "#{sudo} #{dimg.project.tar_bin} -czf #{container_archive_path} #{exclude_paths} #{include_paths.join(' ')} #{credentials}"
|
data/lib/dapp/builder/base.rb
CHANGED
data/lib/dapp/builder/chef.rb
CHANGED
@@ -57,8 +57,26 @@ module Dapp
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
def before_build_check
|
61
|
+
%i(before_install install before_setup setup build_artifact).tap do |stages|
|
62
|
+
(enabled_recipes - stages.map { |stage| stage_enabled_recipes(stage) }.flatten.uniq).each do |recipe|
|
63
|
+
dimg.project.log_warning(desc: { code: :recipe_does_not_used, data: { recipe: recipe } })
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
60
68
|
private
|
61
69
|
|
70
|
+
def stage_enabled_modules(stage)
|
71
|
+
@stage_enabled_modules ||= {}
|
72
|
+
@stage_enabled_modules[stage] ||= enabled_modules.select { |cookbook| stage_entry_exist?(stage, cookbook, stage) }
|
73
|
+
end
|
74
|
+
|
75
|
+
def stage_enabled_recipes(stage)
|
76
|
+
@stage_enabled_recipes ||= {}
|
77
|
+
@stage_enabled_recipes[stage] ||= enabled_recipes.select { |recipe| stage_entry_exist?(stage, project_name, recipe) }
|
78
|
+
end
|
79
|
+
|
62
80
|
def enabled_modules
|
63
81
|
dimg.config._chef._dimod
|
64
82
|
end
|
@@ -440,26 +458,21 @@ module Dapp
|
|
440
458
|
@stage_cookbooks_runlist[stage] ||= begin
|
441
459
|
res = []
|
442
460
|
|
443
|
-
does_entry_exist = proc do |cookbook, entrypoint|
|
444
|
-
stage_cookbooks_path(stage, cookbook, 'recipes', "#{entrypoint}.rb").exist?
|
445
|
-
end
|
446
|
-
|
447
461
|
format_entry = proc do |cookbook, entrypoint|
|
448
462
|
entrypoint = 'void' if entrypoint.nil?
|
449
463
|
"#{cookbook}::#{entrypoint}"
|
450
464
|
end
|
451
465
|
|
452
466
|
enabled_modules.map do |cookbook|
|
453
|
-
if
|
467
|
+
if stage_enabled_modules(stage).include? cookbook
|
454
468
|
[cookbook, stage]
|
455
469
|
else
|
456
470
|
[cookbook, nil]
|
457
471
|
end
|
458
472
|
end.tap { |entries| res.concat entries }
|
459
473
|
|
460
|
-
|
461
|
-
|
462
|
-
.tap do |entries|
|
474
|
+
stage_enabled_recipes(stage).map { |recipe| [project_name, recipe] }
|
475
|
+
.tap do |entries|
|
463
476
|
if entries.any?
|
464
477
|
res.concat entries
|
465
478
|
else
|
@@ -480,6 +493,10 @@ module Dapp
|
|
480
493
|
stage_cookbooks_runlist(stage).empty?
|
481
494
|
end
|
482
495
|
|
496
|
+
def stage_entry_exist?(stage, cookbook, entrypoint)
|
497
|
+
stage_cookbooks_path(stage, cookbook, 'recipes', "#{entrypoint}.rb").exist?
|
498
|
+
end
|
499
|
+
|
483
500
|
def _stage_cookbooks_path(stage)
|
484
501
|
stage_build_path(stage, 'cookbooks')
|
485
502
|
end
|
data/lib/dapp/dimg.rb
CHANGED
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.7.
|
4
|
+
version: 0.7.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|