kubernetes_template_rendering 0.2.1.pre.dc.6 → 0.2.1.pre.dc.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: d4f2b0c2babad49e2d7575342add52164dd884fe4ff5a4d3ddcfa2c03c1b3bce
4
- data.tar.gz: 9e083a18142eec4c42d509cc2e86b3d459e58fb10a4155b385598aa2a96b4813
3
+ metadata.gz: bcdd01fc6d1d74b92773cc37605bbb89b111332e9d586f50426accf12b2e1b8b
4
+ data.tar.gz: c2e17c6100ce5f65dd77d61ab1d0d3731fbca3e15e03e7890fbc75a33c102dde
5
5
  SHA512:
6
- metadata.gz: 249a72b3493290a7fe5dd115e4d7d6277b04be0b23a030843c96372e4e2b685dc682d610f4058527169f63e507f23f980697b7dfdad3b7d15e07a4ba0b54d3a5
7
- data.tar.gz: 3575c715541ac1d8e447ce4e52d1bed1c87f8080eb8f1945fe71ee4f9bc77505f1a39319603a8b02b1481755b92564f2f03bdfee11b0b500715a0f3e8723130a
6
+ metadata.gz: 2de63b006e3e987b619a5b39fd1064f9780ae3b9876b0eed28b8d58cf8b641b708a76d021246938008ce09cf6804f9bbe4af6b537f7d10433b66207d2e4e5640
7
+ data.tar.gz: 21c984cb6f85512c55d4b77122a9b87681d5935ce91a3d9b7c5e6ff09d039dc4e81248ce9492479c00294fce25a228332706ee00b90dbd78c41cac5bf6226a3d
@@ -28,6 +28,7 @@ module KubernetesTemplateRendering
28
28
 
29
29
  def render(args)
30
30
  child_pids = []
31
+ failed_processes = [] # [[pid, status]]
31
32
 
32
33
  resource_sets.each do |name, resource_sets|
33
34
  puts "Rendering templates for definition #{Color.red(name)}..."
@@ -36,7 +37,7 @@ module KubernetesTemplateRendering
36
37
  if (pid = Process.fork)
37
38
  # this is the parent
38
39
  child_pids << pid
39
- wait_if_max_forked(child_pids)
40
+ wait_if_max_forked(child_pids, failed_processes)
40
41
  else
41
42
  # this is the child
42
43
  render_set(args, resource_set)
@@ -49,9 +50,11 @@ module KubernetesTemplateRendering
49
50
  end
50
51
 
51
52
  if args.fork?
52
- process_statuses = Process.waitall
53
+ Process.waitall.each do |pid, status|
54
+ status.success? or failed_processes << [pid, status]
55
+ end
53
56
 
54
- if (failed_processes = process_statuses.select { |_, status| !status.success? }).any?
57
+ if failed_processes.any?
55
58
  raise "Child process completed with non-zero status: #{failed_processes.inspect}"
56
59
  end
57
60
  end
@@ -65,18 +68,18 @@ module KubernetesTemplateRendering
65
68
 
66
69
  MAX_FORKED_PROCESSES = 9
67
70
 
68
- def wait_if_max_forked(child_pids)
71
+ def wait_if_max_forked(child_pids, failed_processes)
69
72
  while child_pids.size >= MAX_FORKED_PROCESSES
70
73
  begin
71
74
  pid, exit_status = Process.waitpid2 # this is a race condition because 1 or more processes could exit before we get here
72
- exit_status.success? or raise "Child process #{pid} failed"
75
+ exit_status.success? or failed_processes << [pid, exit_status]
73
76
  rescue SystemCallError # this will happen if they all exited before we called waitpid
74
77
  end
75
78
  child_pids.delete_if do |pid|
76
79
  begin
77
80
  _, exit_status = Process.waitpid2(pid, Process::WNOHANG)
78
- if exit_status
79
- exit_status.success? or raise "Child process #{pid} failed"
81
+ if exit_status && !exit_status.success?
82
+ failed_processes << [pid, exit_status]
80
83
  end
81
84
  rescue Errno::ECHILD # No child processes
82
85
  true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubernetesTemplateRendering
4
- VERSION = "0.2.1.pre.dc.6"
4
+ VERSION = "0.2.1.pre.dc.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubernetes_template_rendering
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.pre.dc.6
4
+ version: 0.2.1.pre.dc.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Octothorpe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-14 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport