helmsnap 0.7.1 → 0.7.5
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/generate.rb +2 -2
- data/lib/helmsnap/setup_dependencies.rb +34 -5
- data/lib/helmsnap/version.rb +1 -1
- data/lib/helmsnap.rb +1 -0
- 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: 76745aa695bb329e8e8d8cdf2a7c35fddd42cb24cc41f5ae15ac7f79a1513bb3
|
4
|
+
data.tar.gz: 532988aa8e92b3d48de4f9393bb88cb50506345c10d9645f56cdd2491141f671
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccedd03bea5461c576bc5e146180a83d5a201eb25b29ea483bafc610f74736a8691e6890261dcd33f7b376d51c7558e7dc620bb9b9d50fb204fd44e1ec1c0e6a
|
7
|
+
data.tar.gz: ca3c0246e70ce001454364556596b35376ea69ac12d4e8ca72191050d11275810ba5c8ab98954afcd82946af28b7ea87157ddda6040322d44c60657f4eb84b3f
|
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.5)
|
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/generate.rb
CHANGED
@@ -4,29 +4,58 @@ class Helmsnap::SetupDependencies < Helmsnap::Service
|
|
4
4
|
def initialize(config)
|
5
5
|
super()
|
6
6
|
self.config = config
|
7
|
+
self.processed_paths = Set.new
|
7
8
|
end
|
8
9
|
|
9
10
|
def call
|
10
|
-
config.envs.flat_map(&:release_paths).
|
11
|
+
config.envs.flat_map(&:release_paths).each do |chart_path|
|
11
12
|
setup!(chart_path)
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
16
|
private
|
16
17
|
|
17
|
-
attr_accessor :config
|
18
|
+
attr_accessor :config, :processed_paths
|
18
19
|
|
19
20
|
def setup!(chart_path)
|
20
|
-
|
21
|
+
normalized_path = chart_path.expand_path
|
22
|
+
return if processed_paths.include?(normalized_path)
|
23
|
+
processed_paths << normalized_path
|
24
|
+
|
25
|
+
dep_list = get_dependency_list(chart_path)
|
21
26
|
|
22
27
|
dep_list.scan(%r{file://(.+?)\t}) do |dep_path|
|
23
|
-
|
28
|
+
subchart_path = chart_path.join(dep_path.first)
|
29
|
+
setup!(subchart_path)
|
24
30
|
end
|
25
31
|
|
26
32
|
dep_list.scan(%r{(https?://.+?)\t}) do |dep_path|
|
27
33
|
run_cmd("helm", "repo", "add", Digest::MD5.hexdigest(dep_path.first), dep_path.first)
|
28
34
|
end
|
29
35
|
|
30
|
-
|
36
|
+
update_deps!(chart_path)
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_dependency_list(chart_path)
|
40
|
+
base_cmd = ["helm", "dependency", "list", chart_path]
|
41
|
+
|
42
|
+
result = run_cmd(*base_cmd, "--max-col-width", 0, allow_failure: true, stderr: nil)
|
43
|
+
|
44
|
+
if result.success
|
45
|
+
result.output
|
46
|
+
else
|
47
|
+
run_cmd(*base_cmd).output.tap do
|
48
|
+
Helmsnap::Console.warning(
|
49
|
+
$stderr, "it looks like your Helm binary is outdated, please update.\n"
|
50
|
+
)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def update_deps!(chart_path)
|
56
|
+
base_cmd = ["helm", "dependency", "update", chart_path]
|
57
|
+
result = run_cmd(*base_cmd, "--skip-refresh", allow_failure: true)
|
58
|
+
run_cmd(*base_cmd) unless result.success # Try with deps refresh in case of any failure
|
59
|
+
true
|
31
60
|
end
|
32
61
|
end
|
data/lib/helmsnap/version.rb
CHANGED
data/lib/helmsnap.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.5
|
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.
|