pfab 0.58.7 → 0.58.8

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: b20c68616c45b8a3dfd03878def263856dea71de19c4fdba68f8d486e4b87c9e
4
- data.tar.gz: 8c6f90dd1980bc20b99b08946fdb2550de3be07432e68fce4a785b71af1cc042
3
+ metadata.gz: e7e3d292ab2f6eee610144e871f341ca2bbb128854552b98d2a4e197850d8328
4
+ data.tar.gz: 6f8c89d9512f0956039fe97c860a8a8e4edfcc66e4a22a992a3bf2e9a3f01871
5
5
  SHA512:
6
- metadata.gz: cd2b6872de0404da1d7b9a9aa6dd5278c71f93cd311074cb359dcc030ba43f36698f16d7a43f4611ddd336debb7ad8dd2bcea582e91d47312ad8f8efc58619e3
7
- data.tar.gz: 41ab35fb28d25efe6d9b31dbe51f52834c75724a22156d8ed410b9bef8b6d23cbad2f3af15eb6897c78ff463d6b081be1e0a36980e2e53bd5f029a856bb0e919
6
+ metadata.gz: b516b4d73d6e281da4e5ce9bc1af4f1e3697f7046af5a24df4df3e154557e08013cf57ff3c7ce731168d3a9e0ee034cb0ec6da4765330aaa9f2527a74c7d0a39
7
+ data.tar.gz: eb666a562d7e5f86f0ddda3edaf9d038d23ab60b29e3dd27ed66ca47f9c62035aa20201e9d56c20d81fd5cb16608278741f991905bf6b98a1a93423f7de48686
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: #{status.exitstatus}\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 = 8
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.8 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.8"
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-21"
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.8
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-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander