Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fc6adf3d
Commit
fc6adf3d
authored
Oct 07, 2021
by
Tiger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Agent creation in Core
Changelog: added
parent
93803cc0
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
80 additions
and
120 deletions
+80
-120
app/helpers/clusters_helper.rb
app/helpers/clusters_helper.rb
+2
-2
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-0
ee/app/helpers/ee/clusters_helper.rb
ee/app/helpers/ee/clusters_helper.rb
+0
-12
ee/app/helpers/ee/projects_helper.rb
ee/app/helpers/ee/projects_helper.rb
+0
-1
ee/app/models/license.rb
ee/app/models/license.rb
+0
-1
ee/spec/features/projects/cluster_agents_spec.rb
ee/spec/features/projects/cluster_agents_spec.rb
+0
-63
ee/spec/helpers/ee/clusters_helper_spec.rb
ee/spec/helpers/ee/clusters_helper_spec.rb
+0
-39
spec/features/clusters/create_agent_spec.rb
spec/features/clusters/create_agent_spec.rb
+0
-2
spec/features/projects/cluster_agents_spec.rb
spec/features/projects/cluster_agents_spec.rb
+57
-0
spec/helpers/clusters_helper_spec.rb
spec/helpers/clusters_helper_spec.rb
+20
-0
No files found.
app/helpers/clusters_helper.rb
View file @
fc6adf3d
...
...
@@ -12,8 +12,8 @@ module ClustersHelper
end
end
def
display_cluster_agents?
(
_
clusterable
)
false
def
display_cluster_agents?
(
clusterable
)
clusterable
.
is_a?
(
Project
)
end
def
js_cluster_agents_list_data
(
clusterable_project
)
...
...
app/helpers/projects_helper.rb
View file @
fc6adf3d
...
...
@@ -583,6 +583,7 @@ module ProjectsHelper
%w[
environments
clusters
cluster_agents
functions
error_tracking
alert_management
...
...
ee/app/helpers/ee/clusters_helper.rb
deleted
100644 → 0
View file @
93803cc0
# frozen_string_literal: true
module
EE
module
ClustersHelper
extend
::
Gitlab
::
Utils
::
Override
override
:display_cluster_agents?
def
display_cluster_agents?
(
clusterable
)
clusterable
.
is_a?
(
Project
)
&&
clusterable
.
feature_available?
(
:cluster_agents
)
end
end
end
ee/app/helpers/ee/projects_helper.rb
View file @
fc6adf3d
...
...
@@ -7,7 +7,6 @@ module EE
override
:sidebar_operations_paths
def
sidebar_operations_paths
super
+
%w[
cluster_agents
oncall_schedules
]
end
...
...
ee/app/models/license.rb
View file @
fc6adf3d
...
...
@@ -67,7 +67,6 @@ class License < ApplicationRecord
board_milestone_lists
ci_cd_projects
ci_secrets_management
cluster_agents
cluster_agents_gitops
cluster_deployments
code_owner_approval_required
...
...
ee/spec/features/projects/cluster_agents_spec.rb
deleted
100644 → 0
View file @
93803cc0
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'ClusterAgents'
,
:js
do
let_it_be
(
:token
)
{
create
(
:cluster_agent_token
,
description:
'feature test token'
)}
let
(
:agent
)
{
token
.
agent
}
let
(
:project
)
{
agent
.
project
}
let
(
:user
)
{
project
.
creator
}
before
do
gitlab_sign_in
(
user
)
end
context
'premium user'
do
before
do
stub_licensed_features
(
cluster_agents:
true
)
end
context
'when user does not have any agents and visits the index page'
do
let
(
:empty_project
)
{
create
(
:project
)
}
before
do
empty_project
.
add_maintainer
(
user
)
visit
project_clusters_path
(
empty_project
)
end
it
'displays empty state'
,
:aggregate_failures
do
click_link
'GitLab Agent managed clusters'
expect
(
page
).
to
have_content
(
'Integrate with the GitLab Agent'
)
expect
(
page
).
to
have_selector
(
'.empty-state'
)
end
end
context
'when user has an agent'
do
context
'when visiting the index page'
do
before
do
visit
project_clusters_path
(
project
)
end
it
'displays a table with agent'
,
:aggregate_failures
do
click_link
'GitLab Agent managed clusters'
expect
(
page
).
to
have_content
(
agent
.
name
)
expect
(
page
).
to
have_selector
(
'[data-testid="cluster-agent-list-table"] tbody tr'
,
count:
1
)
end
end
context
'when visiting the show page'
do
before
do
visit
project_cluster_agent_path
(
project
,
agent
.
name
)
end
it
'displays agent and token information'
,
:aggregate_failures
do
expect
(
page
).
to
have_content
(
agent
.
name
)
expect
(
page
).
to
have_content
(
token
.
description
)
end
end
end
end
end
ee/spec/helpers/ee/clusters_helper_spec.rb
deleted
100644 → 0
View file @
93803cc0
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
ClustersHelper
do
describe
'#display_cluster_agents?'
do
let
(
:clusterable
)
{
build
(
:project
)
}
subject
{
helper
.
display_cluster_agents?
(
clusterable
)
}
context
'without premium license'
do
it
'does not allows agents to display'
do
expect
(
subject
).
to
be_falsey
end
end
context
'with premium license'
do
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
stub_licensed_features
(
cluster_agents:
true
)
end
context
'when clusterable is a project'
do
it
'allows agents to display'
do
expect
(
subject
).
to
be_truthy
end
end
context
'when clusterable is a group'
do
let
(
:clusterable
)
{
build
(
:group
)
}
it
'does not allows agents to display'
do
expect
(
subject
).
to
be_falsey
end
end
end
end
end
ee/
spec/features/clusters/create_agent_spec.rb
→
spec/features/clusters/create_agent_spec.rb
View file @
fc6adf3d
...
...
@@ -7,8 +7,6 @@ RSpec.describe 'Cluster agent registration', :js do
let_it_be
(
:current_user
)
{
create
(
:user
,
maintainer_projects:
[
project
])
}
before
do
stub_licensed_features
(
cluster_agents:
true
)
allow
(
Gitlab
::
Kas
).
to
receive
(
:enabled?
).
and_return
(
true
)
allow
(
Gitlab
::
Kas
).
to
receive
(
:internal_url
).
and_return
(
'kas.example.internal'
)
...
...
spec/features/projects/cluster_agents_spec.rb
0 → 100644
View file @
fc6adf3d
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'ClusterAgents'
,
:js
do
let_it_be
(
:token
)
{
create
(
:cluster_agent_token
,
description:
'feature test token'
)}
let
(
:agent
)
{
token
.
agent
}
let
(
:project
)
{
agent
.
project
}
let
(
:user
)
{
project
.
creator
}
before
do
gitlab_sign_in
(
user
)
end
context
'when user does not have any agents and visits the index page'
do
let
(
:empty_project
)
{
create
(
:project
)
}
before
do
empty_project
.
add_maintainer
(
user
)
visit
project_clusters_path
(
empty_project
)
end
it
'displays empty state'
,
:aggregate_failures
do
click_link
'GitLab Agent managed clusters'
expect
(
page
).
to
have_content
(
'Integrate with the GitLab Agent'
)
expect
(
page
).
to
have_selector
(
'.empty-state'
)
end
end
context
'when user has an agent'
do
context
'when visiting the index page'
do
before
do
visit
project_clusters_path
(
project
)
end
it
'displays a table with agent'
,
:aggregate_failures
do
click_link
'GitLab Agent managed clusters'
expect
(
page
).
to
have_content
(
agent
.
name
)
expect
(
page
).
to
have_selector
(
'[data-testid="cluster-agent-list-table"] tbody tr'
,
count:
1
)
end
end
context
'when visiting the show page'
do
before
do
visit
project_cluster_agent_path
(
project
,
agent
.
name
)
end
it
'displays agent and token information'
,
:aggregate_failures
do
expect
(
page
).
to
have_content
(
agent
.
name
)
expect
(
page
).
to
have_content
(
token
.
description
)
end
end
end
end
spec/helpers/clusters_helper_spec.rb
View file @
fc6adf3d
...
...
@@ -152,4 +152,24 @@ RSpec.describe ClustersHelper do
end
end
end
describe
'#display_cluster_agents?'
do
subject
{
helper
.
display_cluster_agents?
(
clusterable
)
}
context
'when clusterable is a project'
do
let
(
:clusterable
)
{
build
(
:project
)
}
it
'allows agents to display'
do
expect
(
subject
).
to
be_truthy
end
end
context
'when clusterable is a group'
do
let
(
:clusterable
)
{
build
(
:group
)
}
it
'does not allow agents to display'
do
expect
(
subject
).
to
be_falsey
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment