summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-04-12 13:22:11 +0000
committerKamil TrzciƄski <ayufan@ayufan.eu>2019-04-12 13:22:11 +0000
commit8dfec0cedd4d623226ee9d058323a13470631bce (patch)
tree3eaa5de3c486a158ffb8f7934ff430d65483e099 /app
parentd30ac3259faa6281504971f918793aa195bd0493 (diff)
downloadgitlab-ce-8dfec0cedd4d623226ee9d058323a13470631bce.tar.gz
Do not rescue errors from state transitions
As this are un-expected errors which we should hear about from Sentry. Still rescue StandardError when operating a Helm action as we can get non Kubeclient errors such as SSL certificate or network errors
Diffstat (limited to 'app')
-rw-r--r--app/services/clusters/applications/install_service.rb9
-rw-r--r--app/services/clusters/applications/patch_service.rb10
-rw-r--r--app/services/clusters/applications/upgrade_service.rb36
3 files changed, 36 insertions, 19 deletions
diff --git a/app/services/clusters/applications/install_service.rb b/app/services/clusters/applications/install_service.rb
index 1f62b3eb4de..b37ac510ff4 100644
--- a/app/services/clusters/applications/install_service.rb
+++ b/app/services/clusters/applications/install_service.rb
@@ -7,6 +7,13 @@ module Clusters
return unless app.scheduled?
app.make_installing!
+
+ install
+ end
+
+ private
+
+ def install
log_event(:begin_install)
helm_api.install(install_command)
@@ -18,7 +25,7 @@ module Clusters
app.make_errored!("Kubernetes error: #{e.error_code}")
rescue StandardError => e
log_error(e)
- app.make_errored!("Can't start installation process.")
+ app.make_errored!('Failed to install.')
end
end
end
diff --git a/app/services/clusters/applications/patch_service.rb b/app/services/clusters/applications/patch_service.rb
index c3d317e226b..977a5e91041 100644
--- a/app/services/clusters/applications/patch_service.rb
+++ b/app/services/clusters/applications/patch_service.rb
@@ -8,6 +8,12 @@ module Clusters
app.make_updating!
+ patch
+ end
+
+ private
+
+ def patch
log_event(:begin_patch)
helm_api.update(update_command)
@@ -16,10 +22,10 @@ module Clusters
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue Kubeclient::HttpError => e
log_error(e)
- app.make_update_errored!("Kubernetes error: #{e.error_code}")
+ app.make_errored!("Kubernetes error: #{e.error_code}")
rescue StandardError => e
log_error(e)
- app.make_update_errored!("Can't start update process.")
+ app.make_errored!('Failed to update.')
end
end
end
diff --git a/app/services/clusters/applications/upgrade_service.rb b/app/services/clusters/applications/upgrade_service.rb
index c34391bc8ad..813a9c4d071 100644
--- a/app/services/clusters/applications/upgrade_service.rb
+++ b/app/services/clusters/applications/upgrade_service.rb
@@ -6,24 +6,28 @@ module Clusters
def execute
return unless app.scheduled?
- begin
- app.make_updating!
+ app.make_updating!
- log_event(:begin_upgrade)
- # install_command works with upgrades too
- # as it basically does `helm upgrade --install`
- helm_api.update(install_command)
+ upgrade
+ end
+
+ private
+
+ def upgrade
+ # install_command works with upgrades too
+ # as it basically does `helm upgrade --install`
+ log_event(:begin_upgrade)
+ helm_api.update(install_command)
- log_event(:schedule_wait_for_upgrade)
- ClusterWaitForAppInstallationWorker.perform_in(
- ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
- rescue Kubeclient::HttpError => e
- log_error(e)
- app.make_update_errored!("Kubernetes error: #{e.error_code}")
- rescue StandardError => e
- log_error(e)
- app.make_update_errored!("Can't start upgrade process.")
- end
+ log_event(:schedule_wait_for_upgrade)
+ ClusterWaitForAppInstallationWorker.perform_in(
+ ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
+ rescue Kubeclient::HttpError => e
+ log_error(e)
+ app.make_errored!("Kubernetes error: #{e.error_code}")
+ rescue StandardError => e
+ log_error(e)
+ app.make_errored!('Failed to upgrade.')
end
end
end