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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
785 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
module Clusters
module Applications
class PatchService < BaseHelmService
def execute
return unless app.scheduled?
app.make_updating!
2019-07-31 22:56:46 +05:30
patch
end
private
def patch
log_event(:begin_patch)
2019-07-07 11:18:12 +05:30
helm_api.update(update_command)
2019-07-31 22:56:46 +05:30
log_event(:schedule_wait_for_patch)
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 update.'))
2019-07-07 11:18:12 +05:30
end
end
end
end