helmsnap 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/helmsnap/check.rb +15 -12
- data/lib/helmsnap/command.rb +3 -3
- data/lib/helmsnap/runner.rb +11 -2
- 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: bd784fcd78ea76eeb09743cf411b599c9cd6ab2299a1a647a037d0dcc667cdb0
|
4
|
+
data.tar.gz: a53928f8100827b1cd738840abff6ab43d875c0d44f5c7400023aa185d5ffeb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e5f7c1f7516cf65c9bcb3dde36977e739a5973ec7eaf7147380b797c9acc271b889a637fe6b9d3a6764839ed8362270e77c8160cc0fbcab1aee9775421c7c07
|
7
|
+
data.tar.gz: 12d305a44dfc9c07956aa84ad5c221a7bf2b404888be7750de6bdcd06617c69d13e9c0a1846e2f07157b029a55b23b867a541014e550f6d94e62989a569494a7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,6 +28,8 @@ The typical usage flow:
|
|
28
28
|
2. You add `helmsnap check` command to your CI (or run it manually on every commit).
|
29
29
|
3. In case snapshots differ, you should carefully check the updates and either fix your chart or update the snapshots using `helmsnap generate`.
|
30
30
|
|
31
|
+
This tool can also be useful when you are developing a new chart or updating an existing one: you can generate snapshots and see what is rendered without need to deploy the chart in your cluster.
|
32
|
+
|
31
33
|
## Features
|
32
34
|
|
33
35
|
### Helm dependency management
|
@@ -55,9 +57,7 @@ Example job for Gitlab CI:
|
|
55
57
|
```yaml
|
56
58
|
check-snapshots:
|
57
59
|
stage: test
|
58
|
-
image:
|
59
|
-
name: ghcr.io/tycooon/helmsnap:master
|
60
|
-
entrypoint: []
|
60
|
+
image: ghcr.io/tycooon/helmsnap:latest
|
61
61
|
script: helmsnap check -c helm/mychart -s helm/snapshots -v helm/values/production.yaml
|
62
62
|
```
|
63
63
|
|
data/lib/helmsnap/check.rb
CHANGED
@@ -12,21 +12,24 @@ class Helmsnap::Check
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def call
|
15
|
-
Dir.mktmpdir
|
16
|
-
temp_dir_path = Pathname.new(temp_dir)
|
15
|
+
temp_dir_path = Pathname.new(Dir.mktmpdir)
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
Helmsnap::Generate.call(
|
18
|
+
chart_path: chart_path,
|
19
|
+
snapshots_path: temp_dir_path,
|
20
|
+
values_path: values_path,
|
21
|
+
)
|
23
22
|
|
24
|
-
|
25
|
-
|
23
|
+
result = Helmsnap.run_cmd("which", "colordiff", allow_failure: true)
|
24
|
+
util = result.success ? "colordiff" : "diff"
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
diff = Helmsnap.run_cmd(
|
27
|
+
util, "--unified", "--recursive", snapshots_path, temp_dir_path, allow_failure: true
|
28
|
+
).output
|
29
|
+
|
30
|
+
diff.strip.empty?
|
31
|
+
ensure
|
32
|
+
FileUtils.rmtree(temp_dir_path)
|
30
33
|
end
|
31
34
|
|
32
35
|
private
|
data/lib/helmsnap/command.rb
CHANGED
@@ -36,9 +36,9 @@ class Helmsnap::Command
|
|
36
36
|
success = exit_status.success?
|
37
37
|
|
38
38
|
if !success && !allow_failure
|
39
|
-
Helmsnap::Console.error(stderr, err.read
|
40
|
-
Helmsnap::Console.error(stderr, "Command failed with status #{exit_status.to_i}"
|
41
|
-
|
39
|
+
Helmsnap::Console.error(stderr, err.read)
|
40
|
+
Helmsnap::Console.error(stderr, "Command failed with status #{exit_status.to_i}")
|
41
|
+
exit 1
|
42
42
|
end
|
43
43
|
|
44
44
|
Helmsnap::Console.print(stdout, "\n")
|
data/lib/helmsnap/runner.rb
CHANGED
@@ -46,10 +46,19 @@ class Helmsnap::Runner
|
|
46
46
|
if Helmsnap::Check.call(**options.to_h)
|
47
47
|
Helmsnap::Console.info($stdout, "Snapshots are up-to-date.")
|
48
48
|
else
|
49
|
+
example_cmd = Shellwords.join(
|
50
|
+
[
|
51
|
+
"helmsnap", "generate",
|
52
|
+
"--chart-dir", options.chart_path,
|
53
|
+
"--snapshots-dir", options.snapshots_path,
|
54
|
+
"--values", options.values_path
|
55
|
+
],
|
56
|
+
)
|
57
|
+
|
49
58
|
Helmsnap::Console.error(
|
50
59
|
$stdout,
|
51
|
-
"Snapshots are outdated
|
52
|
-
"update the snapshots using
|
60
|
+
"Snapshots are outdated. You should check the diff above and either fix your chart or " \
|
61
|
+
"update the snapshots using the following command:\n> #{example_cmd}",
|
53
62
|
)
|
54
63
|
|
55
64
|
exit 1
|
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.4.1
|
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-
|
11
|
+
date: 2021-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|