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
4b1b2f3b
Commit
4b1b2f3b
authored
Sep 25, 2017
by
Alexis Reigel
Committed by
Alexis Reigel
Apr 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Ci::Runner#group? method
parent
32a9c85b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
app/models/ci/runner.rb
app/models/ci/runner.rb
+4
-0
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+24
-0
No files found.
app/models/ci/runner.rb
View file @
4b1b2f3b
...
...
@@ -139,6 +139,10 @@ module Ci
!
shared?
end
def
group?
runner_groups
.
any?
end
def
can_pick?
(
build
)
return
false
if
self
.
ref_protected?
&&
!
build
.
protected?
...
...
spec/models/ci/runner_spec.rb
View file @
4b1b2f3b
...
...
@@ -642,4 +642,28 @@ describe Ci::Runner do
expect
(
described_class
.
search
(
runner
.
description
.
upcase
)).
to
eq
([
runner
])
end
end
describe
'group?'
do
it
'returns false when the runner is a project runner'
do
project
=
create
:project
runner
=
create
(
:ci_runner
,
description:
'Project runner'
).
tap
do
|
r
|
create
:ci_runner_project
,
runner:
r
,
project:
project
end
expect
(
runner
.
group?
).
to
be
false
end
it
'returns false when the runner is a shared runner'
do
runner
=
create
:ci_runner
,
:shared
,
description:
'Shared runner'
expect
(
runner
.
group?
).
to
be
false
end
it
'returns true when the runner is assigned to a group'
do
group
=
create
:group
runner
=
create
:ci_runner
,
description:
'Group runner'
,
groups:
[
group
]
expect
(
runner
.
group?
).
to
be
true
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