Commit 825d7596 authored by Tiger's avatar Tiger

Fix deployments for Kubernetes service templates

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27687
parent 6246979a
......@@ -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
......
---
title: Fix Kubernetes service template deployment jobs broken as of 11.10.0
merge_request: 27687
author:
type: fixed
......@@ -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) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment