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 +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 +2 -2
- 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: 31e5cee4b09ffeba97252188b31ebc0af612042569f731d7eabfae575360e2de
         | 
| 4 | 
            +
              data.tar.gz: 4ba08e5dc74933acb38103fada98647290946cb3733b05668e09302ea2b828ea
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 91601cf6b45b0122293a7dd037f4e4dff9a89260e9e998a39c9b759970aafd0114df09785e76e7ae93f02a35244a47569b2a547cead73976964efb5ae17fb9b2
         | 
| 7 | 
            +
              data.tar.gz: bf4d57b5c80f7f0267be6977695400a3da3166e8a3945d3cae4a0c227718faaf95b454147c1dff15f0cfa73833d046f33092ec08ba05de8794db878b769a226b
         | 
    
        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,6 +1,6 @@ | |
| 1 1 | 
             
            class KuberKit::ShellLauncher::Strategies::Kubernetes < KuberKit::ShellLauncher::Strategies::Abstract
         | 
| 2 2 | 
             
              include KuberKit::Import[
         | 
| 3 | 
            -
                " | 
| 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 | 
            -
               | 
| 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.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- | 
| 11 | 
            +
            date: 2022-05-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: contracts
         |