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
81c0c57a
Commit
81c0c57a
authored
Sep 25, 2017
by
Alexis Reigel
Committed by
Alexis Reigel
Apr 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exclude group runners on projects that disabled it
parent
677291b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
app/models/ci/runner.rb
app/models/ci/runner.rb
+6
-3
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+8
-0
No files found.
app/models/ci/runner.rb
View file @
81c0c57a
...
@@ -35,13 +35,16 @@ module Ci
...
@@ -35,13 +35,16 @@ module Ci
%{
%{
INNER JOIN ci_runner_groups ON ci_runner_groups.runner_id = ci_runners.id
INNER JOIN ci_runner_groups ON ci_runner_groups.runner_id = ci_runners.id
INNER JOIN namespaces ON namespaces.id = ci_runner_groups.group_id
INNER JOIN namespaces ON namespaces.id = ci_runner_groups.group_id
INNER JOIN projects
group_projects ON group_
projects.namespace_id = namespaces.id
INNER JOIN projects
ON
projects.namespace_id = namespaces.id
}
}
).
where
(
).
where
(
%{
%{
group_projects.id = :project_id
projects.id = :project_id
AND
projects.group_runners_enabled = :true
}
,
}
,
project_id:
project_id
project_id:
project_id
,
true:
true
)
)
shared_runners
=
where
(
is_shared:
true
)
shared_runners
=
where
(
is_shared:
true
)
...
...
spec/models/ci/runner_spec.rb
View file @
81c0c57a
...
@@ -83,6 +83,14 @@ describe Ci::Runner do
...
@@ -83,6 +83,14 @@ describe Ci::Runner do
expect
(
described_class
.
owned_or_shared
(
specific_project
.
id
)).
to
eq
[
specific_runner
]
expect
(
described_class
.
owned_or_shared
(
specific_project
.
id
)).
to
eq
[
specific_runner
]
end
end
it
'does not return the group runner if the project has group runners disabled'
do
specific_group
=
create
:group
specific_project
=
create
:project
,
group:
specific_group
,
group_runners_enabled:
false
create
:ci_runner
,
:specific
,
groups:
[
specific_group
]
expect
(
described_class
.
owned_or_shared
(
specific_project
.
id
)).
to
be_empty
end
it
'returns the shared group runner'
do
it
'returns the shared group runner'
do
group
=
create
:group
group
=
create
:group
runner
=
create
:ci_runner
,
:shared
,
groups:
[
group
]
runner
=
create
:ci_runner
,
:shared
,
groups:
[
group
]
...
...
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