Sha256: 6b1b55cfc5e46da36dd31371b7ea8066938d3cfac1b153baf66b986e83b80ed1
Contents?: true
Size: 1.47 KB
Versions: 8
Compression:
Stored size: 1.47 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'kubernetes-deploy' require 'optparse' skip_wait = false template_dir = nil allow_protected_ns = false prune = true bindings = {} ARGV.options do |opts| opts.on("--bindings=BINDINGS", Array, "k1=v1,k2=v2") do |binds| bindings = binds.each_with_object({}) do |bind, acc| k,v = bind.split('=') raise "key for value #{v} is blank!" if k.blank? raise "value for key #{k} is blank!" if v.blank? acc[k] = v end end opts.on("--skip-wait") { skip_wait = true } opts.on("--allow-protected-ns") { allow_protected_ns = true } opts.on("--no-prune") { prune = false } opts.on("--template-dir=DIR") { |v| template_dir = v } opts.parse! end if !template_dir && ENV.key?("ENVIRONMENT") template_dir = "config/deploy/#{ENV['ENVIRONMENT']}" end if !template_dir || template_dir.empty? puts "Template directory is unknown. " \ "Either specify --template-dir argument or set $ENVIRONMENT to use config/deploy/$ENVIRONMENT as a default path." exit 1 end revision = ENV.fetch('REVISION') do puts "ENV['REVISION'] is missing. Please specify the commit SHA" exit 1 end KubernetesDeploy::Runner.with_friendly_errors do runner = KubernetesDeploy::Runner.new( namespace: ARGV[0], context: ARGV[1], current_sha: revision, template_dir: template_dir, wait_for_completion: !skip_wait, allow_protected_ns: allow_protected_ns, prune: prune, bindings: bindings ) runner.run end
Version data entries
8 entries across 8 versions & 1 rubygems