kuber_kit 0.1.4 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -2
  3. data/README.md +16 -3
  4. data/TODO.md +4 -4
  5. data/example/app_data/env_file.yml +10 -0
  6. data/example/configurations/review.rb +2 -1
  7. data/example/images/app_sources/Dockerfile +1 -1
  8. data/example/images/ruby_app/image.rb +4 -4
  9. data/example/infrastructure/build_servers.rb +8 -0
  10. data/example/infrastructure/templates.rb +5 -0
  11. data/example/services/env_file.rb +6 -0
  12. data/kuber_kit.gemspec +1 -0
  13. data/lib/kuber_kit.rb +50 -23
  14. data/lib/kuber_kit/actions/configuration_loader.rb +5 -0
  15. data/lib/kuber_kit/actions/env_file_reader.rb +8 -5
  16. data/lib/kuber_kit/actions/image_compiler.rb +18 -22
  17. data/lib/kuber_kit/actions/kubectl_applier.rb +6 -1
  18. data/lib/kuber_kit/actions/service_deployer.rb +13 -3
  19. data/lib/kuber_kit/actions/service_reader.rb +9 -6
  20. data/lib/kuber_kit/actions/template_reader.rb +5 -0
  21. data/lib/kuber_kit/cli.rb +12 -6
  22. data/lib/kuber_kit/configs.rb +24 -22
  23. data/lib/kuber_kit/container.rb +39 -19
  24. data/lib/kuber_kit/core/artifacts/artifact_store.rb +12 -23
  25. data/lib/kuber_kit/core/build_servers/abstract_build_server.rb +21 -0
  26. data/lib/kuber_kit/core/build_servers/build_server.rb +24 -0
  27. data/lib/kuber_kit/core/build_servers/build_server_store.rb +18 -0
  28. data/lib/kuber_kit/core/configuration.rb +14 -4
  29. data/lib/kuber_kit/core/configuration_definition.rb +22 -1
  30. data/lib/kuber_kit/core/configuration_factory.rb +11 -1
  31. data/lib/kuber_kit/core/configuration_store.rb +14 -24
  32. data/lib/kuber_kit/core/context_helper/base_helper.rb +12 -7
  33. data/lib/kuber_kit/core/context_helper/context_helper_factory.rb +11 -8
  34. data/lib/kuber_kit/core/context_helper/service_helper.rb +9 -4
  35. data/lib/kuber_kit/core/env_files/env_file_store.rb +8 -23
  36. data/lib/kuber_kit/core/image_store.rb +8 -18
  37. data/lib/kuber_kit/core/registries/registry_store.rb +8 -23
  38. data/lib/kuber_kit/core/service.rb +19 -3
  39. data/lib/kuber_kit/core/service_definition.rb +7 -0
  40. data/lib/kuber_kit/core/service_factory.rb +5 -1
  41. data/lib/kuber_kit/core/service_store.rb +13 -23
  42. data/lib/kuber_kit/core/store.rb +48 -0
  43. data/lib/kuber_kit/core/templates/template_store.rb +12 -23
  44. data/lib/kuber_kit/env_file_reader/action_handler.rb +12 -0
  45. data/lib/kuber_kit/env_file_reader/reader.rb +4 -4
  46. data/lib/kuber_kit/env_file_reader/{abstract_env_file_reader.rb → strategies/abstract.rb} +1 -1
  47. data/lib/kuber_kit/env_file_reader/{artifact_file_reader.rb → strategies/artifact_file.rb} +1 -1
  48. data/lib/kuber_kit/image_compiler/action_handler.rb +21 -0
  49. data/lib/kuber_kit/image_compiler/build_server_pool.rb +30 -0
  50. data/lib/kuber_kit/image_compiler/build_server_pool_factory.rb +13 -0
  51. data/lib/kuber_kit/image_compiler/compiler.rb +2 -5
  52. data/lib/kuber_kit/image_compiler/image_build_dir_creator.rb +13 -7
  53. data/lib/kuber_kit/image_compiler/image_dependency_resolver.rb +25 -5
  54. data/lib/kuber_kit/preprocessing/file_preprocessor.rb +5 -4
  55. data/lib/kuber_kit/preprocessing/text_preprocessor.rb +1 -1
  56. data/lib/kuber_kit/service_deployer/action_handler.rb +16 -0
  57. data/lib/kuber_kit/service_deployer/deployer.rb +28 -6
  58. data/lib/kuber_kit/service_deployer/strategies/abstract.rb +1 -1
  59. data/lib/kuber_kit/service_deployer/strategies/kubernetes.rb +9 -4
  60. data/lib/kuber_kit/service_deployer/strategy_detector.rb +6 -0
  61. data/lib/kuber_kit/service_reader/action_handler.rb +13 -0
  62. data/lib/kuber_kit/{service_deployer/service_reader.rb → service_reader/reader.rb} +1 -1
  63. data/lib/kuber_kit/shell/abstract_shell.rb +4 -0
  64. data/lib/kuber_kit/shell/{bash_commands.rb → commands/bash_commands.rb} +1 -1
  65. data/lib/kuber_kit/shell/{docker_commands.rb → commands/docker_commands.rb} +1 -1
  66. data/lib/kuber_kit/shell/{git_commands.rb → commands/git_commands.rb} +1 -1
  67. data/lib/kuber_kit/shell/{kubectl_commands.rb → commands/kubectl_commands.rb} +1 -1
  68. data/lib/kuber_kit/shell/{rsync_commands.rb → commands/rsync_commands.rb} +9 -3
  69. data/lib/kuber_kit/shell/local_shell.rb +24 -5
  70. data/lib/kuber_kit/shell/ssh_session.rb +60 -0
  71. data/lib/kuber_kit/shell/ssh_shell.rb +77 -0
  72. data/lib/kuber_kit/tools/file_presence_checker.rb +6 -2
  73. data/lib/kuber_kit/version.rb +1 -1
  74. metadata +40 -13
  75. data/lib/kuber_kit/preprocessing/dir_preprocessor.rb +0 -19
  76. data/lib/kuber_kit/service_deployer/service_restarter.rb +0 -37
  77. data/lib/kuber_kit/tools/files_sync.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d85e9b30ebb43f4fe0a056823e3eeda6f878784555fa909df004e46522d750ec
4
- data.tar.gz: 441270e1f147862ff75f999606bfafa7e467efde71765d27490e8f6afdd74740
3
+ metadata.gz: b7fcc957995bcc680107ef41f95ef77d5ee20dda2c0063d31e21bf339ccdae2d
4
+ data.tar.gz: 80561e6e2562b9f195e6725c9dfcd785d36d741b4cf1779c7ccf1d071193c5ec
5
5
  SHA512:
6
- metadata.gz: 0d112105c8b7e268a528b59097028f9c483ac921d3b584bb372ba33f23595d3d8614f4a7251b75498934c1f0d365e5eed3d9c2b237a9f30d5a235cbd290150c8
7
- data.tar.gz: '068e6d864886eb38d6ebd9f8ac10358bb3f220cabe0c38a67df9b6a886b07b224083586be4ddd7320691b05b0420af8f053f9f2d1ed6c2a7c81accd4dce6f4a0'
6
+ metadata.gz: bd95c6391e1880cbe6e92eb43fc13278da1cef2bcf47c0bd0e2aab66932c640bf8c709dae8df5b36961baf19d41acd6c846907f27cab237a7d37113642d6b8ee
7
+ data.tar.gz: 433d47c04f1a8f61e55e6dd664ab0818c0e687769cd29e9985acd74886abd2e5f4a2dacede60839c85797d71fa887e1196c61076837f6813c4fb55ac00fc25c2
@@ -1,16 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuber_kit (0.1.4)
4
+ kuber_kit (0.1.9)
5
5
  cli-ui
6
6
  contracts-lite
7
7
  dry-auto_inject
8
+ net-ssh
8
9
  thor
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- cli-ui (1.3.0)
14
+ cli-ui (1.4.0)
14
15
  coderay (1.1.3)
15
16
  concurrent-ruby (1.1.7)
16
17
  contracts-lite (0.15.0)
@@ -29,6 +30,7 @@ GEM
29
30
  concurrent-ruby (~> 1.0)
30
31
  dry-equalizer (0.3.0)
31
32
  method_source (1.0.0)
33
+ net-ssh (6.1.0)
32
34
  pry (0.13.1)
33
35
  coderay (~> 1.1)
34
36
  method_source (~> 1.0)
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # Docker Kit
1
+ # KuberKit
2
+
3
+ [![Codeship Status for ArtStation/kuber_kit](https://app.codeship.com/projects/1286f0a6-3f90-4c1b-b426-721ed8a6571b/status?branch=master)](https://app.codeship.com/projects/417264)
4
+
5
+ Solution for building & deploying applications on Kubernetes, written in Ruby.
2
6
 
3
7
  ## Installation
4
8
 
@@ -8,12 +12,21 @@ Add this line to your application's Gemfile:
8
12
  gem 'kuber_kit'
9
13
  ```
10
14
 
11
- ## Launch compilation for example images
15
+ ## Development
16
+
17
+ ### Launch compilation
18
+
19
+ ```
20
+ bin/kit compile ruby_app,ruby_app2 --path=./example
21
+ ```
22
+
23
+ ### Launch deployment
12
24
 
13
25
  ```
14
- bin/kit compile ruby_app,ruby_app2 --path=./example -C review
26
+ bin/kit compile -s ruby_app,ruby_app2 --path=./example
15
27
  ```
16
28
 
29
+
17
30
  ## License
18
31
 
19
32
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/TODO.md CHANGED
@@ -1,4 +1,4 @@
1
- - rename service reader to service config reader
2
- - service factory should make sure that template exists
3
- - add build servers support
4
- - add build vars support (use images instead of containers)
1
+ - list services and require confirmation before deployment
2
+ - add build vars support (use images instead of containers)
3
+ - template should be able to set default attributes
4
+ - template should be able to depend on image?
@@ -0,0 +1,10 @@
1
+ ---
2
+ apiVersion: v1
3
+ kind: Secret
4
+ metadata:
5
+ name: env-secret-review
6
+ type: Opaque
7
+ stringData:
8
+ <% env_file(:test).each do |key, value| -%>
9
+ <%= key %>: "<%= value %>"
10
+ <% end -%>
@@ -1,4 +1,5 @@
1
1
  KuberKit
2
2
  .define_configuration(:review)
3
3
  .use_registry(:review_default, as: :default)
4
- .use_artifact(:kuber_kit_repo, as: :kuber_kit_repo)
4
+ .use_artifact(:kuber_kit_repo, as: :kuber_kit_repo)
5
+ .use_build_server(:remote_bs)
@@ -1,4 +1,4 @@
1
- FROM default/ruby
1
+ FROM <%= image_url(:ruby) %>
2
2
 
3
3
  RUN mkdir -p /app
4
4
  WORKDIR /app
@@ -3,13 +3,13 @@ KuberKit
3
3
  .registry(:default)
4
4
  .depends_on(:ruby, :app_sources)
5
5
  .before_build do |context_helper, build_dir|
6
- # copy file local artifact
6
+ # copy file: local artifact
7
7
  source_path = context_helper.artifact_path(:kuber_kit_example_data, "test.txt")
8
8
  target_path = File.join(build_dir, "test.txt")
9
- context_helper.shell.exec!("cp #{source_path} #{target_path}")
9
+ context_helper.shell.sync(source_path, target_path)
10
10
 
11
- # copy file local artifact
11
+ # copy file: remote artifact
12
12
  source_path = context_helper.artifact_path(:kuber_kit_repo, "README.md")
13
13
  target_path = File.join(build_dir, "README.md")
14
- context_helper.shell.exec!("cp #{source_path} #{target_path}")
14
+ context_helper.shell.sync(source_path, target_path)
15
15
  end
@@ -0,0 +1,8 @@
1
+ ENV['SSH_TEST_HOST'] ||= "indocker.artstn.ninja"
2
+ ENV['SSH_TEST_USER'] ||= "kuber_kit"
3
+
4
+ KuberKit.add_build_server(
5
+ KuberKit::Core::BuildServers::BuildServer
6
+ .new(:remote_bs)
7
+ .setup(host: ENV['SSH_TEST_HOST'], user: ENV['SSH_TEST_USER'], port: 22)
8
+ )
@@ -1,4 +1,9 @@
1
1
  KuberKit.add_template(
2
2
  KuberKit::Core::Templates::ArtifactFile
3
3
  .new(:service, artifact_name: :kuber_kit_example_data, file_path: "service.yml")
4
+ )
5
+
6
+ KuberKit.add_template(
7
+ KuberKit::Core::Templates::ArtifactFile
8
+ .new(:env_file, artifact_name: :kuber_kit_example_data, file_path: "env_file.yml")
4
9
  )
@@ -0,0 +1,6 @@
1
+ KuberKit
2
+ .define_service(:env_file)
3
+ .template(:env_file)
4
+ .attributes(
5
+ deployment_restart_enabled: false
6
+ )
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "dry-auto_inject"
28
28
  spec.add_dependency "thor"
29
29
  spec.add_dependency "cli-ui"
30
+ spec.add_dependency "net-ssh"
30
31
 
31
32
  spec.add_development_dependency "bundler", "~> 1.17"
32
33
  spec.add_development_dependency "rake", "~> 10.0"
@@ -31,18 +31,7 @@ module KuberKit
31
31
  autoload :ConfigurationFactory, 'core/configuration_factory'
32
32
  autoload :Configuration, 'core/configuration'
33
33
 
34
- module ContextHelper
35
- autoload :BaseHelper, 'core/context_helper/base_helper'
36
- autoload :ImageHelper, 'core/context_helper/image_helper'
37
- autoload :ServiceHelper, 'core/context_helper/service_helper'
38
- autoload :ContextHelperFactory, 'core/context_helper/context_helper_factory'
39
- end
40
-
41
- module Registries
42
- autoload :AbstractRegistry, 'core/registries/abstract_registry'
43
- autoload :RegistryStore, 'core/registries/registry_store'
44
- autoload :Registry, 'core/registries/registry'
45
- end
34
+ autoload :Store, 'core/store'
46
35
 
47
36
  module Artifacts
48
37
  autoload :AbstractArtifact, 'core/artifacts/abstract_artifact'
@@ -51,12 +40,31 @@ module KuberKit
51
40
  autoload :Local, 'core/artifacts/local'
52
41
  end
53
42
 
43
+ module BuildServers
44
+ autoload :AbstractBuildServer, 'core/build_servers/abstract_build_server'
45
+ autoload :BuildServerStore, 'core/build_servers/build_server_store'
46
+ autoload :BuildServer, 'core/build_servers/build_server'
47
+ end
48
+
54
49
  module EnvFiles
55
50
  autoload :EnvFileStore, 'core/env_files/env_file_store'
56
51
  autoload :AbstractEnvFile, 'core/env_files/abstract_env_file'
57
52
  autoload :ArtifactFile, 'core/env_files/artifact_file'
58
53
  end
59
54
 
55
+ module ContextHelper
56
+ autoload :BaseHelper, 'core/context_helper/base_helper'
57
+ autoload :ImageHelper, 'core/context_helper/image_helper'
58
+ autoload :ServiceHelper, 'core/context_helper/service_helper'
59
+ autoload :ContextHelperFactory, 'core/context_helper/context_helper_factory'
60
+ end
61
+
62
+ module Registries
63
+ autoload :AbstractRegistry, 'core/registries/abstract_registry'
64
+ autoload :RegistryStore, 'core/registries/registry_store'
65
+ autoload :Registry, 'core/registries/registry'
66
+ end
67
+
60
68
  module Templates
61
69
  autoload :TemplateStore, 'core/templates/template_store'
62
70
  autoload :AbstractTemplate, 'core/templates/abstract_template'
@@ -67,21 +75,28 @@ module KuberKit
67
75
  module Tools
68
76
  autoload :FilePresenceChecker, 'tools/file_presence_checker'
69
77
  autoload :LoggerFactory, 'tools/logger_factory'
70
- autoload :FilesSync, 'tools/files_sync'
71
78
  end
72
79
 
73
80
  module Shell
74
81
  autoload :AbstractShell, 'shell/abstract_shell'
75
82
  autoload :LocalShell, 'shell/local_shell'
83
+ autoload :SshShell, 'shell/ssh_shell'
84
+ autoload :SshSession, 'shell/ssh_session'
76
85
  autoload :CommandCounter, 'shell/command_counter'
77
- autoload :BashCommands, 'shell/bash_commands'
78
- autoload :DockerCommands, 'shell/docker_commands'
79
- autoload :GitCommands, 'shell/git_commands'
80
- autoload :RsyncCommands, 'shell/rsync_commands'
81
- autoload :KubectlCommands, 'shell/kubectl_commands'
86
+
87
+ module Commands
88
+ autoload :BashCommands, 'shell/commands/bash_commands'
89
+ autoload :DockerCommands, 'shell/commands/docker_commands'
90
+ autoload :GitCommands, 'shell/commands/git_commands'
91
+ autoload :RsyncCommands, 'shell/commands/rsync_commands'
92
+ autoload :KubectlCommands, 'shell/commands/kubectl_commands'
93
+ end
82
94
  end
83
95
 
84
96
  module ImageCompiler
97
+ autoload :ActionHandler, 'image_compiler/action_handler'
98
+ autoload :BuildServerPool, 'image_compiler/build_server_pool'
99
+ autoload :BuildServerPoolFactory, 'image_compiler/build_server_pool_factory'
85
100
  autoload :Compiler, 'image_compiler/compiler'
86
101
  autoload :ImageBuilder, 'image_compiler/image_builder'
87
102
  autoload :ImageBuildDirCreator, 'image_compiler/image_build_dir_creator'
@@ -92,7 +107,6 @@ module KuberKit
92
107
  module Preprocessing
93
108
  autoload :TextPreprocessor, 'preprocessing/text_preprocessor'
94
109
  autoload :FilePreprocessor, 'preprocessing/file_preprocessor'
95
- autoload :DirPreprocessor, 'preprocessing/dir_preprocessor'
96
110
  end
97
111
 
98
112
  module ArtifactsSync
@@ -103,9 +117,13 @@ module KuberKit
103
117
  end
104
118
 
105
119
  module EnvFileReader
120
+ autoload :ActionHandler, 'env_file_reader/action_handler'
106
121
  autoload :Reader, 'env_file_reader/reader'
107
- autoload :AbstractEnvFileReader, 'env_file_reader/abstract_env_file_reader'
108
- autoload :ArtifactFileReader, 'env_file_reader/artifact_file_reader'
122
+
123
+ module Strategies
124
+ autoload :Abstract, 'env_file_reader/strategies/abstract'
125
+ autoload :ArtifactFile, 'env_file_reader/strategies/artifact_file'
126
+ end
109
127
  end
110
128
 
111
129
  module TemplateReader
@@ -115,9 +133,9 @@ module KuberKit
115
133
  end
116
134
 
117
135
  module ServiceDeployer
136
+ autoload :ActionHandler, 'service_deployer/action_handler'
137
+ autoload :StrategyDetector, 'service_deployer/strategy_detector'
118
138
  autoload :Deployer, 'service_deployer/deployer'
119
- autoload :ServiceRestarter, 'service_deployer/service_restarter'
120
- autoload :ServiceReader, 'service_deployer/service_reader'
121
139
  autoload :ServiceListResolver, 'service_deployer/service_list_resolver'
122
140
 
123
141
  module Strategies
@@ -126,6 +144,11 @@ module KuberKit
126
144
  end
127
145
  end
128
146
 
147
+ module ServiceReader
148
+ autoload :ActionHandler, 'service_reader/action_handler'
149
+ autoload :Reader, 'service_reader/reader'
150
+ end
151
+
129
152
  module Actions
130
153
  autoload :ImageCompiler, 'actions/image_compiler'
131
154
  autoload :EnvFileReader, 'actions/env_file_reader'
@@ -202,6 +225,10 @@ module KuberKit
202
225
  Container["core.template_store"].add(template)
203
226
  end
204
227
 
228
+ def add_build_server(build_server)
229
+ Container["core.build_server_store"].add(build_server)
230
+ end
231
+
205
232
  def build_helper(&proc)
206
233
  KuberKit::Core::ContextHelper::BaseHelper.class_exec(&proc)
207
234
  end
@@ -50,6 +50,11 @@ class KuberKit::Actions::ConfigurationLoader
50
50
  files = service_store.load_definitions(services_path)
51
51
  task.update_title("Loaded #{files.count} service definitions")
52
52
  end
53
+
54
+ true
55
+ rescue KuberKit::Error => e
56
+ ui.print_error("Error", e.message)
57
+ false
53
58
  end
54
59
 
55
60
  def load_configurations(configurations_path, configuration_name)
@@ -2,16 +2,19 @@ require 'json'
2
2
 
3
3
  class KuberKit::Actions::EnvFileReader
4
4
  include KuberKit::Import[
5
- "core.env_file_store",
6
- "env_file_reader.reader",
7
5
  "shell.local_shell",
8
- "ui"
6
+ "ui",
7
+ env_file_reader: "env_file_reader.action_handler",
9
8
  ]
10
9
 
11
10
  Contract Symbol, Hash => Any
12
11
  def call(env_file_name, options)
13
- env_file = env_file_store.get(env_file_name)
14
- result = reader.read(local_shell, env_file)
12
+ result = env_file_reader.call(local_shell, env_file_name)
15
13
  ui.print_info(env_file_name.to_s, JSON.pretty_generate(result))
14
+
15
+ true
16
+ rescue KuberKit::Error => e
17
+ ui.print_error("Error", e.message)
18
+ false
16
19
  end
17
20
  end
@@ -1,37 +1,42 @@
1
1
  class KuberKit::Actions::ImageCompiler
2
2
  include KuberKit::Import[
3
- "image_compiler.compiler",
4
3
  "image_compiler.image_dependency_resolver",
4
+ "image_compiler.build_server_pool_factory",
5
5
  "shell.local_shell",
6
6
  "tools.logger",
7
- "configs",
8
- "ui"
7
+ "ui",
8
+ image_compiler: "image_compiler.action_handler",
9
9
  ]
10
10
 
11
11
  Contract ArrayOf[Symbol], Hash => Any
12
12
  def call(image_names, options)
13
13
  build_id = generate_build_id
14
+ build_server_pool = build_server_pool_factory.create()
14
15
 
15
- resolved_dependencies = []
16
- dependencies = image_dependency_resolver.get_next(image_names)
17
-
18
- while (dependencies - resolved_dependencies).any?
19
- compile_simultaneously(dependencies, build_id)
20
- resolved_dependencies += dependencies
21
- dependencies = image_dependency_resolver.get_next(image_names, resolved: resolved_dependencies)
16
+ image_dependency_resolver.each_with_deps(image_names) do |dep_image_names|
17
+ result = compile_simultaneously(dep_image_names, build_id, build_server_pool)
18
+ abort unless result
22
19
  end
23
20
 
24
- compile_simultaneously(image_names - resolved_dependencies, build_id)
21
+ build_server_pool.disconnect_all
22
+
23
+ true
24
+ rescue KuberKit::Error => e
25
+ ui.print_error("Error", e.message)
26
+
27
+ false
25
28
  end
26
29
 
27
30
  private
28
- def compile_simultaneously(image_names, build_id)
31
+ def compile_simultaneously(image_names, build_id, build_server_pool)
29
32
  task_group = ui.create_task_group
30
33
  image_names.map do |image_name|
31
34
 
32
35
  logger.info("Started compiling: #{image_name.to_s.green}")
33
36
  task_group.add("Compiling #{image_name.to_s.yellow}") do |task|
34
- compile_image(image_name, build_id)
37
+ shell = build_server_pool.get_shell
38
+
39
+ image_compiler.call(shell, image_name, build_id)
35
40
 
36
41
  task.update_title("Compiled #{image_name.to_s.green}")
37
42
  logger.info("Finished compiling: #{image_name.to_s.green}")
@@ -41,16 +46,7 @@ class KuberKit::Actions::ImageCompiler
41
46
  task_group.wait
42
47
  end
43
48
 
44
- def compile_image(image_name, build_id)
45
- compile_dir = generate_compile_dir(build_id: build_id)
46
- compiler.compile(local_shell, image_name, compile_dir)
47
- end
48
-
49
49
  def generate_build_id
50
50
  Time.now.strftime("%H%M%S")
51
51
  end
52
-
53
- def generate_compile_dir(build_id:)
54
- File.join(configs.image_compile_dir, build_id)
55
- end
56
52
  end
@@ -12,6 +12,11 @@ class KuberKit::Actions::KubectlApplier
12
12
  kubectl_commands.apply_file(local_shell, file_path, kubeconfig_path: kubeconfig_path)
13
13
  task.update_title("Applied file: #{file_path}")
14
14
  end
15
- nil
15
+
16
+ true
17
+ rescue KuberKit::Error => e
18
+ ui.print_error("Error", e.message)
19
+
20
+ false
16
21
  end
17
22
  end
@@ -2,11 +2,11 @@ class KuberKit::Actions::ServiceDeployer
2
2
  include KuberKit::Import[
3
3
  "actions.image_compiler",
4
4
  "service_deployer.service_list_resolver",
5
- "service_deployer.deployer",
6
5
  "core.service_store",
7
6
  "shell.local_shell",
8
7
  "tools.logger",
9
- "ui"
8
+ "ui",
9
+ service_deployer: "service_deployer.action_handler",
10
10
  ]
11
11
 
12
12
  Contract KeywordArgs[
@@ -19,6 +19,10 @@ class KuberKit::Actions::ServiceDeployer
19
19
  tags: tags || []
20
20
  )
21
21
 
22
+ unless service_names.any?
23
+ ui.print_warning "WARNING", "No service found with given options, nothing will be deployed."
24
+ end
25
+
22
26
  services = service_names.map do |service_name|
23
27
  service_store.get_service(service_name.to_sym)
24
28
  end
@@ -27,6 +31,12 @@ class KuberKit::Actions::ServiceDeployer
27
31
 
28
32
  compile_images(images_names)
29
33
  deploy_services(service_names)
34
+
35
+ true
36
+ rescue KuberKit::Error => e
37
+ ui.print_error("Error", e.message)
38
+
39
+ false
30
40
  end
31
41
 
32
42
  def deploy_services(service_names)
@@ -36,7 +46,7 @@ class KuberKit::Actions::ServiceDeployer
36
46
 
37
47
  logger.info("Started deploying: #{service_name.to_s.green}")
38
48
  task_group.add("Deploying #{service_name.to_s.yellow}") do |task|
39
- deployer.deploy(local_shell, service_name.to_sym)
49
+ service_deployer.call(local_shell, service_name.to_sym)
40
50
 
41
51
  task.update_title("Deployed #{service_name.to_s.green}")
42
52
  logger.info("Finished deploying: #{service_name.to_s.green}")