dapp 0.31.0 → 0.31.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5589825e906db3c287d0abc4cd312c9fcc8efc96e36945cb7e3655370d8b288d
4
- data.tar.gz: a0164e08a37faf5f8c03bba714da833458ae7081549085e8aecf6a089f51f003
3
+ metadata.gz: acbc086c66b025c8c5740bfff5d0bdee5e741f66eca42099f0beeacb5a5af2ff
4
+ data.tar.gz: 3540b080c1791f3be5ecc317ed2350fe70f3fda3c3e3ac089d74a636ecad46ab
5
5
  SHA512:
6
- metadata.gz: bafb007a39acc411b6add0c23a6f437120e7dd8235aeb9382de3ad025d8800e4cc1f7acd586d6eca933f0f45ef1d52e09bc358977f8d05f869098ffd0ba1076e
7
- data.tar.gz: ea5c715b0f06b4170b424ec2231504e951e9b12f54a783dee04327cd662a802316a2274313d9cf61fd42eb0140d7be798643b17127f8230e7e33dd2cb6a44a16
6
+ metadata.gz: c32d9de226d357c3bfddb6891b3ebb7832738c7886fc0a7e61fd31b702d46435d119d3390996b3c734f7fb04b805b91bd8689b5686ceb8a4f7f0f591d6a3d7a9
7
+ data.tar.gz: 792857d5e53d9818b688b9599f3793f619261529cb86e7a82e8a6aa9aca5f0e348d06c684a44a8229618645cd662085238625baf7badb2e39b79afdd0ee24c35
@@ -64,6 +64,7 @@ en:
64
64
  dapp_secret_key_not_found: "WARNING: Secrets haven't decoded: secret key not found in %{not_found_in}!"
65
65
  introspect_image_impossible: "WARNING: You can't introspect stage `%{name}`!"
66
66
  stage_dependencies_not_found: "WARNING: Stage dependencies `%{dependencies}` haven't been found in repo `%{repo}`!"
67
+ stage_dependencies_file_not_found: "WARNING: Stage dependencies `%{dependencies}` haven't been found in repo `%{repo}`!\nIf you want to consider specific file you should use one of the following git-artifact configuration:\n\n```\ngit:\n- add: /folder/file\n to: /folder/file\n stageDependencies:\n install: ''\n```\n\n```\ngit:\n- add: /folder\n to: /folder\n includePaths: file\n stageDependencies:\n install: file\n```"
67
68
  unsupported_dapp_config_options: "WARNING: .dapp_config includes unsupported options [%{options}]: use only following options [%{supported_options}]"
68
69
  group:
69
70
  install: 'Install group'
@@ -124,8 +124,10 @@ en:
124
124
  git_repository_reference_error: "Git repo `%{name}`: %{message}!"
125
125
  rugged_remote_error: "Remote git repo `%{url}`: `%{message}`!"
126
126
  local_git_repository_does_not_exist: "Local git repo (`%{path}`): doesn't exist!"
127
- commit_not_found_in_local_git_repository: "Local git repo: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
127
+ commit_not_found_in_local_git_repository: "Local git repo (`%{path}`): commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
128
128
  commit_not_found_in_remote_git_repository: "Remote git repo `%{url}`: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
129
+ git_local_submodule_commit_not_found: "Git repo `%{path}`: submodule commit `%{commit}` not found!"
130
+ git_remote_submodule_commit_not_found: "Git repo `%{url}`: submodule commit `%{commit}` not found!"
129
131
  branch_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: branch `%{branch}` not exist!"
130
132
  rugged_protocol_not_supported: "Rugged has been compiled without support for `%{protocol}`.\nGit repositories will not be reachable via `%{protocol}` (`%{url}`).\nRugged.features should include `%{protocol}`."
131
133
  git_local_incorrect_gitmodules_params: "Local git repo with invalid `.gitmodules` file: %{error}"
@@ -158,19 +158,21 @@ module Dapp
158
158
  elsif cwd == ''
159
159
  :directory
160
160
  else
161
- commit = repo.lookup_commit(stage.layer_commit(self))
161
+ cwd_type_by_commit(repo.lookup_commit(stage.layer_commit(self)))
162
+ end
163
+ end
162
164
 
163
- cwd_entry = begin
164
- commit.tree.path(cwd)
165
- rescue Rugged::TreeError
166
- end
165
+ def cwd_type_by_commit(commit)
166
+ cwd_entry = begin
167
+ commit.tree.path(cwd)
168
+ rescue Rugged::TreeError
169
+ end
167
170
 
168
- if cwd_entry
169
- if cwd_entry[:type] == :tree
170
- :directory
171
- else
172
- :file
173
- end
171
+ if cwd_entry
172
+ if cwd_entry[:type] == :tree
173
+ :directory
174
+ else
175
+ :file
174
176
  end
175
177
  end
176
178
  end
@@ -248,13 +250,16 @@ module Dapp
248
250
 
249
251
  stage_dependencies_key = [stage.name, commit]
250
252
 
253
+ @stage_dependencies_warning ||= {}
251
254
  @stage_dependencies_checksums ||= {}
252
255
  @stage_dependencies_checksums[stage_dependencies_key] ||= begin
253
256
  if dev_mode?
254
257
  dev_patch_hash(paths: paths)
255
258
  else
256
- if (entries = repo_entries(commit, paths: paths)).empty?
257
- repo.dapp.log_warning(desc: { code: :stage_dependencies_not_found,
259
+ if (entries = repo_entries(commit, paths: paths)).empty? && @stage_dependencies_warning[stage.name].nil?
260
+ @stage_dependencies_warning[stage.name] = true
261
+ code = cwd_type_by_commit(repo.lookup_commit(commit)) == :file ? :stage_dependencies_file_not_found : :stage_dependencies_not_found
262
+ repo.dapp.log_warning(desc: { code: code,
258
263
  data: { repo: repo.respond_to?(:url) ? repo.url : 'local',
259
264
  dependencies: stage_dependencies.join(', ') } })
260
265
  end
@@ -67,8 +67,30 @@ module Dapp
67
67
  .select { |s| !ignore_directory?(s.path, paths: paths, exclude_paths: exclude_paths) }
68
68
  end
69
69
 
70
- def submodules_git(_)
71
- git
70
+ def submodules_git(commit)
71
+ submodules_git_path(commit).tap do |git_path|
72
+ break begin
73
+ if git_path.directory?
74
+ Rugged::Repository.new(git_path.to_s)
75
+ else
76
+ Rugged::Repository.clone_at(path.to_s, git_path.to_s).tap do |submodules_git|
77
+ begin
78
+ submodules_git.checkout(commit)
79
+ rescue Rugged::ReferenceError
80
+ raise_submodule_commit_not_found!(commit)
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ def submodules_git_path(commit)
89
+ Pathname(File.join(dapp.host_docker_tmp_config_dir, "submodule", dapp.consistent_uniq_slugify(name), commit).to_s)
90
+ end
91
+
92
+ def raise_submodule_commit_not_found!(_)
93
+ raise
72
94
  end
73
95
 
74
96
  def submodule_url(gitsubmodule_url)
@@ -30,18 +30,19 @@ module Dapp
30
30
  submodules(commit, paths: paths, exclude_paths: exclude_paths).map do |submodule|
31
31
  next if commit.nil? && !submodule.in_config?
32
32
  submodule_params(submodule).tap do |params|
33
- if commit.nil?
34
- submodule_path = File.join(workdir_path, params[:path])
35
- params[:commit] = submodule.workdir_oid || submodule.head_oid
36
- if git_repo_exist?(submodule_path)
37
- dapp.log_info("Using local submodule `#{params[:path]}`!")
38
- params[:type] = :local
39
- end
33
+ params[:commit] = submodule.workdir_oid || params[:commit] if commit.nil?
34
+ if submodule.in_workdir? && !submodule.uninitialized?
35
+ dapp.log_info("Using local submodule repository `#{params[:path]}`!")
36
+ params[:type] = :local
40
37
  end
41
38
  end
42
39
  end.compact
43
40
  end
44
41
 
42
+ def raise_submodule_commit_not_found!(commit)
43
+ raise Error::Rugged, code: :git_local_submodule_commit_not_found, data: { commit: commit, path: path }
44
+ end
45
+
45
46
  def ignore_patch?(patch, paths: [], exclude_paths: [])
46
47
  delta_new_file = patch.delta.new_file
47
48
  args = [delta_new_file[:path], paths: paths, exclude_paths: exclude_paths]
@@ -79,7 +80,7 @@ module Dapp
79
80
  def lookup_commit(commit)
80
81
  super
81
82
  rescue Rugged::OdbError, TypeError => _e
82
- raise Error::Rugged, code: :commit_not_found_in_local_git_repository, data: { commit: commit }
83
+ raise Error::Rugged, code: :commit_not_found_in_local_git_repository, data: { commit: commit, path: path }
83
84
  end
84
85
 
85
86
  protected
@@ -9,6 +9,10 @@ module Dapp
9
9
  def exclude_paths
10
10
  dapp.local_git_artifact_exclude_paths
11
11
  end
12
+
13
+ def submodules_git(_)
14
+ git
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -100,22 +100,8 @@ module Dapp
100
100
  raise Error::Rugged, code: :commit_not_found_in_remote_git_repository, data: { commit: commit, url: url }
101
101
  end
102
102
 
103
- def submodules_git(commit)
104
- submodules_git_path(commit).tap do |git_path|
105
- break begin
106
- if git_path.directory?
107
- Rugged::Repository.new(git_path.to_s)
108
- else
109
- Rugged::Repository.clone_at(path.to_s, git_path.to_s).tap do |submodules_git|
110
- submodules_git.checkout(commit)
111
- end
112
- end
113
- end
114
- end
115
- end
116
-
117
- def submodules_git_path(commit)
118
- Pathname(File.join(dapp.host_docker_tmp_config_dir, "submodule", dapp.consistent_uniq_slugify(name), commit).to_s)
103
+ def raise_submodule_commit_not_found!(commit)
104
+ raise Error::Rugged, code: :git_remote_submodule_commit_not_found, data: { commit: commit, url: url }
119
105
  end
120
106
 
121
107
  protected
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.31.0"
2
+ VERSION = "0.31.1"
3
3
  BUILD_CACHE_VERSION = 30
4
4
  end
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.31.0
4
+ version: 0.31.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2018-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout