Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-04 09:08:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-04 09:08:10 +0300
commit6d10e8955122e96a92bb980c04f1d7b116ed527a (patch)
treef1910c2a09ae0ca7b50f1182f7cf4ed976dfbe8f
parentfc98192f90aaa287731da2d95dd2e3aaae0a54a5 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/services/clusters/applications/upgrade_service.rb34
-rw-r--r--locale/gitlab.pot3
-rw-r--r--spec/services/clusters/applications/upgrade_service_spec.rb80
3 files changed, 0 insertions, 117 deletions
diff --git a/app/services/clusters/applications/upgrade_service.rb b/app/services/clusters/applications/upgrade_service.rb
deleted file mode 100644
index ac68e64af38..00000000000
--- a/app/services/clusters/applications/upgrade_service.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-module Clusters
- module Applications
- class UpgradeService < BaseHelmService
- def execute
- return unless app.scheduled?
-
- app.make_updating!
-
- 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_errored!(_('Kubernetes error: %{error_code}') % { error_code: e.error_code })
- rescue StandardError => e
- log_error(e)
- app.make_errored!(_('Failed to upgrade.'))
- end
- end
- end
-end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 12732bc9678..88d7ffcd606 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -16828,9 +16828,6 @@ msgstr ""
msgid "Failed to update the Canary Ingress."
msgstr ""
-msgid "Failed to upgrade."
-msgstr ""
-
msgid "Failed to upload object map file"
msgstr ""
diff --git a/spec/services/clusters/applications/upgrade_service_spec.rb b/spec/services/clusters/applications/upgrade_service_spec.rb
deleted file mode 100644
index 22fbb7ca6e3..00000000000
--- a/spec/services/clusters/applications/upgrade_service_spec.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Clusters::Applications::UpgradeService do
- describe '#execute' do
- let(:application) { create(:clusters_applications_helm, :scheduled) }
- let!(:install_command) { application.install_command }
- let(:service) { described_class.new(application) }
- let(:helm_client) { instance_double(Gitlab::Kubernetes::Helm::API) }
-
- before do
- allow(service).to receive(:install_command).and_return(install_command)
- allow(service).to receive(:helm_api).and_return(helm_client)
- end
-
- context 'when there are no errors' do
- before do
- expect(helm_client).to receive(:update).with(install_command)
- allow(ClusterWaitForAppInstallationWorker).to receive(:perform_in).and_return(nil)
- end
-
- it 'make the application updating' do
- expect(application.cluster).not_to be_nil
- service.execute
-
- expect(application).to be_updating
- end
-
- it 'schedule async installation status check' do
- expect(ClusterWaitForAppInstallationWorker).to receive(:perform_in).once
-
- service.execute
- end
- end
-
- context 'when kubernetes cluster communication fails' do
- let(:error) { Kubeclient::HttpError.new(500, 'system failure', nil) }
-
- before do
- expect(helm_client).to receive(:update).with(install_command).and_raise(error)
- end
-
- include_examples 'logs kubernetes errors' do
- let(:error_name) { 'Kubeclient::HttpError' }
- let(:error_message) { 'system failure' }
- let(:error_code) { 500 }
- end
-
- it 'make the application errored' do
- service.execute
-
- expect(application).to be_update_errored
- expect(application.status_reason).to eq(_('Kubernetes error: %{error_code}') % { error_code: 500 })
- end
- end
-
- context 'a non kubernetes error happens' do
- let(:application) { create(:clusters_applications_helm, :scheduled) }
- let(:error) { StandardError.new('something bad happened') }
-
- before do
- expect(helm_client).to receive(:update).with(install_command).and_raise(error)
- end
-
- include_examples 'logs kubernetes errors' do
- let(:error_name) { 'StandardError' }
- let(:error_message) { 'something bad happened' }
- let(:error_code) { nil }
- end
-
- it 'make the application errored' do
- service.execute
-
- expect(application).to be_update_errored
- expect(application.status_reason).to eq(_('Failed to upgrade.'))
- end
- end
- end
-end