pfab 0.58.7 → 0.58.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pfab/cli.rb +30 -1
- data/lib/pfab/version.rb +1 -1
- data/pfab.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7e3d292ab2f6eee610144e871f341ca2bbb128854552b98d2a4e197850d8328
|
4
|
+
data.tar.gz: 6f8c89d9512f0956039fe97c860a8a8e4edfcc66e4a22a992a3bf2e9a3f01871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
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.
|
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.
|
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-
|
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.
|
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-
|
11
|
+
date: 2024-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|