kubernetes_template_rendering 0.2.1.pre.dc.6 → 0.2.1

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: 687be8fde4f952b4f2a8eae636a807a19d6a8c609fbe34c198e6e7d20215ef91
4
+ data.tar.gz: 04ff6091e0c2382f7671cea095c25487cab558d6c5f73d510e0fdb9390c39ef4
5
5
  SHA512:
6
- metadata.gz: 249a72b3493290a7fe5dd115e4d7d6277b04be0b23a030843c96372e4e2b685dc682d610f4058527169f63e507f23f980697b7dfdad3b7d15e07a4ba0b54d3a5
7
- data.tar.gz: 3575c715541ac1d8e447ce4e52d1bed1c87f8080eb8f1945fe71ee4f9bc77505f1a39319603a8b02b1481755b92564f2f03bdfee11b0b500715a0f3e8723130a
6
+ metadata.gz: ae06721a86171782ecaae0fb867461966a22c0721d7ede3b4b112a4ea8d432854bc03517e83f267d4f3bcb0e3df00c7e08cfd6e2938c862e9b028c58bbdcc25f
7
+ data.tar.gz: c99dd7d94b00c794bf6b86dc1ca6856d0dab6755d982360b58b030f37935d52ba06f375aecf127375a70e1dd413934fb439ddec67908ad218c534f739bdb414e
data/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [0.2.1] - Unreleased
7
+ ## [0.2.1] - 2024-06-17
8
8
  ### Fixed
9
9
  - Fixed a bug allowing child process errors to be ignored while rendering.
10
10
 
@@ -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"
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
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
@@ -104,9 +104,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  version: 3.1.0
105
105
  required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">"
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: 1.3.1
109
+ version: '0'
110
110
  requirements: []
111
111
  rubygems_version: 3.3.26
112
112
  signing_key: