Sha256: 68f6bb0ebf43fee8e4ab74a1aacaabd7b5a5125340f1874527557eff2015f496
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'kubernetes-deploy/render_task' require 'krane/options_helper' require 'krane/bindings_parser' require 'optparse' template_dir = [] bindings = {} current_sha = ENV["REVISION"] ARGV.options do |opts| parser = Krane::BindingsParser.new opts.on("--bindings=BINDINGS", "Expose additional variables to ERB templates " \ "(format: k1=v1,k2=v2, JSON string or file (JSON or YAML) path prefixed by '@')") { |b| parser.add(b) } opts.on("--template-dir=DIR", "Set the template dir (default: config/deploy/$ENVIRONMENT).") do |d| template_dir = [d] end opts.on("--current-sha=CURRENT_SHA", "Expose SHA `current_sha` in ERB bindings") { |r| current_sha = r } opts.parse! bindings = parser.parse end templates = ARGV logger = Krane::FormattedLogger.build(verbose_prefix: false) begin Krane::OptionsHelper.with_processed_template_paths(template_dir) do |dir| runner = KubernetesDeploy::RenderTask.new( current_sha: current_sha, template_dir: dir.first, bindings: bindings, ) success = runner.run(STDOUT, templates) exit(1) unless success end rescue Krane::OptionsHelper::OptionsError => e logger.error(e.message) exit(1) end
Version data entries
4 entries across 4 versions & 1 rubygems