helmsnap 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +9 -3
- data/lib/helmsnap/args_parser.rb +1 -1
- data/lib/helmsnap/env.rb +9 -8
- data/lib/helmsnap/generate.rb +1 -3
- data/lib/helmsnap/runner.rb +6 -0
- data/lib/helmsnap/setup_dependencies.rb +12 -6
- data/lib/helmsnap/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: 82cc0b42f25f49c54cb4ec921c092f7a3e6cc9de565bc3e39e357e4129b5c3ff
|
4
|
+
data.tar.gz: 0fc97b6105f8a9ab5fb8360bf390be3cfaea21bc24b21edf42960b88658c54a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f514cd9633fab8f88efac3ae96dda8579c9b8dbd2a90da8822979958c334681e0b882c498e1b4acfeda279814beeaf181fd942366b036da04100b62cbe1d9dc8
|
7
|
+
data.tar.gz: 5b9046c477241a66acbe1a2bc8b7f982205b49bbcf3f53edbeb1f4f516b4008f0ab4c52aeb5f829538796a1f717931588bea7abce9d33ecd9726031fe43c24dd
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## About
|
4
4
|
|
5
|
-
Helmsnap is a tool for generating and checking
|
5
|
+
Helmsnap is a tool for generating and checking helmfile snapshots. Example:
|
6
6
|
|
7
7
|
Generate snapshots (uses `helmfile template` under the hood):
|
8
8
|
|
@@ -16,6 +16,12 @@ Generate snapshots in a temporary directory and check (diff) them against existi
|
|
16
16
|
helmsnap check
|
17
17
|
```
|
18
18
|
|
19
|
+
Just build dependencies for each release in a helmfile:
|
20
|
+
|
21
|
+
```sh
|
22
|
+
helmsnap dependencies # or `helmsnap deps`
|
23
|
+
```
|
24
|
+
|
19
25
|
Get the full description of possible arguments:
|
20
26
|
|
21
27
|
```sh
|
@@ -59,13 +65,13 @@ Helmsnap will automically replace all occurencies of patterns that look like tim
|
|
59
65
|
|
60
66
|
## Installation
|
61
67
|
|
62
|
-
Just install
|
68
|
+
Just install the gem and use the provided `helmsnap` binary.
|
63
69
|
|
64
70
|
```sh
|
65
71
|
gem install helmsnap
|
66
72
|
```
|
67
73
|
|
68
|
-
Alaternatively, you can use
|
74
|
+
Alaternatively, you can use the [Docker image](https://github.com/tycooon/helmsnap/pkgs/container/helmsnap) with Ruby, helm and helmsnap gem preinstalled. This is useful for CIs or if you don't want to install Ruby and Helmfile on your machine.
|
69
75
|
|
70
76
|
## CI example
|
71
77
|
|
data/lib/helmsnap/args_parser.rb
CHANGED
@@ -34,7 +34,7 @@ class Helmsnap::ArgsParser
|
|
34
34
|
|
35
35
|
def build_parser
|
36
36
|
OptionParser.new(BANNER, 50) do |opts|
|
37
|
-
opts.separator("Supported commands: `generate` and `
|
37
|
+
opts.separator("Supported commands: `generate`, `check` and `dependencies`.")
|
38
38
|
opts.separator("")
|
39
39
|
opts.separator("Specific options:")
|
40
40
|
|
data/lib/helmsnap/env.rb
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Helmsnap::Env
|
4
|
-
attr_reader :name
|
4
|
+
attr_reader :name
|
5
5
|
|
6
6
|
def initialize(name)
|
7
7
|
self.name = name
|
8
|
-
self.release_paths = get_release_paths
|
9
8
|
end
|
10
9
|
|
11
|
-
|
10
|
+
def release_paths
|
11
|
+
@release_paths ||= begin
|
12
|
+
json = Helmsnap.run_cmd("helmfile", "--environment", name, "list", "--output", "json").output
|
13
|
+
YAML.load(json).map { |x| x.fetch("chart") }
|
14
|
+
end
|
15
|
+
end
|
12
16
|
|
13
|
-
|
17
|
+
private
|
14
18
|
|
15
|
-
|
16
|
-
json = Helmsnap.run_cmd("helmfile", "--environment", name, "list", "--output", "json").output
|
17
|
-
YAML.load(json).map { |x| x.fetch("chart") }
|
18
|
-
end
|
19
|
+
attr_writer :name
|
19
20
|
end
|
data/lib/helmsnap/generate.rb
CHANGED
@@ -10,9 +10,7 @@ class Helmsnap::Generate < Helmsnap::Service
|
|
10
10
|
def call
|
11
11
|
FileUtils.rmtree(snapshots_path)
|
12
12
|
|
13
|
-
|
14
|
-
Helmsnap::SetupDependencies.call(release_path)
|
15
|
-
end
|
13
|
+
Helmsnap::SetupDependencies.call(config)
|
16
14
|
|
17
15
|
config.envs.each do |env|
|
18
16
|
run_cmd(
|
data/lib/helmsnap/runner.rb
CHANGED
@@ -26,6 +26,8 @@ class Helmsnap::Runner < Helmsnap::Service
|
|
26
26
|
generate!
|
27
27
|
when "check"
|
28
28
|
check!
|
29
|
+
when "dependencies", "deps"
|
30
|
+
setup_deps!
|
29
31
|
else
|
30
32
|
parser.print_help!("Unknown command: #{cmd}.")
|
31
33
|
end
|
@@ -55,4 +57,8 @@ class Helmsnap::Runner < Helmsnap::Service
|
|
55
57
|
exit 1
|
56
58
|
end
|
57
59
|
end
|
60
|
+
|
61
|
+
def setup_deps!
|
62
|
+
Helmsnap::SetupDependencies.call(config)
|
63
|
+
end
|
58
64
|
end
|
@@ -1,12 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Helmsnap::SetupDependencies < Helmsnap::Service
|
4
|
-
def initialize(
|
4
|
+
def initialize(config)
|
5
5
|
super()
|
6
|
-
self.
|
6
|
+
self.config = config
|
7
7
|
end
|
8
8
|
|
9
9
|
def call
|
10
|
+
config.envs.flat_map(&:release_paths).uniq.each do |chart_path|
|
11
|
+
setup!(chart_path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
attr_accessor :config
|
18
|
+
|
19
|
+
def setup!(chart_path)
|
10
20
|
dep_list = run_cmd("helm", "dependency", "list", "--max-col-width", 0, chart_path).output
|
11
21
|
|
12
22
|
dep_list.scan(%r{file://(.+?)\t}) do |dep_path|
|
@@ -19,8 +29,4 @@ class Helmsnap::SetupDependencies < Helmsnap::Service
|
|
19
29
|
|
20
30
|
run_cmd("helm", "dependency", "update", "--skip-refresh", chart_path)
|
21
31
|
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
attr_accessor :chart_path
|
26
32
|
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.
|
4
|
+
version: 0.7.0
|
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-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|