dapp 0.7.36 → 0.8.0

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/config/en/common.yml +1 -3
  3. data/config/en/net_status.yml +7 -9
  4. data/lib/dapp.rb +3 -1
  5. data/lib/dapp/artifact.rb +7 -2
  6. data/lib/dapp/build/stage/after_setup_artifact.rb +1 -1
  7. data/lib/dapp/build/stage/artifact_base.rb +1 -1
  8. data/lib/dapp/build/stage/artifact_default.rb +24 -43
  9. data/lib/dapp/build/stage/base.rb +35 -31
  10. data/lib/dapp/build/stage/build_artifact.rb +1 -1
  11. data/lib/dapp/build/stage/from.rb +1 -1
  12. data/lib/dapp/build/stage/ga_archive_dependencies.rb +10 -1
  13. data/lib/dapp/build/stage/ga_artifact_patch.rb +2 -2
  14. data/lib/dapp/build/stage/ga_base.rb +18 -5
  15. data/lib/dapp/build/stage/ga_dependencies_base.rb +1 -1
  16. data/lib/dapp/build/stage/ga_latest_patch.rb +10 -2
  17. data/lib/dapp/build/stage/import_artifact.rb +1 -1
  18. data/lib/dapp/build/stage/install/ga_pre_install_patch_dependencies.rb +0 -4
  19. data/lib/dapp/build/stage/install/install.rb +1 -1
  20. data/lib/dapp/build/stage/mod/logging.rb +2 -2
  21. data/lib/dapp/build/stage/setup/ga_post_setup_patch.rb +0 -4
  22. data/lib/dapp/build/stage/setup/ga_post_setup_patch_dependencies.rb +2 -2
  23. data/lib/dapp/build/stage/setup/ga_pre_setup_patch.rb +0 -4
  24. data/lib/dapp/build/stage/setup/setup.rb +1 -1
  25. data/lib/dapp/builder/base.rb +0 -7
  26. data/lib/dapp/builder/chef.rb +67 -408
  27. data/lib/dapp/builder/chef/berksfile.rb +78 -69
  28. data/lib/dapp/builder/chef/cookbook.rb +257 -0
  29. data/lib/dapp/builder/chef/cookbook_metadata.rb +54 -52
  30. data/lib/dapp/builder/none.rb +0 -6
  31. data/lib/dapp/cli/build.rb +8 -1
  32. data/lib/dapp/cli/stage_image.rb +1 -1
  33. data/lib/dapp/config/directive/base.rb +1 -3
  34. data/lib/dapp/config/directive/git_artifact_remote.rb +3 -6
  35. data/lib/dapp/dimg.rb +13 -14
  36. data/lib/dapp/dimg/path.rb +1 -9
  37. data/lib/dapp/error/tar_writer.rb +6 -0
  38. data/lib/dapp/git_artifact.rb +136 -37
  39. data/lib/dapp/git_repo/base.rb +44 -28
  40. data/lib/dapp/git_repo/own.rb +11 -7
  41. data/lib/dapp/git_repo/remote.rb +8 -45
  42. data/lib/dapp/image/docker.rb +9 -11
  43. data/lib/dapp/image/stage.rb +1 -1
  44. data/lib/dapp/project/chef.rb +2 -7
  45. data/lib/dapp/project/command/stages/cleanup_local.rb +1 -2
  46. data/lib/dapp/project/command/stages/cleanup_repo.rb +1 -2
  47. data/lib/dapp/version.rb +2 -2
  48. metadata +4 -3
  49. data/lib/dapp/build/stage/setup/chef_cookbooks.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adca48a7c835ec4933a2b8bb3c1f16de64a5221a
4
- data.tar.gz: 724dfed9ee30db37ea650ec775908cbe76753ca8
3
+ metadata.gz: 92eea836b5eb9b9d0b542583679e8138609e37ad
4
+ data.tar.gz: f9b18f1faf86f4b0524e132d85783df1fddb905b
5
5
  SHA512:
6
- metadata.gz: f43599e74343261ed0dbb5f8664f3145d944b247bb04088247cab42ae3c4b1e96e647b4c0832ecd2ead546276a5e4baca5df2850252ea543c9f2ee52420cb740
7
- data.tar.gz: fcd6dd54e7d1e3f4718dea2b22fa77b5e1408ddea2bb66c1cf1b20f2bf53a6fa5388a0dcd29ce9823ad88b0fcd12aea3ed1d4fe5e2e1e609d50074f86329fa0a
6
+ metadata.gz: add25471d85a39f355507fb1a19d77d6673020c327997ee0a7ca89a2eb33141d28a8e41ac07e36e5f5d7fb9d4fbdef5a5fa32b69344f57541f16f3da78360ee5
7
+ data.tar.gz: d9cc3f25bde5fba86ec1f7b7e511ca2123a85cce668fb3049dad6f039c505661f5679e3e832541f057e0b71b8371dbdd08f3a6adbaf7699a0d8d15efa5851914
@@ -15,8 +15,7 @@ en:
15
15
  artifact_building: "building artifact `%{name}`"
16
16
  git_artifact_clone: "cloning remote git_artifact `%{name}`"
17
17
  git_artifact_fetch: "fetching remote git_artifact `%{name}`"
18
- berks_vendor: 'vendoring cookbooks'
19
- chef_cookbooks_stage_berks_vendor: 'vendoring cookbooks for chef cookbooks stage'
18
+ vendoring_builder_cookbooks: 'vendoring builder cookbooks'
20
19
  waiting_resouce_lock: "waiting for locked resource `%{name}`"
21
20
  gitartifact_container_creating: 'creating dappdeps/gitartifact container'
22
21
  base_container_creating: 'creating dappdeps/base container'
@@ -76,7 +75,6 @@ en:
76
75
  g_a_pre_setup_patch_dependencies: 'Git artifacts dependencies'
77
76
  g_a_pre_setup_patch: 'Git artifacts: apply patches (before setup)'
78
77
  setup: 'Setup'
79
- chef_cookbooks: 'Сhef сookbooks'
80
78
  g_a_post_setup_patch_dependencies: 'Git artifacts dependencies'
81
79
  g_a_post_setup_patch: 'Git artifacts: apply patches (after setup)'
82
80
  after_setup_artifact: 'After setup artifact'
@@ -17,7 +17,7 @@ en:
17
17
  image_not_exist: "Image `%{name}` not exist!"
18
18
  built_id_not_defined: '`from.built_id` not defined!'
19
19
  from_image_not_found: 'Image `%{name}` not found!'
20
- unsupported_docker_image_size_format: "Unsupported docker image size format `%{value}`"
20
+ unsupported_patch_format: "Unsupported patch format:\n\n%{patch}"
21
21
  project:
22
22
  command_unexpected_dimgs_number: "Command can process only one dimg!\nAmbiguous dimg pattern: `%{dimgs_names}`!"
23
23
  no_such_dimg: "No such dimg: `%{dimgs_patterns}`!"
@@ -45,7 +45,7 @@ en:
45
45
  stage_artifact_not_associated: "Artifact not associated with any stage: expected `before` or `after` attribute!"
46
46
  stage_artifact_double_associate: "Cannot use `%{stage}` stage for artifact, already used in `%{conflict_stage}` stage!"
47
47
  stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
48
- git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
48
+ git_artifact_remote_unsupported_protocol: "Remote git repo `%{url}`: unsupported protocol!"
49
49
  artifact_conflict: "Conflict between artifacts paths!"
50
50
  scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
51
51
  scratch_artifact_required: "Scratch dimg without artifacts!"
@@ -53,10 +53,9 @@ en:
53
53
  scratch_artifact_docker_from: "Scratch artifact must have directive `docker.from`!"
54
54
  chef:
55
55
  stage_path_overlap: "Cannot install `%{cookbook}` cookbook's path %{from} into %{to}: already exists"
56
- mdapp_dependency_in_metadata_forbidden: "Using mdapp as dependency in metadata.rb forbidden: detected `%{dependency}`"
57
- local_cookbook_path_not_found: "Dapp cookbook directory not found at %{path}"
58
- cookbook_berksfile_not_found: "Dapp cookbook Berksfile not found at %{path}"
59
- cookbook_metadata_not_found: "Dapp cookbook metadata.rb file not found at %{path}"
56
+ builder_cookbook_not_found: "Dapp cookbook directory not found at %{path}"
57
+ builder_cookbook_berksfile_not_found: "Dapp local cookbook Berksfile not found at %{path}"
58
+ builder_cookbook_metadata_not_found: "Dapp local cookbook metadata.rb file not found at %{path}"
60
59
  cookbook_not_specified_in_berksfile: "Dapp cookbook `%{name}` not specified in Berksfile at %{path}"
61
60
  berksfile_absolute_path_forbidden: "Absolute paths in Berksfile are not allowed (cookbook `%{cookbook}`, path: `%{path}`)"
62
61
  registry:
@@ -67,8 +66,7 @@ en:
67
66
  rugged:
68
67
  rugged_remote_error: "Remote git repo `%{url}`: `%{message}`!"
69
68
  local_git_repository_does_not_exist: "Local git repo: doesn't exist!"
70
- commit_not_found_in_local_git_repository: "Local git repo: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp stages cleanup local --improper-git-commit`!"
71
- commit_not_found_in_remote_git_repository: "Remote git repo `%{url}`: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp stages cleanup local --improper-git-commit`!"
72
- branch_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: branch `%{branch}` not exist!"
69
+ commit_not_found_in_local_git_repository: "Local git repo: commit `%{commit}` not found (run command `dapp stages cleanup local --improper-git-commit`)!"
70
+ commit_not_found_in_remote_git_repository: "Remote git repo `%{url}`: commit `%{commit}` not found (run command `dapp stages cleanup local --improper-git-commit`)!"
73
71
  lock:
74
72
  timeout: "Could not obtain lock for `%{name}` within %{timeout} seconds"
@@ -16,6 +16,7 @@ require 'i18n'
16
16
  require 'paint'
17
17
  require 'inifile'
18
18
  require 'rugged'
19
+ require 'rubygems/package'
19
20
 
20
21
  require 'net_status'
21
22
 
@@ -36,6 +37,7 @@ require 'dapp/error/project'
36
37
  require 'dapp/error/shellout'
37
38
  require 'dapp/error/registry'
38
39
  require 'dapp/error/rugged'
40
+ require 'dapp/error/tar_writer'
39
41
  require 'dapp/exception/base'
40
42
  require 'dapp/exception/introspect_image'
41
43
  require 'dapp/exception/registry'
@@ -88,6 +90,7 @@ require 'dapp/builder/chef'
88
90
  require 'dapp/builder/chef/error'
89
91
  require 'dapp/builder/chef/cookbook_metadata'
90
92
  require 'dapp/builder/chef/berksfile'
93
+ require 'dapp/builder/chef/cookbook'
91
94
  require 'dapp/builder/shell'
92
95
  require 'dapp/builder/none'
93
96
  require 'dapp/build/stage/mod/logging'
@@ -114,7 +117,6 @@ require 'dapp/build/stage/before_setup_artifact'
114
117
  require 'dapp/build/stage/setup/ga_pre_setup_patch_dependencies'
115
118
  require 'dapp/build/stage/setup/ga_pre_setup_patch'
116
119
  require 'dapp/build/stage/setup/setup'
117
- require 'dapp/build/stage/setup/chef_cookbooks'
118
120
  require 'dapp/build/stage/setup/ga_post_setup_patch_dependencies'
119
121
  require 'dapp/build/stage/setup/ga_post_setup_patch'
120
122
  require 'dapp/build/stage/after_setup_artifact'
@@ -1,6 +1,13 @@
1
1
  module Dapp
2
2
  # Artifact
3
3
  class Artifact < Dimg
4
+ def after_stages_build!
5
+ end
6
+
7
+ def stage_should_be_introspected?(name)
8
+ project.cli_options[:introspect_artifact_stage] == name
9
+ end
10
+
4
11
  def artifact?
5
12
  true
6
13
  end
@@ -9,8 +16,6 @@ module Dapp
9
16
  false
10
17
  end
11
18
 
12
- protected
13
-
14
19
  def last_stage
15
20
  @last_stage ||= Build::Stage::BuildArtifact.new(self)
16
21
  end
@@ -5,7 +5,7 @@ module Dapp
5
5
  class AfterSetupArtifact < ArtifactDefault
6
6
  def initialize(dimg, next_stage)
7
7
  @prev_stage = if dimg.artifact?
8
- SetupGroup::ChefCookbooks.new(dimg, self)
8
+ SetupGroup::Setup.new(dimg, self)
9
9
  else
10
10
  SetupGroup::GAPostSetupPatch.new(dimg, self)
11
11
  end
@@ -13,7 +13,7 @@ module Dapp
13
13
  artifacts_labels = {}
14
14
  artifacts.each do |artifact|
15
15
  apply_artifact(artifact, image)
16
- artifacts_labels["dapp-artifact-#{artifact[:name]}".to_sym] = artifact[:dimg].send(:last_stage).image.built_id
16
+ artifacts_labels["dapp-artifact-#{artifact[:name]}".to_sym] = artifact[:dimg].last_stage.image.built_id
17
17
  end
18
18
  image.add_service_change_label artifacts_labels
19
19
  end
@@ -18,7 +18,7 @@ module Dapp
18
18
  group = artifact[:options][:group]
19
19
  to = artifact[:options][:to]
20
20
 
21
- command = safe_cp(cwd, artifact_dimg.container_tmp_path(artifact_name).to_s, nil, nil, include_paths, exclude_paths)
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
24
  command = safe_cp(dimg.container_tmp_path('artifact', artifact_name).to_s, to, owner, group, include_paths, exclude_paths)
@@ -31,51 +31,32 @@ module Dapp
31
31
 
32
32
  # rubocop:disable Metrics/ParameterLists, Metrics/AbcSize, Metrics/MethodLength
33
33
  def safe_cp(from, to, owner, group, include_paths = [], exclude_paths = [])
34
- ''.tap do |cmd|
35
- cmd << dimg.project.rsync_bin
36
- cmd << ' --archive --links'
37
- cmd << " --chown=#{owner}:#{group}" if owner or group
38
-
39
- if include_paths.any?
40
- # Если указали include_paths ­— это означает, что надо копировать
41
- # только указанные пути. Поэтому exclude_paths в приоритете, т.к. в данном режиме
42
- # exclude_paths может относится только к путям, указанным в include_paths.
43
- # При этом случай, когда в include_paths указали более специальный путь, чем в exclude_paths,
44
- # будет обрабатываться в пользу exclude, этот путь не скопируется.
45
- exclude_paths.each do |p|
46
- cmd << " --filter='-/ #{File.join(from, p)}'"
47
- end
48
-
49
- include_paths.each do |p|
50
- target_path = File.join(from, p)
51
-
52
- # Генерируем разрешающее правило для каждого элемента пути
53
- Pathname.new(target_path).descend do |path_part|
54
- cmd << " --filter='+/ #{path_part}'"
55
- end
56
-
57
- # * На данный момент не знаем директорию или файл имел в виду пользователь,
58
- # поэтому подставляем фильтры для обоих возможных случаев.
59
- # * Автоматом подставляем паттерн ** для включения файлов, содержащихся в
60
- # директории, которую пользователь указал в include_paths.
61
- cmd << " --filter='+/ #{target_path}'"
62
- cmd << " --filter='+/ #{File.join(target_path, '**')}'"
63
- end
64
-
65
- # Все что не подошло по include — исключается
66
- cmd << " --filter='-/ #{File.join(from, '**')}'"
67
- else
68
- exclude_paths.each do |p|
69
- cmd << " --filter='-/ #{File.join(from, p)}'"
70
- end
71
- end
72
-
73
- # Слэш после from — это инструкция rsync'у для копирования
74
- # содержимого директории from, а не самой директории.
75
- cmd << " #{from}/ #{to}"
34
+ credentials = ''
35
+ credentials += "-o #{owner} " if owner
36
+ credentials += "-g #{group} " if group
37
+ excludes = find_command_excludes(from, exclude_paths).join(' ')
38
+
39
+ copy_files = proc do |from_, path_ = ''|
40
+ "if [[ -d #{File.join(from_, path_)} ]] || [[ -f #{File.join(from_, path_)} ]]; then " \
41
+ "#{dimg.project.find_bin} #{File.join(from_, path_)} #{excludes} -type f -exec " \
42
+ "#{dimg.project.bash_bin} -ec '#{dimg.project.install_bin} -D #{credentials} \"{}\" " \
43
+ "\"#{File.join(to, "$(echo \"{}\" | " \
44
+ "#{dimg.project.sed_bin} -e \"s/^#{from_.gsub('/', '\\/')}\\///g\")")}\"' \\; ;" \
45
+ 'fi'
76
46
  end
47
+
48
+ commands = []
49
+ commands << [dimg.project.install_bin, credentials, '-d', to].join(' ')
50
+ commands.concat(include_paths.empty? ? Array(copy_files.call(from)) : include_paths.map { |path| copy_files.call(from, path) })
51
+ commands << "#{dimg.project.find_bin} #{to} -type d -exec " \
52
+ "#{dimg.project.bash_bin} -ec '#{dimg.project.install_bin} -d #{credentials} {}' \\;"
53
+ commands.join(' && ')
77
54
  end
78
55
  # rubocop:enable Metrics/ParameterLists, Metrics/AbcSize, Metrics/MethodLength
56
+
57
+ def find_command_excludes(from, exclude_paths)
58
+ exclude_paths.map { |path| "-not \\( -path #{File.join(from, path)} -prune \\)" }
59
+ end
79
60
  end # ArtifactDefault
80
61
  end # Stage
81
62
  end # Build
@@ -48,10 +48,10 @@ module Dapp
48
48
  # rubocop:enable Metrics/MethodLength, Metrics/PerceivedComplexity
49
49
 
50
50
  def build!
51
- return if should_be_skipped?
51
+ return if build_should_be_skipped?
52
52
  prev_stage.build! if prev_stage
53
53
  if image_should_be_build?
54
- prepare_image if !image.tagged? && !should_be_not_present?
54
+ prepare_image if !image.built? && !should_be_not_present?
55
55
  log_image_build(&method(:image_build))
56
56
  end
57
57
  dimg.introspect_image!(image: image.built_id, options: image.send(:prepared_options)) if should_be_introspected?
@@ -68,7 +68,7 @@ module Dapp
68
68
  if empty?
69
69
  prev_stage.image
70
70
  else
71
- Image::Stage.new(name: image_name, from: from_image, project: dimg.project)
71
+ Image::Stage.image_by_name(name: image_name, from: from_image, project: dimg.project)
72
72
  end
73
73
  end
74
74
  end
@@ -76,8 +76,11 @@ module Dapp
76
76
  def prepare_image
77
77
  return if dimg.project.dry_run?
78
78
  image.add_volumes_from dimg.project.base_container
79
- image_add_volumes
79
+
80
+ image_add_mounts
81
+
80
82
  image.add_service_change_label dapp: dimg.stage_dapp_label
83
+ image.add_service_change_label 'dapp-version'.to_sym => Dapp::VERSION
81
84
  image.add_service_change_label 'dapp-cache-version'.to_sym => Dapp::BUILD_CACHE_VERSION
82
85
  image.add_service_change_label 'dapp-dev-mode'.to_sym => true if dimg.dev_mode?
83
86
 
@@ -85,32 +88,31 @@ module Dapp
85
88
  image.add_volume "#{dimg.project.ssh_auth_sock}:/tmp/dapp-ssh-agent"
86
89
  image.add_env 'SSH_AUTH_SOCK', '/tmp/dapp-ssh-agent'
87
90
  end
88
- end
89
91
 
90
- def image_add_volumes
91
- image_add_tmp_volumes
92
- image_add_build_volumes
92
+ yield if block_given?
93
93
  end
94
94
 
95
- def image_add_tmp_volumes
96
- image_add_default_volumes(:tmp_dir)
97
- end
95
+ def image_add_mounts
96
+ [:tmp_dir, :build_dir].each do |type|
97
+ next if (mounts = mounts_by_type(type)).empty?
98
+
99
+ mounts.each do |path|
100
+ absolute_path = File.expand_path(File.join('/', path))
101
+ tmp_path = dimg.send(type, 'mount', absolute_path[1..-1]).tap(&:mkpath)
102
+ image.add_volume "#{tmp_path}:#{absolute_path}"
103
+ end
98
104
 
99
- def image_add_build_volumes
100
- image_add_default_volumes(:build_dir)
105
+ image.add_service_change_label :"dapp-mount-#{type.to_s.tr('_', '-')}" => mounts.join(';')
106
+ end
101
107
  end
102
108
 
103
- def image_add_default_volumes(type)
109
+ def mounts_by_type(type)
104
110
  (dimg.config.public_send("_#{type}_mount").map(&:_to) +
105
- from_image.labels.select { |l, _| l == "dapp-#{type}-dir" }.map { |_, value| value.split(';') }.flatten).each do |path|
106
- absolute_path = File.expand_path(File.join('/', path))
107
- tmp_path = dimg.send(type, 'mount', absolute_path[1..-1]).tap(&:mkpath)
108
- image.add_volume "#{tmp_path}:#{absolute_path}"
109
- end
111
+ from_image.labels.select { |l, _| l == "dapp-mount-#{type.to_s.tr('_', '-')}" }.map { |_, value| value.split(';') }.flatten).uniq
110
112
  end
111
113
 
112
114
  def image_should_be_build?
113
- !empty? || dimg.project.log_verbose?
115
+ (!empty? && !image.built?) || dimg.project.log_verbose?
114
116
  end
115
117
 
116
118
  def empty?
@@ -122,16 +124,18 @@ module Dapp
122
124
  end
123
125
 
124
126
  def signature
125
- if empty?
126
- prev_stage.signature
127
- else
128
- args = []
129
- args << prev_stage.signature unless prev_stage.nil?
130
- args << dimg.build_cache_version
131
- args << builder_checksum
132
- args.concat(dependencies.flatten)
127
+ @signature ||= begin
128
+ if empty?
129
+ prev_stage.signature
130
+ else
131
+ args = []
132
+ args << prev_stage.signature unless prev_stage.nil?
133
+ args << dimg.build_cache_version
134
+ args << builder_checksum
135
+ args.concat(dependencies.flatten)
133
136
 
134
- hashsum args
137
+ hashsum args
138
+ end
135
139
  end
136
140
  end
137
141
 
@@ -152,8 +156,8 @@ module Dapp
152
156
  image.build!
153
157
  end
154
158
 
155
- def should_be_skipped?
156
- image.tagged? && !dimg.project.log_verbose? && !should_be_introspected?
159
+ def build_should_be_skipped?
160
+ image.built? && !dimg.project.log_verbose? && !should_be_introspected?
157
161
  end
158
162
 
159
163
  def should_be_tagged?
@@ -28,7 +28,7 @@ module Dapp
28
28
  private
29
29
 
30
30
  def artifact_dependencies_files_checksum
31
- @artifact_files_checksum ||= dependencies_files_checksum(dimg.config._artifact_dependencies)
31
+ dependencies_files_checksum(dimg.config._artifact_dependencies)
32
32
  end
33
33
  end # BuildArtifact
34
34
  end # Stage
@@ -26,7 +26,7 @@ module Dapp
26
26
  end
27
27
 
28
28
  def from_image
29
- @from_image ||= Image::Stage.new(name: from_image_name, project: dimg.project)
29
+ @from_image ||= Image::Stage.image_by_name(name: from_image_name, project: dimg.project)
30
30
  end
31
31
  end # Prepare
32
32
  end # Stage
@@ -3,13 +3,22 @@ module Dapp
3
3
  module Stage
4
4
  # GAArchiveDependencies
5
5
  class GAArchiveDependencies < GADependenciesBase
6
+ RESET_COMMIT_MESSAGES = ['[dapp reset]', '[reset dapp]']
7
+
6
8
  def initialize(dimg, next_stage)
7
9
  @prev_stage = BeforeInstallArtifact.new(dimg, self)
8
10
  super
9
11
  end
10
12
 
11
13
  def dependencies
12
- [dimg.git_artifacts.map(&:paramshash).join]
14
+ [dimg.git_artifacts.map(&:paramshash).join, reset_commits.sort.uniq.compact]
15
+ end
16
+
17
+ protected
18
+
19
+ def reset_commits
20
+ regex = Regexp.union(RESET_COMMIT_MESSAGES)
21
+ dimg.git_artifacts.map { |git_artifact| git_artifact.repo.find_commit_id_by_message(regex) }
13
22
  end
14
23
  end # GAArchiveDependencies
15
24
  end # Stage
@@ -4,7 +4,7 @@ module Dapp
4
4
  # GAArtifactPatch
5
5
  class GAArtifactPatch < GALatestPatch
6
6
  def initialize(dimg, next_stage)
7
- @prev_stage = SetupGroup::ChefCookbooks.new(dimg, self)
7
+ @prev_stage = SetupGroup::Setup.new(dimg, self)
8
8
  super
9
9
  end
10
10
 
@@ -13,7 +13,7 @@ module Dapp
13
13
  end
14
14
 
15
15
  def prev_g_a_stage
16
- super.prev_stage.prev_stage # GAPreSetupPatch
16
+ super.prev_stage # GAPreSetupPatch
17
17
  end
18
18
  end # GAArtifactPatch
19
19
  end # Stage
@@ -18,14 +18,27 @@ module Dapp
18
18
  end
19
19
 
20
20
  def prepare_image
21
- super
22
- image.add_volumes_from dimg.project.gitartifact_container
21
+ super do
22
+ image.add_volumes_from dimg.project.gitartifact_container
23
+ image.add_volume "#{dimg.tmp_path('archives')}:#{dimg.container_tmp_path('archives')}:ro"
24
+ image.add_volume "#{dimg.tmp_path('patches')}:#{dimg.container_tmp_path('patches')}:ro"
23
25
 
24
- dimg.git_artifacts.each do |git_artifact|
25
- image.add_volume "#{git_artifact.repo.path}:#{git_artifact.repo.container_path}:ro"
26
- image.add_command git_artifact.send(apply_command_method, self)
26
+ prepare_local_git_artifacts_command
27
+ prepare_remote_git_artifacts_command
27
28
  end
28
29
  end
30
+
31
+ def prepare_local_git_artifacts_command
32
+ prepare_base_git_artifacts_command(dimg.local_git_artifacts)
33
+ end
34
+
35
+ def prepare_remote_git_artifacts_command
36
+ prepare_base_git_artifacts_command(dimg.remote_git_artifacts)
37
+ end
38
+
39
+ def prepare_base_git_artifacts_command(git_artifacts)
40
+ git_artifacts.each { |git_artifact| image.add_command git_artifact.send(apply_command_method, self) }
41
+ end
29
42
 
30
43
  def empty?
31
44
  dependencies_stage.empty?
@@ -11,7 +11,7 @@ module Dapp
11
11
  end
12
12
 
13
13
  def empty?
14
- dimg.git_artifacts.empty? ? true : false
14
+ dimg.git_artifacts.empty? || super
15
15
  end
16
16
  end # GADependenciesBase
17
17
  end # Stage