kuber_kit 0.3.9 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +35 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/TODO.md +2 -3
- data/example/configurations/review.rb +1 -0
- data/example/infrastructure/artifacts.rb +1 -1
- data/example/services/docker_app.rb +12 -0
- data/lib/kuber_kit.rb +6 -4
- data/lib/kuber_kit/actions/configuration_loader.rb +12 -19
- data/lib/kuber_kit/actions/env_file_reader.rb +1 -0
- data/lib/kuber_kit/actions/image_compiler.rb +10 -6
- data/lib/kuber_kit/actions/service_deployer.rb +24 -11
- data/lib/kuber_kit/actions/template_reader.rb +1 -0
- data/lib/kuber_kit/artifacts_sync/artifacts_updater.rb +3 -2
- data/lib/kuber_kit/cli.rb +49 -31
- data/lib/kuber_kit/container.rb +5 -1
- data/lib/kuber_kit/core/configuration.rb +26 -24
- data/lib/kuber_kit/core/configuration_definition.rb +17 -10
- data/lib/kuber_kit/core/configuration_factory.rb +10 -9
- data/lib/kuber_kit/core/configuration_store.rb +2 -2
- data/lib/kuber_kit/core/image_store.rb +2 -2
- data/lib/kuber_kit/core/service_store.rb +2 -2
- data/lib/kuber_kit/image_compiler/compiler.rb +3 -1
- data/lib/kuber_kit/image_compiler/image_builder.rb +9 -1
- data/lib/kuber_kit/service_deployer/strategies/docker.rb +23 -5
- data/lib/kuber_kit/service_deployer/strategies/docker_compose.rb +4 -4
- data/lib/kuber_kit/service_deployer/strategies/kubernetes.rb +3 -1
- data/lib/kuber_kit/shell/commands/docker_commands.rb +52 -11
- data/lib/kuber_kit/shell/commands/docker_compose_commands.rb +1 -1
- data/lib/kuber_kit/shell/local_shell.rb +6 -6
- data/lib/kuber_kit/shell/ssh_shell.rb +4 -4
- data/lib/kuber_kit/tools/logger_factory.rb +1 -1
- data/lib/kuber_kit/ui/api.rb +48 -0
- data/lib/kuber_kit/ui/debug.rb +31 -0
- data/lib/kuber_kit/ui/interactive.rb +15 -0
- data/lib/kuber_kit/ui/simple.rb +34 -5
- data/lib/kuber_kit/version.rb +1 -1
- metadata +10 -6
@@ -2,7 +2,7 @@ require 'tempfile'
|
|
2
2
|
|
3
3
|
class KuberKit::Shell::SshShell < KuberKit::Shell::LocalShell
|
4
4
|
include KuberKit::Import[
|
5
|
-
"
|
5
|
+
"ui",
|
6
6
|
"shell.command_counter",
|
7
7
|
"shell.rsync_commands",
|
8
8
|
"shell.local_shell"
|
@@ -24,13 +24,13 @@ class KuberKit::Shell::SshShell < KuberKit::Shell::LocalShell
|
|
24
24
|
command_number = command_counter.get_number.to_s.rjust(2, "0")
|
25
25
|
|
26
26
|
if log_command
|
27
|
-
|
27
|
+
ui.print_debug("SshShell", "#{ssh_session.host.green} > Execute: [#{command_number}]: #{command.to_s.cyan}")
|
28
28
|
end
|
29
29
|
|
30
30
|
result = ssh_session.exec!(command)
|
31
31
|
|
32
32
|
if result && result != "" && log_command
|
33
|
-
|
33
|
+
ui.print_debug("SshShell", "#{ssh_session.host.green} > Finished [#{command_number}] with result: \n#{result.grey}")
|
34
34
|
end
|
35
35
|
|
36
36
|
result
|
@@ -62,7 +62,7 @@ class KuberKit::Shell::SshShell < KuberKit::Shell::LocalShell
|
|
62
62
|
sync(file.path, file_path)
|
63
63
|
end
|
64
64
|
|
65
|
-
|
65
|
+
ui.print_debug("SshShell", "Created file #{file_path.to_s.cyan}\r\n ----\r\n#{content.grey}\r\n ----")
|
66
66
|
|
67
67
|
true
|
68
68
|
end
|
@@ -26,7 +26,7 @@ class KuberKit::Tools::LoggerFactory
|
|
26
26
|
severity_text = severity.to_s
|
27
27
|
severity_text = severity_text.colorize(severity_color) if severity_color
|
28
28
|
|
29
|
-
if level == Logger::
|
29
|
+
if level == Logger::DEBUG
|
30
30
|
"#{datetime.strftime("%Y/%m/%d %H:%M:%S").grey} #{msg}\n"
|
31
31
|
else
|
32
32
|
"#{datetime.strftime("%Y/%m/%d %H:%M:%S").grey} #{severity_text.downcase}: #{msg}\n"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'json'
|
2
|
+
class KuberKit::UI::Api < KuberKit::UI::Simple
|
3
|
+
class Task < KuberKit::UI::Simple::Task
|
4
|
+
def print_started
|
5
|
+
# do nothing, api formatter should only show result
|
6
|
+
end
|
7
|
+
|
8
|
+
def print_finished
|
9
|
+
# do nothing, api formatter should only show result
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_task_group
|
14
|
+
TaskGroup.new(KuberKit::UI::Api::Task)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_task(title, &block)
|
18
|
+
task = KuberKit::UI::Api::Task.new(title, &block)
|
19
|
+
task.execute
|
20
|
+
task.wait
|
21
|
+
end
|
22
|
+
|
23
|
+
def print_info(title, text)
|
24
|
+
logger.debug(text)
|
25
|
+
end
|
26
|
+
|
27
|
+
def print_error(title, text)
|
28
|
+
logger.debug(text)
|
29
|
+
print_json({error: text})
|
30
|
+
end
|
31
|
+
|
32
|
+
def print_warning(title, text)
|
33
|
+
logger.debug(text)
|
34
|
+
end
|
35
|
+
|
36
|
+
def print_debug(title, text)
|
37
|
+
logger.debug(text)
|
38
|
+
end
|
39
|
+
|
40
|
+
def print_result(message, data = {})
|
41
|
+
print_json({message: message}.merge(data))
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
def print_json(data)
|
46
|
+
puts JSON.generate(data)
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class KuberKit::UI::Debug < KuberKit::UI::Simple
|
2
|
+
def print_info(title, text)
|
3
|
+
print_text(text, color: String::Colors::BLUE)
|
4
|
+
end
|
5
|
+
|
6
|
+
def print_error(title, text)
|
7
|
+
print_text(text, color: String::Colors::RED)
|
8
|
+
end
|
9
|
+
|
10
|
+
def print_warning(title, text)
|
11
|
+
print_text(text, color: String::Colors::YELLOW)
|
12
|
+
logger.debug(text)
|
13
|
+
end
|
14
|
+
|
15
|
+
def print_debug(title, text)
|
16
|
+
print_text(text, color: nil)
|
17
|
+
logger.debug(text)
|
18
|
+
end
|
19
|
+
|
20
|
+
def print_result(message, data = {})
|
21
|
+
print_debug("Result", "---------------------------")
|
22
|
+
print_debug("Result", message)
|
23
|
+
print_debug("Result", "---------------------------")
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
def print_text(text, color: nil)
|
28
|
+
colorized_message = color ? text.colorize(color) : text
|
29
|
+
puts " #{Time.now.strftime("%H:%M:%S").grey} #{colorized_message}"
|
30
|
+
end
|
31
|
+
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'cli/ui'
|
2
2
|
|
3
3
|
class KuberKit::UI::Interactive
|
4
|
+
include KuberKit::Import[
|
5
|
+
"tools.logger",
|
6
|
+
]
|
7
|
+
|
4
8
|
class TaskGroup < CLI::UI::SpinGroup
|
5
9
|
end
|
6
10
|
|
@@ -24,6 +28,17 @@ class KuberKit::UI::Interactive
|
|
24
28
|
|
25
29
|
def print_warning(title, text)
|
26
30
|
print_in_frame(title, text, color: :yellow)
|
31
|
+
logger.debug(text)
|
32
|
+
end
|
33
|
+
|
34
|
+
def print_debug(title, text)
|
35
|
+
logger.debug(text)
|
36
|
+
end
|
37
|
+
|
38
|
+
def print_result(message, data = {})
|
39
|
+
print_debug("Result", "---------------------------")
|
40
|
+
print_debug("Result", message)
|
41
|
+
print_debug("Result", "---------------------------")
|
27
42
|
end
|
28
43
|
|
29
44
|
def prompt(text, options, &callback)
|
data/lib/kuber_kit/ui/simple.rb
CHANGED
@@ -1,19 +1,33 @@
|
|
1
1
|
class KuberKit::UI::Simple
|
2
|
+
include KuberKit::Import[
|
3
|
+
"tools.logger",
|
4
|
+
]
|
5
|
+
|
2
6
|
class Task
|
3
7
|
def initialize(title, &callback)
|
4
8
|
@title = title
|
5
9
|
@callback = callback
|
6
10
|
end
|
7
11
|
|
12
|
+
def print_started
|
13
|
+
puts "- #{@title}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def print_finished
|
17
|
+
puts "- #{@title.grey}"
|
18
|
+
end
|
19
|
+
|
8
20
|
def execute
|
9
21
|
if @thread
|
10
22
|
raise "Already started execution of task '#{title}'"
|
11
23
|
end
|
12
24
|
|
13
25
|
@thread = Thread.new do
|
14
|
-
|
26
|
+
Thread.current.abort_on_exception = true
|
27
|
+
Thread.current.report_on_exception = false
|
28
|
+
print_started
|
15
29
|
@callback.call(self)
|
16
|
-
|
30
|
+
print_finished
|
17
31
|
end
|
18
32
|
end
|
19
33
|
|
@@ -30,8 +44,12 @@ class KuberKit::UI::Simple
|
|
30
44
|
end
|
31
45
|
|
32
46
|
class TaskGroup
|
47
|
+
def initialize(task_class)
|
48
|
+
@task_class = task_class
|
49
|
+
end
|
50
|
+
|
33
51
|
def add(task_title, &task_block)
|
34
|
-
task =
|
52
|
+
task = @task_class.new(task_title, &task_block)
|
35
53
|
task.execute
|
36
54
|
add_task(task)
|
37
55
|
end
|
@@ -47,7 +65,7 @@ class KuberKit::UI::Simple
|
|
47
65
|
end
|
48
66
|
|
49
67
|
def create_task_group
|
50
|
-
TaskGroup.new
|
68
|
+
TaskGroup.new(KuberKit::UI::Simple::Task)
|
51
69
|
end
|
52
70
|
|
53
71
|
def create_task(title, &block)
|
@@ -66,6 +84,17 @@ class KuberKit::UI::Simple
|
|
66
84
|
|
67
85
|
def print_warning(title, text)
|
68
86
|
print_text(title, text, color: String::Colors::YELLOW)
|
87
|
+
logger.debug(text)
|
88
|
+
end
|
89
|
+
|
90
|
+
def print_debug(title, text)
|
91
|
+
logger.debug(text)
|
92
|
+
end
|
93
|
+
|
94
|
+
def print_result(message, data = {})
|
95
|
+
print_debug("Result", "---------------------------")
|
96
|
+
print_debug("Result", message)
|
97
|
+
print_debug("Result", "---------------------------")
|
69
98
|
end
|
70
99
|
|
71
100
|
def prompt(text, options, &callback)
|
@@ -75,7 +104,7 @@ class KuberKit::UI::Simple
|
|
75
104
|
result
|
76
105
|
end
|
77
106
|
|
78
|
-
|
107
|
+
protected
|
79
108
|
def print_text(title, text, color:)
|
80
109
|
puts "#{title.colorize(color)}\r\n #{text.colorize(color)}"
|
81
110
|
end
|
data/lib/kuber_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuber_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Khaziev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts-lite
|
@@ -145,6 +145,7 @@ executables:
|
|
145
145
|
extensions: []
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
|
+
- ".github/workflows/rspec.yml"
|
148
149
|
- ".gitignore"
|
149
150
|
- ".rspec"
|
150
151
|
- ".ruby-gemset"
|
@@ -182,6 +183,7 @@ files:
|
|
182
183
|
- example/infrastructure/registries.rb
|
183
184
|
- example/infrastructure/templates.rb
|
184
185
|
- example/services/compose_app.rb
|
186
|
+
- example/services/docker_app.rb
|
185
187
|
- example/services/env_file.rb
|
186
188
|
- example/services/ruby_app.rb
|
187
189
|
- kuber_kit.gemspec
|
@@ -286,6 +288,8 @@ files:
|
|
286
288
|
- lib/kuber_kit/tools/file_presence_checker.rb
|
287
289
|
- lib/kuber_kit/tools/logger_factory.rb
|
288
290
|
- lib/kuber_kit/ui.rb
|
291
|
+
- lib/kuber_kit/ui/api.rb
|
292
|
+
- lib/kuber_kit/ui/debug.rb
|
289
293
|
- lib/kuber_kit/ui/interactive.rb
|
290
294
|
- lib/kuber_kit/ui/simple.rb
|
291
295
|
- lib/kuber_kit/version.rb
|
@@ -293,7 +297,7 @@ homepage: https://github.com/ArtStation/kuber_kit
|
|
293
297
|
licenses:
|
294
298
|
- MIT
|
295
299
|
metadata: {}
|
296
|
-
post_install_message:
|
300
|
+
post_install_message:
|
297
301
|
rdoc_options: []
|
298
302
|
require_paths:
|
299
303
|
- lib
|
@@ -308,8 +312,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
308
312
|
- !ruby/object:Gem::Version
|
309
313
|
version: '0'
|
310
314
|
requirements: []
|
311
|
-
rubygems_version: 3.0.
|
312
|
-
signing_key:
|
315
|
+
rubygems_version: 3.0.9
|
316
|
+
signing_key:
|
313
317
|
specification_version: 4
|
314
318
|
summary: Docker Containers Build & Deployment
|
315
319
|
test_files: []
|