Commit 8fadaad 1 parent b7d4713 commit 8fadaad Copy full SHA for 8fadaad
File tree 1 file changed +15
-7
lines changed
1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -10,30 +10,38 @@ def initialize(config, snapshots_path: nil)
10
10
def call
11
11
Helmsnap ::SetupDependencies . call ( config )
12
12
13
- FileUtils . rmtree ( snapshots_path )
13
+ Dir . mktmpdir do |tmpdir |
14
+ tmp_path = Pathname . new ( tmpdir )
15
+ generate! ( tmp_path )
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ attr_accessor :config , :snapshots_path
14
22
23
+ def generate! ( tmp_path )
15
24
config . envs . each do |env |
16
25
run_cmd (
17
26
"helmfile" ,
18
27
"--environment" ,
19
28
env . name ,
20
29
"template" ,
21
30
"--output-dir-template" ,
22
- snapshots_path . join ( env . name ) . join ( "{{ .Release.Name }}" ) ,
31
+ tmp_path . join ( env . name , "{{ .Release.Name }}" ) ,
23
32
"--skip-deps" ,
24
33
)
25
34
end
26
35
27
- snapshots_path . glob ( [ "**/*yaml" , "**/*.yml" ] ) . each do |path |
36
+ tmp_path . glob ( [ "**/*yaml" , "**/*.yml" ] ) . each do |path |
28
37
content = path . read
29
38
content . gsub! ( /\d \d \d \d -\d \d -\d \d \d \d :\d \d :\d \d \. \d +/ , "2022-01-01 00:00:00.000" )
30
39
content . gsub! ( /\d \d \d \d -\d \d -\d \d -\d \d -\d \d -\d \d / , "2022-01-01-00-00-00" )
31
40
content . gsub! ( /\d \d \d \d -\d \d -\d \d -\d \d -\d \d / , "2022-01-01-00-00" )
32
41
path . write ( content )
33
42
end
34
- end
35
-
36
- private
37
43
38
- attr_accessor :config , :snapshots_path
44
+ FileUtils . rmtree ( snapshots_path )
45
+ FileUtils . move ( tmp_path , snapshots_path )
46
+ end
39
47
end
You can’t perform that action at this time.
0 commit comments