helm_upgrade_logs 0.3.1 → 0.3.4
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 +24 -10
- 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: ff847ee96c1dbced9f3dbd122b6245f695fe599462d7e1899d1dd09e483051cf
|
4
|
+
data.tar.gz: a3b10b6e66cfbb71ddeb5490f9073fd868868cf9b0afb3e35c620f01ee17e6ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adb0f2c697a023259f264cb6af3580a63f44448b025cb91400a8733b34ed3731e656807f40f52a376ac6688eb0fb287a73ec2b87c4cda23f257bfa30e8e797e4
|
7
|
+
data.tar.gz: '09bcd240fd9519e938c1fe0112907e922a57f21d2a67215f1f42270a8f67a6fecc5501cadd3968a07abaf4f2c73e358b77b79e95db976d2e44d132e51ac57ed0'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## [0.3.4]
|
2
|
+
|
3
|
+
- Only log to folder if `helm_upgrade_logs_error_msg` env variable set
|
4
|
+
|
5
|
+
## [0.3.3]
|
6
|
+
|
7
|
+
- Run force kill on processes to ensure they stop
|
8
|
+
|
9
|
+
## [0.3.2]
|
10
|
+
|
11
|
+
- ADO error and normal error don't need to both be displayed
|
12
|
+
|
1
13
|
## [0.3.1]
|
2
14
|
|
3
15
|
- Fix LOG folder parsed to check error message
|
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}_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
|
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")
|
@@ -74,8 +85,11 @@ if ENV["helm_upgrade_logs_error_msg"]
|
|
74
85
|
next unless line.include?(ENV["helm_upgrade_logs_error_msg"])
|
75
86
|
|
76
87
|
msg = "Helm install error: #{line} from #{log_file} (Line #{index + 1})"
|
77
|
-
|
78
|
-
|
88
|
+
if ENV["helm_upgrade_logs_ado_error"] == "true"
|
89
|
+
puts "##vso[task.logissue type=error] #{msg}"
|
90
|
+
else
|
91
|
+
puts "[ERROR] #{msg}"
|
92
|
+
end
|
79
93
|
end
|
80
94
|
end
|
81
95
|
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.
|
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-
|
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
|