pfab 0.58.5 → 0.58.7
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 +4 -4
- data/lib/pfab/cli.rb +20 -8
- 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: b20c68616c45b8a3dfd03878def263856dea71de19c4fdba68f8d486e4b87c9e
|
|
4
|
+
data.tar.gz: 8c6f90dd1980bc20b99b08946fdb2550de3be07432e68fce4a785b71af1cc042
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd2b6872de0404da1d7b9a9aa6dd5278c71f93cd311074cb359dcc030ba43f36698f16d7a43f4611ddd336debb7ad8dd2bcea582e91d47312ad8f8efc58619e3
|
|
7
|
+
data.tar.gz: 41ab35fb28d25efe6d9b31dbe51f52834c75724a22156d8ed410b9bef8b6d23cbad2f3af15eb6897c78ff463d6b081be1e0a36980e2e53bd5f029a856bb0e919
|
data/lib/pfab/cli.rb
CHANGED
|
@@ -68,15 +68,22 @@ module Pfab
|
|
|
68
68
|
c.option "-t", "--timeout TIMEOUT", Integer, "timeout for rollout (default 360s)"
|
|
69
69
|
c.option "-r", "--retries RETRIES", Integer, "number of retries for rollout (default 3)"
|
|
70
70
|
c.option "-s", "--sleep SLEEP", Integer, "sleep duration between retries in seconds (default 5)"
|
|
71
|
+
c.option "-g", "--tagged TAGGED", String, "target deployables tagged with TAGGED"
|
|
71
72
|
|
|
72
73
|
c.action do |args, options|
|
|
73
74
|
options.default timeout: 360, retries: 3, sleep: 5
|
|
74
|
-
app_name =
|
|
75
|
+
app_name = ""
|
|
76
|
+
if options.tagged && options.tagged != ""
|
|
77
|
+
app_name = "Apps tagged with #{options.tagged}"
|
|
78
|
+
else
|
|
79
|
+
app_name = get_app_name(all: true)
|
|
80
|
+
end
|
|
81
|
+
|
|
75
82
|
puts "Shipping #{app_name}"
|
|
76
83
|
success = cmd_build
|
|
77
84
|
if success
|
|
78
85
|
cmd_generate_yaml
|
|
79
|
-
cmd_apply(timeout: options.timeout, retries: options.retries, sleep_duration: options.sleep)
|
|
86
|
+
cmd_apply(timeout: options.timeout, retries: options.retries, sleep_duration: options.sleep, tagged: options.tagged)
|
|
80
87
|
end
|
|
81
88
|
end
|
|
82
89
|
end
|
|
@@ -209,11 +216,13 @@ module Pfab
|
|
|
209
216
|
run!
|
|
210
217
|
end
|
|
211
218
|
|
|
212
|
-
def cmd_apply(timeout: 240, retries: 3, sleep_duration: 5)
|
|
219
|
+
def cmd_apply(timeout: 240, retries: 3, sleep_duration: 5, tagged: nil)
|
|
213
220
|
set_kube_context
|
|
214
221
|
success = true
|
|
215
222
|
|
|
216
|
-
|
|
223
|
+
apps = tagged ? deployables.select { |k, v| v[:tags]&.include?(tagged) }.keys : get_apps
|
|
224
|
+
|
|
225
|
+
apps.each do |app_name|
|
|
217
226
|
app = deployables[app_name]
|
|
218
227
|
if app[:deployable_type] == "cron"
|
|
219
228
|
deployed_name = deployed_name(app)
|
|
@@ -233,12 +242,14 @@ module Pfab
|
|
|
233
242
|
selector = "application=#{@application_yaml['name']}"
|
|
234
243
|
deployment_json = `kubectl get deployment -l #{selector} -o json --namespace=#{yy.namespace}`
|
|
235
244
|
deployments = JSON.parse(deployment_json)
|
|
236
|
-
|
|
245
|
+
|
|
237
246
|
if deployments["items"].any?
|
|
238
247
|
deployments["items"].each do |deployment|
|
|
239
248
|
deployment_name = deployment["metadata"]["name"]
|
|
240
249
|
puts "Waiting for deployment #{deployment_name} to roll out..."
|
|
241
|
-
|
|
250
|
+
|
|
251
|
+
rollout_success = false
|
|
252
|
+
|
|
242
253
|
retries.times do |attempt|
|
|
243
254
|
rollout_success = kubectl("rollout status deployment/#{deployment_name} --timeout=#{timeout}s")
|
|
244
255
|
if rollout_success
|
|
@@ -252,7 +263,7 @@ module Pfab
|
|
|
252
263
|
end
|
|
253
264
|
end
|
|
254
265
|
end
|
|
255
|
-
|
|
266
|
+
|
|
256
267
|
unless rollout_success
|
|
257
268
|
puts "Deployment #{deployment_name} failed to roll out after #{retries} attempts."
|
|
258
269
|
return false
|
|
@@ -422,6 +433,7 @@ module Pfab
|
|
|
422
433
|
application: application,
|
|
423
434
|
deployable: deployable,
|
|
424
435
|
deployable_type: deployable_type,
|
|
436
|
+
tags: dep["tags"],
|
|
425
437
|
command: dep["command"],
|
|
426
438
|
}
|
|
427
439
|
end
|
|
@@ -454,4 +466,4 @@ module Pfab
|
|
|
454
466
|
(name == "all") ? deployables.keys : [name]
|
|
455
467
|
end
|
|
456
468
|
end
|
|
457
|
-
end
|
|
469
|
+
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.7 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.7"
|
|
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-10"
|
|
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.7
|
|
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-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: commander
|