Commit 05943523 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 0c4a25f3 addefa8e
...@@ -135,13 +135,13 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -135,13 +135,13 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
def metrics def metrics
respond_to do |format|
format.html
format.json do
# Currently, this acts as a hint to load the metrics details into the cache # Currently, this acts as a hint to load the metrics details into the cache
# if they aren't there already # if they aren't there already
@metrics = environment.metrics || {} @metrics = environment.metrics || {}
respond_to do |format|
format.html
format.json do
render json: @metrics, status: @metrics.any? ? :ok : :no_content render json: @metrics, status: @metrics.any? ? :ok : :no_content
end end
end end
......
...@@ -85,7 +85,11 @@ class Deployment < ApplicationRecord ...@@ -85,7 +85,11 @@ class Deployment < ApplicationRecord
end end
def cluster 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 end
def execute_hooks def execute_hooks
......
---
title: Fix Kubernetes service template deployment jobs broken as of 11.10.0
merge_request: 27687
author:
type: fixed
...@@ -12,12 +12,10 @@ module QA ...@@ -12,12 +12,10 @@ module QA
fill_in 'password', with: QA::Runtime::Env.github_password fill_in 'password', with: QA::Runtime::Env.github_password
click_on 'Sign in' click_on 'Sign in'
unless has_no_text?("Authorize GitLab-OAuth")
click_on 'Authorize gitlab-qa' if has_button?('Authorize gitlab-qa') click_on 'Authorize gitlab-qa' if has_button?('Authorize gitlab-qa')
end end
end end
end end
end end
end end
end
end end
...@@ -342,11 +342,9 @@ describe Projects::EnvironmentsController do ...@@ -342,11 +342,9 @@ describe Projects::EnvironmentsController do
end end
context 'when environment has no metrics' do context 'when environment has no metrics' do
before do
expect(environment).to receive(:metrics).and_return(nil)
end
it 'returns a metrics page' do it 'returns a metrics page' do
expect(environment).not_to receive(:metrics)
get :metrics, params: environment_params get :metrics, params: environment_params
expect(response).to be_ok expect(response).to be_ok
...@@ -354,6 +352,8 @@ describe Projects::EnvironmentsController do ...@@ -354,6 +352,8 @@ describe Projects::EnvironmentsController do
context 'when requesting metrics as JSON' do context 'when requesting metrics as JSON' do
it 'returns a metrics JSON document' do it 'returns a metrics JSON document' do
expect(environment).to receive(:metrics).and_return(nil)
get :metrics, params: environment_params(format: :json) get :metrics, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(204)
......
...@@ -400,6 +400,12 @@ describe Deployment do ...@@ -400,6 +400,12 @@ describe Deployment do
it { is_expected.to be_nil } it { is_expected.to be_nil }
end 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 context 'project has a deployment platform' do
let!(:cluster) { create(:cluster, projects: [project]) } let!(:cluster) { create(:cluster, projects: [project]) }
let!(:platform) { create(:cluster_platform_kubernetes, cluster: cluster) } 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