seira 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/seira/jobs.rb +21 -2
- data/lib/seira/util/resource_renderer.rb +10 -0
- data/lib/seira/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: 78ba9d18d0744eaa4f13efb9e1301a716f3b6ac39a2918dfe39c8f00d159cdac
|
4
|
+
data.tar.gz: c8a603326969f48c4a7e907c3848833bbe40d2c0197aee57492a6a606625b054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71da810729d57a4db2b64db4abc0bff54dc32962d2c0796da5951c7c5dda962d57107124026079b9725373d7ca013783a806aecc45c6ae7210c0eb974583dcbe
|
7
|
+
data.tar.gz: 5be8d22be54bdd01c9fca06467b832c9002ed1a809352759ee9b05368d5e943c09c5ef8c4a17512b5affda29661bdd05734e60b3671e7377c936c7c56ece71c1
|
data/lib/seira/jobs.rb
CHANGED
@@ -113,18 +113,29 @@ module Seira
|
|
113
113
|
source = "kubernetes/#{context[:cluster]}/#{app}" # TODO: Move to method in app.rb
|
114
114
|
Dir.mktmpdir do |destination|
|
115
115
|
revision = ENV['REVISION']
|
116
|
-
file_name =
|
116
|
+
file_name = discover_job_template_file_name(source)
|
117
117
|
|
118
118
|
FileUtils.mkdir_p destination # Create the nested directory
|
119
119
|
FileUtils.copy_file "#{source}/jobs/#{file_name}", "#{destination}/#{file_name}"
|
120
120
|
|
121
121
|
# TOOD: Move this into a method since it is copied from app.rb
|
122
122
|
text = File.read("#{destination}/#{file_name}")
|
123
|
+
|
124
|
+
# First run it through ERB if it should be
|
125
|
+
if file_name.end_with?('.erb')
|
126
|
+
locals = {}.merge(replacement_hash)
|
127
|
+
renderer = Seira::Util::ResourceRenderer.new(template: text, context: context, locals: locals)
|
128
|
+
text = renderer.render
|
129
|
+
end
|
130
|
+
|
123
131
|
new_contents = text
|
124
132
|
replacement_hash.each do |key, value|
|
125
133
|
new_contents.gsub!(key, value)
|
126
134
|
end
|
127
|
-
|
135
|
+
|
136
|
+
target_name = file_name.gsub('.erb', '')
|
137
|
+
|
138
|
+
File.open("#{destination}/#{target_name}", 'w') { |file| file.write(new_contents) }
|
128
139
|
|
129
140
|
kubectl("apply -f #{destination}", context: context)
|
130
141
|
log_link = Helpers.log_link(context: context, query: unique_name)
|
@@ -162,5 +173,13 @@ module Seira
|
|
162
173
|
exit(1) unless status == "succeeded"
|
163
174
|
end
|
164
175
|
end
|
176
|
+
|
177
|
+
def discover_job_template_file_name(source)
|
178
|
+
if File.exist?("#{source}/jobs/template.yaml.erb")
|
179
|
+
"template.yaml.erb"
|
180
|
+
else
|
181
|
+
"template.yaml"
|
182
|
+
end
|
183
|
+
end
|
165
184
|
end
|
166
185
|
end
|
@@ -37,6 +37,16 @@ module Seira
|
|
37
37
|
count
|
38
38
|
end
|
39
39
|
|
40
|
+
def get_secret(secret_name)
|
41
|
+
secret_value = Seira::Helpers.get_secret(key: secret_name, context: @context)
|
42
|
+
@summary[secret_name] = 'fetched'
|
43
|
+
|
44
|
+
# Validate we actually get something back
|
45
|
+
fail "Missing value for secret #{secret_name}" unless secret_value
|
46
|
+
|
47
|
+
secret_value
|
48
|
+
end
|
49
|
+
|
40
50
|
def target_revision
|
41
51
|
rv = @locals['REVISION']
|
42
52
|
@summary["revision"] = rv
|
data/lib/seira/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Ringwelski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|