summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2019-04-29 10:30:29 +0000
committerDouwe Maan <douwe@gitlab.com>2019-04-29 10:30:29 +0000
commit6885419a48c39ab9f38aea13ec1900b10bce7d80 (patch)
treea3702e3e23e65ee28f653381a41d6a7580e55274
parent08e0dbe6754711604952313b01d7159d7fa8f946 (diff)
parent825d759634773c82b6417ba8e7a9fdcb0f76561c (diff)
downloadgitlab-ce-6885419a48c39ab9f38aea13ec1900b10bce7d80.tar.gz
Merge branch '60821-deployment-jobs-broken-as-of-11-10-0' into 'master'
Resolve "Deployment jobs broken as of 11.10.0" Closes #60821 See merge request gitlab-org/gitlab-ce!27687
-rw-r--r--app/models/deployment.rb6
-rw-r--r--changelogs/unreleased/60821-deployment-jobs-broken-as-of-11-10-0.yml5
-rw-r--r--spec/models/deployment_spec.rb6
3 files changed, 16 insertions, 1 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index f5fdf285522..92c7311014a 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -85,7 +85,11 @@ class Deployment < ApplicationRecord
end
def cluster
- project.deployment_platform(environment: environment.name)&.cluster
+ platform = project.deployment_platform(environment: environment.name)
+
+ if platform.present? && platform.respond_to?(:cluster)
+ platform.cluster
+ end
end
def execute_hooks
diff --git a/changelogs/unreleased/60821-deployment-jobs-broken-as-of-11-10-0.yml b/changelogs/unreleased/60821-deployment-jobs-broken-as-of-11-10-0.yml
new file mode 100644
index 00000000000..88584352d42
--- /dev/null
+++ b/changelogs/unreleased/60821-deployment-jobs-broken-as-of-11-10-0.yml
@@ -0,0 +1,5 @@
+---
+title: Fix Kubernetes service template deployment jobs broken as of 11.10.0
+merge_request: 27687
+author:
+type: fixed
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index 0ca758429b8..f51322e1404 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -400,6 +400,12 @@ describe Deployment do
it { is_expected.to be_nil }
end
+ context 'project uses the kubernetes service for deployments' do
+ let!(:service) { create(:kubernetes_service, project: project) }
+
+ it { is_expected.to be_nil }
+ end
+
context 'project has a deployment platform' do
let!(:cluster) { create(:cluster, projects: [project]) }
let!(:platform) { create(:cluster_platform_kubernetes, cluster: cluster) }