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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
1a9cef79
Commit
1a9cef79
authored
Nov 18, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit projects to just one cluster
parent
cc0c6115
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
app/services/clusters/create_service.rb
app/services/clusters/create_service.rb
+10
-0
No files found.
app/services/clusters/create_service.rb
View file @
1a9cef79
...
...
@@ -5,6 +5,8 @@ module Clusters
def
execute
(
access_token
)
@access_token
=
access_token
return
unless
can_create_cluster?
create_cluster
.
tap
do
|
cluster
|
ClusterProvisionWorker
.
perform_async
(
cluster
.
id
)
if
cluster
.
persisted?
end
...
...
@@ -25,5 +27,13 @@ module Clusters
@cluster_params
=
params
.
merge
(
user:
current_user
,
projects:
[
project
])
end
def
can_create_cluster?
if
project
.
clusters
.
empty?
true
else
false
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