helm_upgrade_logs 0.3.3 → 0.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c152efac3e0107333fb8a9101cb06f9eede40e5bfeb747b3815e3aca8a0d02b7
4
- data.tar.gz: c6ef07655615775aebbe6bb347873905b9d5a43dc5a1ef3fcbfbfeaeb28c2d77
3
+ metadata.gz: ff847ee96c1dbced9f3dbd122b6245f695fe599462d7e1899d1dd09e483051cf
4
+ data.tar.gz: a3b10b6e66cfbb71ddeb5490f9073fd868868cf9b0afb3e35c620f01ee17e6ad
5
5
  SHA512:
6
- metadata.gz: 8aa9f87875f45d174c337314988546e66d4af1bcb279b471a278eb7d826d4eb21362a9a060466abb7e86e27a9902cb9778593f7102e4fbbd82103a72686e68ed
7
- data.tar.gz: 2dc02dc6e520c3997957885f68d180a88889132fbf74e3f4f8f01331b92cf3f6ee382c7e98da87557bde798e2854db7eaa5b28ff25c6670c41a7606fc2b94bdb
6
+ metadata.gz: adb0f2c697a023259f264cb6af3580a63f44448b025cb91400a8733b34ed3731e656807f40f52a376ac6688eb0fb287a73ec2b87c4cda23f257bfa30e8e797e4
7
+ data.tar.gz: '09bcd240fd9519e938c1fe0112907e922a57f21d2a67215f1f42270a8f67a6fecc5501cadd3968a07abaf4f2c73e358b77b79e95db976d2e44d132e51ac57ed0'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.3.4]
2
+
3
+ - Only log to folder if `helm_upgrade_logs_error_msg` env variable set
4
+
1
5
  ## [0.3.3]
2
6
 
3
7
  - Run force kill on processes to ensure they stop
@@ -31,7 +31,7 @@ rescue Errno::ECHILD
31
31
  raise HelmUpgradeLogs::Error, "Failed to find logs before helm finished"
32
32
  end
33
33
 
34
- FileUtils.mkdir_p UPGRADE_LOG_FOLDER
34
+ FileUtils.mkdir_p(UPGRADE_LOG_FOLDER) if ENV["helm_upgrade_logs_error_msg"]
35
35
 
36
36
  while Process.waitpid(@helm_pid, Process::WNOHANG).nil?
37
37
  pods = read_pods - pods_before_upgrade
@@ -46,11 +46,13 @@ while Process.waitpid(@helm_pid, Process::WNOHANG).nil?
46
46
  std_out_pid = Process.spawn(
47
47
  add_ns("kubectl logs #{pod} -f --all-containers --prefix --ignore-errors=true --timestamps=true")
48
48
  )
49
+ @pod_pids["#{pod}_stdout"] = std_out_pid
50
+ next unless ENV["helm_upgrade_logs_error_msg"]
51
+
49
52
  logfile_pid = Process.spawn(
50
53
  add_ns("kubectl logs #{pod} -f --all-containers --prefix --ignore-errors=true --timestamps=true"),
51
54
  out: "#{UPGRADE_LOG_FOLDER}/#{pod.gsub("/", "_")}.log"
52
55
  )
53
- @pod_pids["#{pod}_stdout"] = std_out_pid
54
56
  @pod_pids["#{pod}_fileout"] = logfile_pid
55
57
  end
56
58
  end
@@ -59,12 +61,20 @@ end
59
61
  puts "[INFO] Cleaning up loggers after helm upgrade"
60
62
  helm_status = $CHILD_STATUS.exitstatus
61
63
  Process.kill("KILL", event_pid)
64
+ Process.wait event_pid
62
65
  Process.kill("KILL", service_pid)
63
- puts @pod_pids if ENV["helm_upgrade_logs_debug"] == "true"
66
+ Process.wait service_pid
67
+
68
+ if ENV["helm_upgrade_logs_debug"] == "true"
69
+ puts "[INFO] Log processes"
70
+ puts @pod_pids
71
+ end
64
72
  @pod_pids.each do |_pod, pid|
65
73
  puts "Terminating #{_pod} #{pid}" if ENV["helm_upgrade_logs_debug"] == "true"
66
74
  Process.kill("KILL", pid)
75
+ Process.wait pid
67
76
  end
77
+ puts `ps` if ENV["helm_upgrade_logs_debug"] == "true"
68
78
 
69
79
  if ENV["helm_upgrade_logs_error_msg"]
70
80
  pod_logs_files = Dir.glob("#{UPGRADE_LOG_FOLDER}/*.log")
@@ -2,5 +2,5 @@
2
2
 
3
3
  module HelmUpgradeLogs
4
4
  # @return [String] Version of helm upgrade logs
5
- VERSION = "0.3.3"
5
+ VERSION = "0.3.4"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helm_upgrade_logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Garratt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-29 00:00:00.000000000 Z
11
+ date: 2022-06-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Basic wrapper around helm and kubectl to allow easy debugging of a helm
14
14
  release. All arguments after a usual helm upgrade are used as normal