pfab 0.20.0 → 0.23.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae294e06f6c051ecc7a114ce443c26620e95ccad7a51c14f73647b11f49d71a3
4
- data.tar.gz: 2f72d8acbd9cac08442e4c8f3aa8e135ccc9830d8e532edfb30ea3d75a2afd00
3
+ metadata.gz: 714a03244225ab924ffc98c75b620eb8205e6631314f6f43f731f6016f4dd91f
4
+ data.tar.gz: 0bca11dc0205345aca57a8cbab34208a0b7144ffd79c0f9b4a21258aff54276c
5
5
  SHA512:
6
- metadata.gz: ad8d785eb4d122aa05583f15221ae878b43782eb83b6c3f1b83364d33b543c98a0ae6c68d7b923db4d8d328c9eeec3b00d2ed0ebb8262e9859710eef3d28e4af
7
- data.tar.gz: fac2aec3de8fce83b95e1c03af150c48c1b5c21cef4afb25dba5daf57f8e7b39f122fe223184330b36395ec575c052237954551b1c050420fdc4ecd91377c0a6
6
+ metadata.gz: 6e442240a6666c09f9b42c29d37a2abc6dd56c7ac158eec52f0c82c9d36ad4f70cc551b76289084fbc414054fcccffeb13b65e1642c48ebb539681016d3004a2
7
+ data.tar.gz: 2d9e9765c520d267ccb9e3e97eaa2148d60b62a8d665defd50bbb3971385e855a906e78910af5929e1e727a0c11cb30842eefe22d9a558ac91dbbaf0f1888bd2
data/Gemfile.lock CHANGED
@@ -126,4 +126,4 @@ DEPENDENCIES
126
126
  test-unit
127
127
 
128
128
  BUNDLED WITH
129
- 1.17.2
129
+ 2.3.5
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 cmd_build(force: false)
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
- # return 0 if image exists 1 if not
213
- cmd = "docker manifest inspect #{full_image_name} > /dev/null ; echo $?"
214
- say "Looking for images with #{cmd}"
215
- existing = `#{cmd}`.strip
216
-
217
- if existing == "0" && !force
218
- say "Found image #{full_image_name} already, skipping prebuild, build & push"
219
- return true
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"
@@ -274,7 +296,7 @@ module Pfab
274
296
  end
275
297
 
276
298
  def get_current_sha
277
- `git rev-parse --short --verify HEAD`.chomp
299
+ `git rev-parse --short=8 --verify HEAD`.chomp
278
300
  end
279
301
 
280
302
  def set_kube_context
@@ -42,6 +42,10 @@ module Pfab
42
42
  }
43
43
  end
44
44
 
45
+ # overridden in subtypes
46
+ def application_type
47
+ "base"
48
+ end
45
49
 
46
50
  def deploy_id
47
51
  "#{@data['application']}.#{application_type}.#{@data['deployed_name']}"
data/lib/pfab/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Pfab
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 20
4
+ MINOR = 23
5
5
  PATCH = 0
6
6
  BUILD = nil
7
7
 
data/pfab.gemspec CHANGED
@@ -2,16 +2,16 @@
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.20.0 ruby lib
5
+ # stub: pfab 0.23.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pfab".freeze
9
- s.version = "0.20.0"
9
+ s.version = "0.23.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]
13
13
  s.authors = ["Jeff Dwyer".freeze]
14
- s.date = "2022-07-16"
14
+ s.date = "2022-07-21"
15
15
  s.description = "k8s helper".freeze
16
16
  s.email = "jdwyer@prefab.cloud".freeze
17
17
  s.executables = ["pfab".freeze]
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.files = [
23
23
  ".document",
24
24
  ".tool-versions",
25
+ "CODEOWNERS",
25
26
  "Gemfile",
26
27
  "Gemfile.lock",
27
28
  "LICENSE.txt",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dwyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-16 00:00:00.000000000 Z
11
+ date: 2022-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander