kuber_kit 0.9.2 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d12070a68a28af618ebe127fd4b5bc6e8091e5eda80d97b02bdc5811250a50a5
4
- data.tar.gz: 1596fe61bafd254762585d87cfb72081c4149305d2754c80fb11d032f8deaf70
3
+ metadata.gz: 6f981c4a56cdd8e79c87d9ad0005930ddf68f54df5208be13bceaeeab48e935d
4
+ data.tar.gz: daf378968fba31265645d1e3695f42b0682c9335413cce1e43d28df0545ea458
5
5
  SHA512:
6
- metadata.gz: 5a9ba53c902b8d7b24f84752c2fa71f37e1ed65e017f7a1cb1769590bea8fcbb662e1bd1e1223e44f2edcd3fe9697777054f6beccb777d909a8b704c6f121fc4
7
- data.tar.gz: 10885940c62eac245e82522cad006f3709e10d53bbc9b1b9e33fb6917664ed77f353030bd2aeab315722aeb66386e7f465691b5f16d19ded2e14e0672249574b
6
+ metadata.gz: 599602af81d2936fe7d0a2629bc758ae3dfd83d20cc408bb2a23f6cf4eb1cfcee236587f6f23e30406a34d6e4f7adb02fb8bc4a3033d3fa2ef21f22b269deef7
7
+ data.tar.gz: b5e95e8abbbae885b7fa3c0ab010673a55ab57b36e7badb25f477a22812788783591d020684b03f2c3d03f88d41e9d0724312d53ec3a50dcb65047b1e32b3d01
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- **0.9.0-0.9.2**
1
+ **0.9.0-0.9.4**
2
2
  - Allow skipping confirmation during deployment
3
3
  - Added `kit sh` command to create a new shell
4
4
  - Use tmp dir as image builds parent dir for remote compilation
@@ -41,7 +41,7 @@ class KuberKit::Configs
41
41
  set :image_build_context_dir, "build_context"
42
42
  set :image_tag, 'latest'
43
43
  set :image_compile_dir, File.join(absolute_kuber_kit_path, "image_builds")
44
- set :remote_image_compile_dir, File.join("tmp", "kuber_kit", "image_builds")
44
+ set :remote_image_compile_dir, File.join("/tmp", "kuber_kit", "image_builds")
45
45
  set :docker_ignore_list, DOCKER_IGNORE_LIST
46
46
  set :kuber_kit_dirname, "kuber_kit"
47
47
  set :kuber_kit_min_version, KuberKit::VERSION
@@ -117,7 +117,7 @@ class KuberKit::Core::ConfigurationDefinition
117
117
  alias_method :deployer_require_confirimation, :deployer_require_confirmation
118
118
 
119
119
  def shell_launcher_strategy(strategy)
120
- @shell_launcher_strategy = path
120
+ @shell_launcher_strategy = strategy
121
121
 
122
122
  self
123
123
  end
@@ -12,7 +12,7 @@ class KuberKit::ImageCompiler::ActionHandler
12
12
 
13
13
  image = image_store.get_image(image_name)
14
14
 
15
- build_dir_cleaner.call(parent_dir: parent_dir)
15
+ build_dir_cleaner.call(shell, parent_dir: parent_dir)
16
16
 
17
17
  compile_dir = generate_compile_dir(parent_dir: parent_dir, build_id: build_id)
18
18
 
@@ -25,10 +25,10 @@ class KuberKit::ImageCompiler::ActionHandler
25
25
  end
26
26
 
27
27
  def get_image_compile_parent_dir_for_shell(shell)
28
- if shell.is_a?(KuberKit::Shell::LocalShell)
29
- configs.image_compile_dir
30
- else
28
+ if shell.is_a?(KuberKit::Shell::SshShell)
31
29
  configs.remote_image_compile_dir
30
+ else
31
+ configs.image_compile_dir
32
32
  end
33
33
  end
34
34
  end
@@ -1,3 +1,4 @@
1
+ require 'time'
1
2
  class KuberKit::Shell::Commands::BashCommands
2
3
  def rm(shell, path)
3
4
  shell.exec!(%Q{rm "#{path}"})
@@ -22,4 +23,9 @@ class KuberKit::Shell::Commands::BashCommands
22
23
  def mkdir_p(shell, path)
23
24
  shell.exec!(%Q{mkdir -p "#{path}"})
24
25
  end
26
+
27
+ def ctime(shell, path)
28
+ result = shell.exec!(%Q{date -r "#{path}"})
29
+ Time.parse(result)
30
+ end
25
31
  end
@@ -112,8 +112,7 @@ class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
112
112
  end
113
113
 
114
114
  def list_dirs(path)
115
- command = %Q{find -L #{path} -type f}
116
- command += " -name '#{name}'" if name
115
+ command = %Q{find -L #{path} -maxdepth 0 -type d}
117
116
  exec!(command).split(/[\r\n]+/)
118
117
  rescue => e
119
118
  if e.message.include?("No such file or directory")
@@ -1,6 +1,6 @@
1
1
  class KuberKit::ShellLauncher::Strategies::Kubernetes < KuberKit::ShellLauncher::Strategies::Abstract
2
2
  include KuberKit::Import[
3
- "service_reader.reader",
3
+ "core.artifact_path_resolver",
4
4
  "shell.kubectl_commands",
5
5
  "configs",
6
6
  ]
@@ -1,24 +1,25 @@
1
1
  class KuberKit::Tools::BuildDirCleaner
2
2
  include KuberKit::Import[
3
3
  "shell.bash_commands",
4
- "shell.local_shell",
5
4
  ]
6
5
 
7
6
  KEEP_DIRS_COUNT = 10
8
7
 
9
- def call(parent_dir:)
10
- dirs_to_delete = get_ancient_builds_dirs(parent_dir: parent_dir)
8
+ Contract KuberKit::Shell::AbstractShell, KeywordArgs[parent_dir: String] => Any
9
+ def call(shell, parent_dir:)
10
+ dirs_to_delete = get_ancient_builds_dirs(shell, parent_dir: parent_dir)
11
11
 
12
12
  dirs_to_delete.each do |dir|
13
- bash_commands.rm_rf(local_shell, dir)
13
+ bash_commands.rm_rf(shell, dir)
14
14
  end
15
15
  end
16
16
 
17
17
  private
18
- def get_ancient_builds_dirs(parent_dir:)
19
- all_dirs = Dir.glob("#{parent_dir}/*")
18
+ def get_ancient_builds_dirs(shell, parent_dir:)
19
+ all_dirs = shell.list_dirs("#{parent_dir}/*")
20
+
20
21
  skip_dirs = all_dirs
21
- .sort_by{ |f| File.ctime(f) }
22
+ .sort_by{ |f| bash_commands.ctime(shell, f) }
22
23
  .reverse[0...KEEP_DIRS_COUNT]
23
24
 
24
25
  all_dirs - skip_dirs
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.5"
3
3
  end
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.9.2
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Khaziev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-02 00:00:00.000000000 Z
11
+ date: 2022-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contracts