dapp 0.12.8 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/bin/dapp +0 -4
  3. data/config/en/common.yml +1 -0
  4. data/config/en/net_status.yml +5 -0
  5. data/lib/dapp.rb +20 -8
  6. data/lib/dapp/cli.rb +2 -5
  7. data/lib/dapp/cli/command/base.rb +1 -5
  8. data/lib/dapp/dapp.rb +0 -22
  9. data/lib/dapp/dapp/shellout/streaming.rb +2 -2
  10. data/lib/dapp/deployment/cli/command/deployment.rb +1 -3
  11. data/lib/dapp/deployment/cli/command/deployment/apply.rb +1 -1
  12. data/lib/dapp/deployment/dapp/dapp.rb +0 -2
  13. data/lib/dapp/dimg/cli/command/base.rb +4 -0
  14. data/lib/dapp/dimg/config/directive/git_artifact_remote.rb +1 -3
  15. data/lib/dapp/dimg/dimg.rb +1 -0
  16. data/lib/dapp/dimg/dimg/path.rb +0 -6
  17. data/lib/dapp/helper/trivia.rb +4 -0
  18. data/lib/dapp/kube.rb +1 -0
  19. data/lib/dapp/kube/cli/cli.rb +1 -0
  20. data/lib/dapp/kube/cli/command/base.rb +14 -0
  21. data/lib/dapp/kube/cli/command/kube.rb +21 -0
  22. data/lib/dapp/kube/cli/command/kube/deploy.rb +30 -0
  23. data/lib/dapp/kube/cli/command/kube/dismiss.rb +21 -0
  24. data/lib/dapp/kube/cli/command/kube/secret_file_encrypt.rb +23 -0
  25. data/lib/dapp/kube/cli/command/kube/secret_generate.rb +13 -0
  26. data/lib/dapp/kube/cli/command/kube/secret_key_generate.rb +13 -0
  27. data/lib/dapp/kube/dapp/command/common.rb +29 -0
  28. data/lib/dapp/kube/dapp/command/deploy.rb +192 -0
  29. data/lib/dapp/kube/dapp/command/dismiss.rb +25 -0
  30. data/lib/dapp/kube/dapp/command/secret_file_encrypt.rb +22 -0
  31. data/lib/dapp/{deployment → kube}/dapp/command/secret_generate.rb +3 -3
  32. data/lib/dapp/{deployment → kube}/dapp/command/secret_key_generate.rb +2 -2
  33. data/lib/dapp/kube/dapp/dapp.rb +16 -0
  34. data/lib/dapp/kube/error/base.rb +7 -0
  35. data/lib/dapp/kube/error/command.rb +7 -0
  36. data/lib/dapp/kube/kubernetes.rb +191 -0
  37. data/lib/dapp/kube/secret.rb +93 -0
  38. data/lib/dapp/version.rb +1 -1
  39. metadata +23 -37
  40. data/lib/dapp/dapp/sentry.rb +0 -112
  41. data/lib/dapp/deployment/cli/command/deployment/secret_generate.rb +0 -13
  42. data/lib/dapp/deployment/cli/command/deployment/secret_key_generate.rb +0 -13
  43. data/lib/dapp/helper/url.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abb0b46dd26ada57b287c0fb49aec41ce51b5519
4
- data.tar.gz: 45e624bd7960c59a03dfdf85969b66af9007ab2a
3
+ metadata.gz: fc7114fd303ed284e6a00e4e35047b43577d346d
4
+ data.tar.gz: 4a5e24ab8bcbf23b781a97988be0a975188d75db
5
5
  SHA512:
6
- metadata.gz: becc23aa741a453d0fc3cae98b1ec0aad96e6de24c0db7e835bd4e82c3e0e5be6f5a8fc3f4d9a9b05c43220ddb89d9fc530d2ecf8fc1fc76b5fd7a3bfa25f85a
7
- data.tar.gz: 11fdcb6e12957eb737c3cf68479ff1044264de3d9ddf275a1a770412ad3e00e7c55ca99fb803b3eb98ecdfa29f41332af3413b480736e8e4503d05b50e11f51f
6
+ metadata.gz: 6581f92f31676b7e98707f2774ca3afed77ba3420cb8ebb5617d40c11a203077f5750c71607d7767e5c94d3b9551ee5413b2ad8a540bc2a71de670b7e9fd9cf4
7
+ data.tar.gz: bb0284c586d5d24679a55e97c4eeb23e2bf23a847ad5365f595876bca37ecf85ea9e959a79668fbc95fd1ed2f6345645a834a71d0dcc2e4cf277158127fae7f1
data/bin/dapp CHANGED
@@ -27,10 +27,6 @@ begin
27
27
  $stderr.puts(message)
28
28
  end
29
29
 
30
- if Dapp::CLI.dapp_object
31
- Dapp::CLI.dapp_object.sentry_exception(e)
32
- end
33
-
34
30
  raise
35
31
  end
36
32
  rescue ::SystemExit
@@ -54,6 +54,7 @@ en:
54
54
  stage_artifact_rewritten: "WARNING: Artifact stage rewritten from %{conflict_stage} to %{stage}."
55
55
  recipe_does_not_used: "WARNING: Recipe `%{recipe}` doesn't used in any stage."
56
56
  context_archive_not_found: "WARNING: context archive `%{path}` not found!"
57
+ dapp_secret_key_not_found: "Secrets haven't decoded: set `DAPP_SECRET_KEY`!"
57
58
  group:
58
59
  install: 'Install group'
59
60
  setup: 'Setup group'
@@ -30,6 +30,11 @@ en:
30
30
  secret_key_not_found: "Secret key `DAPP_SECRET_KEY` not found!"
31
31
  minikube_not_found: "Minikube not found: install minikube (https://github.com/kubernetes/minikube/releases)!"
32
32
  minikube_not_started: "Minikube not started!"
33
+ project_helm_chart_not_found: "Project helm chart `%{path}` not found!"
34
+ helm_not_found: "Helm not found: install helm (https://github.com/kubernetes/helm/blob/master/docs/install.md)"
35
+ helm_release_not_exist: "Helm release `%{name}` not exist!"
36
+ file_not_exist: "File `%{path}` doesn't exist!"
37
+ helm_directory_not_exist: "Helm directory doesn't exist in project!"
33
38
  dapp:
34
39
  no_such_dimg: "No such dimg: `%{dimgs_patterns}`!"
35
40
  no_such_app: "No such app: `%{apps_patterns}`!"
@@ -22,8 +22,6 @@ require 'net_status'
22
22
  require 'yaml'
23
23
  require 'openssl'
24
24
  require 'etc'
25
- require 'sentry-raven'
26
- require 'toml-rb'
27
25
 
28
26
  require 'dapp/version'
29
27
  require 'dapp/core_ext/hash'
@@ -32,7 +30,6 @@ require 'dapp/helper/cli'
32
30
  require 'dapp/helper/trivia'
33
31
  require 'dapp/helper/sha256'
34
32
  require 'dapp/helper/net_status'
35
- require 'dapp/helper/url'
36
33
  require 'dapp/prctl'
37
34
  require 'dapp/error/base'
38
35
  require 'dapp/error/dapp'
@@ -46,7 +43,6 @@ require 'dapp/config/config'
46
43
  require 'dapp/config/error/config'
47
44
  require 'dapp/dapp/lock'
48
45
  require 'dapp/dapp/ssh_agent'
49
- require 'dapp/dapp/sentry'
50
46
  require 'dapp/dapp/git_artifact'
51
47
  require 'dapp/dapp/dappfile'
52
48
  require 'dapp/dapp/chef'
@@ -93,19 +89,35 @@ require 'dapp/deployment/cli/command/base'
93
89
  require 'dapp/deployment/cli/command/deployment'
94
90
  require 'dapp/deployment/cli/command/deployment/apply'
95
91
  require 'dapp/deployment/cli/command/deployment/mrproper'
96
- require 'dapp/deployment/cli/command/deployment/secret_key_generate'
97
- require 'dapp/deployment/cli/command/deployment/secret_generate'
98
92
  require 'dapp/deployment/cli/command/deployment/minikube_setup'
99
93
  require 'dapp/deployment/cli/cli'
100
94
  require 'dapp/deployment/dapp/command/mrproper'
101
95
  require 'dapp/deployment/dapp/command/apply'
102
- require 'dapp/deployment/dapp/command/secret_key_generate'
103
- require 'dapp/deployment/dapp/command/secret_generate'
104
96
  require 'dapp/deployment/dapp/command/minikube_setup'
105
97
  require 'dapp/deployment/dapp/command/common'
106
98
  require 'dapp/deployment/dapp/dappfile'
107
99
  require 'dapp/deployment/dapp/dapp'
108
100
  require 'dapp/deployment/secret'
101
+ require 'dapp/kube'
102
+ require 'dapp/kube/kubernetes'
103
+ require 'dapp/kube/cli/command/base'
104
+ require 'dapp/kube/cli/command/kube'
105
+ require 'dapp/kube/cli/command/kube/deploy'
106
+ require 'dapp/kube/cli/command/kube/dismiss'
107
+ require 'dapp/kube/cli/command/kube/secret_key_generate'
108
+ require 'dapp/kube/cli/command/kube/secret_generate'
109
+ require 'dapp/kube/cli/command/kube/secret_file_encrypt'
110
+ require 'dapp/kube/cli/cli'
111
+ require 'dapp/kube/dapp/command/common'
112
+ require 'dapp/kube/dapp/command/deploy'
113
+ require 'dapp/kube/dapp/command/dismiss'
114
+ require 'dapp/kube/dapp/command/secret_key_generate'
115
+ require 'dapp/kube/dapp/command/secret_generate'
116
+ require 'dapp/kube/dapp/command/secret_file_encrypt'
117
+ require 'dapp/kube/dapp/dapp'
118
+ require 'dapp/kube/error/base'
119
+ require 'dapp/kube/error/command'
120
+ require 'dapp/kube/secret'
109
121
  require 'dapp/dimg'
110
122
  require 'dapp/dimg/builder'
111
123
  require 'dapp/dimg/builder/base'
@@ -5,7 +5,7 @@ module Dapp
5
5
  extend Helper::Cli
6
6
  include Helper::Trivia
7
7
 
8
- SUBCOMMANDS = ['dimg', 'deployment'].freeze
8
+ SUBCOMMANDS = ['dimg', 'deployment', 'kube'].freeze
9
9
 
10
10
  banner <<BANNER.freeze
11
11
  Usage: dapp sub-command [sub-command options]
@@ -14,6 +14,7 @@ Available subcommands: (for details, dapp SUB-COMMAND --help)
14
14
 
15
15
  dapp dimg
16
16
  dapp deployment
17
+ dapp kube
17
18
 
18
19
  Options:
19
20
  BANNER
@@ -35,10 +36,6 @@ BANNER
35
36
  show_options: true,
36
37
  exit: 0
37
38
 
38
- class << self
39
- attr_accessor :dapp_object
40
- end
41
-
42
39
  def initialize(*args)
43
40
  super(*args)
44
41
 
@@ -56,16 +56,12 @@ module Dapp
56
56
  super()
57
57
  end
58
58
 
59
- def run_method
60
- class_to_lowercase
61
- end
62
-
63
59
  def run(_argv = ARGV)
64
60
  raise
65
61
  end
66
62
 
67
63
  def cli_options(**kvargs)
68
- config.merge(dapp_command: run_method, **kvargs)
64
+ config.merge(**kvargs)
69
65
  end
70
66
  end
71
67
  end
@@ -11,12 +11,8 @@ module Dapp
11
11
  include Logging::Paint
12
12
 
13
13
  include SshAgent
14
- include Sentry
15
-
16
14
  include Helper::Sha256
17
- extend Helper::Trivia
18
15
  include Helper::Trivia
19
- include Helper::Url
20
16
 
21
17
  include Deps::Gitartifact
22
18
  include Deps::Base
@@ -29,20 +25,6 @@ module Dapp
29
25
  @options = options
30
26
  Logging::Paint.initialize(options[:log_color])
31
27
  Logging::I18n.initialize
32
- ::Dapp::CLI.dapp_object = self
33
- sentry_message("Manual usage: `#{options[:dapp_command]}` command") unless ENV['CI']
34
- end
35
-
36
- def settings
37
- @settings ||= begin
38
- settings_path = File.join(self.class.home_dir, "settings.toml")
39
-
40
- if File.exists? settings_path
41
- TomlRB.load_file(settings_path)
42
- else
43
- {}
44
- end
45
- end
46
28
  end
47
29
 
48
30
  def name
@@ -106,9 +88,5 @@ module Dapp
106
88
  def stage_dapp_label
107
89
  name
108
90
  end
109
-
110
- def self.home_dir
111
- File.join(Dir.home, ".dapp")
112
- end
113
91
  end # Dapp
114
92
  end # Dapp
@@ -28,13 +28,13 @@ module Dapp
28
28
  end
29
29
 
30
30
  def format_string(str)
31
- str.lines.map { |l| "#{Dapp.log_time if @with_time}#{l.strip}\n" }.join
31
+ str.lines.map { |l| "#{Dapp.log_time if @with_time}#{l.chomp}\n" }.join
32
32
  end
33
33
  end
34
34
 
35
35
  class Error < Base
36
36
  def format_string(str)
37
- "#{Dapp.paint_string(super.strip, :warning)}\n"
37
+ "#{Dapp.paint_string(super.chomp, :warning)}\n"
38
38
  end
39
39
  end
40
40
  end
@@ -1,7 +1,7 @@
1
1
  module Dapp::Deployment::CLI
2
2
  module Command
3
3
  class Deployment < ::Dapp::CLI
4
- SUBCOMMANDS = ['apply', 'mrproper', 'secret generate', 'secret key generate', 'minikube setup'].freeze
4
+ SUBCOMMANDS = ['apply', 'mrproper', 'minikube setup'].freeze
5
5
 
6
6
  banner <<BANNER.freeze
7
7
  Usage: dapp deployment sub-command [sub-command options]
@@ -9,8 +9,6 @@ Usage: dapp deployment sub-command [sub-command options]
9
9
  Available subcommands: (for details, dapp deployment SUB-COMMAND --help)
10
10
 
11
11
  dapp deployment apply [options] [APP ...] REPO
12
- dapp deployment secret key generate
13
- dapp deployment secret generate
14
12
  dapp deployment minikube setup
15
13
  dapp deployment mrproper [options]
16
14
 
@@ -4,7 +4,7 @@ module Dapp::Deployment::CLI::Command
4
4
  banner <<BANNER.freeze
5
5
  Usage:
6
6
 
7
- dapp deploy apply [options] [APP ...] REPO
7
+ dapp deployment apply [options] [APP ...] REPO
8
8
 
9
9
  Options:
10
10
  BANNER
@@ -3,8 +3,6 @@ module Dapp
3
3
  module Dapp
4
4
  module Dapp
5
5
  include Command::Apply
6
- include Command::SecretKeyGenerate
7
- include Command::SecretGenerate
8
6
  include Command::MinikubeSetup
9
7
  include Command::Mrproper
10
8
  include Command::Common
@@ -5,6 +5,10 @@ module Dapp::Dimg::CLI
5
5
  self.class.parse_options(self, argv)
6
6
  ::Dapp::Dapp.new(options: cli_options(dimgs_patterns: cli_arguments)).public_send(run_method)
7
7
  end
8
+
9
+ def run_method
10
+ class_to_lowercase
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -3,13 +3,11 @@ module Dapp
3
3
  module Config
4
4
  module Directive
5
5
  class GitArtifactRemote < GitArtifactLocal
6
- include ::Dapp::Helper::Url
7
-
8
6
  attr_reader :_url, :_name, :_branch, :_commit
9
7
 
10
8
  def initialize(url, **kwargs, &blk)
11
9
  @_url = url
12
- @_name = git_url_to_name(url)
10
+ @_name = url.gsub(%r{.*?([^\/ ]+)\.git}, '\\1')
13
11
 
14
12
  super(**kwargs, &blk)
15
13
  end
@@ -7,6 +7,7 @@ module Dapp
7
7
  include Stages
8
8
 
9
9
  include Helper::Sha256
10
+ include Helper::Trivia
10
11
 
11
12
  attr_reader :config
12
13
  attr_reader :ignore_git_fetch
@@ -29,12 +29,6 @@ module Dapp
29
29
 
30
30
  alias build_dir build_path
31
31
  alias tmp_dir tmp_path
32
-
33
- private
34
-
35
- def make_path(base, *path)
36
- path.compact.map(&:to_s).inject(Pathname.new(base), &:+)
37
- end
38
32
  end # Path
39
33
  end
40
34
  end # Dimg
@@ -24,6 +24,10 @@ module Dapp
24
24
  end
25
25
  end
26
26
 
27
+ def make_path(base, *path)
28
+ path.compact.map(&:to_s).inject(Pathname.new(base), &:+)
29
+ end
30
+
27
31
  def self.class_to_lowercase(class_name = self)
28
32
  class_name.to_s.split('::').last.split(/(?=[[:upper:]]|[0-9])/).join('_').downcase.to_s
29
33
  end
@@ -0,0 +1 @@
1
+ module Dapp::Kube; end
@@ -0,0 +1 @@
1
+ ::Dapp::CLI.send(:include, ::Dapp::Kube::CLI::Command)
@@ -0,0 +1,14 @@
1
+ module Dapp::Kube::CLI
2
+ module Command
3
+ class Base < ::Dapp::CLI::Command::Base
4
+ def run(argv = ARGV)
5
+ self.class.parse_options(self, argv)
6
+ ::Dapp::Dapp.new(options: cli_options).public_send(run_method)
7
+ end
8
+
9
+ def run_method
10
+ :"kube_#{class_to_lowercase}"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ module Dapp::Kube::CLI
2
+ module Command
3
+ class Kube < ::Dapp::CLI
4
+ SUBCOMMANDS = ['secret generate', 'secret key generate', 'secret file encrypt', 'deploy', 'dismiss'].freeze
5
+
6
+ banner <<BANNER.freeze
7
+ Usage: dapp kube sub-command [sub-command options]
8
+
9
+ Available subcommands: (for details, dapp kube SUB-COMMAND --help)
10
+
11
+ dapp kube deploy [options] REPO
12
+ dapp kube dismiss [options]
13
+ dapp kube secret generate [options]
14
+ dapp kube secret key generate [options]
15
+ dapp kube secret file encrypt FILE_PATH [options]
16
+
17
+ Options:
18
+ BANNER
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ module Dapp::Kube::CLI::Command
2
+ class Kube < ::Dapp::CLI
3
+ class Deploy < Base
4
+ banner <<BANNER.freeze
5
+ Usage:
6
+
7
+ dapp deployment deploy [options] REPO
8
+
9
+ Options:
10
+ BANNER
11
+ option :namespace,
12
+ long: '--namespace NAME',
13
+ required: true
14
+
15
+ option :image_version,
16
+ long: '--image-version IMAGE_VERSION',
17
+ default: 'latest'
18
+
19
+ option :tmp_dir_prefix,
20
+ long: '--tmp-dir-prefix PREFIX',
21
+ description: 'Tmp directory prefix (/tmp by default). Used for build process service directories.'
22
+
23
+ def run(argv = ARGV)
24
+ self.class.parse_options(self, argv)
25
+ repo = self.class.required_argument(self, 'repo')
26
+ ::Dapp::Dapp.new(options: cli_options(apps_patterns: cli_arguments, repo: repo)).public_send(run_method)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ module Dapp::Kube::CLI::Command
2
+ class Kube < ::Dapp::CLI
3
+ class Dismiss < Base
4
+ banner <<BANNER.freeze
5
+ Usage:
6
+
7
+ dapp kube dismiss [options]
8
+
9
+ Options:
10
+ BANNER
11
+
12
+ option :namespace,
13
+ long: '--namespace NAME',
14
+ required: true
15
+
16
+ option :with_namespace,
17
+ long: '--with-namespace',
18
+ default: false
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ module Dapp::Kube::CLI::Command
2
+ class Kube < ::Dapp::CLI
3
+ class SecretFileEncrypt < Base
4
+ banner <<BANNER.freeze
5
+ Usage:
6
+
7
+ dapp kube secret file encrypt FILE [options]
8
+
9
+ Options:
10
+ BANNER
11
+
12
+ option :output_file_path,
13
+ short: '-o OUTPUt_FILE_PATH',
14
+ required: false
15
+
16
+ def run(argv = ARGV)
17
+ self.class.parse_options(self, argv)
18
+ file_path = self.class.required_argument(self, 'file')
19
+ ::Dapp::Dapp.new(options: cli_options).public_send(run_method, file_path)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module Dapp::Kube::CLI::Command
2
+ class Kube < ::Dapp::CLI
3
+ class SecretGenerate < Base
4
+ banner <<BANNER.freeze
5
+ Usage:
6
+
7
+ dapp kube secret generate
8
+
9
+ Options:
10
+ BANNER
11
+ end
12
+ end
13
+ end