kuber_kit 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/kuber_kit/configs.rb +1 -1
- data/lib/kuber_kit/core/configuration_definition.rb +1 -1
- data/lib/kuber_kit/image_compiler/action_handler.rb +1 -1
- data/lib/kuber_kit/shell/commands/bash_commands.rb +6 -0
- data/lib/kuber_kit/shell/local_shell.rb +1 -2
- data/lib/kuber_kit/shell_launcher/strategies/kubernetes.rb +1 -1
- data/lib/kuber_kit/tools/build_dir_cleaner.rb +12 -7
- data/lib/kuber_kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5f0b92eec3497c897de06a8a4f15d58e2244574d5f6b58d7987de53eacc933c
|
4
|
+
data.tar.gz: 8e27cba7749afc8d12a46e6efcc4800fcb9fadfa41003a04623af4c4eb7b4095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 202a9ad0f727b595521985137afa1f68ffd5ec0ab156887bbd1d1e38226fd9c14e5ffdf191a83c12a92f7944f0130f2f06e2787dfd7a14502db2f6096d1a7aed
|
7
|
+
data.tar.gz: a3e15732d176ea3efb94560e8f5d747bae0fc59153a49e4fcf3364726946aa42ef4c2161571f69d3ffbe91956a92316df89149e3898292315f8d0bf920a69b0b
|
data/CHANGELOG.md
CHANGED
data/lib/kuber_kit/configs.rb
CHANGED
@@ -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 =
|
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}
|
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,24 +1,29 @@
|
|
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
|
-
|
10
|
-
|
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(
|
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 =
|
18
|
+
def get_ancient_builds_dirs(shell, parent_dir:)
|
19
|
+
all_dirs = shell.list_dirs("#{parent_dir}/*")
|
20
|
+
|
21
|
+
all_dirs.each do |dir|
|
22
|
+
puts bash_commands.ctime(shell, f).inspect
|
23
|
+
end
|
24
|
+
|
20
25
|
skip_dirs = all_dirs
|
21
|
-
.sort_by{ |f|
|
26
|
+
.sort_by{ |f| bash_commands.ctime(shell, f) }
|
22
27
|
.reverse[0...KEEP_DIRS_COUNT]
|
23
28
|
|
24
29
|
all_dirs - skip_dirs
|
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.9.
|
4
|
+
version: 0.9.4
|
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-
|
11
|
+
date: 2022-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts
|