helm_upgrade_logs 0.3.2 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/exe/helm_upgrade_logs +19 -8
- data/lib/helm_upgrade_logs/version.rb +1 -1
- 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: '0984598273cbd41ca2d6fa3b727f1a5bcb723e771c0fa7ed8acf1a1e6ba0ab5b'
|
4
|
+
data.tar.gz: f44847d139474e405d525500cfbd1fe048d36c60d7452be9c72578c8be5251ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31c657f1b1c17b07772ea106ee40f7d9dde3b1a272d3d34477c40257ebf7cf013ffe406eb8ff121e9df631f616d7292e5783d00fa2e5bdfadd1cc6a0d8d1f427
|
7
|
+
data.tar.gz: bf1ad1e99ff2d571094d1abf0ac8c2b822a3f63452083b5fa7ecc366454d4f1ccfb732b7a9d1cb93c672f06a27c49f6a35c2a246b6c81420a9cfbec4917bf311
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## [0.3.5]
|
2
|
+
|
3
|
+
- Fix error where multiple processes being spawned to log the same pod
|
4
|
+
|
5
|
+
## [0.3.4]
|
6
|
+
|
7
|
+
- Only log to folder if `helm_upgrade_logs_error_msg` env variable set
|
8
|
+
|
9
|
+
## [0.3.3]
|
10
|
+
|
11
|
+
- Run force kill on processes to ensure they stop
|
12
|
+
|
1
13
|
## [0.3.2]
|
2
14
|
|
3
15
|
- ADO error and normal error don't need to both be displayed
|
data/exe/helm_upgrade_logs
CHANGED
@@ -26,12 +26,12 @@ wait_for_pod_to_log
|
|
26
26
|
begin
|
27
27
|
Process.waitpid(@helm_pid, Process::WNOHANG)
|
28
28
|
rescue Errno::ECHILD
|
29
|
-
|
30
|
-
|
29
|
+
Process.kill("KILL", event_pid)
|
30
|
+
Process.kill("KILL", service_pid)
|
31
31
|
raise HelmUpgradeLogs::Error, "Failed to find logs before helm finished"
|
32
32
|
end
|
33
33
|
|
34
|
-
FileUtils.mkdir_p
|
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,24 +46,35 @@ 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] = 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
|
57
59
|
sleep 1
|
58
60
|
end
|
61
|
+
puts "[INFO] Cleaning up loggers after helm upgrade"
|
59
62
|
helm_status = $CHILD_STATUS.exitstatus
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
+
Process.kill("KILL", event_pid)
|
64
|
+
Process.wait event_pid
|
65
|
+
Process.kill("KILL", service_pid)
|
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
|
63
72
|
@pod_pids.each do |_pod, pid|
|
64
73
|
puts "Terminating #{_pod} #{pid}" if ENV["helm_upgrade_logs_debug"] == "true"
|
65
|
-
|
74
|
+
Process.kill("KILL", pid)
|
75
|
+
Process.wait pid
|
66
76
|
end
|
77
|
+
puts `ps` if ENV["helm_upgrade_logs_debug"] == "true"
|
67
78
|
|
68
79
|
if ENV["helm_upgrade_logs_error_msg"]
|
69
80
|
pod_logs_files = Dir.glob("#{UPGRADE_LOG_FOLDER}/*.log")
|
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.
|
4
|
+
version: 0.3.5
|
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-
|
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
|