lib/vidar/cli.rb in vidar-1.5.4 vs lib/vidar/cli.rb in vidar-1.6.0
- old
+ new
@@ -64,10 +64,13 @@
end
desc "deploy", "Perform k8s deployment with deploy hook"
method_option :revision, required: false
method_option :kubectl_context, required: false
+ method_option :destination, required: false, default: "deployments,cronjobs"
+ method_option :container, required: false, default: "*"
+ method_option :all, required: false, type: :boolean, default: true
def deploy
revision = options[:revision] || Config.get!(:revision)
kubectl_context = options[:kubectl_context] || Config.get!(:kubectl_context)
Log.info "Current kubectl context: #{kubectl_context}"
@@ -100,11 +103,14 @@
Log.info "Error getting deploy hook template: #{error}"
slack_notification.failure if slack_notification.configured?
exit(1)
end
- Log.info "Set kubectl image..."
- Run.kubectl "set image deployments,cronjobs *=#{Config.get!(:image)}:#{revision} --all"
+ destination = options[:destination]
+ container = options[:container]
+ all = options[:all]
+ Log.info "Set kubectl image for #{all ? 'all ' : ''}#{destination} container=#{container}..."
+ Run.kubectl "set image #{destination} #{container}=#{Config.get!(:image)}:#{revision} #{all ? '--all' : ''}"
end
desc "release", "Build and publish docker images"
def release
Log.info "Build and release #{Config.get!(:image)}:#{Config.get!(:revision)}"