helmsnap 0.7.0 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -2
- data/lib/helmsnap/command.rb +6 -2
- data/lib/helmsnap/console.rb +5 -0
- data/lib/helmsnap/env.rb +1 -1
- data/lib/helmsnap/generate.rb +2 -2
- data/lib/helmsnap/setup_dependencies.rb +26 -3
- data/lib/helmsnap/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5e21c78125566f4355ae0679100331a32322034be84fcde8f72ba44397de8e2
|
4
|
+
data.tar.gz: da348e3a0651dd69d20e33555ddf547b8097057169eac3b1e678d4006ce90ff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb09555b7dc60d769d5a54df05740b9f50fe9e0542a6f1b3a85ce9c1cfcbba1a630bd079109e468620345757ca693b41b79345e737f8ce0a4a5f8f3272a3d02d
|
7
|
+
data.tar.gz: 59237f6806aa14d80335ccd6afaa08dd4f11398c930e5b3f491058d1cfc96a67f1303a22af3094e172cdb7b5ec43a1a1cc312799dd4fc245c932b47beb62600e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
helmsnap (0.7.
|
4
|
+
helmsnap (0.7.4)
|
5
5
|
colorize
|
6
6
|
|
7
7
|
GEM
|
@@ -85,6 +85,7 @@ GEM
|
|
85
85
|
zeitwerk (2.5.1)
|
86
86
|
|
87
87
|
PLATFORMS
|
88
|
+
arm64-darwin-21
|
88
89
|
x86_64-darwin-20
|
89
90
|
x86_64-linux
|
90
91
|
|
@@ -97,4 +98,4 @@ DEPENDENCIES
|
|
97
98
|
rubocop-config-umbrellio
|
98
99
|
|
99
100
|
BUNDLED WITH
|
100
|
-
2.2.
|
101
|
+
2.2.33
|
data/lib/helmsnap/command.rb
CHANGED
@@ -7,8 +7,8 @@ class Helmsnap::Command < Helmsnap::Service
|
|
7
7
|
super()
|
8
8
|
self.cmd = cmd
|
9
9
|
self.output = +""
|
10
|
-
self.stdout = stdout
|
11
|
-
self.stderr = stderr
|
10
|
+
self.stdout = stdout || null_file
|
11
|
+
self.stderr = stderr || null_file
|
12
12
|
self.allow_failure = allow_failure
|
13
13
|
end
|
14
14
|
|
@@ -21,6 +21,10 @@ class Helmsnap::Command < Helmsnap::Service
|
|
21
21
|
|
22
22
|
attr_accessor :cmd, :output, :stdout, :stderr, :allow_failure
|
23
23
|
|
24
|
+
def null_file
|
25
|
+
File.open(File::NULL, "w")
|
26
|
+
end
|
27
|
+
|
24
28
|
def run_command
|
25
29
|
Open3.popen3(cmd) do |_in, out, err, wait_thr|
|
26
30
|
while (chunk = out.gets)
|
data/lib/helmsnap/console.rb
CHANGED
@@ -12,6 +12,11 @@ module Helmsnap::Console
|
|
12
12
|
stream.puts(msg)
|
13
13
|
end
|
14
14
|
|
15
|
+
def warning(stream, msg)
|
16
|
+
msg = ColorizedString["WARNING: #{msg}"].colorize(:light_blue)
|
17
|
+
stream.puts(msg)
|
18
|
+
end
|
19
|
+
|
15
20
|
def error(stream, msg)
|
16
21
|
msg = ColorizedString[msg].colorize(:light_red)
|
17
22
|
stream.puts(msg)
|
data/lib/helmsnap/env.rb
CHANGED
@@ -10,7 +10,7 @@ class Helmsnap::Env
|
|
10
10
|
def release_paths
|
11
11
|
@release_paths ||= begin
|
12
12
|
json = Helmsnap.run_cmd("helmfile", "--environment", name, "list", "--output", "json").output
|
13
|
-
YAML.load(json).map { |x| x.fetch("chart") }
|
13
|
+
YAML.load(json).map { |x| Pathname.new(x.fetch("chart")) }
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
data/lib/helmsnap/generate.rb
CHANGED
@@ -17,16 +17,39 @@ class Helmsnap::SetupDependencies < Helmsnap::Service
|
|
17
17
|
attr_accessor :config
|
18
18
|
|
19
19
|
def setup!(chart_path)
|
20
|
-
dep_list =
|
20
|
+
dep_list = get_dependency_list(chart_path)
|
21
21
|
|
22
22
|
dep_list.scan(%r{file://(.+?)\t}) do |dep_path|
|
23
|
-
|
23
|
+
update_deps!(chart_path.join(dep_path.first))
|
24
24
|
end
|
25
25
|
|
26
26
|
dep_list.scan(%r{(https?://.+?)\t}) do |dep_path|
|
27
27
|
run_cmd("helm", "repo", "add", Digest::MD5.hexdigest(dep_path.first), dep_path.first)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
update_deps!(chart_path)
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_dependency_list(chart_path)
|
34
|
+
base_cmd = ["helm", "dependency", "list", chart_path]
|
35
|
+
|
36
|
+
result = run_cmd(*base_cmd, "--max-col-width", 0, allow_failure: true, stderr: nil)
|
37
|
+
|
38
|
+
if result.success
|
39
|
+
result.output
|
40
|
+
else
|
41
|
+
run_cmd(*base_cmd).output.tap do
|
42
|
+
Helmsnap::Console.warning(
|
43
|
+
$stderr, "it looks like your Helm binary is outdated, please update.\n"
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def update_deps!(chart_path)
|
50
|
+
base_cmd = ["helm", "dependency", "update", chart_path]
|
51
|
+
result = run_cmd(*base_cmd, "--skip-refresh", allow_failure: true)
|
52
|
+
run_cmd(*base_cmd) unless result.success # Try with deps refresh in case of any failure
|
53
|
+
true
|
31
54
|
end
|
32
55
|
end
|
data/lib/helmsnap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helmsnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuri Smirnov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
rubygems_version: 3.2.
|
95
|
+
rubygems_version: 3.2.33
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: A tool for creating and checking helm chart snapshots.
|