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
29971d70
Commit
29971d70
authored
May 11, 2021
by
Pedro Pombeiro
Committed by
Matthias Käppler
May 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more user-friendly message in case of hitting against runner registration limit
parent
816b507f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
app/controllers/projects/runner_projects_controller.rb
app/controllers/projects/runner_projects_controller.rb
+4
-1
app/models/ci/runner.rb
app/models/ci/runner.rb
+2
-2
spec/requests/api/ci/runner/runners_post_spec.rb
spec/requests/api/ci/runner/runners_post_spec.rb
+2
-2
No files found.
app/controllers/projects/runner_projects_controller.rb
View file @
29971d70
...
@@ -17,7 +17,10 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
...
@@ -17,7 +17,10 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
if
@runner
.
assign_to
(
project
,
current_user
)
if
@runner
.
assign_to
(
project
,
current_user
)
redirect_to
path
redirect_to
path
else
else
redirect_to
path
,
alert:
'Failed adding runner to project'
assign_to_messages
=
@runner
.
errors
.
messages
[
:assign_to
]
alert
=
assign_to_messages
&
.
join
(
','
)
||
'Failed adding runner to project'
redirect_to
path
,
alert:
alert
end
end
end
end
...
...
app/models/ci/runner.rb
View file @
29971d70
...
@@ -46,9 +46,9 @@ module Ci
...
@@ -46,9 +46,9 @@ module Ci
MINUTES_COST_FACTOR_FIELDS
=
%i[public_projects_minutes_cost_factor private_projects_minutes_cost_factor]
.
freeze
MINUTES_COST_FACTOR_FIELDS
=
%i[public_projects_minutes_cost_factor private_projects_minutes_cost_factor]
.
freeze
has_many
:builds
has_many
:builds
has_many
:runner_projects
,
inverse_of: :runner
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:runner_projects
,
inverse_of: :runner
,
autosave:
true
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:projects
,
through: :runner_projects
has_many
:projects
,
through: :runner_projects
has_many
:runner_namespaces
,
inverse_of: :runner
has_many
:runner_namespaces
,
inverse_of: :runner
,
autosave:
true
has_many
:groups
,
through: :runner_namespaces
has_many
:groups
,
through: :runner_namespaces
has_one
:last_build
,
->
{
order
(
'id DESC'
)
},
class_name:
'Ci::Build'
has_one
:last_build
,
->
{
order
(
'id DESC'
)
},
class_name:
'Ci::Build'
...
...
spec/requests/api/ci/runner/runners_post_spec.rb
View file @
29971d70
...
@@ -102,7 +102,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
...
@@ -102,7 +102,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
request
request
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
include
(
'runner_projects
'
=>
[
'is invali
d'
])
expect
(
json_response
[
'message'
]).
to
include
(
'runner_projects
.base'
=>
[
'Maximum number of ci registered project runners (1) exceede
d'
])
expect
(
project
.
runners
.
reload
.
size
).
to
eq
(
1
)
expect
(
project
.
runners
.
reload
.
size
).
to
eq
(
1
)
end
end
end
end
...
@@ -143,7 +143,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
...
@@ -143,7 +143,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
request
request
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
include
(
'runner_namespaces
'
=>
[
'is invali
d'
])
expect
(
json_response
[
'message'
]).
to
include
(
'runner_namespaces
.base'
=>
[
'Maximum number of ci registered group runners (1) exceede
d'
])
expect
(
group
.
runners
.
reload
.
size
).
to
eq
(
1
)
expect
(
group
.
runners
.
reload
.
size
).
to
eq
(
1
)
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