kuber_kit 0.9.3 → 0.9.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e67c6edb93aac9bbbcfe41d4d12df62b77f657fdc5b8d6144c24fe50c49da8c6
4
- data.tar.gz: 4f17809d73a86012bf45b072f054a171cfdf35268140019e6aa64ff87de871d1
3
+ metadata.gz: 31e5cee4b09ffeba97252188b31ebc0af612042569f731d7eabfae575360e2de
4
+ data.tar.gz: 4ba08e5dc74933acb38103fada98647290946cb3733b05668e09302ea2b828ea
5
5
  SHA512:
6
- metadata.gz: dbd934839a2584a8cd3b428a5c44de9b3356b9bfc6e211d16095cc10e78785cf8ad90bff2898855a7b66722e9f471a35234a11c4422cfc378a0812463e2b66a1
7
- data.tar.gz: febd3b1e27c4a14da1bf6e1d8a15a5c238d0fb182f9ea4b31368f0474abdfb27ac64c311385ad6aefb26bf4407255a0b4138d17ca9b9fcd8041d4a9a63e1a68a
6
+ metadata.gz: 91601cf6b45b0122293a7dd037f4e4dff9a89260e9e998a39c9b759970aafd0114df09785e76e7ae93f02a35244a47569b2a547cead73976964efb5ae17fb9b2
7
+ data.tar.gz: bf4d57b5c80f7f0267be6977695400a3da3166e8a3945d3cae4a0c227718faaf95b454147c1dff15f0cfa73833d046f33092ec08ba05de8794db878b769a226b
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- **0.9.0-0.9.3**
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
 
@@ -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
  ]
@@ -17,6 +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
- shell.replace!(env: ["KUBECONFIG=#{kubeconfig_path}"])
20
+ shell.replace!(env: ["KUBECONFIG=#{kubeconfig_path}", "KUBER_KIT_SHELL_CONFIGURATION=#{KuberKit.current_configuration.name}"])
21
21
  end
22
22
  end
@@ -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.3"
2
+ VERSION = "0.9.6"
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.3
4
+ version: 0.9.6
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