pfab 0.21.0 → 0.22.0
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/lib/pfab/cli.rb +32 -10
- data/lib/pfab/version.rb +1 -1
- data/pfab.gemspec +2 -2
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3cf4984e6014745e194fa5d2b6cb12499548ae1113fd61c73529273554d1f5db
         | 
| 4 | 
            +
              data.tar.gz: febfd1b79e28f2227c40b2d122a9fd236d065f8b18a0c09fad82779f02174061
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d3802f127e96a1b0f2fc57e6f38821783e0caa2fc065d7d718727960c201ea76d6d96420196256a26ecf2559904b70fbe2d5f45f6b5b71bdca47ffbbb7f4eef5
         | 
| 7 | 
            +
              data.tar.gz: 7366605a1c4882177ce807a26113d465a419e839193e795cafa17546f8b38cb7f0709dee5c72c1b771ba44e2147267d7cbd20b036d0f16db5c3851b2fff93829
         | 
    
        data/lib/pfab/cli.rb
    CHANGED
    
    | @@ -31,8 +31,9 @@ module Pfab | |
| 31 31 | 
             
                    c.syntax = "pfab build"
         | 
| 32 32 | 
             
                    c.summary = "build image"
         | 
| 33 33 | 
             
                    c.option "--force", "force build and push"
         | 
| 34 | 
            +
                    c.option "--check", "just check if built"
         | 
| 34 35 | 
             
                    c.action do |_args, options|
         | 
| 35 | 
            -
                      cmd_build(force: options.force)
         | 
| 36 | 
            +
                      cmd_build(force: options.force, checkonly: options.check)
         | 
| 36 37 | 
             
                    end
         | 
| 37 38 | 
             
                  end
         | 
| 38 39 |  | 
| @@ -83,6 +84,18 @@ module Pfab | |
| 83 84 | 
             
                    end
         | 
| 84 85 | 
             
                  end
         | 
| 85 86 |  | 
| 87 | 
            +
                  command :restart do |c|
         | 
| 88 | 
            +
                    c.syntax = "pfab restart"
         | 
| 89 | 
            +
                    c.summary = "rolling restart of a deployment"
         | 
| 90 | 
            +
                    c.description = "rolling restart of a deployment"
         | 
| 91 | 
            +
                    c.action do
         | 
| 92 | 
            +
                      set_kube_context
         | 
| 93 | 
            +
                      app_name = get_app_name
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                      puts_and_system "kubectl rollout restart deployment.apps/#{app_name}"
         | 
| 96 | 
            +
                    end
         | 
| 97 | 
            +
                  end
         | 
| 98 | 
            +
             | 
| 86 99 | 
             
                  command :exec do |c|
         | 
| 87 100 | 
             
                    c.syntax = "pfab exec"
         | 
| 88 101 | 
             
                    c.summary = "kubectl exec into a  pod"
         | 
| @@ -193,7 +206,16 @@ module Pfab | |
| 193 206 | 
             
                  end
         | 
| 194 207 | 
             
                end
         | 
| 195 208 |  | 
| 196 | 
            -
                def  | 
| 209 | 
            +
                def image_exists?(full_image_name)
         | 
| 210 | 
            +
             | 
| 211 | 
            +
                  # return 0 if image exists 1 if not
         | 
| 212 | 
            +
                  cmd = "docker manifest inspect #{full_image_name} > /dev/null ; echo $?"
         | 
| 213 | 
            +
                  say "Looking for images with #{cmd}"
         | 
| 214 | 
            +
                  existing = `#{cmd}`.strip
         | 
| 215 | 
            +
                  existing == "0"
         | 
| 216 | 
            +
                end
         | 
| 217 | 
            +
             | 
| 218 | 
            +
                def cmd_build(force: false, checkonly: false)
         | 
| 197 219 | 
             
                  rev = get_current_sha
         | 
| 198 220 | 
             
                  say "This repo is at rev: #{rev}"
         | 
| 199 221 | 
             
                  uncommitted_changes = !`git diff-index HEAD --`.empty?
         | 
| @@ -209,14 +231,14 @@ module Pfab | |
| 209 231 |  | 
| 210 232 | 
             
                  full_image_name = "#{container_repository}/#{image_name}:#{rev}"
         | 
| 211 233 |  | 
| 212 | 
            -
                   | 
| 213 | 
            -
             | 
| 214 | 
            -
             | 
| 215 | 
            -
             | 
| 216 | 
            -
             | 
| 217 | 
            -
             | 
| 218 | 
            -
                     | 
| 219 | 
            -
                    return  | 
| 234 | 
            +
                  unless force
         | 
| 235 | 
            +
                    if image_exists?(full_image_name)
         | 
| 236 | 
            +
                      say "Found image #{full_image_name} already, skipping prebuild, build & push"
         | 
| 237 | 
            +
                      return true
         | 
| 238 | 
            +
                    else
         | 
| 239 | 
            +
                      say "No image #{full_image_name} present"
         | 
| 240 | 
            +
                    end
         | 
| 241 | 
            +
                    return if checkonly
         | 
| 220 242 | 
             
                  end
         | 
| 221 243 |  | 
| 222 244 | 
             
                  say "No image #{full_image_name} present, building"
         | 
    
        data/lib/pfab/version.rb
    CHANGED
    
    
    
        data/pfab.gemspec
    CHANGED
    
    | @@ -2,11 +2,11 @@ | |
| 2 2 | 
             
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 3 | 
             
            # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            -
            # stub: pfab 0. | 
| 5 | 
            +
            # stub: pfab 0.22.0 ruby lib
         | 
| 6 6 |  | 
| 7 7 | 
             
            Gem::Specification.new do |s|
         | 
| 8 8 | 
             
              s.name = "pfab".freeze
         | 
| 9 | 
            -
              s.version = "0. | 
| 9 | 
            +
              s.version = "0.22.0"
         | 
| 10 10 |  | 
| 11 11 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
         | 
| 12 12 | 
             
              s.require_paths = ["lib".freeze]
         |