pfab 0.58.0 → 0.58.2
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 +27 -9
- data/lib/pfab/version.rb +1 -1
- data/pfab.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5431534b800da64ae3ef1e1c4a3b26324e5ba535c72ab520eaac2b7f2f31fc61
|
4
|
+
data.tar.gz: 0dfb207acf2aa57acc1200d41e85d3c624b5ee82c667afb864b3c94561936977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df9d9d0932394fbf2b10a09cba1e27b5cc9b7beb6afc72ec351ac9fb8da65f3b8efed11aa01be27e6ffb6093c6b47dd1cb0b233f558237887eea2c2a1948ccee
|
7
|
+
data.tar.gz: f9ecf06f3bc8e05a654fa6eeef04185143d855964a570be0dd87b0d1d1d7cef2c38c55af8a67dd74805a0e85dc1247573b75b77efb93ce60677759099400fb48
|
data/lib/pfab/cli.rb
CHANGED
@@ -65,13 +65,16 @@ module Pfab
|
|
65
65
|
command :shipit do |c|
|
66
66
|
c.syntax = "pfab shipit"
|
67
67
|
c.summary = "build, generate, apply"
|
68
|
-
c.
|
68
|
+
c.option "-t", "--timeout timeout", "timeout for rollout (default 240s)"
|
69
|
+
|
70
|
+
c.action do |args, options|
|
71
|
+
options.default :timeout => 240
|
69
72
|
app_name = get_app_name(all: true)
|
70
73
|
puts "Shipping #{app_name}"
|
71
74
|
success = cmd_build
|
72
75
|
if success
|
73
76
|
cmd_generate_yaml
|
74
|
-
cmd_apply
|
77
|
+
cmd_apply(timeout: options.timeout)
|
75
78
|
end
|
76
79
|
end
|
77
80
|
end
|
@@ -204,7 +207,7 @@ module Pfab
|
|
204
207
|
run!
|
205
208
|
end
|
206
209
|
|
207
|
-
def cmd_apply
|
210
|
+
def cmd_apply(timeout: 240)
|
208
211
|
set_kube_context
|
209
212
|
success = true
|
210
213
|
|
@@ -221,18 +224,33 @@ module Pfab
|
|
221
224
|
|
222
225
|
selector = "application=#{@application_yaml['name']}"
|
223
226
|
|
224
|
-
# Get
|
227
|
+
# Get all deployments for the given selector
|
225
228
|
deployment_json = `kubectl get deployment -l #{selector} -o json --namespace=#{yy.namespace}`
|
226
|
-
|
229
|
+
deployments = JSON.parse(deployment_json)
|
227
230
|
|
228
|
-
if
|
229
|
-
|
230
|
-
|
231
|
+
if deployments["items"].any?
|
232
|
+
deployments["items"].each do |deployment|
|
233
|
+
deployment_name = deployment["metadata"]["name"]
|
234
|
+
puts "Waiting for deployment #{deployment_name} to roll out..."
|
235
|
+
rollout_success = kubectl("rollout status deployment/#{deployment_name} --timeout=#{timeout}s")
|
236
|
+
if rollout_success
|
237
|
+
puts "Deployment #{deployment_name} successfully rolled out."
|
238
|
+
else
|
239
|
+
puts "Deployment #{deployment_name} failed to roll out within the specified timeout."
|
240
|
+
end
|
241
|
+
success &= rollout_success
|
242
|
+
end
|
231
243
|
else
|
232
|
-
puts "No
|
244
|
+
puts "No deployments found for selector: #{selector}"
|
233
245
|
success = false
|
234
246
|
end
|
235
247
|
|
248
|
+
if success
|
249
|
+
puts "All deployments successfully rolled out."
|
250
|
+
else
|
251
|
+
puts "One or more deployments failed to roll out successfully."
|
252
|
+
end
|
253
|
+
|
236
254
|
exit(success ? 0 : 1)
|
237
255
|
end
|
238
256
|
|
data/lib/pfab/version.rb
CHANGED
data/pfab.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
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.2 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.2"
|
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]
|