kuber_kit 1.1.4 → 1.2.0
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 +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +0 -6
- data/README.md +2 -1
- data/kuber_kit.gemspec +2 -6
- data/lib/kuber_kit/actions/configuration_loader.rb +2 -6
- data/lib/kuber_kit/actions/kubectl_get.rb +3 -3
- data/lib/kuber_kit/actions/service_deployer.rb +1 -7
- data/lib/kuber_kit/cli.rb +1 -7
- data/lib/kuber_kit/configs.rb +1 -2
- data/lib/kuber_kit/core/artifacts/abstract_artifact.rb +0 -4
- data/lib/kuber_kit/core/artifacts/git.rb +0 -4
- data/lib/kuber_kit/core/artifacts/local.rb +0 -4
- data/lib/kuber_kit/core/context_helper/context_vars.rb +15 -13
- data/lib/kuber_kit/shell/commands/bash_commands.rb +6 -6
- data/lib/kuber_kit/shell/commands/docker_commands.rb +4 -4
- data/lib/kuber_kit/shell/commands/docker_compose_commands.rb +1 -1
- data/lib/kuber_kit/shell/commands/git_commands.rb +8 -8
- data/lib/kuber_kit/shell/commands/kubectl_commands.rb +2 -2
- data/lib/kuber_kit/shell/commands/rsync_commands.rb +1 -1
- data/lib/kuber_kit/shell/commands/system_commands.rb +1 -1
- data/lib/kuber_kit/shell/local_shell.rb +7 -11
- data/lib/kuber_kit/shell/ssh_session.rb +1 -5
- data/lib/kuber_kit/shell/ssh_shell.rb +2 -2
- data/lib/kuber_kit/shell_launcher/strategies/kubernetes.rb +0 -9
- data/lib/kuber_kit/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 41f8c55add7e426b80fa74ec7f39b2af312e9d8bc94ffc412d6046d228af1bcf
|
|
4
|
+
data.tar.gz: 55f2921894f99cd9aa68a868c87c0059e59e2405355154015571cc5d8676575c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13312d069ddfbddbd5972b2fbdc3e87970e366dfb2bb12caa94ac76979ecf511c92887c17567c521846648cf10a6e2c725d20baa0d2739ee5288d2497fbd6817
|
|
7
|
+
data.tar.gz: f9d35c210a01f77f3083a6ac2a92c9452ce3d26703d941fac175b78d4838fc0dca6d63eb5fe1de0b3bae1135a8ed1276601044193ce814677191747712f1fead
|
data/.github/workflows/rspec.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.1.2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
**1.2.1**
|
|
2
|
-
- Update shell commands so that STDERR stream won't be merged for commands using the command result.
|
|
3
|
-
- kit sh would also set current default configuration
|
|
4
|
-
- kit get supports "api" ui
|
|
5
|
-
- show sync description (git/local) for artifact sync
|
|
6
|
-
|
|
7
1
|
**1.2.0**
|
|
8
2
|
- Change minimal ruby version to 3
|
|
9
3
|
|
data/README.md
CHANGED
data/kuber_kit.gemspec
CHANGED
|
@@ -23,13 +23,9 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
24
24
|
spec.require_paths = ["lib"]
|
|
25
25
|
|
|
26
|
-
spec.required_ruby_version = ">=
|
|
26
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
spec.add_dependency "contracts", '0.17.0'
|
|
30
|
-
else
|
|
31
|
-
spec.add_dependency "contracts", '0.16.0'
|
|
32
|
-
end
|
|
28
|
+
spec.add_dependency "contracts", '0.17.0'
|
|
33
29
|
|
|
34
30
|
spec.add_dependency "dry-auto_inject", "~> 0.9.0"
|
|
35
31
|
spec.add_dependency "dry-core", "~> 0.8.1"
|
|
@@ -84,10 +84,6 @@ class KuberKit::Actions::ConfigurationLoader
|
|
|
84
84
|
configuration_name = first_configurations.configuration_name
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
if configuration_store.count > 1 && configuration_name
|
|
88
|
-
ui.print_info("Configuration", "Using configuration: #{configuration_name.to_s.cyan}")
|
|
89
|
-
end
|
|
90
|
-
|
|
91
87
|
if configuration_store.count > 1 && configuration_name.nil?
|
|
92
88
|
options = all_configurations.map(&:configuration_name).map(&:to_s)
|
|
93
89
|
configuration_name = ui.prompt("Please select configuration name (or set it using -C option)", options)
|
|
@@ -113,9 +109,9 @@ class KuberKit::Actions::ConfigurationLoader
|
|
|
113
109
|
|
|
114
110
|
artifact_task_group = ui.create_task_group
|
|
115
111
|
not_local_artifacts.each do |artifact|
|
|
116
|
-
artifact_task_group.add("Updating #{artifact.name.to_s.yellow}
|
|
112
|
+
artifact_task_group.add("Updating #{artifact.name.to_s.yellow}") do |task|
|
|
117
113
|
artifact_updater.update(local_shell, artifact)
|
|
118
|
-
task.update_title("
|
|
114
|
+
task.update_title("Updated #{artifact.name.to_s.green}")
|
|
119
115
|
end
|
|
120
116
|
end
|
|
121
117
|
artifact_task_group.wait
|
|
@@ -6,7 +6,7 @@ class KuberKit::Actions::KubectlGet
|
|
|
6
6
|
"ui"
|
|
7
7
|
]
|
|
8
8
|
|
|
9
|
-
Contract Maybe[String], Hash =>
|
|
9
|
+
Contract Maybe[String], Hash => Any
|
|
10
10
|
def call(resource_name, options)
|
|
11
11
|
kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
|
|
12
12
|
deployer_namespace = KuberKit.current_configuration.deployer_namespace
|
|
@@ -23,10 +23,10 @@ class KuberKit::Actions::KubectlGet
|
|
|
23
23
|
|
|
24
24
|
ui.print_info("Pods", resources.join("\n"))
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
true
|
|
27
27
|
rescue KuberKit::Error => e
|
|
28
28
|
ui.print_error("Error", e.message)
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
false
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -18,10 +18,9 @@ class KuberKit::Actions::ServiceDeployer
|
|
|
18
18
|
skip_services: Maybe[ArrayOf[String]],
|
|
19
19
|
skip_compile: Maybe[Bool],
|
|
20
20
|
skip_dependencies: Maybe[Bool],
|
|
21
|
-
skip_deployment: Maybe[Bool],
|
|
22
21
|
require_confirmation: Maybe[Bool],
|
|
23
22
|
] => Any
|
|
24
|
-
def call(services:, tags:, skip_services: nil, skip_compile: false, skip_dependencies: false,
|
|
23
|
+
def call(services:, tags:, skip_services: nil, skip_compile: false, skip_dependencies: false, require_confirmation: false)
|
|
25
24
|
deployment_result = KuberKit::Actions::ActionResult.new()
|
|
26
25
|
current_configuration = KuberKit.current_configuration
|
|
27
26
|
|
|
@@ -67,11 +66,6 @@ class KuberKit::Actions::ServiceDeployer
|
|
|
67
66
|
return false unless compilation_result && compilation_result.succeeded?
|
|
68
67
|
end
|
|
69
68
|
|
|
70
|
-
# Skip service deployment, only compile images.
|
|
71
|
-
if skip_deployment
|
|
72
|
-
return deployment_result
|
|
73
|
-
end
|
|
74
|
-
|
|
75
69
|
# First deploy initial services.
|
|
76
70
|
# This feature is used to deploy some services, required for deployment of other services, e.g. env files
|
|
77
71
|
# Note: Initial services are deployed without dependencies
|
data/lib/kuber_kit/cli.rb
CHANGED
|
@@ -42,7 +42,6 @@ class KuberKit::CLI < Thor
|
|
|
42
42
|
method_option :skip_dependencies, :type => :boolean, aliases: ["-D"]
|
|
43
43
|
method_option :require_confirmation, :type => :boolean, aliases: ["-r"]
|
|
44
44
|
method_option :skip_confirmation, :type => :boolean, aliases: ["-R"]
|
|
45
|
-
method_option :skip_deployment, :type => :boolean, aliases: ["-K"]
|
|
46
45
|
def deploy
|
|
47
46
|
setup(options)
|
|
48
47
|
|
|
@@ -58,7 +57,6 @@ class KuberKit::CLI < Thor
|
|
|
58
57
|
skip_services: (options[:skip_services] || []).flatten.uniq,
|
|
59
58
|
skip_compile: options[:skip_compile] || false,
|
|
60
59
|
skip_dependencies: options[:skip_dependencies] || false,
|
|
61
|
-
skip_deployment: options[:skip_deployment] || false,
|
|
62
60
|
require_confirmation: require_confirmation
|
|
63
61
|
)
|
|
64
62
|
end
|
|
@@ -179,11 +177,7 @@ class KuberKit::CLI < Thor
|
|
|
179
177
|
setup(options)
|
|
180
178
|
|
|
181
179
|
if KuberKit::Container['actions.configuration_loader'].call(options.merge(load_inventory: false))
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
print_result("Fetched list of pods", result: {
|
|
185
|
-
pods: pods
|
|
186
|
-
})
|
|
180
|
+
KuberKit::Container['actions.kubectl_get'].call(pod_name, options)
|
|
187
181
|
end
|
|
188
182
|
end
|
|
189
183
|
|
data/lib/kuber_kit/configs.rb
CHANGED
|
@@ -5,7 +5,7 @@ class KuberKit::Configs
|
|
|
5
5
|
:image_dockerfile_name, :image_build_context_dir, :image_tag, :docker_ignore_list, :image_compile_dir, :remote_image_compile_dir,
|
|
6
6
|
:kuber_kit_dirname, :kuber_kit_min_version, :images_dirname, :services_dirname, :infra_dirname, :configurations_dirname,
|
|
7
7
|
:artifact_clone_dir, :service_config_dir, :deployer_strategy, :compile_simultaneous_limit, :deploy_simultaneous_limit,
|
|
8
|
-
:additional_images_paths, :deprecation_warnings_disabled, :log_file_path, :env_file_compile_dir, :shell_launcher_strategy
|
|
8
|
+
:additional_images_paths, :deprecation_warnings_disabled, :log_file_path, :env_file_compile_dir, :shell_launcher_strategy
|
|
9
9
|
]
|
|
10
10
|
DOCKER_IGNORE_LIST = [
|
|
11
11
|
'Dockerfile',
|
|
@@ -59,7 +59,6 @@ class KuberKit::Configs
|
|
|
59
59
|
set :deprecation_warnings_disabled, false
|
|
60
60
|
set :log_file_path, File.join(absolute_kuber_kit_path, "deploy.log")
|
|
61
61
|
set :env_file_compile_dir, File.join(absolute_kuber_kit_path, "env_files")
|
|
62
|
-
set :shell_launcher_sets_configration, true
|
|
63
62
|
end
|
|
64
63
|
|
|
65
64
|
def items
|
|
@@ -3,18 +3,13 @@ class KuberKit::Core::ContextHelper::ContextVars
|
|
|
3
3
|
|
|
4
4
|
BuildArgUndefined = Class.new(KuberKit::Error)
|
|
5
5
|
|
|
6
|
-
def initialize(context_vars, parent_name = nil)
|
|
6
|
+
def initialize(context_vars, parent_name = nil, parent = nil)
|
|
7
7
|
@context_vars = context_vars
|
|
8
8
|
@parent_name = parent_name
|
|
9
|
+
@parent = parent
|
|
9
10
|
end
|
|
10
11
|
|
|
11
|
-
def read(*variable_names
|
|
12
|
-
dig(*variable_names)
|
|
13
|
-
rescue BuildArgUndefined
|
|
14
|
-
return default
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def dig(*variable_names)
|
|
12
|
+
def read(*variable_names)
|
|
18
13
|
result = self
|
|
19
14
|
variable_names.each do |var|
|
|
20
15
|
result = result.get_variable_value(var)
|
|
@@ -23,7 +18,7 @@ class KuberKit::Core::ContextHelper::ContextVars
|
|
|
23
18
|
end
|
|
24
19
|
|
|
25
20
|
def variable_defined?(*variable_names)
|
|
26
|
-
|
|
21
|
+
read(*variable_names)
|
|
27
22
|
return true
|
|
28
23
|
rescue BuildArgUndefined
|
|
29
24
|
return false
|
|
@@ -34,7 +29,7 @@ class KuberKit::Core::ContextHelper::ContextVars
|
|
|
34
29
|
raise ArgumentError.new("context args does not accept any arguments")
|
|
35
30
|
end
|
|
36
31
|
|
|
37
|
-
|
|
32
|
+
read(name)
|
|
38
33
|
end
|
|
39
34
|
|
|
40
35
|
def to_h
|
|
@@ -51,16 +46,23 @@ class KuberKit::Core::ContextHelper::ContextVars
|
|
|
51
46
|
end
|
|
52
47
|
|
|
53
48
|
if value.is_a?(Hash)
|
|
54
|
-
return self.class.new(value,
|
|
49
|
+
return self.class.new(value, variable_name, self)
|
|
55
50
|
end
|
|
56
51
|
|
|
57
52
|
value
|
|
58
53
|
end
|
|
59
54
|
|
|
60
55
|
private
|
|
61
|
-
|
|
62
56
|
|
|
63
57
|
def format_arg(name)
|
|
64
|
-
[@parent_name, name].compact.join(".")
|
|
58
|
+
string = [@parent_name, name].compact.join(".")
|
|
59
|
+
parent = @parent
|
|
60
|
+
|
|
61
|
+
while parent do
|
|
62
|
+
string = [parent.parent_name, string].compact.join(".")
|
|
63
|
+
parent = parent.parent
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
string
|
|
65
67
|
end
|
|
66
68
|
end
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
require 'time'
|
|
2
2
|
class KuberKit::Shell::Commands::BashCommands
|
|
3
3
|
def rm(shell, path)
|
|
4
|
-
shell.exec!(%Q{rm "#{path}"}
|
|
4
|
+
shell.exec!(%Q{rm "#{path}"})
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def rm_rf(shell, path)
|
|
8
|
-
shell.exec!(%Q{rm -rf "#{path}"}
|
|
8
|
+
shell.exec!(%Q{rm -rf "#{path}"})
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def cp(shell, source_path, dest_path)
|
|
12
|
-
shell.exec!(%Q{cp "#{source_path}" "#{dest_path}"}
|
|
12
|
+
shell.exec!(%Q{cp "#{source_path}" "#{dest_path}"})
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def cp_r(shell, source_path, dest_path)
|
|
16
|
-
shell.exec!(%Q{cp -r "#{source_path}" "#{dest_path}"}
|
|
16
|
+
shell.exec!(%Q{cp -r "#{source_path}" "#{dest_path}"})
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def mkdir(shell, path)
|
|
20
|
-
shell.exec!(%Q{mkdir "#{path}"}
|
|
20
|
+
shell.exec!(%Q{mkdir "#{path}"})
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def mkdir_p(shell, path)
|
|
24
|
-
shell.exec!(%Q{mkdir -p "#{path}"}
|
|
24
|
+
shell.exec!(%Q{mkdir -p "#{path}"})
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def ctime(shell, path)
|
|
@@ -3,15 +3,15 @@ class KuberKit::Shell::Commands::DockerCommands
|
|
|
3
3
|
default_args = ["--rm=true"]
|
|
4
4
|
args_list = (default_args + args).join(" ")
|
|
5
5
|
|
|
6
|
-
shell.exec!(%Q{docker image build #{build_dir} #{args_list}}
|
|
6
|
+
shell.exec!(%Q{docker image build #{build_dir} #{args_list}})
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def tag(shell, image_name, tag_name)
|
|
10
|
-
shell.exec!(%Q{docker tag #{image_name} #{tag_name}}
|
|
10
|
+
shell.exec!(%Q{docker tag #{image_name} #{tag_name}})
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def push(shell, tag_name)
|
|
14
|
-
shell.exec!(%Q{docker push #{tag_name}}
|
|
14
|
+
shell.exec!(%Q{docker push #{tag_name}})
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def run(shell, image_name, args: nil, command: nil, detached: false, interactive: false)
|
|
@@ -25,7 +25,7 @@ class KuberKit::Shell::Commands::DockerCommands
|
|
|
25
25
|
if interactive
|
|
26
26
|
shell.interactive!(command_parts.join(" "))
|
|
27
27
|
else
|
|
28
|
-
shell.exec!(command_parts.join(" ")
|
|
28
|
+
shell.exec!(command_parts.join(" "))
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
class KuberKit::Shell::Commands::GitCommands
|
|
2
2
|
def get_remote_url(shell, git_repo_path, remote_name: "origin")
|
|
3
|
-
shell.exec!
|
|
3
|
+
shell.exec! [
|
|
4
4
|
"cd #{git_repo_path}",
|
|
5
5
|
"git config --get remote.#{remote_name}.url",
|
|
6
|
-
].join(" && ")
|
|
6
|
+
].join(" && ")
|
|
7
7
|
rescue KuberKit::Shell::AbstractShell::ShellError
|
|
8
8
|
return nil
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def get_version_hash(shell, git_repo_path)
|
|
12
|
-
shell.exec!
|
|
12
|
+
shell.exec! [
|
|
13
13
|
"cd #{git_repo_path}",
|
|
14
14
|
"git rev-parse --short HEAD",
|
|
15
|
-
].join(" && ")
|
|
15
|
+
].join(" && ")
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def download_repo(shell, remote_url:, path:, branch:)
|
|
19
|
-
shell.exec!
|
|
19
|
+
shell.exec! [
|
|
20
20
|
"rm -rf #{path}",
|
|
21
21
|
"mkdir -p #{path}",
|
|
22
22
|
"git clone -b #{branch} --depth 1 #{remote_url} #{path}",
|
|
23
|
-
].join(" && ")
|
|
23
|
+
].join(" && ")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def force_pull_repo(shell, path:, branch:)
|
|
27
|
-
shell.exec!
|
|
27
|
+
shell.exec! [
|
|
28
28
|
"cd #{path}",
|
|
29
29
|
"git add .",
|
|
30
30
|
"git reset HEAD --hard",
|
|
31
31
|
"git checkout #{branch}",
|
|
32
32
|
"git reset --hard '@{u}'",
|
|
33
33
|
"git pull --force",
|
|
34
|
-
].join(" && ")
|
|
34
|
+
].join(" && ")
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -10,8 +10,8 @@ class KuberKit::Shell::Commands::KubectlCommands
|
|
|
10
10
|
kubeconfig_path: Maybe[Or[
|
|
11
11
|
String, KuberKit::Core::ArtifactPath
|
|
12
12
|
]],
|
|
13
|
-
namespace:
|
|
14
|
-
interactive:
|
|
13
|
+
namespace: Maybe[Or[Symbol, String]],
|
|
14
|
+
interactive: Optional[Bool],
|
|
15
15
|
] => Any
|
|
16
16
|
def kubectl_run(shell, command_list, kubeconfig_path: nil, namespace: nil, interactive: false)
|
|
17
17
|
command_parts = []
|
|
@@ -2,7 +2,7 @@ class KuberKit::Shell::Commands::SystemCommands
|
|
|
2
2
|
def kill_process(shell, pid)
|
|
3
3
|
# we need to use kill command directly sometimes,
|
|
4
4
|
# because Process.kill doesn't kill processes created by system() call
|
|
5
|
-
shell.exec!("kill -9 #{pid}"
|
|
5
|
+
shell.exec!("kill -9 #{pid}")
|
|
6
6
|
true
|
|
7
7
|
rescue
|
|
8
8
|
false
|
|
@@ -9,9 +9,7 @@ class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
|
|
|
9
9
|
"ui",
|
|
10
10
|
]
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
# Should be false, if we want to read & use the result of the command.
|
|
14
|
-
def exec!(command, log_command: true, merge_stderr: false)
|
|
12
|
+
def exec!(command, log_command: true)
|
|
15
13
|
command_number = command_counter.get_number.to_s.rjust(2, "0")
|
|
16
14
|
|
|
17
15
|
if log_command
|
|
@@ -19,9 +17,7 @@ class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
|
|
|
19
17
|
end
|
|
20
18
|
|
|
21
19
|
result = nil
|
|
22
|
-
|
|
23
|
-
options = merge_stderr ? {err: [:child, :out]} : {}
|
|
24
|
-
IO.popen(wrap_command_with_pid(command), **options) do |io|
|
|
20
|
+
IO.popen(wrap_command_with_pid(command), err: [:child, :out]) do |io|
|
|
25
21
|
result = io.read.chomp.strip
|
|
26
22
|
end
|
|
27
23
|
|
|
@@ -92,21 +88,21 @@ class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
|
|
|
92
88
|
end
|
|
93
89
|
|
|
94
90
|
def delete(file_path)
|
|
95
|
-
exec!("rm #{file_path}"
|
|
91
|
+
exec!("rm #{file_path}")
|
|
96
92
|
end
|
|
97
93
|
|
|
98
94
|
def file_exists?(file_path)
|
|
99
|
-
exec!("test -f #{file_path} && echo 'true' || echo 'false'", log_command: false
|
|
95
|
+
exec!("test -f #{file_path} && echo 'true' || echo 'false'", log_command: false) == 'true'
|
|
100
96
|
end
|
|
101
97
|
|
|
102
98
|
def dir_exists?(dir_path)
|
|
103
|
-
exec!("test -d #{dir_path} && echo 'true' || echo 'false'", log_command: false
|
|
99
|
+
exec!("test -d #{dir_path} && echo 'true' || echo 'false'", log_command: false) == 'true'
|
|
104
100
|
end
|
|
105
101
|
|
|
106
102
|
def recursive_list_files(path, name: nil)
|
|
107
103
|
command = %Q{find -L #{path} -type f}
|
|
108
104
|
command += " -name '#{name}'" if name
|
|
109
|
-
exec!(command
|
|
105
|
+
exec!(command).split(/[\r\n]+/)
|
|
110
106
|
rescue => e
|
|
111
107
|
if e.message.include?("No such file or directory")
|
|
112
108
|
raise DirNotFoundError.new("Dir not found: #{path}")
|
|
@@ -117,7 +113,7 @@ class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
|
|
|
117
113
|
|
|
118
114
|
def list_dirs(path)
|
|
119
115
|
command = %Q{find -L #{path} -maxdepth 0 -type d}
|
|
120
|
-
exec!(command
|
|
116
|
+
exec!(command).split(/[\r\n]+/)
|
|
121
117
|
rescue => e
|
|
122
118
|
if e.message.include?("No such file or directory")
|
|
123
119
|
raise DirNotFoundError.new("Dir not found: #{path}")
|
|
@@ -22,7 +22,7 @@ class KuberKit::Shell::SshSession
|
|
|
22
22
|
@session = nil
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def exec!(command
|
|
25
|
+
def exec!(command)
|
|
26
26
|
stdout_data = ''
|
|
27
27
|
stderr_data = ''
|
|
28
28
|
exit_code = nil
|
|
@@ -38,10 +38,6 @@ class KuberKit::Shell::SshSession
|
|
|
38
38
|
|
|
39
39
|
channel.on_extended_data do |ch,type,data|
|
|
40
40
|
stderr_data += data
|
|
41
|
-
|
|
42
|
-
if merge_stderr
|
|
43
|
-
stdout_data += data
|
|
44
|
-
end
|
|
45
41
|
end
|
|
46
42
|
|
|
47
43
|
channel.on_request('exit-status') do |ch,data|
|
|
@@ -20,14 +20,14 @@ class KuberKit::Shell::SshShell < KuberKit::Shell::LocalShell
|
|
|
20
20
|
@ssh_session.disconnect if @ssh_session
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def exec!(command, log_command: true
|
|
23
|
+
def exec!(command, log_command: true)
|
|
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
|
-
result = ssh_session.exec!(wrap_command_with_pid(command)
|
|
30
|
+
result = ssh_session.exec!(wrap_command_with_pid(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}")
|
|
@@ -17,15 +17,6 @@ class KuberKit::ShellLauncher::Strategies::Kubernetes < KuberKit::ShellLauncher:
|
|
|
17
17
|
kubectl_commands.set_namespace(shell, deployer_namespace, kubeconfig_path: kubeconfig_path)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
env_vars = [
|
|
21
|
-
"KUBECONFIG=#{kubeconfig_path}",
|
|
22
|
-
"KUBER_KIT_SHELL_CONFIGURATION=#{KuberKit.current_configuration.name}"
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
if configs.shell_launcher_sets_configration
|
|
26
|
-
env_vars << "KUBER_KIT_CONFIGURATION=#{KuberKit.current_configuration.name}"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
20
|
shell.replace!(env: ["KUBECONFIG=#{kubeconfig_path}", "KUBER_KIT_SHELL_CONFIGURATION=#{KuberKit.current_configuration.name}"])
|
|
30
21
|
end
|
|
31
22
|
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: 1.
|
|
4
|
+
version: 1.2.0
|
|
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:
|
|
11
|
+
date: 2022-10-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: contracts
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.17.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
26
|
+
version: 0.17.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: dry-auto_inject
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -382,7 +382,7 @@ homepage: https://github.com/ArtStation/kuber_kit
|
|
|
382
382
|
licenses:
|
|
383
383
|
- MIT
|
|
384
384
|
metadata: {}
|
|
385
|
-
post_install_message:
|
|
385
|
+
post_install_message:
|
|
386
386
|
rdoc_options: []
|
|
387
387
|
require_paths:
|
|
388
388
|
- lib
|
|
@@ -390,15 +390,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
390
390
|
requirements:
|
|
391
391
|
- - ">="
|
|
392
392
|
- !ruby/object:Gem::Version
|
|
393
|
-
version:
|
|
393
|
+
version: 3.0.0
|
|
394
394
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
395
395
|
requirements:
|
|
396
396
|
- - ">="
|
|
397
397
|
- !ruby/object:Gem::Version
|
|
398
398
|
version: '0'
|
|
399
399
|
requirements: []
|
|
400
|
-
rubygems_version: 3.
|
|
401
|
-
signing_key:
|
|
400
|
+
rubygems_version: 3.3.7
|
|
401
|
+
signing_key:
|
|
402
402
|
specification_version: 4
|
|
403
403
|
summary: Docker Containers Build & Deployment
|
|
404
404
|
test_files: []
|