kuber_kit 0.9.2 → 0.9.5
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/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 +4 -4
- 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 +8 -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: 6f981c4a56cdd8e79c87d9ad0005930ddf68f54df5208be13bceaeeab48e935d
         | 
| 4 | 
            +
              data.tar.gz: daf378968fba31265645d1e3695f42b0682c9335413cce1e43d28df0545ea458
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 599602af81d2936fe7d0a2629bc758ae3dfd83d20cc408bb2a23f6cf4eb1cfcee236587f6f23e30406a34d6e4f7adb02fb8bc4a3033d3fa2ef21f22b269deef7
         | 
| 7 | 
            +
              data.tar.gz: b5e95e8abbbae885b7fa3c0ab010673a55ab57b36e7badb25f477a22812788783591d020684b03f2c3d03f88d41e9d0724312d53ec3a50dcb65047b1e32b3d01
         | 
    
        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 |  | 
| @@ -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:: | 
| 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} | 
| 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,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 | 
            -
               | 
| 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 | 
            +
             | 
| 20 21 | 
             
                  skip_dirs = all_dirs
         | 
| 21 | 
            -
                    .sort_by{ |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
         | 
    
        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.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- | 
| 11 | 
            +
            date: 2022-05-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: contracts
         |