Commit d9cacdc2 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'remove_support_for_showing_app_label_warning' into 'master'

Removes fallback warning for legacy deploy board labels

See merge request gitlab-org/gitlab!43376
parents 3934a31b d1535ead
...@@ -184,7 +184,6 @@ export default { ...@@ -184,7 +184,6 @@ export default {
:deploy-boards-help-path="deployBoardsHelpPath" :deploy-boards-help-path="deployBoardsHelpPath"
:is-loading="model.isLoadingDeployBoard" :is-loading="model.isLoadingDeployBoard"
:is-empty="model.isEmptyDeployBoard" :is-empty="model.isEmptyDeployBoard"
:has-legacy-app-label="model.hasLegacyAppLabel"
:logs-path="model.logs_path" :logs-path="model.logs_path"
/> />
</div> </div>
......
...@@ -17,7 +17,7 @@ import { ...@@ -17,7 +17,7 @@ import {
GlSafeHtmlDirective as SafeHtml, GlSafeHtmlDirective as SafeHtml,
} from '@gitlab/ui'; } from '@gitlab/ui';
import deployBoardSvg from 'ee_empty_states/icons/_deploy_board.svg'; import deployBoardSvg from 'ee_empty_states/icons/_deploy_board.svg';
import { n__, s__, sprintf } from '~/locale'; import { n__ } from '~/locale';
import { STATUS_MAP, CANARY_STATUS } from '../constants'; import { STATUS_MAP, CANARY_STATUS } from '../constants';
export default { export default {
...@@ -53,27 +53,11 @@ export default { ...@@ -53,27 +53,11 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
hasLegacyAppLabel: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
canRenderDeployBoard() { canRenderDeployBoard() {
return !this.isEmpty && !isEmpty(this.deployBoardData); return !this.isEmpty && !isEmpty(this.deployBoardData);
}, },
legacyLabelWarningMessage() {
return sprintf(
s__(
'DeployBoard|Matching on the %{appLabel} label has been removed for deploy boards. To see all instances on your board, you must update your chart and redeploy.',
),
{
appLabel: '<code>app</code>',
},
false,
);
},
canRenderEmptyState() { canRenderEmptyState() {
return this.isEmpty; return this.isEmpty;
}, },
...@@ -117,13 +101,6 @@ export default { ...@@ -117,13 +101,6 @@ export default {
<div class="js-deploy-board deploy-board"> <div class="js-deploy-board deploy-board">
<gl-loading-icon v-if="isLoading" class="loading-icon" /> <gl-loading-icon v-if="isLoading" class="loading-icon" />
<template v-else> <template v-else>
<div v-if="hasLegacyAppLabel" class="bs-callout bs-callout-warning mb-0 mt-0">
<span v-safe-html="legacyLabelWarningMessage"></span>
<gl-link target="_blank" :href="deployBoardsHelpPath">
<strong>{{ __('More Information') }}</strong>
</gl-link>
</div>
<div v-if="canRenderDeployBoard" class="deploy-board-information p-3"> <div v-if="canRenderDeployBoard" class="deploy-board-information p-3">
<div class="deploy-board-information"> <div class="deploy-board-information">
<section class="deploy-board-status"> <section class="deploy-board-status">
......
...@@ -18,7 +18,6 @@ export const setDeployBoard = (oldEnvironmentState, environment) => { ...@@ -18,7 +18,6 @@ export const setDeployBoard = (oldEnvironmentState, environment) => {
environment.rollout_status.status === 'found' ? environment.rollout_status : {}, environment.rollout_status.status === 'found' ? environment.rollout_status : {},
isLoadingDeployBoard: environment.rollout_status.status === 'loading', isLoadingDeployBoard: environment.rollout_status.status === 'loading',
isEmptyDeployBoard: environment.rollout_status.status === 'not_found', isEmptyDeployBoard: environment.rollout_status.status === 'not_found',
hasLegacyAppLabel: environment.rollout_status.has_legacy_app_label,
}; };
} }
return parsedEnvironment; return parsedEnvironment;
......
...@@ -26,9 +26,8 @@ module EE ...@@ -26,9 +26,8 @@ module EE
deployments = filter_by_project_environment(data[:deployments], project.full_path_slug, environment.slug) deployments = filter_by_project_environment(data[:deployments], project.full_path_slug, environment.slug)
pods = filter_by_project_environment(data[:pods], project.full_path_slug, environment.slug) pods = filter_by_project_environment(data[:pods], project.full_path_slug, environment.slug)
legacy_deployments = filter_by_legacy_label(data[:deployments], project.full_path_slug, environment.slug)
::Gitlab::Kubernetes::RolloutStatus.from_deployments(*deployments, pods_attrs: pods, legacy_deployments: legacy_deployments) ::Gitlab::Kubernetes::RolloutStatus.from_deployments(*deployments, pods_attrs: pods)
end end
private private
......
...@@ -4,7 +4,11 @@ class RolloutStatusEntity < Grape::Entity ...@@ -4,7 +4,11 @@ class RolloutStatusEntity < Grape::Entity
include RequestAwareEntity include RequestAwareEntity
expose :status, as: :status expose :status, as: :status
expose :has_legacy_app_label?, as: :has_legacy_app_label
# To be removed in API v5
expose :has_legacy_app_label do |_rollout_status|
false
end
expose :instances, if: -> (rollout_status, _) { rollout_status.found? } expose :instances, if: -> (rollout_status, _) { rollout_status.found? }
expose :completion, if: -> (rollout_status, _) { rollout_status.found? } expose :completion, if: -> (rollout_status, _) { rollout_status.found? }
......
---
title: Removes fallback warning for legacy deploy board labels
merge_request: 43376
author:
type: changed
...@@ -22,31 +22,26 @@ module Gitlab ...@@ -22,31 +22,26 @@ module Gitlab
@status == :not_found @status == :not_found
end end
def has_legacy_app_label?
legacy_deployments.present?
end
def found? def found?
@status == :found @status == :found
end end
def self.from_deployments(*deployments, pods_attrs: [], legacy_deployments: []) def self.from_deployments(*deployments, pods_attrs: {})
return new([], status: :not_found, legacy_deployments: legacy_deployments) if deployments.empty? return new([], status: :not_found) if deployments.empty?
deployments = deployments.map { |deploy| ::Gitlab::Kubernetes::Deployment.new(deploy, pods: pods_attrs) } deployments = deployments.map { |deploy| ::Gitlab::Kubernetes::Deployment.new(deploy, pods: pods_attrs) }
deployments.sort_by!(&:order) deployments.sort_by!(&:order)
new(deployments, legacy_deployments: legacy_deployments) new(deployments)
end end
def self.loading def self.loading
new([], status: :loading) new([], status: :loading)
end end
def initialize(deployments, status: :found, legacy_deployments: []) def initialize(deployments, status: :found)
@status = status @status = status
@deployments = deployments @deployments = deployments
@instances = deployments.flat_map(&:instances) @instances = deployments.flat_map(&:instances)
@legacy_deployments = legacy_deployments
@completion = @completion =
if @instances.empty? if @instances.empty?
...@@ -58,10 +53,6 @@ module Gitlab ...@@ -58,10 +53,6 @@ module Gitlab
(finished / @instances.count.to_f * 100).to_i (finished / @instances.count.to_f * 100).to_i
end end
end end
private
attr_reader :legacy_deployments
end end
end end
end end
...@@ -89,28 +89,6 @@ describe('Deploy Board', () => { ...@@ -89,28 +89,6 @@ describe('Deploy Board', () => {
}); });
}); });
describe('with hasLegacyAppLabel equal true', () => {
beforeEach(done => {
wrapper = createComponent({
isLoading: false,
isEmpty: false,
logsPath,
hasLegacyAppLabel: true,
deployBoardData: {},
});
wrapper.vm.$nextTick(done);
});
it('should render legacy label warning message', () => {
const warningMessage = wrapper.find('.bs-callout-warning');
expect(warningMessage).toBeTruthy();
expect(warningMessage.text()).toContain(
'Matching on the app label has been removed for deploy boards.',
);
});
});
describe('has legend component', () => { describe('has legend component', () => {
let statuses = []; let statuses = [];
beforeEach(done => { beforeEach(done => {
...@@ -118,7 +96,6 @@ describe('Deploy Board', () => { ...@@ -118,7 +96,6 @@ describe('Deploy Board', () => {
isLoading: false, isLoading: false,
isEmpty: false, isEmpty: false,
logsPath: environment.log_path, logsPath: environment.log_path,
hasLegacyAppLabel: true,
deployBoardData: deployBoardMockData, deployBoardData: deployBoardMockData,
}); });
({ statuses } = wrapper.vm); ({ statuses } = wrapper.vm);
......
...@@ -60,26 +60,6 @@ describe('Store', () => { ...@@ -60,26 +60,6 @@ describe('Store', () => {
expect(store.state.environments[0].deployBoardData).toEqual(deployBoardMockData); expect(store.state.environments[0].deployBoardData).toEqual(deployBoardMockData);
}); });
it('should set hasLegacyAppLabel property', () => {
expect(store.state.environments[0].deployBoardData).toEqual(deployBoardMockData);
const environment = {
name: 'foo',
size: 1,
latest: {
id: 1,
},
rollout_status: {
...deployBoardMockData,
status: 'not_found',
has_legacy_app_label: true,
},
};
store.storeEnvironments([environment]);
expect(store.state.environments[0].hasLegacyAppLabel).toBe(true);
});
}); });
describe('canaryCallout', () => { describe('canaryCallout', () => {
......
...@@ -7,7 +7,6 @@ RSpec.describe Gitlab::Kubernetes::RolloutStatus do ...@@ -7,7 +7,6 @@ RSpec.describe Gitlab::Kubernetes::RolloutStatus do
let(:track) { nil } let(:track) { nil }
let(:specs) { specs_all_finished } let(:specs) { specs_all_finished }
let(:legacy_deployments) { [] }
let(:pods) do let(:pods) do
create_pods(name: "one", count: 3, track: 'stable') + create_pods(name: "two", count: 3, track: "canary") create_pods(name: "one", count: 3, track: 'stable') + create_pods(name: "two", count: 3, track: "canary")
...@@ -27,26 +26,7 @@ RSpec.describe Gitlab::Kubernetes::RolloutStatus do ...@@ -27,26 +26,7 @@ RSpec.describe Gitlab::Kubernetes::RolloutStatus do
] ]
end end
subject(:rollout_status) { described_class.from_deployments(*specs, pods_attrs: pods, legacy_deployments: legacy_deployments) } subject(:rollout_status) { described_class.from_deployments(*specs, pods_attrs: pods) }
describe '#has_legacy_app_label?' do
let(:specs) { [] }
let(:pods) { [] }
context 'no legacy deployments' do
it { is_expected.not_to be_has_legacy_app_label }
end
context 'with legacy deployment' do
let(:legacy_deployments) do
[
kube_deployment(name: 'legacy')
]
end
it { is_expected.to be_has_legacy_app_label }
end
end
describe '#deployments' do describe '#deployments' do
it 'stores the deployments' do it 'stores the deployments' do
......
...@@ -61,10 +61,6 @@ RSpec.describe Clusters::Platforms::Kubernetes do ...@@ -61,10 +61,6 @@ RSpec.describe Clusters::Platforms::Kubernetes do
expect(rollout_status.deployments).to eq([]) expect(rollout_status.deployments).to eq([])
end end
it 'has the has_legacy_app_label flag' do
expect(rollout_status).to be_has_legacy_app_label
end
end end
context 'deployment with no pods' do context 'deployment with no pods' do
...@@ -89,35 +85,6 @@ RSpec.describe Clusters::Platforms::Kubernetes do ...@@ -89,35 +85,6 @@ RSpec.describe Clusters::Platforms::Kubernetes do
expect(rollout_status.deployments.map(&:name)).to contain_exactly('matched-deployment') expect(rollout_status.deployments.map(&:name)).to contain_exactly('matched-deployment')
end end
it 'does have the has_legacy_app_label flag' do
expect(rollout_status).to be_has_legacy_app_label
end
end
context 'deployment with app label not matching the environment' do
let(:other_deployment) do
kube_deployment(name: 'other-deployment').tap do |deployment|
deployment['metadata']['annotations'].delete('app.gitlab.com/env')
deployment['metadata']['annotations'].delete('app.gitlab.com/app')
deployment['metadata']['labels']['app'] = 'helm-app-label'
end
end
let(:other_pod) do
kube_pod(name: 'other-pod').tap do |pod|
pod['metadata']['annotations'].delete('app.gitlab.com/env')
pod['metadata']['annotations'].delete('app.gitlab.com/app')
pod['metadata']['labels']['app'] = environment.slug
end
end
let(:deployments) { [other_deployment] }
let(:pods) { [other_pod] }
it 'does not have the has_legacy_app_label flag' do
expect(rollout_status).not_to be_has_legacy_app_label
end
end end
end end
......
...@@ -8595,9 +8595,6 @@ msgstr "" ...@@ -8595,9 +8595,6 @@ msgstr ""
msgid "Deploy to..." msgid "Deploy to..."
msgstr "" msgstr ""
msgid "DeployBoard|Matching on the %{appLabel} label has been removed for deploy boards. To see all instances on your board, you must update your chart and redeploy."
msgstr ""
msgid "DeployFreeze|Freeze end" msgid "DeployFreeze|Freeze end"
msgstr "" msgstr ""
......
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