pfab 0.58.7 → 0.58.9

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: b20c68616c45b8a3dfd03878def263856dea71de19c4fdba68f8d486e4b87c9e
4
- data.tar.gz: 8c6f90dd1980bc20b99b08946fdb2550de3be07432e68fce4a785b71af1cc042
3
+ metadata.gz: fcd7141bf78562fe211e2a75d69bf6a1740503619ca96355efd133266ed4647b
4
+ data.tar.gz: 1bf6df535aabf62eca0d89f64cd37aa3fa584eaab1c66097638370db409055d9
5
5
  SHA512:
6
- metadata.gz: cd2b6872de0404da1d7b9a9aa6dd5278c71f93cd311074cb359dcc030ba43f36698f16d7a43f4611ddd336debb7ad8dd2bcea582e91d47312ad8f8efc58619e3
7
- data.tar.gz: 41ab35fb28d25efe6d9b31dbe51f52834c75724a22156d8ed410b9bef8b6d23cbad2f3af15eb6897c78ff463d6b081be1e0a36980e2e53bd5f029a856bb0e919
6
+ metadata.gz: 2f8379ecc7808db17552591a3de98e910487f2255b6ab483a20d627f5297c0bf0913e8eda1561684705250a068cde5a8fbd8890b94766ad65d0c04f34c6d3c8e
7
+ data.tar.gz: f239cdff5b8a6857e6c8a7979c3eae8070854c24bab782f23de2589fa06c09a8362c38f9cb79aadd0c2cce8c18375b5ce1dd5537934ca8799c2840ab6b7e72df
data/lib/pfab/cli.rb CHANGED
@@ -5,6 +5,7 @@ require "json"
5
5
  require 'active_support/core_ext/hash/indifferent_access'
6
6
  require 'styled_yaml'
7
7
  require 'digest'
8
+ require 'open3'
8
9
 
9
10
  module Pfab
10
11
  class CLI
@@ -251,12 +252,14 @@ module Pfab
251
252
  rollout_success = false
252
253
 
253
254
  retries.times do |attempt|
254
- rollout_success = kubectl("rollout status deployment/#{deployment_name} --timeout=#{timeout}s")
255
+ rollout_result = kubectl_with_output("rollout status deployment/#{deployment_name} --timeout=#{timeout}s")
256
+ rollout_success = rollout_result.success?
255
257
  if rollout_success
256
258
  puts "Deployment #{deployment_name} successfully rolled out. Attempt #{attempt + 1}/#{retries}."
257
259
  break
258
260
  else
259
261
  puts "Attempt #{attempt + 1}/#{retries}: Deployment #{deployment_name} failed to roll out within the specified timeout."
262
+ puts "Output was #{rollout_result}"
260
263
  if attempt < retries - 1
261
264
  puts "Retrying in #{sleep_duration} seconds..."
262
265
  sleep(sleep_duration)
@@ -401,6 +404,10 @@ module Pfab
401
404
  result == true
402
405
  end
403
406
 
407
+ def kubectl_with_output(cmd, post_cmd = "")
408
+ puts_and_system_with_output("kubectl #{cmd} --namespace=#{yy.namespace} #{post_cmd}")
409
+ end
410
+
404
411
  def puts_and_system(cmd)
405
412
  puts cmd
406
413
  if $dryrun
@@ -411,6 +418,18 @@ module Pfab
411
418
  end
412
419
  end
413
420
 
421
+ def puts_and_system_with_output(cmd)
422
+ puts cmd
423
+ if $dryrun
424
+ dryrun_message = "dry run, didn't run that"
425
+ puts dryrun_message
426
+ CommandResult.new(stdout: dryrun_message, stderr: dryrun_message, exit_status_code: 0)
427
+ else
428
+ stdout, stderr, status = Open3.capture3(cmd)
429
+ CommandResult.new(stdout: stdout, stderr: stderr, exit_status_code: status.exitstatus)
430
+ end
431
+ end
432
+
414
433
  def deployables
415
434
  @_deployables ||= calculate_runnables("deployables")
416
435
  end
@@ -466,4 +485,14 @@ module Pfab
466
485
  (name == "all") ? deployables.keys : [name]
467
486
  end
468
487
  end
488
+
489
+ CommandResult = Struct.new(:stdout, :stderr, :exit_status_code, keyword_init: true) do
490
+ def success?
491
+ exit_status_code == 0
492
+ end
493
+
494
+ def to_s
495
+ "status: #{exit_status_code}\n\nstdout: #{stdout}\n\nstderr: #{stderr}\n\n"
496
+ end
497
+ end
469
498
  end
data/lib/pfab/version.rb CHANGED
@@ -2,7 +2,7 @@ module Pfab
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 58
5
- PATCH = 7
5
+ PATCH = 9
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.58.7 ruby lib
5
+ # stub: pfab 0.58.9 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pfab".freeze
9
- s.version = "0.58.7"
9
+ s.version = "0.58.9"
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-10-10"
14
+ s.date = "2024-10-23"
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.58.7
4
+ version: 0.58.9
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-10-10 00:00:00.000000000 Z
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander