pfab 0.57.1 → 0.58.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca0e426618db3917a6ef9ec88e9f0e1e2e915aeda75ada09ee3195554b5e3459
4
- data.tar.gz: 2c3f606dc89afe42e3a4f81ca63dc26f86dbbce30b33ec0f65cb42b6e87eb6a8
3
+ metadata.gz: 54465d79148f277fb4f811a42bd64515cfa91db27136f98d4c5bba1f51175b5f
4
+ data.tar.gz: 0fd8666d12d99292becd875d99d74a1250ea0fe6e5c1f40b3c4ff799b91b2068
5
5
  SHA512:
6
- metadata.gz: f4a20bf537748c2ab4e695a1e317102ab68a2523f249b6f764f4b9b45dbbde4e84c3f21e8e9f3979c66c7233d1aedb1432272d34b1f54ddce300d203352d13cd
7
- data.tar.gz: 9abb5db57922ddef966c96a3682b2940614384bcee60c9a35f94e24cad27604948c9341f286176ef68310c3c29ba8021dd13be0bb4c59838dc0af3cad23b63f3
6
+ metadata.gz: f117eac3ced18cf6fc03d04fa4f196922c0b37a6be27052f11b70ca7c13f6c657b279f17c3cec5ba22daa8b940572e3418992ed369580fee748194a4553cf3b3
7
+ data.tar.gz: '08692b693dc3894006f5879a7b91ed9364a8165047444714b7c1fc6c117991d34afd6b2db3617d0dd4ac336b7f4d1cce972c299781e9158169ceaab63a66bbd0'
data/README.markdown CHANGED
@@ -230,7 +230,7 @@ Local Testing
230
230
  -----------------------------------------
231
231
  ```bash
232
232
  bundle exec rake build
233
- gem install --local pkg/pfab-0.44.0.gem
233
+ gem install --local pkg/pfab-0.57.1.gem
234
234
  ```
235
235
  ```ruby
236
236
  gem 'pfab', :path => "../pfab"
data/lib/pfab/cli.rb CHANGED
@@ -206,18 +206,34 @@ module Pfab
206
206
 
207
207
  def cmd_apply
208
208
  set_kube_context
209
+ success = true
210
+
209
211
  get_apps.each do |app_name|
210
212
  app = deployables[app_name]
211
213
  if app[:deployable_type] == "cron"
212
214
  deployed_name = deployed_name(app)
213
- kubectl("delete cronjob -l deployed-name=#{deployed_name}")
215
+ success &= kubectl("delete cronjob -l deployed-name=#{deployed_name}")
214
216
  end
215
- kubectl("apply -f .application-k8s-#{$env}-#{app_name}.yaml")
216
- puts_and_system("git tag release-#{$env}-#{app_name}-#{Time.now.strftime("%Y-%m-%d-%H-%M-%S")} HEAD")
217
- puts_and_system("git push origin --tags")
217
+ success &= kubectl("apply -f .application-k8s-#{$env}-#{app_name}.yaml")
218
+ success &= puts_and_system("git tag release-#{$env}-#{app_name}-#{Time.now.strftime("%Y-%m-%d-%H-%M-%S")} HEAD")
219
+ success &= puts_and_system("git push origin --tags")
218
220
  end
221
+
219
222
  selector = "application=#{@application_yaml['name']}"
220
- kubectl "get pods -l #{selector} -w"
223
+
224
+ # Get the deployment for the given selector
225
+ deployment_json = `kubectl get deployment -l #{selector} -o json --namespace=#{yy.namespace}`
226
+ deployment = JSON.parse(deployment_json)
227
+
228
+ if deployment["items"].any?
229
+ deployment_name = deployment["items"].first["metadata"]["name"]
230
+ success &= kubectl("rollout status deployment/#{deployment_name} --timeout=60s")
231
+ else
232
+ puts "No deployment found for selector: #{selector}"
233
+ success = false
234
+ end
235
+
236
+ exit(success ? 0 : 1)
221
237
  end
222
238
 
223
239
  def image_exists?(full_image_name)
@@ -339,16 +355,18 @@ module Pfab
339
355
  @_config ||= YAML.load(File.read(File.join(Dir.home, ".pfab.yaml")))
340
356
  end
341
357
 
342
- def kubectl cmd, post_cmd = ""
343
- puts_and_system "kubectl #{cmd} --namespace=#{yy.namespace} #{post_cmd}"
358
+ def kubectl(cmd, post_cmd = "")
359
+ result = puts_and_system("kubectl #{cmd} --namespace=#{yy.namespace} #{post_cmd}")
360
+ result == true
344
361
  end
345
362
 
346
- def puts_and_system cmd
363
+ def puts_and_system(cmd)
347
364
  puts cmd
348
365
  if $dryrun
349
366
  puts "dry run, didn't run that"
367
+ true
350
368
  else
351
- system cmd
369
+ system(cmd)
352
370
  end
353
371
  end
354
372
 
@@ -406,4 +424,4 @@ module Pfab
406
424
  (name == "all") ? deployables.keys : [name]
407
425
  end
408
426
  end
409
- end
427
+ end
data/lib/pfab/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Pfab
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 57
5
- PATCH = 1
4
+ MINOR = 58
5
+ PATCH = 0
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
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.57.1 ruby lib
5
+ # stub: pfab 0.58.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pfab".freeze
9
- s.version = "0.57.1"
9
+ s.version = "0.58.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 = "2024-07-18"
14
+ s.date = "2024-10-07"
15
15
  s.description = "k8s helper".freeze
16
16
  s.email = "jdwyer@prefab.cloud".freeze
17
17
  s.executables = ["pfab".freeze]
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.57.1
4
+ version: 0.58.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: 2024-07-18 00:00:00.000000000 Z
11
+ date: 2024-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander