Commit 188dece9 authored by Thong Kuah's avatar Thong Kuah

Show cluster agents UI only when enabled on GitLab.com

No change for self-managed
parent a853e5ad
---
name: cluster_agent_list
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42115
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/249596
milestone: '13.5'
type: development
group: group::configure
default_enabled: true
......@@ -6,9 +6,13 @@ module EE
override :display_cluster_agents?
def display_cluster_agents?(clusterable)
return unless ::Feature.enabled?(:cluster_agent_list, default_enabled: true)
clusterable.is_a?(Project) && clusterable.feature_available?(:cluster_agents) && included_in_gitlab_com_rollout?(clusterable)
end
private
clusterable.is_a?(Project) && clusterable.feature_available?(:cluster_agents)
def included_in_gitlab_com_rollout?(project)
::Gitlab::Kas.included_in_gitlab_com_rollout?(project)
end
end
end
---
title: Hide cluster agent UI if not enabled on GitLab.com
merge_request: 57668
author:
type: changed
......@@ -16,6 +16,8 @@ RSpec.describe ClustersHelper do
context 'with premium license' do
before do
allow(Gitlab).to receive(:com?).and_return(false)
stub_licensed_features(cluster_agents: true)
end
......@@ -33,15 +35,31 @@ RSpec.describe ClustersHelper do
end
end
context 'when cluster_agent_list feature flag is disabled' do
context 'GitLab.com' do
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
context 'when kubernetes_agent_on_gitlab_com feature flag is disabled' do
before do
stub_feature_flags(cluster_agent_list: false)
stub_feature_flags(kubernetes_agent_on_gitlab_com: false)
end
it 'does not allows agents to display' do
expect(subject).to be_falsey
end
end
context 'kubernetes_agent_on_gitlab_com feature flag enabled' do
before do
stub_feature_flags(kubernetes_agent_on_gitlab_com: clusterable)
end
it 'allows agents to display' do
expect(subject).to be_truthy
end
end
end
end
end
end
......@@ -27,7 +27,7 @@ module Gitlab
def included_in_gitlab_com_rollout?(project)
return true unless ::Gitlab.com?
Feature.enabled?(:kubernetes_agent_on_gitlab_com, project)
Feature.enabled?(:kubernetes_agent_on_gitlab_com, project, default_enabled: :yaml)
end
end
end
......
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