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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 926b5a2923e842e0fe10f3d2050e785a0a140edbb0c3de40c30880e9e7dac3ba
4
- data.tar.gz: 5f99aaac6f14b66727365bbde866896f9c75bd98e129d48de07d76ebdd7ff6a2
3
+ metadata.gz: bd784fcd78ea76eeb09743cf411b599c9cd6ab2299a1a647a037d0dcc667cdb0
4
+ data.tar.gz: a53928f8100827b1cd738840abff6ab43d875c0d44f5c7400023aa185d5ffeb3
5
5
  SHA512:
6
- metadata.gz: 1ba861f010040454c80b4413f3b5e7b74213e0ad041f6c8311ca8295bfb06b71a04a98323f2b6714691e2450f0ce54897ff340a2534cfa66cd79f73884741614
7
- data.tar.gz: 4e164358cf3084a01fc026fcf44670939c6871035883afde758624f31b31739a6fc48d610e9a6a81204fef8535e9c417c95e705c02998a07edf7913e28a16745
6
+ metadata.gz: 9e5f7c1f7516cf65c9bcb3dde36977e739a5973ec7eaf7147380b797c9acc271b889a637fe6b9d3a6764839ed8362270e77c8160cc0fbcab1aee9775421c7c07
7
+ data.tar.gz: 12d305a44dfc9c07956aa84ad5c221a7bf2b404888be7750de6bdcd06617c69d13e9c0a1846e2f07157b029a55b23b867a541014e550f6d94e62989a569494a7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- helmsnap (0.3.0)
4
+ helmsnap (0.4.1)
5
5
  colorize
6
6
 
7
7
  GEM
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
 
@@ -12,21 +12,24 @@ class Helmsnap::Check
12
12
  end
13
13
 
14
14
  def call
15
- Dir.mktmpdir do |temp_dir|
16
- temp_dir_path = Pathname.new(temp_dir)
15
+ temp_dir_path = Pathname.new(Dir.mktmpdir)
17
16
 
18
- Helmsnap::Generate.call(
19
- chart_path: chart_path,
20
- snapshots_path: temp_dir_path,
21
- values_path: values_path,
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
- result = Helmsnap.run_cmd("which", "colordiff", allow_failure: true)
25
- util = result.success ? "colordiff" : "diff"
23
+ result = Helmsnap.run_cmd("which", "colordiff", allow_failure: true)
24
+ util = result.success ? "colordiff" : "diff"
26
25
 
27
- diff = Helmsnap.run_cmd(util, "-r", temp_dir_path, snapshots_path, allow_failure: true).output
28
- diff.strip.empty?
29
- end
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
@@ -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, :red)
40
- Helmsnap::Console.error(stderr, "Command failed with status #{exit_status.to_i}", :red)
41
- abort
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")
@@ -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, you should check the diff above and either fix your chart or " \
52
- "update the snapshots using `helmsnap generate` command.",
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Helmsnap
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.1"
5
5
  end
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.3.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-27 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize