helm_upgrade_logs 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/exe/helm_upgrade_logs +3 -2
- data/lib/helm_upgrade_logs/version.rb +1 -1
- data/lib/helm_upgrade_logs.rb +26 -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: ff6c87e111837be7e9f2b92df25d6ead153cd3a8ccb277a72b8977eca166b94d
|
4
|
+
data.tar.gz: 7d4551bf7d2edc18a86406c2ff331df08cd8812c63fa7b87eceb99017e3e8b30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f64bf311fad025cde524b78eaf6340db3d61e5fe69fb3dedf6bed64362ed9071c43eb40a721ad74d5a21e517fcc1b69a33398bad9eb4df57f51818cc47a8d73
|
7
|
+
data.tar.gz: f080b4c121a246f8fc5856fdfdc5a917aac5aae6ec430e301d6157e5307defa0c092c335312463e8723878afd0a98a8b4dd8b3a8a985732454b5dcc80a7a34b3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [0.4.0]
|
2
|
+
|
3
|
+
- Change to handle params before release name fixing #1
|
4
|
+
|
5
|
+
## [0.3.6]
|
6
|
+
|
7
|
+
- Handle parsing multiple error messages in `helm_upgrade_logs_error_msg` that are comma separated
|
8
|
+
|
1
9
|
## [0.3.5]
|
2
10
|
|
3
11
|
- Fix error where multiple processes being spawned to log the same pod
|
data/exe/helm_upgrade_logs
CHANGED
@@ -7,7 +7,7 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
|
7
7
|
require "helm_upgrade_logs"
|
8
8
|
UPGRADE_LOG_FOLDER = "helm_upgrade_logs"
|
9
9
|
|
10
|
-
@release_name = ARGV
|
10
|
+
@release_name = release_name_from_args(ARGV)
|
11
11
|
@namespace = namespace_from_args(ARGV)
|
12
12
|
|
13
13
|
@helm_pid = Process.spawn "helm upgrade #{ARGV.join(" ")}"
|
@@ -79,10 +79,11 @@ puts `ps` if ENV["helm_upgrade_logs_debug"] == "true"
|
|
79
79
|
if ENV["helm_upgrade_logs_error_msg"]
|
80
80
|
pod_logs_files = Dir.glob("#{UPGRADE_LOG_FOLDER}/*.log")
|
81
81
|
puts "Reading logs from #{pod_logs_files.count} pod logs" if ENV["helm_upgrade_logs_debug"] == "true"
|
82
|
+
error_messages = ENV["helm_upgrade_logs_error_msg"].split(",")
|
82
83
|
pod_logs_files.each do |log_file|
|
83
84
|
lines = File.readlines log_file
|
84
85
|
lines.each_with_index do |line, index|
|
85
|
-
next unless line.include?
|
86
|
+
next unless error_messages.any? { |error| line.include? error }
|
86
87
|
|
87
88
|
msg = "Helm install error: #{line} from #{log_file} (Line #{index + 1})"
|
88
89
|
if ENV["helm_upgrade_logs_ado_error"] == "true"
|
data/lib/helm_upgrade_logs.rb
CHANGED
@@ -62,6 +62,32 @@ def namespace_from_args(args)
|
|
62
62
|
args[match_index + 1]
|
63
63
|
end
|
64
64
|
|
65
|
+
def options_with_args
|
66
|
+
%w[--set --ca-file --cert-file --description --history-max --key-file --keyring --output --password --post-renderer
|
67
|
+
--repo --set --set-file --set-string --timeout --username --values --version --kube-apiserver --kube-as-group
|
68
|
+
--kube-as-user --kube-as-file --kube-context --kube-token --kubeconfig --namespace --registry-config
|
69
|
+
--repository-cache --repository-config -n -f -o]
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return Release name from command line arguments
|
73
|
+
def release_name_from_args(args)
|
74
|
+
arg_list = args.clone
|
75
|
+
|
76
|
+
loop do
|
77
|
+
option_with_val = false
|
78
|
+
arg_list.each_with_index do |arg, index|
|
79
|
+
if options_with_args.include?(arg_list[index - 1])
|
80
|
+
arg_list.delete_at(index - 1)
|
81
|
+
arg_list.delete_at(index - 1)
|
82
|
+
option_with_val = true
|
83
|
+
break
|
84
|
+
end
|
85
|
+
end
|
86
|
+
break if option_with_val == false
|
87
|
+
end
|
88
|
+
arg_list.find { |arg| !arg.start_with?("-") }
|
89
|
+
end
|
90
|
+
|
65
91
|
# Add namespace to kube query
|
66
92
|
def add_ns(kube_query)
|
67
93
|
kube_query += " -n #{@namespace}" if @namespace
|
@@ -77,5 +103,4 @@ end
|
|
77
103
|
|
78
104
|
module HelmUpgradeLogs
|
79
105
|
class Error < StandardError; end
|
80
|
-
# Your code goes here...
|
81
106
|
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.
|
4
|
+
version: 0.4.0
|
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-
|
11
|
+
date: 2022-11-14 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
|