lib/vidar/cli.rb in vidar-1.5.3 vs lib/vidar/cli.rb in vidar-1.5.4

- old
+ new

@@ -72,10 +72,12 @@ Log.info "Current kubectl context: #{kubectl_context}" Log.info "Looking for deploy hook..." template_name, error, status = Open3.capture3 "kubectl get cronjob deploy-hook-template -n #{Config.get!(:namespace)} -o name --ignore-not-found=true" + slack_notification = SlackNotification.get + if status.success? if template_name.to_s.empty? Log.info "No deploy hook found" else Log.info "Executing deploy hook #{template_name.strip!}..." @@ -88,15 +90,17 @@ deploy_status.wait_until_completed unless deploy_status.success? Run.kubectl "describe job deploy-hook" Log.error "Error running deploy hook template" + slack_notification.failure if slack_notification.configured? exit(1) end end else 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" @@ -114,16 +118,10 @@ desc "monitor_deploy_status", "Check is deployment has finished and sends post-deploy notification" def monitor_deploy_status Log.info "Current kubectl context: #{Config.get!(:kubectl_context)}" Log.info "Checking if all containers in #{Config.get!(:namespace)} namespace(s) are ready..." - slack_notification = SlackNotification.new( - github: Config.get!(:github), - revision: Config.get!(:revision), - revision_name: Config.get!(:revision_name), - build_url: Config.build_url, - deploy_config: Config.deploy_config - ) + slack_notification = SlackNotification.get deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace)) deploy_status.wait_until_completed