seira 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48543d46e562c460bb07cd4e5264b381a9f8f290416fc9b49ed72f857c0082d9
4
- data.tar.gz: 14866aed401685a325be5f8687ac799be8028a2607537ea7c0634331af7f9ad6
3
+ metadata.gz: 78ba9d18d0744eaa4f13efb9e1301a716f3b6ac39a2918dfe39c8f00d159cdac
4
+ data.tar.gz: c8a603326969f48c4a7e907c3848833bbe40d2c0197aee57492a6a606625b054
5
5
  SHA512:
6
- metadata.gz: 867599d8ef0343d263432f3c0faac188864eb0df28bacbb381238669df373c9d9d5c5a9d2ec7dd02a633bbae40b7ba2559db8ee41a094f71c8ceb541d7a8b2d0
7
- data.tar.gz: 2a8e70e9c427e1f718d85f538b1df7c0909e942e87cec9c575e9ee64a9560b2b7cd3a2bc2b801e5ab47d3a6d18f2245afdd6d0943ea9f2a4a3ac180853b043cf
6
+ metadata.gz: 71da810729d57a4db2b64db4abc0bff54dc32962d2c0796da5951c7c5dda962d57107124026079b9725373d7ca013783a806aecc45c6ae7210c0eb974583dcbe
7
+ data.tar.gz: 5be8d22be54bdd01c9fca06467b832c9002ed1a809352759ee9b05368d5e943c09c5ef8c4a17512b5affda29661bdd05734e60b3671e7377c936c7c56ece71c1
@@ -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 = "template.yaml"
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
- File.open("#{destination}/#{file_name}", 'w') { |file| file.write(new_contents) }
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
@@ -1,3 +1,3 @@
1
1
  module Seira
2
- VERSION = "0.4.8".freeze
2
+ VERSION = "0.4.9".freeze
3
3
  end
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.8
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-29 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline