dapp 0.31.9 → 0.31.10

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
- SHA256:
3
- metadata.gz: d7aec78205e512f683583d2b504fffdffa60bc53f862ff0e610fd2da1340f7d3
4
- data.tar.gz: 4cf279885ce8fce74dd9023948bb7898b4a21becbb5973c1f42ecce2c805f655
2
+ SHA1:
3
+ metadata.gz: 694eb48fc2804c27d295fb7a5ba39aa7ae3124db
4
+ data.tar.gz: 1a2131680db02ca4d20c748023b1d3eeac4a0720
5
5
  SHA512:
6
- metadata.gz: 617748cc0deab81cc007ee306ec9b9864861334073cb6980af96140acffcc44d84c3d8330272b8faa9abc3291135e4fff18370310483836df7948f2cde7eb363
7
- data.tar.gz: ccf9f4dd3c28e566360807a5397a10b557589d946b73e24805c8a0c280edc9b80d1ea465855b021f2052ec2671ca47dcc6e42328d8576cdcb163bf96f493d7a8
6
+ metadata.gz: 59e3627ddc707a065e47feb1e20ba10e84316dc6c20c8c0a914df3afae3125ec4629593da873b29da258b70e03c920dc43e97c3bccf8e3c4c0997c04235da9dc
7
+ data.tar.gz: 1f6d0d57c3c3f1b099a053f866641adb8fb5cf068af5493e35e5ecdb7f00eb127393a6ef0427deb2efc2574c468228375f987f42a13ab1367bdb6ac58e68d468
@@ -85,7 +85,7 @@ en:
85
85
  stage_artifact_not_associated: "Artifact not associated with any stage: expected `before` or `after` attribute!"
86
86
  stage_artifact_double_associate: "Can't use `%{stage}` stage for artifact; already used in `%{conflict_stage}` stage!"
87
87
  stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
88
- git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
88
+ git_artifact_remote_with_refs: "Remote git repo: use `commit`, `tag` or `branch` directive!"
89
89
  artifact_conflict: "Conflict between artifacts!\n\n%{dappfile_context}"
90
90
  artifact_not_found: "Invalid Dappfile: artifact `%{name}` should be defined before import directive!"
91
91
  artifact_already_exists: "Invalid Dappfile: artifact `%{name}` already exists!"
@@ -129,6 +129,7 @@ en:
129
129
  git_local_submodule_commit_not_found: "Git repo `%{path}`: submodule commit `%{commit}` not found!"
130
130
  git_remote_submodule_commit_not_found: "Git repo `%{url}`: submodule commit `%{commit}` not found!"
131
131
  branch_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: branch `%{branch}` not exist!"
132
+ tag_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: tag `%{tag}` not exist!"
132
133
  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}`."
133
134
  git_local_incorrect_gitmodules_params: "Local git repo with invalid `.gitmodules` file: %{error}"
134
135
  incorrect_gitmodules_file: "Git repo `%{name}` with invalid `.gitmodules` file: %{error}\n\n%{content}"
@@ -6,7 +6,7 @@ module Dapp
6
6
  def _sample_list
7
7
  @sample_list ||= [].tap do |list|
8
8
  tree = begin
9
- latest_commit = _sample_git_repo.latest_commit(_samples_git_repo_branch)
9
+ latest_commit = _sample_git_repo.latest_branch_commit(_samples_git_repo_branch)
10
10
  latest_commit_tree = _sample_git_repo.lookup_commit(latest_commit).tree
11
11
 
12
12
  if _samples_dir == '.'
@@ -35,7 +35,7 @@ module Dapp
35
35
 
36
36
  def _sample_repo_blobs_entries(sample_name)
37
37
  _sample_git_repo
38
- .blobs_entries(_sample_git_repo.latest_commit(_samples_git_repo_branch), paths: [_sample_directory(sample_name)])
38
+ .blobs_entries(_sample_git_repo.latest_branch_commit(_samples_git_repo_branch), paths: [_sample_directory(sample_name)])
39
39
  .reject { |_, entry| entry[:filemode] == 0o160000 }
40
40
  end
41
41
 
@@ -53,7 +53,7 @@ module Dapp
53
53
 
54
54
  def commit_tags
55
55
  return {} unless options[:tag_commit]
56
- { git_commit: [git_own_repo.latest_commit] }
56
+ { git_commit: [git_own_repo.head_commit] }
57
57
  end
58
58
 
59
59
  def build_tags
@@ -95,4 +95,4 @@ module Dapp
95
95
  end
96
96
  end # Tags
97
97
  end # Dapp
98
- end # Dapp
98
+ end # Dapp
@@ -64,7 +64,7 @@ module Dapp
64
64
 
65
65
  extra_git["path"] = git_own_repo.path
66
66
  extra_git["workdir_path"] = git_own_repo.workdir_path
67
- extra_git["latest_commit"] = git_own_repo.latest_commit unless git_own_repo.empty?
67
+ extra_git["latest_commit"] = git_own_repo.head_commit unless git_own_repo.empty?
68
68
  end
69
69
  end
70
70
 
@@ -5,7 +5,7 @@ module Dapp
5
5
  class GitArtifactRemote < GitArtifactLocal
6
6
  include ::Dapp::Helper::Url
7
7
 
8
- attr_reader :_url, :_name, :_branch, :_commit
8
+ attr_reader :_url, :_name, :_branch, :_tag, :_commit
9
9
 
10
10
  def initialize(url, **kwargs, &blk)
11
11
  @_url = url
@@ -18,6 +18,10 @@ module Dapp
18
18
  sub_directive_eval { @_branch = value.to_s }
19
19
  end
20
20
 
21
+ def tag(value)
22
+ sub_directive_eval { @_tag = value.to_s }
23
+ end
24
+
21
25
  def commit(value)
22
26
  sub_directive_eval { @_commit = value.to_s }
23
27
  end
@@ -27,6 +31,7 @@ module Dapp
27
31
  export._url = @_url
28
32
  export._name = @_name
29
33
  export._branch ||= @_branch
34
+ export._tag ||= @_tag
30
35
  export._commit ||= @_commit
31
36
 
32
37
  yield(export) if block_given?
@@ -34,23 +39,28 @@ module Dapp
34
39
  end
35
40
 
36
41
  class Export < GitArtifactLocal::Export
37
- attr_accessor :_url, :_name, :_branch, :_commit
42
+ attr_accessor :_url, :_name, :_branch, :_tag, :_commit
38
43
 
39
44
  def _artifact_options
40
- super.merge(name: _name, branch: _branch, commit: _commit)
45
+ super.merge(name: _name, branch: _branch, tag: _tag, commit: _commit)
41
46
  end
42
47
 
43
48
  def branch(value)
44
49
  sub_directive_eval { @_branch = value.to_s }
45
50
  end
46
51
 
52
+ def tag(value)
53
+ sub_directive_eval { @_tag = value.to_s }
54
+ end
55
+
47
56
  def commit(value)
48
57
  sub_directive_eval { @_commit = value.to_s }
49
58
  end
50
59
 
51
60
  def validate!
52
61
  super
53
- raise ::Dapp::Error::Config, code: :git_artifact_remote_branch_with_commit if !_branch.nil? && !_commit.nil?
62
+ refs = [_branch, _tag, _commit].compact
63
+ raise ::Dapp::Error::Config, code: :git_artifact_remote_with_refs if refs.length > 1
54
64
  end
55
65
  end
56
66
  end
@@ -12,7 +12,7 @@ module Dapp
12
12
  # FIXME: переименовать cwd в from
13
13
 
14
14
  # rubocop:disable Metrics/ParameterLists
15
- def initialize(repo, dimg, to:, name: nil, branch: nil, commit: nil,
15
+ def initialize(repo, dimg, to:, name: nil, branch: nil, tag: nil, commit: nil,
16
16
  cwd: nil, include_paths: nil, exclude_paths: nil, owner: nil, group: nil, as: nil,
17
17
  stages_dependencies: {}, ignore_signature_auto_calculation: false)
18
18
  @repo = repo
@@ -21,7 +21,8 @@ module Dapp
21
21
 
22
22
  @ignore_signature_auto_calculation = ignore_signature_auto_calculation
23
23
 
24
- @branch = branch || repo.branch
24
+ @branch = branch
25
+ @tag = tag
25
26
  @commit = commit
26
27
 
27
28
  @to = to
@@ -296,7 +297,15 @@ module Dapp
296
297
 
297
298
  def latest_commit
298
299
  @latest_commit ||= begin
299
- (commit || repo.latest_commit(branch)).tap do |c|
300
+ commit || begin
301
+ if !tag.nil?
302
+ repo.latest_tag_commit(tag)
303
+ elsif !branch.nil?
304
+ repo.latest_branch_commit(branch)
305
+ else
306
+ repo.head_commit
307
+ end
308
+ end.tap do |c|
300
309
  repo.dapp.log_info("Repository `#{repo.name}`: latest commit `#{c}` to `#{to}`") unless ignore_signature_auto_calculation
301
310
  end
302
311
  end
@@ -332,6 +341,7 @@ module Dapp
332
341
  attr_reader :to
333
342
  attr_reader :commit
334
343
  attr_reader :branch
344
+ attr_reader :tag
335
345
  attr_reader :cwd
336
346
  attr_reader :owner
337
347
  attr_reader :group
@@ -169,7 +169,15 @@ module Dapp
169
169
  git.exists?(commit)
170
170
  end
171
171
 
172
- def latest_commit(_branch)
172
+ def head_commit
173
+ git.head.target_id
174
+ end
175
+
176
+ def latest_branch_commit(_)
177
+ raise
178
+ end
179
+
180
+ def latest_tag_commit(_)
173
181
  raise
174
182
  end
175
183
 
@@ -61,7 +61,7 @@ module Dapp
61
61
 
62
62
  def diff(from, to, **kwargs)
63
63
  if from.nil? and to.nil?
64
- mid_commit = latest_commit
64
+ mid_commit = head_commit
65
65
  diff_obj = super(nil, mid_commit, **kwargs)
66
66
  diff_obj.merge! git.lookup(mid_commit).diff_workdir(**kwargs)
67
67
  diff_obj
@@ -72,10 +72,6 @@ module Dapp
72
72
  end
73
73
  end
74
74
 
75
- def latest_commit(_branch = nil)
76
- git.head.target_id
77
- end
78
-
79
75
  def lookup_commit(commit)
80
76
  super
81
77
  rescue Rugged::OdbError, TypeError => _e
@@ -76,13 +76,20 @@ module Dapp
76
76
  end unless dapp.dry_run?
77
77
  end
78
78
 
79
- def latest_commit(branch)
79
+ def latest_branch_commit(branch)
80
80
  git.ref("refs/remotes/#{branch_format(branch)}").tap do |ref|
81
81
  raise Error::Rugged, code: :branch_not_exist_in_remote_git_repository, data: { branch: branch, url: url } if ref.nil?
82
82
  break ref.target_id
83
83
  end
84
84
  end
85
85
 
86
+ def latest_tag_commit(tag)
87
+ git.tags[tag].tap do |t|
88
+ raise Error::Rugged, code: :tag_not_exist_in_remote_git_repository, data: { tag: tag, url: url } if t.nil?
89
+ break t.target_id
90
+ end
91
+ end
92
+
86
93
  def lookup_commit(commit)
87
94
  super
88
95
  rescue Rugged::OdbError, TypeError => _e
@@ -122,6 +122,7 @@ module Dapp
122
122
  helm_additional_values_options,
123
123
  helm_set_options(without_registry: true),
124
124
  ("--namespace #{namespace}" if namespace),
125
+ "--name #{name}",
125
126
  ].compact.join(" ")
126
127
 
127
128
  cmd.stdout
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.31.9"
2
+ VERSION = "0.31.10"
3
3
  BUILD_CACHE_VERSION = 30
4
4
  end
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.31.9
4
+ version: 0.31.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
@@ -744,7 +744,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
744
744
  version: 2.5.0
745
745
  requirements: []
746
746
  rubyforge_project:
747
- rubygems_version: 2.7.7
747
+ rubygems_version: 2.5.1
748
748
  signing_key:
749
749
  specification_version: 4
750
750
  summary: Build docker packaged apps using chef or shell