kuber_kit 1.1.2 → 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 -2
- data/lib/kuber_kit/actions/kubectl_get.rb +3 -3
- data/lib/kuber_kit/cli.rb +1 -5
- 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/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"
|
@@ -109,9 +109,9 @@ class KuberKit::Actions::ConfigurationLoader
|
|
109
109
|
|
110
110
|
artifact_task_group = ui.create_task_group
|
111
111
|
not_local_artifacts.each do |artifact|
|
112
|
-
artifact_task_group.add("Updating #{artifact.name.to_s.yellow}
|
112
|
+
artifact_task_group.add("Updating #{artifact.name.to_s.yellow}") do |task|
|
113
113
|
artifact_updater.update(local_shell, artifact)
|
114
|
-
task.update_title("
|
114
|
+
task.update_title("Updated #{artifact.name.to_s.green}")
|
115
115
|
end
|
116
116
|
end
|
117
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
|
data/lib/kuber_kit/cli.rb
CHANGED
@@ -177,11 +177,7 @@ class KuberKit::CLI < Thor
|
|
177
177
|
setup(options)
|
178
178
|
|
179
179
|
if KuberKit::Container['actions.configuration_loader'].call(options.merge(load_inventory: false))
|
180
|
-
|
181
|
-
|
182
|
-
print_result("Fetched list of pods", result: {
|
183
|
-
pods: pods
|
184
|
-
})
|
180
|
+
KuberKit::Container['actions.kubectl_get'].call(pod_name, options)
|
185
181
|
end
|
186
182
|
end
|
187
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
|
@@ -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: []
|