lib/vidar/cli.rb in vidar-0.1.6 vs lib/vidar/cli.rb in vidar-0.2.0
- old
+ new
@@ -17,11 +17,11 @@
Log.info "Pulling #{Config.get!(:image)} tags"
Run.docker "pull #{Config.get!(:image)}:builder-#{Config.get!(:current_branch)} 2> /dev/null || true"
Run.docker "pull #{Config.get!(:image)}:builder 2> /dev/null || true"
Run.docker "pull #{Config.get!(:image)}:release 2> /dev/null || true"
Log.info "Docker images:"
- puts Run.docker "images"
+ Log.info Run.docker("images")
end
desc "build", "Builds docker stages"
def build
Log.info "Building #{Config.get!(:image)}:builder-#{Config.get!(:current_branch)}"
@@ -60,11 +60,11 @@
desc "deploy", "Performs k8s deployment with deploy hook"
method_option :revision, default: nil
def deploy
revision = options[:revision] || Config.get!(:revision)
- Log.info "Current cluster: #{Config.get!(:cluster)} ###"
+ Log.info "Current cluster_name: #{Config.get!(:cluster_name)} ###"
Log.info "Set kubectl image..."
Run.kubectl "set image deployments,cronjobs *=#{Config.get!(:image)}:#{revision} --all"
Log.info "Looking for deploy hook..."
@@ -93,12 +93,12 @@
publish
end
desc "monitor_deploy_status", "Checks is deployment has finished and sends post-deploy notification"
def monitor_deploy_status
- Log.info "Current cluster: #{Config.get!(:cluster)} ###"
- Log.info "Checking is all containers on #{Config.get!(:cluster)} in #{Config.get!(:namespace)} are ready..."
+ Log.info "Current cluster_name: #{Config.get!(:cluster_name)} ###"
+ Log.info "Checking is all containers on #{Config.get!(:cluster_name)} in #{Config.get!(:namespace)} are ready..."
sleep(2)
error = false
tries = 0
max_tries = 30
@@ -109,27 +109,25 @@
error = true
break
end
end
- return unless Config.get(:slack_webhook_url)
-
slack_notification = SlackNotification.new(
webhook_url: Config.get!(:slack_webhook_url),
github: Config.get!(:github),
revision: Config.get!(:revision),
revision_name: Config.get!(:revision_name),
- cluster: Config.get!(:cluster),
+ cluster_name: Config.get!(:cluster_name),
cluster_url: Config.get!(:cluster_url)
)
if error
Log.error "ERROR: Some of containers are not ready."
- slack_notification.error
+ slack_notification.error if slack_notification.configured?
exit(1)
else
Log.info "OK: All containers are ready."
- slack_notification.success
+ slack_notification.success if slack_notification.configured?
end
end
end
end