dapp 0.27.24 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/config/en/common.yml +1 -0
  3. data/lib/dapp.rb +2 -2
  4. data/lib/dapp/cli/options/tag.rb +51 -0
  5. data/lib/dapp/dapp/dappfile.rb +2 -2
  6. data/lib/dapp/dimg/artifact.rb +5 -1
  7. data/lib/dapp/dimg/build/stage/artifact_default.rb +2 -4
  8. data/lib/dapp/dimg/build/stage/base.rb +22 -10
  9. data/lib/dapp/dimg/build/stage/ga_archive.rb +7 -2
  10. data/lib/dapp/dimg/build/stage/mod/logging.rb +9 -1
  11. data/lib/dapp/dimg/builder/ansible.rb +1 -1
  12. data/lib/dapp/dimg/cli/cli.rb +1 -0
  13. data/lib/dapp/dimg/cli/command/dimg/bp.rb +8 -32
  14. data/lib/dapp/dimg/cli/command/dimg/build.rb +7 -50
  15. data/lib/dapp/dimg/cli/command/dimg/push.rb +1 -1
  16. data/lib/dapp/dimg/cli/command/dimg/run.rb +7 -3
  17. data/lib/dapp/dimg/cli/command/dimg/tag.rb +1 -1
  18. data/lib/dapp/dimg/cli/options/introspection.rb +45 -0
  19. data/lib/dapp/dimg/dapp/command/cleanup_repo.rb +60 -3
  20. data/lib/dapp/dimg/dapp/command/common.rb +5 -1
  21. data/lib/dapp/dimg/dapp/command/run.rb +1 -1
  22. data/lib/dapp/dimg/dapp/command/stages/common.rb +2 -3
  23. data/lib/dapp/dimg/dapp/command/stages/flush_local.rb +3 -0
  24. data/lib/dapp/dimg/dapp/dimg.rb +16 -2
  25. data/lib/dapp/dimg/dimg.rb +39 -4
  26. data/lib/dapp/dimg/dimg/git_artifact.rb +1 -5
  27. data/lib/dapp/dimg/docker_registry/base/authorization.rb +1 -16
  28. data/lib/dapp/dimg/git_artifact.rb +1 -1
  29. data/lib/dapp/dimg/image/argument.rb +0 -4
  30. data/lib/dapp/kube/cli/command/kube/deploy.rb +1 -3
  31. data/lib/dapp/kube/cli/command/kube/lint.rb +1 -1
  32. data/lib/dapp/kube/cli/command/kube/render.rb +1 -1
  33. data/lib/dapp/kube/cli/command/kube/value_get.rb +1 -1
  34. data/lib/dapp/kube/dapp/command/deploy.rb +0 -2
  35. data/lib/dapp/kube/dapp/command/minikube_setup.rb +4 -0
  36. data/lib/dapp/kube/kubernetes/client.rb +101 -30
  37. data/lib/dapp/version.rb +2 -2
  38. metadata +6 -6
  39. data/lib/dapp/cli/command/options/tag.rb +0 -53
  40. data/lib/dapp/cli/options/ssh.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92ace8efed7d94bce6963a716dd06bcf250565fa
4
- data.tar.gz: 61ad2c2d8022efff30cbe82c25ba788ec1d5a74e
3
+ metadata.gz: 3dbff2ff0349b92efd0c4662cc5ba5bb9c77a107
4
+ data.tar.gz: e97fcc44533ceea1d85f3ca6e2384738885c83b9
5
5
  SHA512:
6
- metadata.gz: dce06b2f76860a3a20864788e1018b22fec7726a606b785cd7b55eb9cb894075ff083bce2060488bb1fd0fcf7d1676020caa0080b0b4ebc8b3b58ad188194c4b
7
- data.tar.gz: dc60b638a540429f1622793f78334902adfc92e734ed06f9fed6ee0e649b500e9c612dd050dbcbe59e3ac72faed3c9a7e3d950b5b3f41b10ba19e5b59aaeaaee
6
+ metadata.gz: 830eb29eb810e75dd9404f44771813b39b5eaffc6a6739f93214d3917138cdc67ecb4f8582da684c28f296158400bae84497854a4dceef89340f7299205a13bc
7
+ data.tar.gz: 7676eef00836559b62814f9833d4877f6f8dd042a9d936f0b758c2e5127aa6f88c25bf6e2076245c62077239e1a9d84586a6bc5d028b7d0946e3d46891a5fb80
data/config/en/common.yml CHANGED
@@ -49,6 +49,7 @@ en:
49
49
  pull: '[PULL]'
50
50
  tag: '[TAG]'
51
51
  exist: '[EXIST]'
52
+ not_exist: '[NOT EXIST]'
52
53
  warning:
53
54
  wrong_using_base_directive: "WARNING: Directive `%{directive}` has declared after dimg_group|dimg|artifact!"
54
55
  wrong_using_directive: "WARNING: Directive `%{directive}` has declared after dimg_group|dimg!"
data/lib/dapp.rb CHANGED
@@ -52,8 +52,7 @@ require 'dapp/error/config'
52
52
  require 'dapp/error/shellout'
53
53
  require 'dapp/exception/base'
54
54
  require 'dapp/cli'
55
- require 'dapp/cli/command/options/tag'
56
- require 'dapp/cli/options/ssh'
55
+ require 'dapp/cli/options/tag'
57
56
  require 'dapp/cli/command/base'
58
57
  require 'dapp/cli/command/update'
59
58
  require 'dapp/cli/command/slug'
@@ -169,6 +168,7 @@ require 'dapp/dimg/build/stage/ga_latest_patch'
169
168
  require 'dapp/dimg/build/stage/docker_instructions'
170
169
  require 'dapp/dimg/build/stage/ga_artifact_patch'
171
170
  require 'dapp/dimg/build/stage/build_artifact'
171
+ require 'dapp/dimg/cli/options/introspection'
172
172
  require 'dapp/dimg/cli/command/base'
173
173
  require 'dapp/dimg/cli/command/dimg'
174
174
  require 'dapp/dimg/cli/command/dimg/build'
@@ -0,0 +1,51 @@
1
+ module Dapp
2
+ class CLI
3
+ module Options
4
+ module Tag
5
+ def self.extended(klass)
6
+ klass.class_eval do
7
+ "Add tag (can be used one or more times), specified text will be slugified".tap do |desc|
8
+ option :tag,
9
+ long: '--tag TAG',
10
+ description: desc,
11
+ default: [],
12
+ proc: proc { |v| composite_options(:tags) << v }
13
+
14
+ option :tag_slug,
15
+ long: '--tag-slug TAG',
16
+ description: desc,
17
+ default: [],
18
+ proc: proc { |v| composite_options(:slug_tags) << v }
19
+ end
20
+
21
+ option :tag_plain,
22
+ long: '--tag-plain TAG',
23
+ description: "Add tag (can be used one or more times)",
24
+ default: [],
25
+ proc: proc { |v| composite_options(:plain_tags) << v }
26
+
27
+ option :tag_branch,
28
+ long: '--tag-branch',
29
+ description: 'Tag by git branch',
30
+ boolean: true
31
+
32
+ option :tag_build_id,
33
+ long: '--tag-build-id',
34
+ description: 'Tag by CI build id',
35
+ boolean: true
36
+
37
+ option :tag_ci,
38
+ long: '--tag-ci',
39
+ description: 'Tag by CI branch and tag',
40
+ boolean: true
41
+
42
+ option :tag_commit,
43
+ long: '--tag-commit',
44
+ description: 'Tag by git commit',
45
+ boolean: true
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -124,12 +124,12 @@ module Dapp
124
124
  return if File.exists? dappfile_yml_bin_path
125
125
 
126
126
  log_process("Downloading dappfile-yml dapp dependency") do
127
- location = URI("https://dl.bintray.com/dapp/ruby2go/#{::Dapp::VERSION}/dappfile-yml")
127
+ location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/dappfile-yml")
128
128
 
129
129
  tmp_bin_path = File.join(self.class.tmp_base_dir, "dappfile-yml-#{SecureRandom.uuid}")
130
130
  ::Dapp::Downloader.download(location, tmp_bin_path, show_progress: true, progress_titile: dappfile_yml_bin_path)
131
131
 
132
- checksum_location = URI("https://dl.bintray.com/dapp/ruby2go/#{::Dapp::VERSION}/dappfile-yml.sha")
132
+ checksum_location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/dappfile-yml.sha")
133
133
  tmp_bin_checksum_path = tmp_bin_path + ".checksum"
134
134
  ::Dapp::Downloader.download(checksum_location, tmp_bin_checksum_path)
135
135
 
@@ -8,7 +8,11 @@ module Dapp
8
8
  def after_stages_build!
9
9
  end
10
10
 
11
- def stage_should_be_introspected?(name)
11
+ def stage_should_be_introspected_before_build?(name)
12
+ dapp.options[:introspect_artifact_before] == name
13
+ end
14
+
15
+ def should_be_introspected_after_build?(name)
12
16
  dapp.options[:introspect_artifact_stage] == name
13
17
  end
14
18
 
@@ -16,12 +16,10 @@ module Dapp
16
16
  group = artifact[:options][:group]
17
17
  to = artifact[:options][:to]
18
18
 
19
- export_folder_name = SecureRandom.uuid
20
-
21
- command = safe_cp(cwd, artifact_dimg.container_tmp_path(artifact_dimg.name, export_folder_name).to_s, nil, nil, include_paths, exclude_paths)
19
+ command = safe_cp(cwd, artifact_dimg.container_tmp_path(artifact_dimg.name, 'data').to_s, nil, nil, include_paths, exclude_paths)
22
20
  run_artifact_dimg(artifact_dimg, command)
23
21
 
24
- command = safe_cp(dimg.container_tmp_path('artifact', artifact_dimg.name, export_folder_name).to_s, to, owner, group, include_paths, exclude_paths)
22
+ command = safe_cp(dimg.container_tmp_path('artifact', artifact_dimg.name, 'data').to_s, to, owner, group, include_paths, exclude_paths)
25
23
  image.add_command command
26
24
  image.add_volume "#{dimg.tmp_path('artifact', artifact_dimg.name)}:#{dimg.container_tmp_path('artifact', artifact_dimg.name)}:ro"
27
25
  end
@@ -50,16 +50,7 @@ module Dapp
50
50
  def build!
51
51
  prev_stage.build! if prev_stage
52
52
  renew if should_be_renewed?
53
- image_build unless empty?
54
- image_introspect if image_should_be_introspected?
55
- end
56
-
57
- def image_introspect
58
- if image.built?
59
- dimg.introspect_image!(image: image.built_id, options: image.send(:prepared_options))
60
- else
61
- dimg.dapp.log_warning(desc: { code: :introspect_image_impossible, data: { name: name } })
62
- end
53
+ image_build
63
54
  end
64
55
 
65
56
  def save_in_cache!
@@ -233,10 +224,31 @@ module Dapp
233
224
 
234
225
  def image_build
235
226
  prepare_image if image_should_be_prepared?
227
+
228
+ introspect_image_before_build if image_should_be_introspected_before_build?
229
+
236
230
  log_image_build do
237
231
  dimg.dapp.log_process(log_name,
238
232
  process: dimg.dapp.t(code: 'status.process.building'),
239
233
  short: should_not_be_detailed?) { image.build! }
234
+ end unless empty?
235
+
236
+ introspect_image_after_build if image_should_be_introspected_after_build?
237
+ end
238
+
239
+ def introspect_image_before_build
240
+ introspect_image_default(from_image)
241
+ end
242
+
243
+ def introspect_image_after_build
244
+ introspect_image_default(image)
245
+ end
246
+
247
+ def introspect_image_default(introspected_image)
248
+ if introspected_image.built?
249
+ dimg.introspect_image!(image: introspected_image.built_id, options: image.send(:prepared_options))
250
+ else
251
+ dimg.dapp.log_warning(desc: { code: :introspect_image_impossible, data: { name: name } })
240
252
  end
241
253
  end
242
254
 
@@ -11,14 +11,19 @@ module Dapp
11
11
  end
12
12
 
13
13
  def dependencies
14
- @dependencies ||= [dimg.git_artifacts.map(&:paramshash).join, reset_commits]
14
+ @dependencies ||= [dimg.git_artifacts.map(&:paramshash).join, reset_commits, dev_mode_dependencies]
15
+ end
16
+
17
+ def dev_mode_dependencies
18
+ return unless dimg.dev_mode?
19
+ dimg.git_artifacts.map(&:latest_commit)
15
20
  end
16
21
 
17
22
  protected
18
23
 
19
24
  def reset_commits
20
25
  regex = Regexp.union(RESET_COMMIT_MESSAGES)
21
- dimg.git_artifacts.map { |git_artifact| git_artifact.repo.find_commit_id_by_message(regex) }.compact.sort.uniq
26
+ dimg.git_artifacts.map { |git_artifact| git_artifact.repo.find_commit_id_by_message(regex) }.sort.uniq.compact
22
27
  end
23
28
 
24
29
  def apply_command_method
@@ -81,7 +81,15 @@ module Dapp
81
81
  end
82
82
 
83
83
  def image_should_be_introspected?
84
- dimg.stage_should_be_introspected?(name) && !dimg.dapp.dry_run?
84
+ image_should_be_introspected_after_build? || image_should_be_introspected_before_build?
85
+ end
86
+
87
+ def image_should_be_introspected_before_build?
88
+ dimg.stage_should_be_introspected_before_build?(name) && !dimg.dapp.dry_run?
89
+ end
90
+
91
+ def image_should_be_introspected_after_build?
92
+ dimg.stage_should_be_introspected_after_build?(name) && !dimg.dapp.dry_run?
85
93
  end
86
94
  end
87
95
  end # Mod
@@ -155,7 +155,7 @@ module Dapp
155
155
  image.add_command [ansible_playbook_bin,
156
156
  container_workdir.join('playbook.yml'),
157
157
  ENV['ANSIBLE_ARGS']
158
- ].join(' ')
158
+ ].compact.join(' ')
159
159
  end
160
160
  end
161
161
  end
@@ -1 +1,2 @@
1
1
  ::Dapp::CLI.send(:include, ::Dapp::Dimg::CLI::Command)
2
+ ::Dapp::CLI.send(:include, ::Dapp::Dimg::CLI::Options)
@@ -15,18 +15,7 @@ BANNER
15
15
 
16
16
  # build options
17
17
 
18
- introspected_stages = [
19
- :from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
20
- :g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact,
21
- :g_a_pre_setup_patch, :setup, :g_a_post_setup_patch, :after_setup_artifact, :g_a_latest_patch, :docker_instructions
22
- ]
23
- artifact_introspected_stages = [
24
- :from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
25
- :g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact,
26
- :g_a_pre_setup_patch, :setup, :after_setup_artifact, :g_a_artifact_patch, :build_artifact
27
- ]
28
-
29
- extend ::Dapp::CLI::Options::Ssh
18
+ extend ::Dapp::Dimg::CLI::Options::Introspection
30
19
 
31
20
  option :tmp_dir_prefix,
32
21
  long: '--tmp-dir-prefix PREFIX',
@@ -41,25 +30,12 @@ BANNER
41
30
  long: '--git-artifact-branch BRANCH',
42
31
  description: 'Default branch to archive artifacts from'
43
32
 
44
- option :introspect_error,
45
- long: '--introspect-error',
46
- boolean: true,
47
- default: false
48
-
49
- option :introspect_before_error,
50
- long: '--introspect-before-error',
51
- boolean: true,
52
- default: false
53
-
54
- option :introspect_stage,
55
- long: '--introspect-stage STAGE',
56
- description: "Introspect one of the following stages (#{list_msg_format(introspected_stages)})",
57
- proc: proc { |val| val.to_sym.tap { |v| in_validate!(v, introspected_stages) } }
58
-
59
- option :introspect_artifact_stage,
60
- long: '--introspect-artifact-stage STAGE',
61
- description: "Introspect one of the following stages (#{list_msg_format(artifact_introspected_stages)})",
62
- proc: proc { |val| val.to_sym.tap { |v| in_validate!(v, artifact_introspected_stages) } }
33
+ option :ssh_key,
34
+ long: '--ssh-key SSH_KEY',
35
+ description: ['Enable only specified ssh keys ',
36
+ '(use system ssh-agent by default)'].join,
37
+ default: nil,
38
+ proc: ->(v) { composite_options(:ssh_key) << v }
63
39
 
64
40
  option :build_context_directory,
65
41
  long: '--build-context-directory DIR_PATH',
@@ -77,7 +53,7 @@ BANNER
77
53
 
78
54
  # push options
79
55
 
80
- extend ::Dapp::CLI::Command::Options::Tag
56
+ extend ::Dapp::CLI::Options::Tag
81
57
 
82
58
  option :with_stages,
83
59
  long: '--with-stages',
@@ -11,21 +11,8 @@ Usage:
11
11
 
12
12
  Options:
13
13
  BANNER
14
- artifact_stages = [
15
- :from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
16
- :g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact,
17
- :g_a_pre_setup_patch, :setup, :after_setup_artifact, :g_a_artifact_patch, :build_artifact
18
- ]
19
14
 
20
- before_stage_proc = proc do |stages|
21
- proc do |val|
22
- val_sym = val.to_sym
23
- STAGE_PROC.call(stages[1..-1]).call(val_sym)
24
- stages[stages.index(val_sym) - 1]
25
- end
26
- end
27
-
28
- extend ::Dapp::CLI::Options::Ssh
15
+ extend ::Dapp::Dimg::CLI::Options::Introspection
29
16
 
30
17
  option :tmp_dir_prefix,
31
18
  long: '--tmp-dir-prefix PREFIX',
@@ -40,35 +27,12 @@ BANNER
40
27
  long: '--git-artifact-branch BRANCH',
41
28
  description: 'Default branch to archive artifacts from'
42
29
 
43
- option :introspect_error,
44
- long: '--introspect-error',
45
- boolean: true,
46
- default: false
47
-
48
- option :introspect_before_error,
49
- long: '--introspect-before-error',
50
- boolean: true,
51
- default: false
52
-
53
- option :introspect_stage,
54
- long: '--introspect-stage STAGE',
55
- description: "Introspect one of the following stages (#{list_msg_format(DIMG_STAGES)})",
56
- proc: STAGE_PROC.call(DIMG_STAGES)
57
-
58
- option :introspect_before,
59
- long: '--introspect-before STAGE',
60
- description: "Introspect stage before one of the following stages (#{list_msg_format(DIMG_STAGES[1..-1])})",
61
- proc: before_stage_proc.call(DIMG_STAGES)
62
-
63
- option :introspect_artifact_stage,
64
- long: '--introspect-artifact-stage STAGE',
65
- description: "Introspect one of the following stages (#{list_msg_format(artifact_stages)})",
66
- proc: STAGE_PROC.call(artifact_stages)
67
-
68
- option :introspect_artifact_before,
69
- long: '--introspect-artifact-before STAGE',
70
- description: "Introspect stage before one of the following stages (#{list_msg_format(artifact_stages[1..-1])})",
71
- proc: before_stage_proc.call(artifact_stages)
30
+ option :ssh_key,
31
+ long: '--ssh-key SSH_KEY',
32
+ description: ['Enable only specified ssh keys ',
33
+ '(use system ssh-agent by default)'].join,
34
+ default: nil,
35
+ proc: ->(v) { composite_options(:ssh_key) << v }
72
36
 
73
37
  option :build_context_directory,
74
38
  long: '--build-context-directory DIR_PATH',
@@ -83,13 +47,6 @@ BANNER
83
47
  long: '--force-save-cache',
84
48
  boolean: true,
85
49
  default: false
86
-
87
- def cli_options(**kwargs)
88
- super.tap do |config|
89
- config[:introspect_stage] ||= config[:introspect_before]
90
- config[:introspect_artifact_stage] ||= config[:introspect_artifact_before]
91
- end
92
- end
93
50
  end
94
51
  end
95
52
  end
@@ -11,7 +11,7 @@ Usage:
11
11
 
12
12
  Options:
13
13
  BANNER
14
- extend ::Dapp::CLI::Command::Options::Tag
14
+ extend ::Dapp::CLI::Options::Tag
15
15
 
16
16
  option :lock_timeout,
17
17
  long: '--lock-timeout TIMEOUT',
@@ -12,14 +12,18 @@ Usage:
12
12
 
13
13
  Options:
14
14
  BANNER
15
-
16
- extend ::Dapp::CLI::Options::Ssh
17
-
18
15
  option :stage,
19
16
  long: '--stage STAGE',
20
17
  description: "Run one of the following stages (#{list_msg_format(DIMG_STAGES)})",
21
18
  proc: STAGE_PROC.call(DIMG_STAGES)
22
19
 
20
+ option :ssh_key,
21
+ long: '--ssh-key SSH_KEY',
22
+ description: ['Enable only specified ssh keys ',
23
+ '(use system ssh-agent by default)'].join,
24
+ default: nil,
25
+ proc: ->(v) { composite_options(:ssh_key) << v }
26
+
23
27
  def read_options(args)
24
28
  self.class.cli_wrapper(self) do
25
29
  args.each_with_index do |arg, i|
@@ -11,7 +11,7 @@ Usage:
11
11
 
12
12
  Options:
13
13
  BANNER
14
- extend ::Dapp::CLI::Command::Options::Tag
14
+ extend ::Dapp::CLI::Options::Tag
15
15
 
16
16
  def run(argv = ARGV)
17
17
  self.class.parse_options(self, argv)
@@ -0,0 +1,45 @@
1
+ module Dapp::Dimg::CLI
2
+ module Options
3
+ module Introspection
4
+ def self.extended(klass)
5
+ artifact_stages = [
6
+ :from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
7
+ :g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact,
8
+ :g_a_pre_setup_patch, :setup, :after_setup_artifact, :g_a_artifact_patch, :build_artifact
9
+ ]
10
+
11
+ klass.class_eval do
12
+ option :introspect_error,
13
+ long: '--introspect-error',
14
+ boolean: true,
15
+ default: false
16
+
17
+ option :introspect_before_error,
18
+ long: '--introspect-before-error',
19
+ boolean: true,
20
+ default: false
21
+
22
+ option :introspect_stage,
23
+ long: '--introspect-stage STAGE',
24
+ description: "Introspect one of the following stages (#{list_msg_format(klass.const_get(:DIMG_STAGES))})",
25
+ proc: klass.const_get(:STAGE_PROC).call(klass.const_get(:DIMG_STAGES))
26
+
27
+ option :introspect_before,
28
+ long: '--introspect-before STAGE',
29
+ description: "Introspect stage before one of the following stages (#{list_msg_format(klass.const_get(:DIMG_STAGES))})",
30
+ proc: klass.const_get(:STAGE_PROC).call(klass.const_get(:DIMG_STAGES))
31
+
32
+ option :introspect_artifact_stage,
33
+ long: '--introspect-artifact-stage STAGE',
34
+ description: "Introspect one of the following stages (#{list_msg_format(artifact_stages)})",
35
+ proc: klass.const_get(:STAGE_PROC).call(artifact_stages)
36
+
37
+ option :introspect_artifact_before,
38
+ long: '--introspect-artifact-before STAGE',
39
+ description: "Introspect stage before one of the following stages (#{list_msg_format(artifact_stages)})",
40
+ proc: klass.const_get(:STAGE_PROC).call(artifact_stages)
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -150,9 +150,15 @@ module Dapp
150
150
  @kube_images ||= namespaces['items'].map do |item|
151
151
  item['metadata']['name']
152
152
  end.map do |ns|
153
- client.with_namespace(ns) do
154
- client.pod_list['items'].map do |pod|
155
- pod['spec']['containers'].map{ |cont| cont['image'] }
153
+ [].tap do |arr|
154
+ client.with_namespace(ns) do
155
+ arr << pod_images(client)
156
+ arr << cronjob_images(client)
157
+ arr << daemonset_images(client)
158
+ arr << deployment_images(client)
159
+ arr << job_images(client)
160
+ arr << replicaset_images(client)
161
+ arr << replicationcontroller_images(client)
156
162
  end
157
163
  end
158
164
  end.flatten.uniq.select do |image|
@@ -160,6 +166,57 @@ module Dapp
160
166
  end
161
167
  end
162
168
 
169
+ # pod items[] spec containers[] image
170
+ def pod_images(client)
171
+ client.pod_list['items'].map do |item|
172
+ item['spec']['containers'].map{ |cont| cont['image'] }
173
+ end
174
+ end
175
+
176
+ # cronjob items[] spec jobTemplate spec template spec containers[] image
177
+ def cronjob_images(client)
178
+ client.cronjob_list['items'].map do |item|
179
+ item['spec']['jobTemplate']['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
180
+ end
181
+ end
182
+
183
+ # daemonsets items[] spec template spec containers[] image
184
+ def daemonset_images(client)
185
+ client.daemonset_list['items'].map do |item|
186
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
187
+ end
188
+ end
189
+
190
+ # deployment items[] spec template spec containers[] image
191
+ def deployment_images(client)
192
+ client.deployment_list['items'].map do |item|
193
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
194
+ end
195
+ end
196
+
197
+ # job items[] spec template spec containers[] image
198
+ def job_images(client)
199
+ client.job_list['items'].map do |item|
200
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
201
+ end
202
+ end
203
+
204
+ # replicasets items[] spec template spec containers[] image
205
+ def replicaset_images(client)
206
+ client.replicaset_list['items'].map do |item|
207
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
208
+ end
209
+ end
210
+
211
+ # replicationcontroller items[] spec template spec containers[] image
212
+ def replicationcontroller_images(client)
213
+ client.replicationcontroller_list['items'].map do |item|
214
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
215
+ end
216
+ end
217
+
218
+
219
+
163
220
  def without_kube?
164
221
  !!options[:without_kube]
165
222
  end
@@ -3,6 +3,10 @@ module Dapp
3
3
  module Dapp
4
4
  module Command
5
5
  module Common
6
+ def dimgstage_push_tag_format
7
+ 'dimgstage-%{signature}'
8
+ end
9
+
6
10
  protected
7
11
 
8
12
  def dapp_project_dimgstages
@@ -203,7 +207,7 @@ module Dapp
203
207
  end
204
208
 
205
209
  def dimgstage_push_format
206
- '%{repo}:dimgstage-%{signature}'
210
+ "%{repo}:#{dimgstage_push_tag_format}"
207
211
  end
208
212
 
209
213
  def with_stages?
@@ -6,7 +6,7 @@ module Dapp
6
6
  def run(stage_name, docker_options, command)
7
7
  one_dimg!
8
8
  setup_ssh_agent
9
- dimg(config: build_configs.first, ignore_git_fetch: true, should_be_built: stage_name.nil?)
9
+ dimg(config: build_configs.first, ignore_git_fetch: true, should_be_built: stage_name.nil?, ignore_signature_auto_calculation: true)
10
10
  .run_stage(stage_name, docker_options, command)
11
11
  end
12
12
  end
@@ -7,11 +7,10 @@ module Dapp
7
7
  protected
8
8
 
9
9
  def repo_detailed_dimgs_images(registry)
10
- repo_dimgs_images(registry).select do |dimg|
10
+ repo_dimgs_images(registry).each do |dimg|
11
11
  image_history = registry.image_history(dimg[:tag], dimg[:dimg])
12
12
  dimg[:parent] = image_history['container_config']['Image']
13
- dimg[:labels] = image_history['config']['Labels'] || {}
14
- dimg[:labels]['dapp'] == name
13
+ dimg[:labels] = image_history['config']['Labels']
15
14
  end
16
15
  end
17
16
 
@@ -8,6 +8,9 @@ module Dapp
8
8
  lock("#{name}.images") do
9
9
  log_step_with_indent('flush stages') { remove_project_images(dapp_project_dimgstages) }
10
10
  end
11
+
12
+ dapp_containers_flush_by_label("dapp=#{name}")
13
+ dapp_dangling_images_flush_by_label("dapp=#{name}")
11
14
  end
12
15
  end
13
16
  end
@@ -3,11 +3,25 @@ module Dapp
3
3
  module Dapp
4
4
  module Dimg
5
5
  def dimg(config:, **kwargs)
6
- (@dimgs ||= {})[config._name] ||= ::Dapp::Dimg::Dimg.new(config: config, dapp: self, **kwargs)
6
+ dimg_after_define_hook(config: config, **kwargs) do
7
+ (@dimg ||= {})[config._name] ||= ::Dapp::Dimg::Dimg.new(config: config, dapp: self, **kwargs)
8
+ end
7
9
  end
8
10
 
9
11
  def artifact_dimg(config:, **kwargs)
10
- (@artifacts_dimgs ||= {})[config._name] ||= ::Dapp::Dimg::Artifact.new(config: config, dapp: self, **kwargs)
12
+ dimg_after_define_hook(config: config, **kwargs) do
13
+ (@artifacts_dimgs ||= {})[config._name] ||= ::Dapp::Dimg::Artifact.new(config: config, dapp: self, **kwargs)
14
+ end
15
+ end
16
+
17
+ def dimg_after_define_hook(**kwargs)
18
+ should_be_built = kwargs[:should_be_built] || false
19
+ yield.tap do |dimg|
20
+ if should_be_built && dimg.should_be_built != should_be_built
21
+ dimg.enable_should_be_built
22
+ dimg.should_be_built!
23
+ end
24
+ end
11
25
  end
12
26
 
13
27
  def dimg_layer(config:, **kwargs)
@@ -20,10 +20,18 @@ module Dapp
20
20
 
21
21
  @ignore_git_fetch = ignore_git_fetch
22
22
  @ignore_signature_auto_calculation = ignore_signature_auto_calculation
23
- @should_be_built = should_be_built
24
23
 
25
24
  @dapp._terminate_dimg_on_terminate(self)
26
25
 
26
+ enable_should_be_built if should_be_built
27
+ should_be_built!
28
+ end
29
+
30
+ def enable_should_be_built
31
+ @should_be_built = true
32
+ end
33
+
34
+ def should_be_built!
27
35
  raise Error::Dimg, code: :dimg_not_built if should_be_built?
28
36
  end
29
37
 
@@ -67,7 +75,14 @@ module Dapp
67
75
  def export_stages!(repo, format:)
68
76
  dapp.lock("#{dapp.name}.images", readonly: true) do
69
77
  export_images.each do |stage_image|
70
- image_name = format(format, repo: repo, signature: stage_image.name.split(':').last)
78
+ signature = stage_image.name.split(':').last
79
+ image_name = format(format, repo: repo, signature: signature)
80
+
81
+ if dimgstage_should_not_be_pushed?(format(dapp.dimgstage_push_tag_format, signature: signature))
82
+ dapp.log_state(image_name, state: dapp.t(code: 'state.exist'))
83
+ next
84
+ end
85
+
71
86
  export_base!(image_name, push: true) do
72
87
  stage_image.export!(image_name)
73
88
  end
@@ -101,6 +116,10 @@ module Dapp
101
116
  end
102
117
  end
103
118
 
119
+ def dimgstage_should_not_be_pushed?(signature)
120
+ registry_dimgstages_tags.include?(signature)
121
+ end
122
+
104
123
  def tag_should_not_be_pushed?(tag)
105
124
  registry_tags.include?(tag) && begin
106
125
  registry_tag_parent = registry.image_history(tag, name)['container_config']['Image']
@@ -118,12 +137,17 @@ module Dapp
118
137
  end
119
138
  end
120
139
 
140
+ def registry_dimgstages_tags
141
+ @registry_dimgstages_tags ||= registry.dimgstages_tags
142
+ end
143
+
121
144
  def registry
122
145
  @registry ||= dapp.dimg_registry
123
146
  end
124
147
 
125
148
  def build_export_image!(image_name, scheme_name:)
126
149
  Image::Dimg.image_by_name(name: image_name, from: last_stage.image, dapp: dapp).tap do |export_image|
150
+ export_image.untag! if export_image.built?
127
151
  export_image.add_service_change_label(:'dapp-tag-scheme' => scheme_name)
128
152
  export_image.add_service_change_label(:'dapp-dimg' => true)
129
153
  export_image.build!
@@ -144,8 +168,15 @@ module Dapp
144
168
  def import_stages!(repo, format:)
145
169
  dapp.lock("#{dapp.name}.images", readonly: true) do
146
170
  import_images.each do |image|
171
+ signature = image.name.split(':').last
172
+ image_name = format(format, repo: repo, signature:signature )
173
+
174
+ unless dimgstage_should_not_be_pushed?(format(dapp.dimgstage_push_tag_format, signature: signature))
175
+ dapp.log_state(image_name, state: dapp.t(code: 'state.not_exist'))
176
+ next
177
+ end
178
+
147
179
  begin
148
- image_name = format(format, repo: repo, signature: image.name.split(':').last)
149
180
  import_base!(image, image_name)
150
181
  rescue ::Dapp::Error::Shellout => e
151
182
  dapp.log_info ::Dapp::Helper::NetStatus.message(e)
@@ -244,7 +275,11 @@ module Dapp
244
275
  dapp.shellout! cmd
245
276
  end
246
277
 
247
- def stage_should_be_introspected?(name)
278
+ def stage_should_be_introspected_before_build?(name)
279
+ dapp.options[:introspect_before] == name
280
+ end
281
+
282
+ def stage_should_be_introspected_after_build?(name)
248
283
  dapp.options[:introspect_stage] == name
249
284
  end
250
285
 
@@ -31,11 +31,7 @@ module Dapp
31
31
  def generate_git_artifacts(repo, **git_artifact_options)
32
32
  [].tap do |artifacts|
33
33
  artifacts << (artifact = ::Dapp::Dimg::GitArtifact.new(repo, self, **git_artifact_options))
34
- if ENV['DAPP_DISABLE_GIT_SUBMODULES']
35
- artifacts
36
- else
37
- artifacts.concat(generate_git_embedded_artifacts(artifact))
38
- end
34
+ artifacts.concat(generate_git_embedded_artifacts(artifact))
39
35
  end.select do |artifact|
40
36
  !artifact.empty?
41
37
  end
@@ -29,25 +29,10 @@ module Dapp
29
29
  [:realm, :service, :scope].map do |option|
30
30
  /#{option}="([[^"].]*)/ =~ header
31
31
  next unless Regexp.last_match(1)
32
-
33
- option_value = begin
34
- if option == :scope
35
- handle_scope_option(Regexp.last_match(1))
36
- else
37
- Regexp.last_match(1)
38
- end
39
- end
40
-
41
- [option, option_value]
32
+ [option, Regexp.last_match(1)]
42
33
  end.compact.to_h
43
34
  end
44
35
 
45
- def handle_scope_option(resourcescope)
46
- resource_type, resource_name, actions = resourcescope.split(":")
47
- actions = actions.split(",").map { |action| action == "delete" ? "*" : action }.join(",")
48
- [resource_type, resource_name, actions].join(":")
49
- end
50
-
51
36
  def authorization_auth
52
37
  @authorization_auth ||= begin
53
38
  if ::Dapp::Dapp.options_with_docker_credentials?
@@ -91,7 +91,7 @@ module Dapp
91
91
  {}.tap do |options|
92
92
  options[:name] = repo.dapp.consistent_uniq_slugify("embedded-#{embedded_rel_path}")
93
93
  options[:cwd] = embedded_inherit_path(cwd, embedded_rel_path).last
94
- options[:to] = Pathname(cwd).subpath_of?(embedded_rel_path) ? to : File.join(to, embedded_rel_path)
94
+ options[:to] = File.join(to, embedded_rel_path)
95
95
  options[:include_paths] = embedded_inherit_paths(include_paths, embedded_rel_path)
96
96
  options[:exclude_paths] = embedded_inherit_paths(exclude_paths, embedded_rel_path)
97
97
  options[:stages_dependencies] = begin
@@ -100,9 +100,6 @@ module Dapp
100
100
  return {} if from.nil?
101
101
  [:entrypoint, :cmd].each_with_object({}) do |option, options|
102
102
  options[option] = from.config_option(option.to_s.capitalize) || []
103
- end.tap do |options|
104
- workdir = from.config_option('WorkingDir')
105
- options[:workdir] = Array((workdir || '').empty? ? '/' : workdir)
106
103
  end
107
104
  end
108
105
 
@@ -124,7 +121,6 @@ module Dapp
124
121
 
125
122
  def service_options
126
123
  {
127
- workdir: '/',
128
124
  entrypoint: dapp.bash_bin,
129
125
  name: container_name,
130
126
  user: '0:0',
@@ -8,9 +8,7 @@ Usage:
8
8
 
9
9
  Options:
10
10
  BANNER
11
-
12
- extend ::Dapp::CLI::Command::Options::Tag
13
- extend ::Dapp::CLI::Options::Ssh
11
+ extend ::Dapp::CLI::Options::Tag
14
12
 
15
13
  option :namespace,
16
14
  long: '--namespace NAME',
@@ -8,7 +8,7 @@ Usage:
8
8
 
9
9
  Options:
10
10
  BANNER
11
- extend ::Dapp::CLI::Command::Options::Tag
11
+ extend ::Dapp::CLI::Options::Tag
12
12
 
13
13
  option :namespace,
14
14
  long: '--namespace NAME',
@@ -8,7 +8,7 @@ Usage:
8
8
 
9
9
  Options:
10
10
  BANNER
11
- extend ::Dapp::CLI::Command::Options::Tag
11
+ extend ::Dapp::CLI::Options::Tag
12
12
 
13
13
  option :namespace,
14
14
  long: '--namespace NAME',
@@ -8,7 +8,7 @@ Usage:
8
8
 
9
9
  Options:
10
10
  BANNER
11
- extend ::Dapp::CLI::Command::Options::Tag
11
+ extend ::Dapp::CLI::Options::Tag
12
12
 
13
13
  option :namespace,
14
14
  long: '--namespace NAME',
@@ -4,8 +4,6 @@ module Dapp
4
4
  module Command
5
5
  module Deploy
6
6
  def kube_deploy
7
- setup_ssh_agent
8
-
9
7
  helm_release do |release|
10
8
  do_deploy = proc do
11
9
  kube_run_deploy(release)
@@ -292,6 +292,10 @@ module Dapp
292
292
  {
293
293
  'name' => 'REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY',
294
294
  'value' => '/var/lib/registry'
295
+ },
296
+ {
297
+ 'name' => 'REGISTRY_STORAGE_DELETE_ENABLED',
298
+ 'value' => 'true',
295
299
  }
296
300
  ],
297
301
  'volumeMounts' => [
@@ -1,15 +1,57 @@
1
1
  module Dapp
2
2
  module Kube
3
3
  module Kubernetes
4
+ # TODO endpoints can be gathered from api-server by api discovery.
5
+ K8S_API_ENDPOINTS = {
6
+ '1.6' => {
7
+ '/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
8
+ '/apis/apps/v1beta1' => [:deployment, :statefulset, ],
9
+ '/apis/extensions/v1beta1' => [:replicaset, :daemonset, ],
10
+ '/apis/batch/v1' => [:job, ],
11
+ '/apis/batch/v2aplha1' => [:cronjob, ],
12
+ },
13
+ '1.7' => {
14
+ '/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
15
+ '/apis/apps/v1beta1' => [:deployment, :statefulset, ],
16
+ '/apis/extensions/v1beta1' => [:replicaset, :daemonset, ],
17
+ '/apis/batch/v1' => [:job, ],
18
+ '/apis/batch/v2aplha1' => [:cronjob, ],
19
+ },
20
+ '1.8' => {
21
+ '/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
22
+ '/apis/apps/v1beta2' => [:daemonset, :deployment, :replicaset, :statefulset, ],
23
+ '/apis/batch/v1' => [:job, ],
24
+ '/apis/batch/v1beta1' => [:cronjob, ],
25
+ },
26
+ '1.9' => {
27
+ '/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
28
+ '/apis/apps/v1' => [:daemonset, :deployment, :replicaset, :statefulset, ],
29
+ '/apis/batch/v1' => [:job, ],
30
+ '/apis/batch/v1beta1' => [:cronjob, ],
31
+ },
32
+ '1.10' => {
33
+ '/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
34
+ '/apis/apps/v1' => [:daemonset, :deployment, :replicaset, :statefulset, ],
35
+ '/apis/batch/v1' => [:job, ],
36
+ '/apis/batch/v1beta1' => [:cronjob, ],
37
+ },
38
+ 'stable' => {
39
+ '/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
40
+ '/apis/batch/v1' => [:job, ],
41
+ },
42
+ }
43
+
4
44
  class Client
5
45
  include Helper::YAML
6
46
  extend Helper::YAML
7
47
 
8
48
  ::Dapp::Dapp::Shellout::Base.default_env_keys << 'KUBECONFIG'
9
49
 
50
+ #
10
51
  def initialize(namespace: nil)
11
52
  @namespace = namespace
12
53
  @query_parameters = {}
54
+ @cluster_version
13
55
  end
14
56
 
15
57
  def namespace
@@ -42,47 +84,61 @@ module Dapp
42
84
  # NOTICE: Название метода аналогично kind'у выдаваемого результата.
43
85
  # NOTICE: В данном случае в результате kind=DeploymentList.
44
86
  # NOTICE: Методы создания/обновления/удаления сущностей kubernetes заканчиваются на '!'. Например, create_deployment!.
87
+ # В каждом методе происходит выбор api на основе версии кластера
45
88
 
46
- {
47
- '/api/v1' => [:service, :replicationcontroller, :pod],
48
- '/apis/extensions/v1beta1' => [:deployment, :replicaset],
49
- '/apis/batch/v1' => [:job]
50
- }.each do |api, objects|
51
- objects.each do |object|
52
- define_method :"#{object}_list" do |**query_parameters|
53
- request!(:get, "#{api}/namespaces/#{namespace}/#{object}s", **query_parameters)
54
- end
89
+ def resource_endpoint_path(resource)
90
+ K8S_API_ENDPOINTS[cluster_version()].map do |path, resources|
91
+ resources.include?(resource) ? path : nil
92
+ end.compact.first
93
+ end
55
94
 
56
- define_method object do |name, **query_parameters|
57
- request!(:get, "#{api}/namespaces/#{namespace}/#{object}s/#{name}", **query_parameters)
58
- end
95
+ [
96
+ :service, :replicationcontroller, :pod, :podtemplate,
97
+ :daemonset, :deployment, :replicaset, :statefulset,
98
+ :job,
99
+ :cronjob,
100
+ ].each do |resource|
101
+ define_method :"#{resource}_list" do |**query_parameters|
102
+ api_path = resource_endpoint_path(resource)
103
+ request!(:get, "#{api_path}/namespaces/#{namespace}/#{resource}s", **query_parameters)
104
+ end
59
105
 
60
- define_method "#{object}_status" do |name, **query_parameters|
61
- request!(:get, "#{api}/namespaces/#{namespace}/#{object}s/#{name}/status", **query_parameters)
62
- end
106
+ define_method resource do |name, **query_parameters|
107
+ api_path = resource_endpoint_path(resource)
108
+ request!(:get, "#{api_path}/namespaces/#{namespace}/#{resource}s/#{name}", **query_parameters)
109
+ end
63
110
 
64
- define_method :"create_#{object}!" do |spec, **query_parameters|
65
- request!(:post, "#{api}/namespaces/#{namespace}/#{object}s", body: spec, **query_parameters)
66
- end
111
+ define_method "#{resource}_status" do |name, **query_parameters|
112
+ api_path = resource_endpoint_path(resource)
113
+ request!(:get, "#{api_path}/namespaces/#{namespace}/#{resource}s/#{name}/status", **query_parameters)
114
+ end
67
115
 
68
- define_method :"replace_#{object}!" do |name, spec, **query_parameters|
69
- request!(:put, "#{api}/namespaces/#{namespace}/#{object}s/#{name}", body: spec, **query_parameters)
70
- end
116
+ define_method :"create_#{resource}!" do |spec, **query_parameters|
117
+ api_path = resource_endpoint_path(resource)
118
+ request!(:post, "#{api_path}/namespaces/#{namespace}/#{resource}s", body: spec, **query_parameters)
119
+ end
71
120
 
72
- define_method :"delete_#{object}!" do |name, **query_parameters|
73
- request!(:delete, "#{api}/namespaces/#{namespace}/#{object}s/#{name}", **query_parameters)
74
- end
121
+ define_method :"replace_#{resource}!" do |name, spec, **query_parameters|
122
+ api_path = resource_endpoint_path(resource)
123
+ request!(:put, "#{api_path}/namespaces/#{namespace}/#{resource}s/#{name}", body: spec, **query_parameters)
124
+ end
75
125
 
76
- define_method :"delete_#{object}s!" do |**query_parameters|
77
- request!(:delete, "#{api}/namespaces/#{namespace}/#{object}s", **query_parameters)
78
- end
126
+ define_method :"delete_#{resource}!" do |name, **query_parameters|
127
+ api_path = resource_endpoint_path(resource)
128
+ request!(:delete, "#{api_path}/namespaces/#{namespace}/#{resource}s/#{name}", **query_parameters)
129
+ end
79
130
 
80
- define_method :"#{object}?" do |name, **query_parameters|
81
- public_send(:"#{object}_list", **query_parameters)['items'].map { |item| item['metadata']['name'] }.include?(name)
82
- end
131
+ define_method :"delete_#{resource}s!" do |**query_parameters|
132
+ api_path = resource_endpoint_path(resource)
133
+ request!(:delete, "#{api_path}/namespaces/#{namespace}/#{resource}s", **query_parameters)
134
+ end
135
+
136
+ define_method :"#{resource}?" do |name, **query_parameters|
137
+ public_send(:"#{resource}_list", **query_parameters)['items'].map { |item| item['metadata']['name'] }.include?(name)
83
138
  end
84
139
  end
85
140
 
141
+
86
142
  def namespace_list(**query_parameters)
87
143
  request!(:get, '/api/v1/namespaces', **query_parameters)
88
144
  end
@@ -99,6 +155,21 @@ module Dapp
99
155
  request!(:delete, "/api/v1/namespaces/#{name}", **query_parameters)
100
156
  end
101
157
 
158
+ # minikube returns empty major and minor. Fallback to stable only apis for minikube setup
159
+ def cluster_version(**query_parameters)
160
+ version_obj = request!(:get, "/version", **query_parameters)
161
+ @cluster_version ||= begin
162
+ major = version_obj['major']
163
+ minor = version_obj['minor']
164
+ k8s_version = "#{version_obj['major']}.#{version_obj['minor']}"
165
+ if K8S_API_ENDPOINTS.has_key?(k8s_version)
166
+ k8s_version
167
+ else
168
+ "stable"
169
+ end
170
+ end
171
+ end
172
+
102
173
  def pod_log(name, follow: false, **query_parameters, &blk)
103
174
  excon_parameters = follow ? { response_block: blk } : {}
104
175
  request!(:get,
data/lib/dapp/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = '0.27.24'
3
- BUILD_CACHE_VERSION = 29.1
2
+ VERSION = "0.28.0"
3
+ BUILD_CACHE_VERSION = 28
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.27.24
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-17 00:00:00.000000000 Z
11
+ date: 2018-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -234,14 +234,14 @@ dependencies:
234
234
  requirements:
235
235
  - - "~>"
236
236
  - !ruby/object:Gem::Version
237
- version: '2.0'
237
+ version: '1.7'
238
238
  type: :development
239
239
  prerelease: false
240
240
  version_requirements: !ruby/object:Gem::Requirement
241
241
  requirements:
242
242
  - - "~>"
243
243
  - !ruby/object:Gem::Version
244
- version: '2.0'
244
+ version: '1.7'
245
245
  - !ruby/object:Gem::Dependency
246
246
  name: rake
247
247
  requirement: !ruby/object:Gem::Requirement
@@ -467,10 +467,9 @@ files:
467
467
  - lib/dapp/cli.rb
468
468
  - lib/dapp/cli/cli.rb
469
469
  - lib/dapp/cli/command/base.rb
470
- - lib/dapp/cli/command/options/tag.rb
471
470
  - lib/dapp/cli/command/slug.rb
472
471
  - lib/dapp/cli/command/update.rb
473
- - lib/dapp/cli/options/ssh.rb
472
+ - lib/dapp/cli/options/tag.rb
474
473
  - lib/dapp/config/config.rb
475
474
  - lib/dapp/config/directive/base.rb
476
475
  - lib/dapp/core_ext/hash.rb
@@ -600,6 +599,7 @@ files:
600
599
  - lib/dapp/dimg/cli/command/dimg/stages/pull.rb
601
600
  - lib/dapp/dimg/cli/command/dimg/stages/push.rb
602
601
  - lib/dapp/dimg/cli/command/dimg/tag.rb
602
+ - lib/dapp/dimg/cli/options/introspection.rb
603
603
  - lib/dapp/dimg/config/config.rb
604
604
  - lib/dapp/dimg/config/directive/artifact.rb
605
605
  - lib/dapp/dimg/config/directive/artifact_base.rb
@@ -1,53 +0,0 @@
1
- module Dapp
2
- class CLI
3
- module Command
4
- module Options
5
- module Tag
6
- def self.extended(klass)
7
- klass.class_eval do
8
- "Add tag (can be used one or more times), specified text will be slugified".tap do |desc|
9
- option :tag,
10
- long: '--tag TAG',
11
- description: desc,
12
- default: [],
13
- proc: proc { |v| composite_options(:tags) << v }
14
-
15
- option :tag_slug,
16
- long: '--tag-slug TAG',
17
- description: desc,
18
- default: [],
19
- proc: proc { |v| composite_options(:slug_tags) << v }
20
- end
21
-
22
- option :tag_plain,
23
- long: '--tag-plain TAG',
24
- description: "Add tag (can be used one or more times)",
25
- default: [],
26
- proc: proc { |v| composite_options(:plain_tags) << v }
27
-
28
- option :tag_branch,
29
- long: '--tag-branch',
30
- description: 'Tag by git branch',
31
- boolean: true
32
-
33
- option :tag_build_id,
34
- long: '--tag-build-id',
35
- description: 'Tag by CI build id',
36
- boolean: true
37
-
38
- option :tag_ci,
39
- long: '--tag-ci',
40
- description: 'Tag by CI branch and tag',
41
- boolean: true
42
-
43
- option :tag_commit,
44
- long: '--tag-commit',
45
- description: 'Tag by git commit',
46
- boolean: true
47
- end
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,18 +0,0 @@
1
- module Dapp
2
- class CLI
3
- module Options
4
- module Ssh
5
- def self.extended(klass)
6
- klass.class_eval do
7
- option :ssh_key,
8
- long: '--ssh-key SSH_KEY',
9
- description: ['Enable only specified ssh keys ',
10
- '(use system ssh-agent by default)'].join,
11
- default: nil,
12
- proc: ->(v) { composite_options(:ssh_key) << v }
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end