debian-mirror-gitlab/app/services/clusters/applications/install_service.rb

33 lines
805 B
Ruby
Raw Normal View History

2018-11-08 19:23:39 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module Clusters
module Applications
class InstallService < BaseHelmService
def execute
return unless app.scheduled?
2019-07-07 11:18:12 +05:30
app.make_installing!
2019-07-31 22:56:46 +05:30
install
end
private
def install
log_event(:begin_install)
2019-07-07 11:18:12 +05:30
helm_api.install(install_command)
2018-03-17 18:26:18 +05:30
2019-07-31 22:56:46 +05:30
log_event(:schedule_wait_for_installation)
2019-07-07 11:18:12 +05:30
ClusterWaitForAppInstallationWorker.perform_in(
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue Kubeclient::HttpError => e
log_error(e)
2019-07-31 22:56:46 +05:30
app.make_errored!(_('Kubernetes error: %{error_code}') % { error_code: e.error_code })
2019-07-07 11:18:12 +05:30
rescue StandardError => e
log_error(e)
2019-07-31 22:56:46 +05:30
app.make_errored!(_('Failed to install.'))
2018-03-17 18:26:18 +05:30
end
end
end
end