pfab 0.58.6 → 0.58.7

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: e2e4518728aafd25de6e2d32503a6a287007d78deb1a18b657db3af110a6a486
4
- data.tar.gz: a5e3614ff8fef07e2b70bd624eb7b3c845bcb352aebf5f0e29b3979d8137d9c0
3
+ metadata.gz: b20c68616c45b8a3dfd03878def263856dea71de19c4fdba68f8d486e4b87c9e
4
+ data.tar.gz: 8c6f90dd1980bc20b99b08946fdb2550de3be07432e68fce4a785b71af1cc042
5
5
  SHA512:
6
- metadata.gz: 1fa91a90727c9685754c7239239e6d9035f0c16cce1f28db3a1cb394f66f3cbe0ee342b82203127f66251a1cdea4e1e689b8f51daa82b882e05c2afd14edf2f4
7
- data.tar.gz: b9f124a10d4221c1384925680d21dac2e87cdf11ae9011a525a395cceb49ec720e1ff05099ef27940e82a1905eb673e7c2738287675b3864fbc3e3fe8e610a71
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 = get_app_name(all: true)
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
- get_apps.each do |app_name|
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,14 +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
 
242
251
  rollout_success = false
243
-
252
+
244
253
  retries.times do |attempt|
245
254
  rollout_success = kubectl("rollout status deployment/#{deployment_name} --timeout=#{timeout}s")
246
255
  if rollout_success
@@ -254,7 +263,7 @@ module Pfab
254
263
  end
255
264
  end
256
265
  end
257
-
266
+
258
267
  unless rollout_success
259
268
  puts "Deployment #{deployment_name} failed to roll out after #{retries} attempts."
260
269
  return false
@@ -424,6 +433,7 @@ module Pfab
424
433
  application: application,
425
434
  deployable: deployable,
426
435
  deployable_type: deployable_type,
436
+ tags: dep["tags"],
427
437
  command: dep["command"],
428
438
  }
429
439
  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 = 6
5
+ PATCH = 7
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.6 ruby lib
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.6"
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-09"
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.6
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-09 00:00:00.000000000 Z
11
+ date: 2024-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander