helmsnap 0.7.3 → 0.7.4

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: ffc691f40a8c6b4f4d28d2379e21e45cc032bf743f71d5cf0df9de0a35f69fe4
4
- data.tar.gz: b50966b9642e57d6a286e0e20e8dd323711aafeb4723a245125d9e522b05547b
3
+ metadata.gz: d5e21c78125566f4355ae0679100331a32322034be84fcde8f72ba44397de8e2
4
+ data.tar.gz: da348e3a0651dd69d20e33555ddf547b8097057169eac3b1e678d4006ce90ff7
5
5
  SHA512:
6
- metadata.gz: 2f4bb8e9617bc866856f5160933fc7a755b441ed397374a57ed7cf9b01625b795163a448154af200af5b830bbf46107d45397fe35380d236a45e978ee66c09dd
7
- data.tar.gz: b63cab9f3767a79586beec2279a4b490c3ff144b426482504233e7a19741dd168bb90c8f21b96a2fc83b32e5ea962f7a970faecf043bf1880e3ce461cf2ed101
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.3)
4
+ helmsnap (0.7.4)
5
5
  colorize
6
6
 
7
7
  GEM
@@ -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)
@@ -8,10 +8,10 @@ class Helmsnap::Generate < Helmsnap::Service
8
8
  end
9
9
 
10
10
  def call
11
- FileUtils.rmtree(snapshots_path)
12
-
13
11
  Helmsnap::SetupDependencies.call(config)
14
12
 
13
+ FileUtils.rmtree(snapshots_path)
14
+
15
15
  config.envs.each do |env|
16
16
  run_cmd(
17
17
  "helmfile",
@@ -20,22 +20,20 @@ class Helmsnap::SetupDependencies < Helmsnap::Service
20
20
  dep_list = get_dependency_list(chart_path)
21
21
 
22
22
  dep_list.scan(%r{file://(.+?)\t}) do |dep_path|
23
- run_cmd("helm", "dependency", "update", chart_path.join(dep_path.first))
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
- run_cmd("helm", "dependency", "update", chart_path)
30
+ update_deps!(chart_path)
31
31
  end
32
32
 
33
33
  def get_dependency_list(chart_path)
34
34
  base_cmd = ["helm", "dependency", "list", chart_path]
35
35
 
36
- result = run_cmd(
37
- *base_cmd, "--max-col-width", 0, allow_failure: true, stderr: File.open(File::NULL, "w")
38
- )
36
+ result = run_cmd(*base_cmd, "--max-col-width", 0, allow_failure: true, stderr: nil)
39
37
 
40
38
  if result.success
41
39
  result.output
@@ -47,4 +45,11 @@ class Helmsnap::SetupDependencies < Helmsnap::Service
47
45
  end
48
46
  end
49
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
54
+ end
50
55
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Helmsnap
4
- VERSION = "0.7.3"
4
+ VERSION = "0.7.4"
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.7.3
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-15 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize